Package com.mxgraph.canvas
Class mxBasicCanvas
java.lang.Object
com.mxgraph.canvas.mxBasicCanvas
- All Implemented Interfaces:
mxICanvas
- Direct Known Subclasses:
mxGraphics2DCanvas,mxHtmlCanvas,mxSvgCanvas,mxVmlCanvas
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringDefines the default value for the imageBasePath in all GDI canvases.protected booleanSpecifies whether labels should be painted.protected StringDefines the base path for images with relative paths.protected Hashtable<String, BufferedImage> Cache for images.static booleanSpecifies if image aspect should be preserved in drawImage.protected doubleSpecifies the current scale.protected mxPointSpecifies the current translation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetImageForStyle(Map<String, Object> style) Gets the image path from the given style.doublegetScale()Returns the scale.Returns the current translate.booleanReturns an image instance for the given URL.voidsetDrawLabels(boolean drawLabels) voidsetImageBasePath(String imageBasePath) voidsetScale(double scale) Sets the scale for the following drawing requests.voidsetTranslate(double dx, double dy) Sets the current translate.
-
Field Details
-
PRESERVE_IMAGE_ASPECT
public static boolean PRESERVE_IMAGE_ASPECTSpecifies if image aspect should be preserved in drawImage. Default is true. -
DEFAULT_IMAGEBASEPATH
Defines the default value for the imageBasePath in all GDI canvases. Default is an empty string. -
imageBasePath
Defines the base path for images with relative paths. Trailing slash is required. Default value is DEFAULT_IMAGEBASEPATH. -
translate
Specifies the current translation. Default is (0,0). -
scale
protected double scaleSpecifies the current scale. Default is 1. -
drawLabels
protected boolean drawLabelsSpecifies whether labels should be painted. Default is true. -
imageCache
Cache for images.
-
-
Constructor Details
-
mxBasicCanvas
public mxBasicCanvas()
-
-
Method Details
-
setTranslate
public void setTranslate(double dx, double dy) Sets the current translate.- Specified by:
setTranslatein interfacemxICanvas
-
getTranslate
Returns the current translate.- Specified by:
getTranslatein interfacemxICanvas- Returns:
- Returns the current translation.
-
setScale
public void setScale(double scale) Description copied from interface:mxICanvasSets the scale for the following drawing requests. -
getScale
public double getScale()Description copied from interface:mxICanvasReturns the scale. -
setDrawLabels
public void setDrawLabels(boolean drawLabels) -
getImageBasePath
-
setImageBasePath
-
isDrawLabels
public boolean isDrawLabels() -
loadImage
Returns an image instance for the given URL. If the URL has been loaded before than an instance of the same instance is returned as in the previous call. -
flushImageCache
public void flushImageCache() -
getImageForStyle
Gets the image path from the given style. If the path is relative (does not start with a slash) then it is appended to the imageBasePath.
-