Class PolygonItem

All Implemented Interfaces:
IFeedbackProvider, IDrawable, EventListener
Direct Known Subclasses:
EllipseItem, RadArcItem, RectangleItem

public class PolygonItem extends PathBasedItem
A closed, filled/stroked polygon defined in world coordinates.

The polygon geometry is stored as a world-coordinate Path2D. Selection/reshape modifies vertices of that path.

  • Constructor Details

    • PolygonItem

      public PolygonItem(Layer layer, Point2D.Double[] points, Object... keyVals)
      Create a world polygon item
      Parameters:
      layer - the z layer this item is on.
      points - the points of the polygon
      keyVals - optional key value pairs for styling the item.
    • PolygonItem

      public PolygonItem(Layer layer, Point2D.Double[] points)
      Create a world polygon item
      Parameters:
      layer - the z layer this item is on.
      points - the points of the polygon
    • PolygonItem

      public PolygonItem(Layer layer)
      Create a world polygon item
      Parameters:
      layer - the z layer this item is on.
  • Method Details

    • setPath

      public void setPath(Point2D.Double[] points)
      Set the path from a world polygon.
      Parameters:
      points - the points of the polygon.
    • reshape

      protected void reshape()
      Reshape the polygon based on the modification. Not much we can do to a polygon except move the selected point. Keep in mind that if control or shift was pressed, the polygon will scale rather than coming here.
      Overrides:
      reshape in class PathBasedItem