Class Polygon

All Implemented Interfaces:
JsonSerializable

public class Polygon extends Marker<@NotNull 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(@NotNull @NotNull String key, @NotNull @NotNull Polyline polyline)
      Create a new polygon.
      Parameters:
      key - identifying key
      polyline - polyline to add
    • Polygon

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

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

    • of

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Keyed