Class Polygon

java.lang.Object
com.massifmaps.vectorelements.VectorElement
com.massifmaps.vectorelements.Polygon

public class Polygon extends VectorElement
A geometric polygon that can be displayed on the map.
Polygons can be concave and have multiple overlapping holes.
  • Constructor Details

    • Polygon

      public Polygon(PolygonGeometry geometry, PolygonStyle style)
      Constructs a Polygon object from a geometry object and a style.
      Parameters:
      geometry - The geometry object that defines the location and holes of this polygon.
      style - The style that defines what this polygon looks like.
    • Polygon

      public Polygon(MapPosVector poses, PolygonStyle style)
      Constructs a Polygon object from a vector of map positions and a style.
      Parameters:
      poses - The vector of map positions that defines the location of this polygon.
      style - The style that defines what this polygon looks like.
    • Polygon

      public Polygon(MapPosVector poses, MapPosVectorVector holes, PolygonStyle style)
      Constructs a Polygon object from a vector of map positions, a vector of holes and a style.
      Parameters:
      poses - The vector of map positions that defines the location of this polygon.
      holes - The vector of holes that defines the locations of holes of this polygon.
      style - The style that defines what this polygon looks like.
  • Method Details

    • getGeometry

      public PolygonGeometry getGeometry()
      Description copied from class: VectorElement
      Returns the geometry object that defines the location of this vector element.
      Overrides:
      getGeometry in class VectorElement
      Returns:
      The geometry object of this vector element.
    • setGeometry

      public void setGeometry(PolygonGeometry geometry)
      Sets the location for this polygon.
      Parameters:
      geometry - The new geometry object that defines the location and holes of this polygon.
    • getPoses

      public MapPosVector getPoses()
      Returns the vertices that define this polygon.
      Returns:
      The vector of map positions that define this polygon.
    • setPoses

      public void setPoses(MapPosVector poses)
      Sets the vertices that define this polygon.
      Note: holes are not affected by this call.
      Parameters:
      poses - The new vector of map positions that define this polygon.
    • getHoles

      public MapPosVectorVector getHoles()
      Returns the holes of the polygon.
      Returns:
      The list of holes of the polygon.
    • setHoles

      public void setHoles(MapPosVectorVector holes)
      Sets the holes of the polygon.
      Parameters:
      holes - The list of holes of the polygon.
    • getStyle

      public PolygonStyle getStyle()
      Returns the style of this polygon.
      Returns:
      The style that defines what this polygon looks like.
    • setStyle

      public void setStyle(PolygonStyle style)
      Sets the style for this polygon.
      Parameters:
      style - The new style that defines what this polygon looks like.