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
Modifier and TypeClassDescriptionstatic class
static class
An event that is fired when selected geo-object has changed. -
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
-
Constructor Summary
ConstructorDescriptionVectorLayer
(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 void
protected EventHub
Collection<? extends T>
Returns an unmodifiable collection of the geo-objects belonging to the layer.Returns the geo-objects providergetId()
int
Returns maximum layer zoom level.int
Returns 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.boolean
Whether the layer is to be editable on a map.boolean
boolean
Whether the layer is to be visible on a map.void
refresh()
Notify clients that the layer has changed and need to be redrawn.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setClusteringOptions
(ClusteringOptions clusteringOptions) void
setDataContainer
(InstanceContainer<T> dataContainer) void
setEditable
(boolean editable) Sets whether the layer is to be editable on a map.void
setItems
(VectorLayerItems<T> items) void
setMaxZoom
(int maxZoom) Sets maximum zoom level up to which the layer is visible (inclusive).void
setMinZoom
(int minZoom) Sets minimum zoom level down to which the layer is visible (inclusive).void
setPopupContentProvider
(Function<? super T, String> popupContentProvider) Sets the popup content provider, i.e.void
setPopupWindowOptions
(PopupWindowOptions popupWindowOptions) Sets the explicit style parameters for bound popups.void
setSelectedGeoObject
(T selectedGeoObject) Sets the selected geo-object of the layer.void
setSelectGeoObjectOnClick
(boolean selectGeoObjectOnClick) void
setStyleProvider
(Function<? super T, GeometryStyle> styleProvider) Sets the style provider for a layer's geo-objects, i.e.void
setTooltipContentProvider
(Function<? super T, String> tooltipContentProvider) Sets the tooltip content provider, i.e.void
setTooltipOptions
(TooltipOptions tooltipOptions) Sets the explicit style parameters for bound tooltips.void
setVisible
(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
Point
type, style object should be of aPointStyle
type. 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:
setApplicationContext
in 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:Layer
Sets maximum zoom level up to which the layer is visible (inclusive).- Specified by:
setMaxZoom
in interfaceLayer
- Parameters:
maxZoom
- maximum layer zoom level
-
getMaxZoom
public int getMaxZoom()Description copied from interface:Layer
Returns maximum layer zoom level.- Specified by:
getMaxZoom
in interfaceLayer
- Returns:
- maximum layer zoom level
-
setMinZoom
public void setMinZoom(int minZoom) Description copied from interface:Layer
Sets minimum zoom level down to which the layer is visible (inclusive).Default value: 0.
- Specified by:
setMinZoom
in interfaceLayer
- Parameters:
minZoom
- minimum layer zoom level
-
getMinZoom
public int getMinZoom()Description copied from interface:Layer
Returns minimum layer zoom level.- Specified by:
getMinZoom
in interfaceLayer
- Returns:
- minimum layer zoom level
-
getId
-
setVisible
public void setVisible(boolean visible) Description copied from interface:Layer
Sets whether the layer should be visible on a map.Default value:
true
.- Specified by:
setVisible
in interfaceLayer
- Parameters:
visible
- true/false
-
isVisible
public boolean isVisible()Description copied from interface:Layer
Whether the layer is to be visible on a map. -
setEditable
public void setEditable(boolean editable) Description copied from interface:Layer
Sets whether the layer is to be editable on a map.Default value:
false
.- Specified by:
setEditable
in interfaceLayer
- Parameters:
editable
- true/false
-
isEditable
public boolean isEditable()Description copied from interface:Layer
Whether the layer is to be editable on a map.- Specified by:
isEditable
in interfaceLayer
- Returns:
true
if the layer is set to be editable; otherwisefalse
-
fireLayerChangedEvent
-
refresh
public void refresh()Description copied from interface:Layer
Notify clients that the layer has changed and need to be redrawn. -
toString
-