Class Polygon

All Implemented Interfaces:
JsonSerializable

@NullMarked public class Polygon extends Marker<Polygon>
Represents a polygon marker.

A polygon requires at least one Polyline for the outer polygon shape. Any additional polylines will be used to cut out "holes" in the outer polygon shape.

  • Constructor Details

    • Polygon

      public Polygon(String key, Polyline polyline)
      Create a new polygon.
      Parameters:
      key - identifying key
      polyline - polyline to add
    • Polygon

      public Polygon(String key, Polyline... polylines)
      Create a new polygon.
      Parameters:
      key - identifying key
      polylines - polylines to add
    • Polygon

      public Polygon(String key, Collection<Polyline> polylines)
      Create a new polygon.
      Parameters:
      key - identifying key
      polylines - polylines to add
  • Method Details

    • of

      public static Polygon of(String key, Polyline polyline)
      Create a new polygon.
      Parameters:
      key - identifying key
      polyline - polyline to add
      Returns:
      a new polygon
    • of

      public static Polygon of(String key, Polyline... polylines)
      Create a new polygon.
      Parameters:
      key - identifying key
      polylines - polylines to add
      Returns:
      a new polygon
    • of

      public static Polygon of(String key, Collection<Polyline> polylines)
      Create a new polygon.
      Parameters:
      key - identifying key
      polylines - polylines to add
      Returns:
      a new polygon
    • getPolylines

      public List<Polyline> getPolylines()
      Get the list of polylines in this polygon.
      Returns:
      list of polylines
    • clearPolylines

      public Polygon clearPolylines()
      Clear the list of polylines in this polygon.
      Returns:
      this polygon
    • addPolyline

      public Polygon addPolyline(Polyline polyline)
      Add a polyline to this polygon.
      Parameters:
      polyline - polyline to remove
      Returns:
      this polygon
    • addPolyline

      public Polygon addPolyline(Polyline... polylines)
      Add polylines to this polygon.
      Parameters:
      polylines - polylines to remove
      Returns:
      this polygon
    • addPolyline

      public Polygon addPolyline(Collection<Polyline> polylines)
      Add polylines to this polygon.
      Parameters:
      polylines - polylines to remove
      Returns:
      this polygon
    • removeLine

      public Polygon removeLine(Polyline polyline)
      Remove a polyline from this polygon.
      Parameters:
      polyline - polyline to remove
      Returns:
      this polygon
    • removeLine

      public Polygon removeLine(Polyline... polylines)
      Remove polylines from this polygon.
      Parameters:
      polylines - polylines to remove
      Returns:
      this polygon
    • removeLine

      public Polygon removeLine(Collection<Polyline> polylines)
      Remove polylines from this polygon.
      Parameters:
      polylines - polylines to remove
      Returns:
      this polygon
    • toJson

      public com.google.gson.JsonObject toJson()
      Description copied from interface: JsonSerializable
      Jsonify this object.
      Returns:
      object as json element
    • fromJson

      public static Polygon fromJson(com.google.gson.JsonObject obj)
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Keyed
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Keyed
    • toString

      public String toString()
      Overrides:
      toString in class Keyed