Class Polyline

All Implemented Interfaces:
JsonSerializable

public class Polyline extends Marker<@NotNull 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(@NotNull @NotNull String key, @NotNull @NotNull 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(@NotNull @NotNull String key, @NotNull @NotNull Point @NotNull ... 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(@NotNull @NotNull String key, @NotNull @NotNull Collection<@NotNull 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

      @NotNull public static @NotNull Polyline of(@NotNull @NotNull String key, @NotNull @NotNull 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

      @NotNull public static @NotNull Polyline of(@NotNull @NotNull String key, @NotNull @NotNull Point @NotNull ... 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

      @NotNull public static @NotNull Polyline of(@NotNull @NotNull String key, @NotNull @NotNull Collection<@NotNull 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

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

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

      @NotNull public @NotNull 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

      @NotNull public @NotNull Polyline addPoint(@NotNull @NotNull 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

      @NotNull public @NotNull Polyline addPoint(@NotNull @NotNull Point @NotNull ... 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

      @NotNull public @NotNull Polyline addPoint(@NotNull @NotNull Collection<@NotNull 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

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

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

      @NotNull public @NotNull Polyline removePoint(@NotNull @NotNull Collection<@NotNull Point> points)
      Remove points from this polyline.
      Parameters:
      points - points to remove
      Returns:
      this polyline
    • 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 Polyline 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