Class Marker<T extends Marker<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

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

    • Marker

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

    • circle

      public static Circle circle(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

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

      public static Ellipse ellipse(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

      public static Ellipse ellipse(String key, 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

      public static Ellipse ellipse(String key, double centerX, double centerZ, 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

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

      public static Ellipse ellipse(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

      public static Ellipse ellipse(String key, 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

      public static Ellipse ellipse(String key, double centerX, double centerZ, 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

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

      public static Icon icon(String key, double x, double z, 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

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

      public static Icon icon(String key, double x, double z, 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

      public static Icon icon(String key, double x, double z, 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

      public static Icon icon(String key, Point point, 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

      public static Icon icon(String key, Point point, 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

      public static Icon icon(String key, Point point, String image, @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

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

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

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

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

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

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

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

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

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

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

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

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

      public static Rectangle rectangle(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

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

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

      Used in the serialized json for the frontend.

      Returns:
      marker type
    • getPane

      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

      public T setPane(@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

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

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

      Returns:
      marker options
    • setOptions

      public T setOptions(@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

      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

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