Class VertexIconShapeTransformer<V>

  • All Implemented Interfaces:
    org.apache.commons.collections4.Transformer<V,​java.awt.Shape>

    public class VertexIconShapeTransformer<V>
    extends java.lang.Object
    implements org.apache.commons.collections4.Transformer<V,​java.awt.Shape>
    A default implementation that stores images in a Map keyed on the vertex. Also applies a shaping function to images to extract the shape of the opaque part of a transparent image.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate  
      protected java.util.Map<V,​javax.swing.Icon> iconMap  
      protected java.util.Map<java.awt.Image,​java.awt.Shape> shapeMap  
    • Constructor Summary

      Constructors 
      Constructor Description
      VertexIconShapeTransformer​(org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.commons.collections4.Transformer<V,​java.awt.Shape> getDelegate()  
      java.util.Map<V,​javax.swing.Icon> getIconMap()  
      java.util.Map<java.awt.Image,​java.awt.Shape> getShapeMap()  
      void setDelegate​(org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate)  
      void setIconMap​(java.util.Map<V,​javax.swing.Icon> iconMap)  
      void setShapeMap​(java.util.Map<java.awt.Image,​java.awt.Shape> shapeMap)  
      java.awt.Shape transform​(V v)
      get the shape from the image.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • shapeMap

        protected java.util.Map<java.awt.Image,​java.awt.Shape> shapeMap
      • iconMap

        protected java.util.Map<V,​javax.swing.Icon> iconMap
      • delegate

        protected org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate
    • Constructor Detail

      • VertexIconShapeTransformer

        public VertexIconShapeTransformer​(org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate)
    • Method Detail

      • getDelegate

        public org.apache.commons.collections4.Transformer<V,​java.awt.Shape> getDelegate()
        Returns:
        Returns the delegate.
      • setDelegate

        public void setDelegate​(org.apache.commons.collections4.Transformer<V,​java.awt.Shape> delegate)
        Parameters:
        delegate - The delegate to set.
      • transform

        public java.awt.Shape transform​(V v)
        get the shape from the image. If not available, get the shape from the delegate VertexShapeFunction
        Specified by:
        transform in interface org.apache.commons.collections4.Transformer<V,​java.awt.Shape>
      • getIconMap

        public java.util.Map<V,​javax.swing.Icon> getIconMap()
        Returns:
        the iconMap
      • setIconMap

        public void setIconMap​(java.util.Map<V,​javax.swing.Icon> iconMap)
        Parameters:
        iconMap - the iconMap to set
      • getShapeMap

        public java.util.Map<java.awt.Image,​java.awt.Shape> getShapeMap()
        Returns:
        the shapeMap
      • setShapeMap

        public void setShapeMap​(java.util.Map<java.awt.Image,​java.awt.Shape> shapeMap)
        Parameters:
        shapeMap - the shapeMap to set