Class DivIcon
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.types.Icon
org.vaadin.addons.componentfactory.leaflet.types.DivIcon
- All Implemented Interfaces:
Serializable,BasicType
Represents a lightweight icon for markers that uses a simple element
instead of an image. Inherits from Icon but ignores the iconUrl and shadow
options.
By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
Usage example
Marker marker = new Marker(new LatLng(47.1, 18.4));
marker.setIcon(new DivIcon("my-div-icon"));
marker.addTo(leafletMap);
- Since:
- 2020-05-29
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Field Summary
Fields inherited from class org.vaadin.addons.componentfactory.leaflet.types.Icon
DEFAULT_ICON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBgPos()Returns the relative position of the background, in pixels.getHtml()Returns the custom HTML code placed inside the div element.voidSets the Optional relative position of the background, in pixelsvoidSets the custom HTML code to put inside the div element, empty by default.Methods inherited from class org.vaadin.addons.componentfactory.leaflet.types.Icon
getClassName, getIconAnchor, getIconSize, getIconUrl, getPopupAnchor, getRetinaUrl, getShadowAnchor, getShadowSize, getShadowUrl, getTooltipAnchor, setClassName, setIconAnchor, setIconSize, setIconUrl, setPopupAnchor, setRetinaUrl, setShadowAnchor, setShadowSize, setShadowUrl, setTooltipAnchorMethods 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
-
Constructor Details
-
DivIcon
public DivIcon()Creates a DivIcon using the defaultleaflet-div-iconCSS class. -
DivIcon
Creates a DivIcon using the given CSS class name.- Parameters:
className- the CSS class name to apply to the icon element
-
-
Method Details
-
getHtml
Returns the custom HTML code placed inside the div element.- Returns:
- the custom HTML content, or
nullif none is set
-
setHtml
Sets the custom HTML code to put inside the div element, empty by default. Alternatively, an instance of HTMLElement.- Parameters:
html- custom HTML code to put inside the div
-
getBgPos
Returns the relative position of the background, in pixels.- Returns:
- the background position
-
setBgPos
Sets the Optional relative position of the background, in pixels- Parameters:
bgPos- the position of the background to be used
-