Class LayerGroup
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.LeafletObject
org.vaadin.addons.componentfactory.leaflet.layer.Layer
org.vaadin.addons.componentfactory.leaflet.layer.groups.LayerGroup
- All Implemented Interfaces:
Serializable,Evented,LayerGroupFunctions,Identifiable,LayerPopupFunctions,LayerTooltipFunctions,ExecutableFunctions
- Direct Known Subclasses:
FeatureGroup
Used to group several layers and handle them as one. If you add it to the
map, any layers added or removed from the group will be added/removed on the
map as well. Extends Layer.
- Since:
- 2020-02-06
- Version:
- 1.1
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
Layer.LayerEventType -
Field Summary
Fields inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
DEFAULT_PANE -
Constructor Summary
ConstructorsConstructorDescriptionLayerGroup(List<Layer> layers) Creates a layer group containing the given layers.LayerGroup(Layer... layers) Creates a layer group containing the given layers. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given layer to the group.voidRemoves all layers from the group.voidIterates over the layers of the group, optionally specifying context of the iterator function.Recursively searches this group and any nested layer groups for the layer with the given internal ID.Returns the layer with the given internal ID.getLayerId(Layer layer) Returns the internal ID for a layerReturns an array of all the layers added to the group.booleanReturns whether a layer with the given internal ID is currently in the group.booleanReturns whether the given layer is currently in the group.voidCalls methodName on every layer contained in this group, passing any additional parameters.voidremoveLayer(String layerId) Removes the layer with the given internal ID from the group.voidremoveLayer(Layer layer) Removes the given layer from the group.voidsetZIndex(int zIndex) Calls setZIndex on every layer contained in this group, passing the z-index.voidtoGeoJSON(int precision) precision is the number of decimal places for coordinates.Methods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
addEventListener, addTo, addTo, bindPopup, bindPopup, bindTooltip, bindTooltip, clearAllEventListeners, fireEvent, getAttribution, getEvents, getPane, getPopup, getTooltip, hasEventListeners, onAdd, onPopupClose, onPopupOpen, onRemove, onTooltipClose, onTooltipOpen, remove, removeEventListener, set, setAttribution, setPane, unbindPopup, unbindTooltipMethods inherited from class org.vaadin.addons.componentfactory.leaflet.LeafletObject
call, configureObjectMapper, executeJs, getConstructorArgumentNames, getJson, getLeafletType, getParent, getUuid, setParentMethods 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.layer.events.Evented
listens, off, off, onMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.ExecutableFunctions
call, call, executeJs, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.Identifiable
getUuidMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerPopupFunctions
closePopup, isPopupOpen, openPopup, openPopup, setPopupContent, setPopupContent, togglePopupMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerTooltipFunctions
closeTooltip, isTooltipOpen, openTooltip, openTooltip, setTooltipContent, setTooltipContent, toggleTooltip
-
Constructor Details
-
LayerGroup
Creates a layer group containing the given layers.- Parameters:
layers- the layers to add to this group
-
LayerGroup
Creates a layer group containing the given layers.- Parameters:
layers- the layers to add to this group
-
-
Method Details
-
toGeoJSON
public void toGeoJSON(int precision) precision is the number of decimal places for coordinates. The default value is 6 places. Returns a GeoJSON representation of the layer group (as a GeoJSON FeatureCollection, GeometryCollection, or MultiPoint).- Parameters:
precision- the precision
-
addLayer
Adds the given layer to the group.- Specified by:
addLayerin interfaceLayerGroupFunctions- Parameters:
layer- the layer to be add
-
removeLayer
Removes the given layer from the group.- Specified by:
removeLayerin interfaceLayerGroupFunctions- Parameters:
layer- the layer to remove
-
removeLayer
Removes the layer with the given internal ID from the group.- Specified by:
removeLayerin interfaceLayerGroupFunctions- Parameters:
layerId- the internal ID of the layer to remove
-
hasLayer
Returns whether the given layer is currently in the group.- Specified by:
hasLayerin interfaceLayerGroupFunctions- Parameters:
layer- the layer to check- Returns:
trueif the layer is in the group
-
hasLayer
Returns whether a layer with the given internal ID is currently in the group.- Specified by:
hasLayerin interfaceLayerGroupFunctions- Parameters:
layerId- the internal ID of the layer to check- Returns:
trueif a matching layer is in the group
-
clearLayers
public void clearLayers()Removes all layers from the group.- Specified by:
clearLayersin interfaceLayerGroupFunctions
-
invoke
Calls methodName on every layer contained in this group, passing any additional parameters. Has no effect if the layers contained do not implement methodName.- Parameters:
functionName- the function name to be invoke
-
eachLayer
Iterates over the layers of the group, optionally specifying context of the iterator function.- Parameters:
action- the callback function
-
getLayer
Returns the layer with the given internal ID.- Parameters:
layerId- layer to be check- Returns:
- the layer with the given internal ID.
-
findLayer
Recursively searches this group and any nested layer groups for the layer with the given internal ID.- Parameters:
layerId- the internal ID of the layer to find- Returns:
- the matching layer, or an empty optional if none is found
-
getLayers
Returns an array of all the layers added to the group.- Returns:
- an array of all the layers added to the group.
-
getLayerId
Returns the internal ID for a layer- Parameters:
layer- a layer- Returns:
- the id of the given layer
-
setZIndex
public void setZIndex(int zIndex) Calls setZIndex on every layer contained in this group, passing the z-index.- Parameters:
zIndex- the z-index to be set on each layer
-