Class Polyline

All Implemented Interfaces:
JsonSerializable

@NullMarked public class Polyline extends Marker<Polyline>
Represents a line of points for a polyline or polygon shape.

This line could be used as a polygon's outer poly, or as inner poly to punch holes into the outer poly.

A minimum of 2 Points are needed to create a valid and visible line for a polyline on the map.

A minimum of 3 Points are needed to create a valid and visible line for a polygon on the map.

The last point you add does not need to be the same as the first point you added for a polygon.

  • Constructor Details

    • Polyline

      public Polyline(String key, Point point)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      point - point to add
    • Polyline

      public Polyline(String key, Point... points)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      points - points to add
    • Polyline

      public Polyline(String key, Collection<Point> points)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      points - points to add
  • Method Details

    • of

      public static Polyline of(String key, Point point)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      point - point to add
      Returns:
      a new line
    • of

      public static Polyline of(String key, Point... points)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      points - points to add
      Returns:
      a new line
    • of

      public static Polyline of(String key, Collection<Point> points)
      Create a new line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      key - identifying key
      points - points to add
      Returns:
      a new line
    • getPoints

      public List<Point> getPoints()
      Get the list of points in this polyline.
      Returns:
      list of points
    • clearPoints

      public Polyline clearPoints()
      Clear the list of points in this polyline.
      Returns:
      this polyline
    • loop

      public Polyline loop()
      Add the first point as the end point, closing off the shape.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Returns:
      this line
    • addPoint

      public Polyline addPoint(Point point)
      Add a point to this line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      point - point to add
      Returns:
      this line
    • addPoint

      public Polyline addPoint(Point... points)
      Add points to this line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      points - points to add
      Returns:
      this line
    • addPoint

      public Polyline addPoint(Collection<Point> points)
      Add points to this line.

      The last point you add does not need to be the same as the first point you added for a polygon.

      Parameters:
      points - points to add
      Returns:
      this line
    • removePoint

      public Polyline removePoint(Point point)
      Remove a point from this polyline.
      Parameters:
      point - point to remove
      Returns:
      this polyline
    • removePoint

      public Polyline removePoint(Point... points)
      Remove points from this polyline.
      Parameters:
      points - points to remove
      Returns:
      this polyline
    • removePoint

      public Polyline removePoint(Collection<Point> points)
      Remove points from this polyline.
      Parameters:
      points - points to remove
      Returns:
      this polyline
    • toJson

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

      public static Polyline 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