Class Icon

All Implemented Interfaces:
JsonSerializable

@NullMarked public class Icon extends Marker<Icon>
Represents an icon marker.
  • Constructor Details

    • Icon

      public 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
    • Icon

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

      public 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
    • Icon

      public 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
    • Icon

      public 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
    • Icon

      public 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
    • Icon

      public 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
  • Method Details

    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • of

      public static Icon of(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
    • getPoint

      public Point getPoint()
      Get the Point on the map for this icon.
      Returns:
      point on map
    • setPoint

      public Icon setPoint(Point point)
      Set a new Point on the map for this icon.
      Parameters:
      point - new point on map
      Returns:
      this icon
    • getImage

      public String getImage()
      Get the image to use for this icon.
      Returns:
      image
      See Also:
    • setImage

      public Icon setImage(String image)
      Set the image to use for this icon.

      Key must be registered with the icon registry.

      Parameters:
      image - new image
      Returns:
      this icon
      See Also:
    • getRetina

      public @Nullable String getRetina()
      Get the retina sized image to use for this icon.

      This image will be used on retina devices.

      Defaults to 'getImage()' if null.

      Returns:
      retina image
      See Also:
    • setRetina

      public Icon setRetina(@Nullable String retina)
      Set the retina sized image to use for this icon.

      This image will be used on retina devices.

      Key must be registered with the icon registry.

      Defaults to 'getImage()' if null.

      Parameters:
      retina - new retina image
      Returns:
      this icon
      See Also:
    • getSize

      public @Nullable Vector getSize()
      Get the size of the image, in pixels.

      Used for auto centering the image on 'getPoint()' if set.

      Returns:
      image size
    • setSize

      public Icon setSize(@Nullable Vector size)
      Set the size of the image, in pixels.

      Used for auto centering the image on 'getPoint()' if set.

      Parameters:
      size - new image size
      Returns:
      this icon
    • getAnchor

      public @Nullable Vector getAnchor()
      Get the coordinates of the "tip" of the icon (relative to its top left corner).

      The icon will be aligned so that this point is at getPoint().

      Centered by default if 'getSize()' is also set.

      Returns:
      icon anchor
    • setAnchor

      public Icon setAnchor(@Nullable Vector anchor)
      Set the coordinates of the "tip" of the icon (relative to its top left corner).

      The icon will be aligned so that this point is at getPoint().

      Centered by default if 'getSize()' is also set.

      Parameters:
      anchor - new anchor
      Returns:
      this icon
    • getRotationAngle

      public @Nullable Double getRotationAngle()
      Get the rotation angle, in degrees, clockwise.

      Defaults to '0' if null.

      Returns:
      angle of rotation
    • setRotationAngle

      public Icon setRotationAngle(@Nullable Double rotationAngle)
      Set the rotation angle, in degrees, clockwise.

      Defaults to '0' if null.

      Parameters:
      rotationAngle - angle of rotation
      Returns:
      this icon
    • getRotationOrigin

      public @Nullable String getRotationOrigin()
      Get the rotation origin, as a transform-origin CSS rule.

      Defaults to 'bottom center' if null.

      Returns:
      origin of rotation
      See Also:
    • setRotationOrigin

      public Icon setRotationOrigin(@Nullable String rotationOrigin)
      Set the rotation origin, as a transform-origin CSS rule.

      Defaults to 'bottom center' if null.

      Parameters:
      rotationOrigin - origin of rotation
      Returns:
      this icon
      See Also:
    • getShadow

      public @Nullable String getShadow()
      Get shadow image of this icon.

      No shadow image will be shown, if null.

      Returns:
      shadow image
    • setShadow

      public Icon setShadow(@Nullable String shadow)
      Set the shadow image to use for this icon.

      Key must be registered with the icon registry.

      No shadow image will be shown, if null.

      Parameters:
      shadow - new shadow image
      Returns:
      this icon
      See Also:
    • getShadowRetina

      public @Nullable String getShadowRetina()
      Get the retina sized shadow image to use for this icon.

      This shadow image will be used on retina devices.

      Key must be registered with the icon registry.

      Defaults to 'getShadow()' if null.

      Returns:
      retina shadow image
      See Also:
    • setShadowRetina

      public Icon setShadowRetina(@Nullable String shadowRetina)
      Set the retina sized shadow image to use for this icon.

      This shadow image will be used on retina devices.

      Key must be registered with the icon registry.

      Defaults to 'getShadow()' if null.

      Parameters:
      shadowRetina - new retina shadow image
      Returns:
      this icon
      See Also:
    • getShadowSize

      public @Nullable Vector getShadowSize()
      Get the size of the shadow image in pixels.

      Used for auto centering the shadow image on 'getPoint()' if set.

      Returns:
      shadow image size
    • setShadowSize

      public Icon setShadowSize(@Nullable Vector shadowSize)
      Set the size of the shadow image in pixels.

      Used for auto centering the shadow image on 'getPoint()' if set.

      Parameters:
      shadowSize - new shadow image size
      Returns:
      this icon
    • getShadowAnchor

      public @Nullable Vector getShadowAnchor()
      Get the coordinates of the "tip" of the shadow image (relative to its top left corner).

      The icon will be aligned so that this point is at getPoint().

      The same as getAnchor() if null.

      Returns:
      icon anchor
    • setShadowAnchor

      public Icon setShadowAnchor(@Nullable Vector shadowAnchor)
      Set the coordinates of the "tip" of the shadow image (relative to its top left corner).

      The shadow image will be aligned so that this point is at getPoint().

      The same as getAnchor() if null.

      Parameters:
      shadowAnchor - new anchor
      Returns:
      this icon
    • toJson

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

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