Class Marker<T extends Marker<@NotNull T>>

java.lang.Object
net.pl3x.map.core.Keyed
net.pl3x.map.core.markers.marker.Marker<T>
All Implemented Interfaces:
JsonSerializable
Direct Known Subclasses:
Circle, Ellipse, Icon, MultiPolygon, MultiPolyline, Polygon, Polyline, Rectangle

public abstract class Marker<T extends Marker<@NotNull T>> extends Keyed implements JsonSerializable
Represents a map marker.
  • Constructor Details

    • Marker

      public Marker(@NotNull @NotNull String type, @NotNull @NotNull String key)
      Create a new marker.
      Parameters:
      type - type of marker
      key - identifying key
  • Method Details

    • circle

      @NotNull public static @NotNull Circle circle(@NotNull @NotNull String key, double centerX, double centerZ, double radius)
      Create a new circle.
      Parameters:
      key - identifying key
      centerX - center x location
      centerZ - center z location
      radius - circle radius
      Returns:
      a new circle
    • circle

      @NotNull public static @NotNull Circle circle(@NotNull @NotNull String key, @NotNull @NotNull Point center, double radius)
      Create a new circle.
      Parameters:
      key - identifying key
      center - center location
      radius - circle radius
      Returns:
      a new circle
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, double centerX, double centerZ, double radiusX, double radiusZ)
      Create a new ellipse.
      Parameters:
      key - identifying key
      centerX - center x location
      centerZ - center z location
      radiusX - x radius
      radiusZ - z radius
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, @NotNull @NotNull Point center, double radiusX, double radiusZ)
      Create a new ellipse.
      Parameters:
      key - identifying key
      center - center location
      radiusX - x radius
      radiusZ - z radius
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, double centerX, double centerZ, @NotNull @NotNull Vector radius)
      Create a new ellipse.
      Parameters:
      key - identifying key
      centerX - center x location
      centerZ - center z location
      radius - radius
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, @NotNull @NotNull Point center, @NotNull @NotNull Vector radius)
      Create a new ellipse.
      Parameters:
      key - identifying key
      center - center location
      radius - radius
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, double centerX, double centerZ, double radiusX, double radiusZ, double tilt)
      Create a new ellipse.
      Parameters:
      key - identifying key
      centerX - center x location
      centerZ - center z location
      radiusX - x radius
      radiusZ - z radius
      tilt - tilt
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, @NotNull @NotNull Point center, double radiusX, double radiusZ, double tilt)
      Create a new ellipse.
      Parameters:
      key - identifying key
      center - center location
      radiusX - x radius
      radiusZ - z radius
      tilt - tilt
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, double centerX, double centerZ, @NotNull @NotNull Vector radius, double tilt)
      Create a new ellipse.
      Parameters:
      key - identifying key
      centerX - center x location
      centerZ - center z location
      radius - radius
      tilt - tilt
      Returns:
      a new ellipse
    • ellipse

      @NotNull public static @NotNull Ellipse ellipse(@NotNull @NotNull String key, @NotNull @NotNull Point center, @NotNull @NotNull Vector radius, double tilt)
      Create a new ellipse.
      Parameters:
      key - identifying key
      center - center location
      radius - radius
      tilt - tilt
      Returns:
      a new ellipse
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, double x, double z, @NotNull @NotNull String image)
      Create a new icon.
      Parameters:
      key - identifying key
      x - icon x location on map
      z - icon z location on map
      image - image key
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, @NotNull @NotNull Point point, @NotNull @NotNull String image)
      Create a new icon.
      Parameters:
      key - identifying key
      point - icon location on map
      image - image key
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, double x, double z, @NotNull @NotNull String image, double size)
      Create a new icon.
      Parameters:
      key - identifying key
      x - icon x location on map
      z - icon z location on map
      image - image key
      size - size of image
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, double x, double z, @NotNull @NotNull String image, double width, double height)
      Create a new icon.
      Parameters:
      key - identifying key
      x - icon x location on map
      z - icon z location on map
      image - image key
      width - width of image
      height - height of image
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, @NotNull @NotNull Point point, @NotNull @NotNull String image, double size)
      Create a new icon.
      Parameters:
      key - identifying key
      point - icon location on map
      image - image key
      size - size of image
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, @NotNull @NotNull Point point, @NotNull @NotNull String image, double width, double height)
      Create a new icon.
      Parameters:
      key - identifying key
      point - icon location on map
      image - image key
      width - width of image
      height - height of image
      Returns:
      a new icon
    • icon

      @NotNull public static @NotNull Icon icon(@NotNull @NotNull String key, @NotNull @NotNull Point point, @NotNull @NotNull String image, @Nullable @Nullable Vector size)
      Create a new icon.
      Parameters:
      key - identifying key
      point - icon location on map
      image - image key
      size - size of image
      Returns:
      a new icon
    • multiPolygon

      @NotNull public static @NotNull MultiPolygon multiPolygon(@NotNull @NotNull String key, @NotNull @NotNull Polygon polygon)
      Create a new multi-polygon.
      Parameters:
      key - identifying key
      polygon - polygon to add
      Returns:
      a new multi-polygon
    • multiPolygon

      @NotNull public static @NotNull MultiPolygon multiPolygon(@NotNull @NotNull String key, @NotNull @NotNull Polygon @NotNull ... polygons)
      Create a new multi-polygon.
      Parameters:
      key - identifying key
      polygons - polygons to add
      Returns:
      a new multi-polygon
    • multiPolygon

      @NotNull public static @NotNull MultiPolygon multiPolygon(@NotNull @NotNull String key, @NotNull @NotNull List<@NotNull Polygon> polygons)
      Create a new multi-polygon.
      Parameters:
      key - identifying key
      polygons - polygons to add
      Returns:
      a new multi-polygon
    • multiPolyline

      @NotNull public static @NotNull MultiPolyline multiPolyline(@NotNull @NotNull String key, @NotNull @NotNull Polyline polyline)
      Create a new multi-polyline.
      Parameters:
      key - identifying key
      polyline - polyline to add
      Returns:
      a new multi-polyline
    • multiPolyline

      @NotNull public static @NotNull MultiPolyline multiPolyline(@NotNull @NotNull String key, @NotNull @NotNull Polyline @NotNull ... polylines)
      Create a new multi-polyline.
      Parameters:
      key - identifying key
      polylines - polylines to add
      Returns:
      a new multi-polyline
    • multiPolyline

      @NotNull public static @NotNull MultiPolyline multiPolyline(@NotNull @NotNull String key, @NotNull @NotNull List<@NotNull Polyline> polylines)
      Create a new multi-polyline.
      Parameters:
      key - identifying key
      polylines - polylines to add
      Returns:
      a new multi-polyline
    • polygon

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

      @NotNull public static @NotNull Polygon polygon(@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
    • polygon

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

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

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

      @NotNull public static @NotNull Polyline polyline(@NotNull @NotNull String key, @NotNull @NotNull List<@NotNull Point> points)
      Create a new polyline.
      Parameters:
      key - identifying key
      points - points to add
      Returns:
      a new polyline
    • rectangle

      @NotNull public static @NotNull Rectangle rectangle(@NotNull @NotNull String key, double x1, double z1, double x2, double z2)
      Create a new rectangle.
      Parameters:
      key - identifying key
      x1 - first x point
      z1 - first z point
      x2 - second x point
      z2 - second z point
      Returns:
      a new rectangle
    • rectangle

      @NotNull public static @NotNull Rectangle rectangle(@NotNull @NotNull String key, @NotNull @NotNull Point point1, @NotNull @NotNull Point point2)
      Create a new rectangle.
      Parameters:
      key - identifying key
      point1 - first point
      point2 - second point
      Returns:
      a new rectangle
    • getType

      @NotNull public @NotNull String getType()
      Get the type identifier of this marker.

      Used in the serialized json for the frontend.

      Returns:
      marker type
    • getPane

      @Nullable public @Nullable String getPane()
      Get the map pane where the marker will be added.

      Defaults to the overlay pane if null.

      Returns:
      map pane
    • setPane

      @NotNull public T setPane(@Nullable @Nullable String pane)
      Set the map pane where the marker will be added.

      If the pane does not exist, it will be created the first time it is used.

      Defaults to the overlay pane if null.

      Parameters:
      pane - map pane
      Returns:
      this marker
    • getOptions

      @Nullable public @Nullable Options getOptions()
      Get the options of this marker.

      Null options represents "default" values. See wiki about defaults.

      Returns:
      marker options
    • setOptions

      @NotNull public T setOptions(@Nullable @Nullable Options options)
      Set new options for this marker.

      Null options represents "default" values. See wiki about defaults.

      Parameters:
      options - new options or null
      Returns:
      this marker
    • setOptions

      @NotNull public T setOptions(@Nullable Options.Builder builder)
      Set new options for this marker.

      Null options represents "default" values. See wiki about defaults.

      Parameters:
      builder - new options builder or null
      Returns:
      this marker
    • fromJson

      @NotNull public static @NotNull Marker<?> fromJson(@NotNull @NotNull com.google.gson.JsonObject obj)