Class Icon

All Implemented Interfaces:
JsonSerializable

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

    • Icon

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

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

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

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

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

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

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

    • of

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

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

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

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

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

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

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

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

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

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

      @NotNull public @NotNull Icon setImage(@NotNull @NotNull 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

      @Nullable 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

      @NotNull public @NotNull Icon setRetina(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Icon setSize(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Icon setAnchor(@Nullable @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

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

      Defaults to '0' if null.

      Returns:
      angle of rotation
    • setRotationAngle

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

      Defaults to '0' if null.

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

      @Nullable 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

      @NotNull public @NotNull Icon setRotationOrigin(@Nullable @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

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

      No shadow image will be shown, if null.

      Returns:
      shadow image
    • setShadow

      @NotNull public @NotNull Icon setShadow(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Icon setShadowRetina(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Icon setShadowSize(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Icon setShadowAnchor(@Nullable @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

      @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 Icon 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