java.lang.Object
org.vaadin.addons.componentfactory.leaflet.types.Icon
All Implemented Interfaces:
Serializable, BasicType
Direct Known Subclasses:
DivIcon

public class Icon extends Object implements BasicType
Represents an icon to provide when creating a marker.
Since:
2020-03-21
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Icon
    The default Leaflet marker icon, using the standard icon, retina and shadow images.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates an empty icon with the default size, anchor and shadow settings.
     
    Icon(String iconUrl)
    Creates an icon using the given image URL for the icon, the retina image and the default shadow image.
     
    Icon(String iconUrl, int size)
    Creates an icon using the given image URL and a square icon size.
     
    Icon(String iconUrl, int width, int height)
    Creates an icon using the given image URL and icon size, deriving the anchor, popup, tooltip and shadow settings from the given width and height.
     
    Icon(String iconUrl, String retinaUrl, String shadowUrl)
    Creates an icon using the given image URL, retina image URL and shadow image URL, keeping the default size and anchor settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the custom CSS class name assigned to both icon and shadow images.
    Gets the coordinates of the "tip" of the icon relative to its top-left corner.
    Gets the size of the icon image in pixels.
    Gets the URL to the icon image.
    Gets the coordinates from which popups will "open", relative to the icon anchor.
    Gets the URL to the retina-sized icon image.
    Gets the coordinates of the "tip" of the shadow relative to its top-left corner.
    Gets the size of the shadow image in pixels.
    Gets the URL to the icon shadow image.
    Gets the coordinates from which tooltips will "open", relative to the icon anchor.
    void
    setClassName(String className)
    Sets a custom CSS class name to assign to both the icon and shadow images.
    void
    setIconAnchor(Point iconAnchor)
    Sets the coordinates of the "tip" of the icon (relative to its top-left corner), which will be aligned to the marker's geographical location.
    void
    setIconSize(Point iconSize)
    Sets the size of the icon image in pixels.
    void
    setIconUrl(String iconUrl)
    Sets the URL to the icon image displayed for the marker.
    void
    setPopupAnchor(Point popupAnchor)
    Sets the coordinates from which popups will "open", relative to the icon anchor.
    void
    setRetinaUrl(String retinaUrl)
    Sets the URL to the retina-sized icon image, used on retina-screen devices.
    void
    setShadowAnchor(Point shadowAnchor)
    Sets the coordinates of the "tip" of the shadow (relative to its top-left corner); defaults to the icon anchor if not specified.
    void
    setShadowSize(Point shadowSize)
    Sets the size of the shadow image in pixels.
    void
    setShadowUrl(String shadowUrl)
    Sets the URL to the icon shadow image.
    void
    setTooltipAnchor(Point tooltipAnchor)
    Sets the coordinates from which tooltips will "open", relative to the icon anchor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.vaadin.addons.componentfactory.leaflet.types.BasicType

    getLeafletType
  • Field Details

    • DEFAULT_ICON

      public static Icon DEFAULT_ICON
      The default Leaflet marker icon, using the standard icon, retina and shadow images.
  • Constructor Details

    • Icon

      protected Icon()
      Creates an empty icon with the default size, anchor and shadow settings.
    • Icon

      public Icon(String iconUrl)
      Creates an icon using the given image URL for the icon, the retina image and the default shadow image.
      Parameters:
      iconUrl - the URL to the icon image (absolute or relative to your script path)
    • Icon

      public Icon(String iconUrl, int size)
      Creates an icon using the given image URL and a square icon size.
      Parameters:
      iconUrl - the URL to the icon image (absolute or relative to your script path)
      size - the width and height of the icon in pixels
    • Icon

      public Icon(String iconUrl, int width, int height)
      Creates an icon using the given image URL and icon size, deriving the anchor, popup, tooltip and shadow settings from the given width and height.
      Parameters:
      iconUrl - the URL to the icon image (absolute or relative to your script path)
      width - the width of the icon in pixels
      height - the height of the icon in pixels
    • Icon

      public Icon(String iconUrl, String retinaUrl, String shadowUrl)
      Creates an icon using the given image URL, retina image URL and shadow image URL, keeping the default size and anchor settings.
      Parameters:
      iconUrl - the URL to the icon image (absolute or relative to your script path)
      retinaUrl - the URL to a retina-sized version of the icon image, used on retina-screen devices
      shadowUrl - the URL to the icon shadow image
  • Method Details

    • getIconUrl

      public String getIconUrl()
      Gets the URL to the icon image.
      Returns:
      the icon image URL
    • setIconUrl

      public void setIconUrl(String iconUrl)
      Sets the URL to the icon image displayed for the marker.
      Parameters:
      iconUrl - the icon image URL to set
    • getRetinaUrl

      public String getRetinaUrl()
      Gets the URL to the retina-sized icon image.
      Returns:
      the retina icon image URL
    • setRetinaUrl

      public void setRetinaUrl(String retinaUrl)
      Sets the URL to the retina-sized icon image, used on retina-screen devices.
      Parameters:
      retinaUrl - the retina icon image URL to set
    • getShadowUrl

      public String getShadowUrl()
      Gets the URL to the icon shadow image.
      Returns:
      the icon shadow image URL
    • setShadowUrl

      public void setShadowUrl(String shadowUrl)
      Sets the URL to the icon shadow image.
      Parameters:
      shadowUrl - the icon shadow image URL to set
    • getIconSize

      public Point getIconSize()
      Gets the size of the icon image in pixels.
      Returns:
      the icon size
    • setIconSize

      public void setIconSize(Point iconSize)
      Sets the size of the icon image in pixels.
      Parameters:
      iconSize - the icon size to set
    • getIconAnchor

      public Point getIconAnchor()
      Gets the coordinates of the "tip" of the icon relative to its top-left corner.
      Returns:
      the icon anchor point
    • setIconAnchor

      public void setIconAnchor(Point iconAnchor)
      Sets the coordinates of the "tip" of the icon (relative to its top-left corner), which will be aligned to the marker's geographical location.
      Parameters:
      iconAnchor - the icon anchor point to set
    • getPopupAnchor

      public Point getPopupAnchor()
      Gets the coordinates from which popups will "open", relative to the icon anchor.
      Returns:
      the popup anchor point
    • setPopupAnchor

      public void setPopupAnchor(Point popupAnchor)
      Sets the coordinates from which popups will "open", relative to the icon anchor.
      Parameters:
      popupAnchor - the popup anchor point to set
    • getShadowAnchor

      public Point getShadowAnchor()
      Gets the coordinates of the "tip" of the shadow relative to its top-left corner.
      Returns:
      the shadow anchor point
    • setShadowAnchor

      public void setShadowAnchor(Point shadowAnchor)
      Sets the coordinates of the "tip" of the shadow (relative to its top-left corner); defaults to the icon anchor if not specified.
      Parameters:
      shadowAnchor - the shadow anchor point to set
    • getShadowSize

      public Point getShadowSize()
      Gets the size of the shadow image in pixels.
      Returns:
      the shadow size
    • setShadowSize

      public void setShadowSize(Point shadowSize)
      Sets the size of the shadow image in pixels.
      Parameters:
      shadowSize - the shadow size to set
    • getTooltipAnchor

      public Point getTooltipAnchor()
      Gets the coordinates from which tooltips will "open", relative to the icon anchor.
      Returns:
      the tooltip anchor point
    • setTooltipAnchor

      public void setTooltipAnchor(Point tooltipAnchor)
      Sets the coordinates from which tooltips will "open", relative to the icon anchor.
      Parameters:
      tooltipAnchor - the tooltip anchor point to set
    • getClassName

      public String getClassName()
      Gets the custom CSS class name assigned to both icon and shadow images.
      Returns:
      the CSS class name
    • setClassName

      public void setClassName(String className)
      Sets a custom CSS class name to assign to both the icon and shadow images.
      Parameters:
      className - the CSS class name to set