Package io.jmix.mapsui.component.layer
Class VectorLayer<T>
java.lang.Object
io.jmix.mapsui.component.layer.VectorLayer<T>
- All Implemented Interfaces:
Layer,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
A layer containing geo-objects (entities having a property of a
Geometry type.
This layer acts as a connector between the data (geo-objects provided by
VectorLayerItems interface implementation) and the map UI component.
It carries the data along with some additional information on how
the geo-objects should be displayed on a map (styles, content of popup info windows).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classAn event that is fired when selected geo-object has changed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext -
Constructor Summary
ConstructorsConstructorDescriptionVectorLayer(String id) VectorLayer(String id, VectorLayerItems<T> items) Creates an instance ofVectorLayer.VectorLayer(String id, InstanceContainer<T> dataContainer) Creates an instance ofVectorLayer. -
Method Summary
Modifier and TypeMethodDescriptionRegisters a new geo-object selected listener.protected voidprotected EventHubCollection<? extends T>Returns an unmodifiable collection of the geo-objects belonging to the layer.Returns the geo-objects providergetId()intReturns maximum layer zoom level.intReturns minimum layer zoom level.Returns the popup content provider.Returns style parameters for bound popups.Returns the selected geo-object of the layer.Function<? super T,GeometryStyle> Returns the geo-objects style provider.booleanWhether the layer is to be editable on a map.booleanbooleanWhether the layer is to be visible on a map.voidrefresh()Notify clients that the layer has changed and need to be redrawn.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetClusteringOptions(ClusteringOptions clusteringOptions) voidsetDataContainer(InstanceContainer<T> dataContainer) voidsetEditable(boolean editable) Sets whether the layer is to be editable on a map.voidsetItems(VectorLayerItems<T> items) voidsetMaxZoom(int maxZoom) Sets maximum zoom level up to which the layer is visible (inclusive).voidsetMinZoom(int minZoom) Sets minimum zoom level down to which the layer is visible (inclusive).voidsetPopupContentProvider(Function<? super T, String> popupContentProvider) Sets the popup content provider, i.e.voidsetPopupWindowOptions(PopupWindowOptions popupWindowOptions) Sets the explicit style parameters for bound popups.voidsetSelectedGeoObject(T selectedGeoObject) Sets the selected geo-object of the layer.voidsetSelectGeoObjectOnClick(boolean selectGeoObjectOnClick) voidsetStyleProvider(Function<? super T, GeometryStyle> styleProvider) Sets the style provider for a layer's geo-objects, i.e.voidsetTooltipContentProvider(Function<? super T, String> tooltipContentProvider) Sets the tooltip content provider, i.e.voidsetTooltipOptions(TooltipOptions tooltipOptions) Sets the explicit style parameters for bound tooltips.voidsetVisible(boolean visible) Sets whether the layer should be visible on a map.toString()
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
-
Constructor Details
-
VectorLayer
-
VectorLayer
Creates an instance ofVectorLayer.- Parameters:
id- layer iditems- geo-objects provider
-
VectorLayer
Creates an instance ofVectorLayer.- Parameters:
id- layer iddataContainer- dataContainer containing geo-objects
-
-
Method Details
-
getGeoObjects
Returns an unmodifiable collection of the geo-objects belonging to the layer.- Returns:
- collection of entities
-
getStyleProvider
Returns the geo-objects style provider. -
setStyleProvider
Sets the style provider for a layer's geo-objects, i.e. function that determines style for a corresponding entity's geometry that is displayed on a map.Make sure to provide a style of an appropriate type. For example, for geometries of a
Pointtype, style object should be of aPointStyletype. Otherwise, style option will not be applied.- Parameters:
styleProvider- function that takes an entity as an argument and produces a GeometryStyle for the entity's geometry
-
getPopupContentProvider
Returns the popup content provider. -
setPopupContentProvider
Sets the popup content provider, i.e. function that determines content for bound popups (which will be opened on clicking on the layer's geometries).By default, popups are not displayed.
- Parameters:
popupContentProvider- function that takes an entity as an argument and produces string of content to be displayed inside a popup window
-
getPopupWindowOptions
Returns style parameters for bound popups. -
setPopupWindowOptions
Sets the explicit style parameters for bound popups. -
getTooltipContentProvider
-
setTooltipContentProvider
Sets the tooltip content provider, i.e. function that determines content for bound tooltips (which will be opened on hovering on the layer's geometries).By default, tooltips are not displayed.
- Parameters:
tooltipContentProvider- function that takes an entity as an argument and produces string of content to be displayed inside a tooltip box
-
getTooltipOptions
-
setTooltipOptions
Sets the explicit style parameters for bound tooltips. -
getSelectedGeoObject
Returns the selected geo-object of the layer. -
setSelectedGeoObject
Sets the selected geo-object of the layer. -
getGeoObjectsProvider
Returns the geo-objects provider -
setItems
-
setDataContainer
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
addGeoObjectSelectedListener
public Subscription addGeoObjectSelectedListener(Consumer<VectorLayer.GeoObjectSelectedEvent<T>> listener) Registers a new geo-object selected listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addGeoObjectClickListener
public Subscription addGeoObjectClickListener(Consumer<VectorLayer.GeoObjectClickEvent<T>> listener) -
getClusteringOptions
-
setClusteringOptions
-
isSelectGeoObjectOnClick
public boolean isSelectGeoObjectOnClick() -
setSelectGeoObjectOnClick
@StudioProperty(defaultValue="true") public void setSelectGeoObjectOnClick(boolean selectGeoObjectOnClick) -
getEventHub
-
setMaxZoom
public void setMaxZoom(int maxZoom) Description copied from interface:LayerSets maximum zoom level up to which the layer is visible (inclusive).- Specified by:
setMaxZoomin interfaceLayer- Parameters:
maxZoom- maximum layer zoom level
-
getMaxZoom
public int getMaxZoom()Description copied from interface:LayerReturns maximum layer zoom level.- Specified by:
getMaxZoomin interfaceLayer- Returns:
- maximum layer zoom level
-
setMinZoom
public void setMinZoom(int minZoom) Description copied from interface:LayerSets minimum zoom level down to which the layer is visible (inclusive).Default value: 0.
- Specified by:
setMinZoomin interfaceLayer- Parameters:
minZoom- minimum layer zoom level
-
getMinZoom
public int getMinZoom()Description copied from interface:LayerReturns minimum layer zoom level.- Specified by:
getMinZoomin interfaceLayer- Returns:
- minimum layer zoom level
-
getId
-
setVisible
public void setVisible(boolean visible) Description copied from interface:LayerSets whether the layer should be visible on a map.Default value:
true.- Specified by:
setVisiblein interfaceLayer- Parameters:
visible- true/false
-
isVisible
public boolean isVisible()Description copied from interface:LayerWhether the layer is to be visible on a map. -
setEditable
public void setEditable(boolean editable) Description copied from interface:LayerSets whether the layer is to be editable on a map.Default value:
false.- Specified by:
setEditablein interfaceLayer- Parameters:
editable- true/false
-
isEditable
public boolean isEditable()Description copied from interface:LayerWhether the layer is to be editable on a map.- Specified by:
isEditablein interfaceLayer- Returns:
trueif the layer is set to be editable; otherwisefalse
-
fireLayerChangedEvent
-
refresh
public void refresh()Description copied from interface:LayerNotify clients that the layer has changed and need to be redrawn. -
toString
-