Package com.treemap

Class AbstractLabeling<N,Row,Column,Color,Font>

java.lang.Object
com.treemap.AbstractLabeling<N,Row,Column,Color,Font>
Type Parameters:
N - the type of nodes
All Implemented Interfaces:
Labeling<N,Row,Column,Color,Font>
Direct Known Subclasses:
ExpandLabeling, OverlayLabeling, SurroundLabeling

@JsType public abstract class AbstractLabeling<N,Row,Column,Color,Font> extends Object implements Labeling<N,Row,Column,Color,Font>
This class provides a skeletal implementation of the Labeling interface to minimize the effort required to implement this interface.
  • Field Details

    • SHARE_OF_ZOOM_FACTOR

      protected static final float SHARE_OF_ZOOM_FACTOR
      See Also:
    • COLOR_SIMILARITY_THRESHOLD

      protected static final float COLOR_SIMILARITY_THRESHOLD
      See Also:
  • Constructor Details

    • AbstractLabeling

      public AbstractLabeling()
  • Method Details

    • subtract

      public com.macrofocus.geom.Shape subtract(TreeMapModel<N,Row,Column,Color,Font> model, com.macrofocus.geom.Shape shape, N node)
      Specified by:
      subtract in interface Labeling<N,Row,Column,Color,Font>
    • getTopSpace

      public double getTopSpace(TreeMapModel<N,Row,Column,Color,Font> model)
      Specified by:
      getTopSpace in interface Labeling<N,Row,Column,Color,Font>
    • getLeftSpace

      public double getLeftSpace(TreeMapModel<N,Row,Column,Color,Font> model)
      Specified by:
      getLeftSpace in interface Labeling<N,Row,Column,Color,Font>
    • paintLeaf

      public void paintLeaf(TGraphics<Color,Font> g2, com.macrofocus.geom.Shape shape, com.macrofocus.geom.Rectangle bounds, N node, TreeMapView view)
      Specified by:
      paintLeaf in interface Labeling<N,Row,Column,Color,Font>
    • getTreeMapFieldsByVerticalAlignment

      protected List<TreeMapField> getTreeMapFieldsByVerticalAlignment(TreeMapModel model, TreeMapField[] fields, int alignement)
    • paintFields

      protected int paintFields(TGraphics<Color,Font> g2, com.macrofocus.geom.Shape shape, com.macrofocus.geom.Rectangle bounds, N node, TreeMapView view, TreeMapModel<N,Row,Column,Color,Font> model, List<TreeMapField> fields, boolean paint, int y)
    • paintLabel

      protected void paintLabel(TGraphics<Color,Font> g2, N node, TreeMapField<N,Column> field, com.macrofocus.labeling.EnhancedLabel<Color,Font> label, com.macrofocus.geom.Rectangle bounds, com.macrofocus.geom.Rectangle drawingArea)
    • adjustLabelColor

      protected com.macrofocus.igraphics.CPColor<Color> adjustLabelColor(TreeMapFieldSettings<Color,Font> settings, com.macrofocus.igraphics.CPColor<Color> foreground, com.macrofocus.igraphics.CPColor<Color> nodeColor)
    • findEnclosedRectangle

      protected static com.macrofocus.geom.Rectangle findEnclosedRectangle(com.macrofocus.geom.Shape shape, int y, int height)
    • getTopHeaderSpacing

      public double getTopHeaderSpacing(N parent, N node, TreeMapView view, TreeMapModel model)
      Specified by:
      getTopHeaderSpacing in interface Labeling<N,Row,Column,Color,Font>
    • getArea

      public static double getArea(com.macrofocus.geom.Shape shape)
    • calcCenterOfMass

      public static com.macrofocus.geom.Point2D calcCenterOfMass(com.macrofocus.geom.Point2D[] points)
      Returns a Point2D object that represents the center of mass of the given point array which represents a polygon.
      Parameters:
      points -
      Returns:
      a Point2D object that represents the center of mass of the given point array
    • getCentroid

      public static com.macrofocus.geom.Point2D getCentroid(com.macrofocus.geom.Shape shape)
      Returns a Point2D object that represents the center of mass of the given shape.
      Parameters:
      shape -
      Returns:
      a Point2D object that represents the center of mass of the given shape
    • getPoints

      public static com.macrofocus.geom.Point2D[] getPoints(com.macrofocus.geom.Shape shape)