Class mxBasicCanvas

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_IMAGEBASEPATH
      Defines the default value for the imageBasePath in all GDI canvases.
      protected boolean drawLabels
      Specifies whether labels should be painted.
      protected java.lang.String imageBasePath
      Defines the base path for images with relative paths.
      protected java.util.Hashtable<java.lang.String,​java.awt.image.BufferedImage> imageCache
      Cache for images.
      static boolean PRESERVE_IMAGE_ASPECT
      Specifies if image aspect should be preserved in drawImage.
      protected double scale
      Specifies the current scale.
      protected mxPoint translate
      Specifies the current translation.
    • Constructor Summary

      Constructors 
      Constructor Description
      mxBasicCanvas()  
    • Field Detail

      • PRESERVE_IMAGE_ASPECT

        public static boolean PRESERVE_IMAGE_ASPECT
        Specifies if image aspect should be preserved in drawImage. Default is true.
      • DEFAULT_IMAGEBASEPATH

        public static java.lang.String DEFAULT_IMAGEBASEPATH
        Defines the default value for the imageBasePath in all GDI canvases. Default is an empty string.
      • imageBasePath

        protected java.lang.String imageBasePath
        Defines the base path for images with relative paths. Trailing slash is required. Default value is DEFAULT_IMAGEBASEPATH.
      • translate

        protected mxPoint translate
        Specifies the current translation. Default is (0,0).
      • scale

        protected double scale
        Specifies the current scale. Default is 1.
      • drawLabels

        protected boolean drawLabels
        Specifies whether labels should be painted. Default is true.
      • imageCache

        protected java.util.Hashtable<java.lang.String,​java.awt.image.BufferedImage> imageCache
        Cache for images.
    • Constructor Detail

      • mxBasicCanvas

        public mxBasicCanvas()
    • Method Detail

      • setTranslate

        public void setTranslate​(double dx,
                                 double dy)
        Sets the current translate.
        Specified by:
        setTranslate in interface mxICanvas
      • getTranslate

        public mxPoint getTranslate()
        Returns the current translate.
        Specified by:
        getTranslate in interface mxICanvas
        Returns:
        Returns the current translation.
      • setScale

        public void setScale​(double scale)
        Description copied from interface: mxICanvas
        Sets the scale for the following drawing requests.
        Specified by:
        setScale in interface mxICanvas
      • getScale

        public double getScale()
        Description copied from interface: mxICanvas
        Returns the scale.
        Specified by:
        getScale in interface mxICanvas
      • setDrawLabels

        public void setDrawLabels​(boolean drawLabels)
      • getImageBasePath

        public java.lang.String getImageBasePath()
      • setImageBasePath

        public void setImageBasePath​(java.lang.String imageBasePath)
      • isDrawLabels

        public boolean isDrawLabels()
      • loadImage

        public java.awt.image.BufferedImage loadImage​(java.lang.String image)
        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

        public java.lang.String getImageForStyle​(java.util.Map<java.lang.String,​java.lang.Object> style)
        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.