public class VectorLayer<T>
extends java.lang.Object
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).
Modifier and Type | Class and Description |
---|---|
static class |
VectorLayer.GeoObjectClickEvent<T> |
static class |
VectorLayer.GeoObjectSelectedEvent<T>
An event that is fired when selected geo-object has changed.
|
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
Constructor and Description |
---|
VectorLayer(java.lang.String id) |
VectorLayer(java.lang.String id,
io.jmix.ui.model.InstanceContainer<T> dataContainer)
Creates an instance of
VectorLayer . |
VectorLayer(java.lang.String id,
VectorLayerItems<T> items)
Creates an instance of
VectorLayer . |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addGeoObjectClickListener(java.util.function.Consumer<VectorLayer.GeoObjectClickEvent<T>> listener) |
io.jmix.core.common.event.Subscription |
addGeoObjectSelectedListener(java.util.function.Consumer<VectorLayer.GeoObjectSelectedEvent<T>> listener)
Registers a new geo-object selected listener.
|
protected void |
fireLayerChangedEvent(LayerChangedEvent event) |
ClusteringOptions |
getClusteringOptions() |
protected io.jmix.core.common.event.EventHub |
getEventHub() |
java.util.Collection<? extends T> |
getGeoObjects()
Returns an unmodifiable collection of the geo-objects belonging to the layer.
|
VectorLayerItems<T> |
getGeoObjectsProvider()
Returns the geo-objects provider
|
java.lang.String |
getId() |
int |
getMaxZoom()
Returns maximum layer zoom level.
|
int |
getMinZoom()
Returns minimum layer zoom level.
|
java.util.function.Function<? super T,java.lang.String> |
getPopupContentProvider()
Returns the popup content provider.
|
PopupWindowOptions |
getPopupWindowOptions()
Returns style parameters for bound popups.
|
T |
getSelectedGeoObject()
Returns the selected geo-object of the layer.
|
java.util.function.Function<? super T,GeometryStyle> |
getStyleProvider()
Returns the geo-objects style provider.
|
java.util.function.Function<? super T,java.lang.String> |
getTooltipContentProvider() |
TooltipOptions |
getTooltipOptions() |
boolean |
isEditable()
Whether the layer is to be editable on a map.
|
boolean |
isSelectGeoObjectOnClick() |
boolean |
isVisible()
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(io.jmix.ui.model.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(java.util.function.Function<? super T,java.lang.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(java.util.function.Function<? super T,GeometryStyle> styleProvider)
Sets the style provider for a layer's geo-objects,
i.e.
|
void |
setTooltipContentProvider(java.util.function.Function<? super T,java.lang.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.
|
java.lang.String |
toString() |
protected org.springframework.context.ApplicationContext applicationContext
public VectorLayer(java.lang.String id)
public VectorLayer(java.lang.String id, VectorLayerItems<T> items)
VectorLayer
.id
- layer iditems
- geo-objects providerpublic VectorLayer(java.lang.String id, io.jmix.ui.model.InstanceContainer<T> dataContainer)
VectorLayer
.id
- layer iddataContainer
- dataContainer containing geo-objectspublic java.util.Collection<? extends T> getGeoObjects()
public java.util.function.Function<? super T,GeometryStyle> getStyleProvider()
public void setStyleProvider(java.util.function.Function<? super T,GeometryStyle> styleProvider)
Make sure to provide a style of an appropriate type.
For example, for geometries of a Point
type, style object should be of a PointStyle
type.
Otherwise, style option will not be applied.
styleProvider
- function that takes an entity as an argument
and produces a GeometryStyle for the entity's geometrypublic java.util.function.Function<? super T,java.lang.String> getPopupContentProvider()
public void setPopupContentProvider(java.util.function.Function<? super T,java.lang.String> popupContentProvider)
By default, popups are not displayed.
popupContentProvider
- function that takes an entity as an argument
and produces string of content to be displayed inside a popup windowpublic PopupWindowOptions getPopupWindowOptions()
public void setPopupWindowOptions(PopupWindowOptions popupWindowOptions)
public java.util.function.Function<? super T,java.lang.String> getTooltipContentProvider()
public void setTooltipContentProvider(java.util.function.Function<? super T,java.lang.String> tooltipContentProvider)
By default, tooltips are not displayed.
tooltipContentProvider
- function that takes an entity as an argument
and produces string of content to be displayed inside a tooltip boxpublic TooltipOptions getTooltipOptions()
public void setTooltipOptions(TooltipOptions tooltipOptions)
public T getSelectedGeoObject()
public void setSelectedGeoObject(T selectedGeoObject)
public VectorLayerItems<T> getGeoObjectsProvider()
public void setItems(VectorLayerItems<T> items)
public void setDataContainer(io.jmix.ui.model.InstanceContainer<T> dataContainer)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public io.jmix.core.common.event.Subscription addGeoObjectSelectedListener(java.util.function.Consumer<VectorLayer.GeoObjectSelectedEvent<T>> listener)
listener
- the listener to be addedpublic io.jmix.core.common.event.Subscription addGeoObjectClickListener(java.util.function.Consumer<VectorLayer.GeoObjectClickEvent<T>> listener)
public ClusteringOptions getClusteringOptions()
public void setClusteringOptions(ClusteringOptions clusteringOptions)
public boolean isSelectGeoObjectOnClick()
@StudioProperty(defaultValue="true") public void setSelectGeoObjectOnClick(boolean selectGeoObjectOnClick)
protected io.jmix.core.common.event.EventHub getEventHub()
public void setMaxZoom(int maxZoom)
Layer
setMaxZoom
in interface Layer
maxZoom
- maximum layer zoom levelpublic int getMaxZoom()
Layer
getMaxZoom
in interface Layer
public void setMinZoom(int minZoom)
Layer
Default value: 0.
setMinZoom
in interface Layer
minZoom
- minimum layer zoom levelpublic int getMinZoom()
Layer
getMinZoom
in interface Layer
public void setVisible(boolean visible)
Layer
Default value: true
.
setVisible
in interface Layer
visible
- true/falsepublic boolean isVisible()
Layer
public void setEditable(boolean editable)
Layer
Default value: false
.
setEditable
in interface Layer
editable
- true/falsepublic boolean isEditable()
Layer
isEditable
in interface Layer
true
if the layer is set to be editable;
otherwise false
protected void fireLayerChangedEvent(LayerChangedEvent event)
public void refresh()
Layer
public java.lang.String toString()
toString
in class java.lang.Object