Class Icon
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.types.Icon
- All Implemented Interfaces:
Serializable,BasicType
- Direct Known Subclasses:
DivIcon
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
FieldsModifier and TypeFieldDescriptionstatic IconThe default Leaflet marker icon, using the standard icon, retina and shadow images. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIcon()Creates an empty icon with the default size, anchor and shadow settings.Creates an icon using the given image URL for the icon, the retina image and the default shadow image.Creates an icon using the given image URL and a square icon size.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.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 TypeMethodDescriptionGets 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.voidsetClassName(String className) Sets a custom CSS class name to assign to both the icon and shadow images.voidsetIconAnchor(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.voidsetIconSize(Point iconSize) Sets the size of the icon image in pixels.voidsetIconUrl(String iconUrl) Sets the URL to the icon image displayed for the marker.voidsetPopupAnchor(Point popupAnchor) Sets the coordinates from which popups will "open", relative to the icon anchor.voidsetRetinaUrl(String retinaUrl) Sets the URL to the retina-sized icon image, used on retina-screen devices.voidsetShadowAnchor(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.voidsetShadowSize(Point shadowSize) Sets the size of the shadow image in pixels.voidsetShadowUrl(String shadowUrl) Sets the URL to the icon shadow image.voidsetTooltipAnchor(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, waitMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.types.BasicType
getLeafletType
-
Field Details
-
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
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
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
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 pixelsheight- the height of the icon in pixels
-
Icon
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 devicesshadowUrl- the URL to the icon shadow image
-
-
Method Details
-
getIconUrl
Gets the URL to the icon image.- Returns:
- the icon image URL
-
setIconUrl
Sets the URL to the icon image displayed for the marker.- Parameters:
iconUrl- the icon image URL to set
-
getRetinaUrl
Gets the URL to the retina-sized icon image.- Returns:
- the retina icon image URL
-
setRetinaUrl
Sets the URL to the retina-sized icon image, used on retina-screen devices.- Parameters:
retinaUrl- the retina icon image URL to set
-
getShadowUrl
Gets the URL to the icon shadow image.- Returns:
- the icon shadow image URL
-
setShadowUrl
Sets the URL to the icon shadow image.- Parameters:
shadowUrl- the icon shadow image URL to set
-
getIconSize
Gets the size of the icon image in pixels.- Returns:
- the icon size
-
setIconSize
Sets the size of the icon image in pixels.- Parameters:
iconSize- the icon size to set
-
getIconAnchor
Gets the coordinates of the "tip" of the icon relative to its top-left corner.- Returns:
- the icon anchor point
-
setIconAnchor
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
Gets the coordinates from which popups will "open", relative to the icon anchor.- Returns:
- the popup anchor point
-
setPopupAnchor
Sets the coordinates from which popups will "open", relative to the icon anchor.- Parameters:
popupAnchor- the popup anchor point to set
-
getShadowAnchor
Gets the coordinates of the "tip" of the shadow relative to its top-left corner.- Returns:
- the shadow anchor point
-
setShadowAnchor
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
Gets the size of the shadow image in pixels.- Returns:
- the shadow size
-
setShadowSize
Sets the size of the shadow image in pixels.- Parameters:
shadowSize- the shadow size to set
-
getTooltipAnchor
Gets the coordinates from which tooltips will "open", relative to the icon anchor.- Returns:
- the tooltip anchor point
-
setTooltipAnchor
Sets the coordinates from which tooltips will "open", relative to the icon anchor.- Parameters:
tooltipAnchor- the tooltip anchor point to set
-
getClassName
Gets the custom CSS class name assigned to both icon and shadow images.- Returns:
- the CSS class name
-
setClassName
Sets a custom CSS class name to assign to both the icon and shadow images.- Parameters:
className- the CSS class name to set
-