Class PolygonDecoration

All Implemented Interfaces:
IFigure, RotatableDecoration

public class PolygonDecoration extends Polygon implements RotatableDecoration
A rotatable, polygon shaped decoration most commonly used for decorating the ends of polylines.
  • Field Details

    • TRIANGLE_TIP

      public static final PointList TRIANGLE_TIP
      Template for a triangle that points to the right when the rotation angle is 0
    • INVERTED_TRIANGLE_TIP

      public static final PointList INVERTED_TRIANGLE_TIP
      Template for a triangle that points to the left when the rotation angle is 0
  • Constructor Details

    • PolygonDecoration

      public PolygonDecoration()
      Constructs a PolygonDecoration. Defaults the PolygonDecoration to fill its region with black.
      Since:
      2.0
  • Method Details

    • getLocalBackgroundColor

      public Color getLocalBackgroundColor()
      Description copied from class: Figure
      Returns null or the local background Color of this Figure. Does not inherit this Color from the parent.
      Specified by:
      getLocalBackgroundColor in interface IFigure
      Overrides:
      getLocalBackgroundColor in class Figure
      Returns:
      bgColor null or the local background Color
      See Also:
    • getPoints

      public PointList getPoints()
      Returns the points in the PolygonDecoration as a PointList.
      Overrides:
      getPoints in class AbstractPointListShape
      Returns:
      the points in this PolygonDecoration
      Since:
      2.0
    • setLocation

      public void setLocation(Point p)
      Sets the location of this PolygonDecoration.
      Specified by:
      setLocation in interface IFigure
      Specified by:
      setLocation in interface RotatableDecoration
      Overrides:
      setLocation in class Figure
      Parameters:
      p - the new location
      See Also:
    • setTemplate

      public void setTemplate(PointList pl)
      Sets the PolygonDecorations point template to the passed PointList. This template is an outline of the PolygonDecoration's region. (The default value is TRIANGLE_TIP which is a triangle whose tip is pointing to the right).
      Parameters:
      pl - the PointList outline to use as the PolygonDecoration's region
      Since:
      2.0
    • setScale

      public void setScale(double x, double y)
      Sets the amount of scaling to be done along X and Y axes on the PolygonDecoration's template.
      Parameters:
      x - X scaling
      y - Y scaling
      Since:
      2.0
    • setReferencePoint

      public void setReferencePoint(Point ref)
      Sets the rotation of this decoration so that the decoration points toward the given reference point.
      Specified by:
      setReferencePoint in interface RotatableDecoration
      Parameters:
      ref - the reference point
    • setRotation

      public void setRotation(double angle)
      Sets the angle by which rotation is to be done on the PolygonDecoration.
      Parameters:
      angle - Angle of rotation
      Since:
      2.0