Class HeatmapDataVectorSource<E>
java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.source.Source
io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
io.jmix.mapsflowui.kit.component.model.source.AbstractEditableVectorSource
io.jmix.mapsflowui.component.model.source.AbstractDataVectorSource<E>
io.jmix.mapsflowui.component.model.source.HeatmapDataVectorSource<E>
- Type Parameters:
E
- item type
- All Implemented Interfaces:
GeoObjectClickNotifier<E>
,HasGeoObjectDrag<E>
,HasGeoObjectModify<E>
,Source.HasAttributions
,Source.HasWrapX
,SupportsFeatureDrag
,SupportsFeatureModify
,Serializable
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class HeatmapDataVectorSource<E>
extends AbstractDataVectorSource<E>
implements org.springframework.context.ApplicationContextAware, GeoObjectClickNotifier<E>, HasGeoObjectDrag<E>, HasGeoObjectModify<E>
A source containing geo-objects (entities having a property of a
Geometry
type) for HeatmapLayer
.
This source acts as a connector between the data (geo-objects provided by
DataVectorSourceItems
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.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
AbstractVectorSource.HasOverlaps, AbstractVectorSource.HasUseSpatialIndex, AbstractVectorSource.HasVectorSourceOptions
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
Source.HasAttributions, Source.HasAttributionsCollapsible, Source.HasProjection, Source.HasSourceOptions, Source.HasWrapX
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent
Nested classes/interfaces inherited from interface io.jmix.mapsflowui.component.model.source.GeoObjectClickNotifier
GeoObjectClickNotifier.AbstractGeoObjectClickEvent<E>, GeoObjectClickNotifier.GeoObjectClickEvent<E>, GeoObjectClickNotifier.GeoObjectDoubleClickEvent<E>, GeoObjectClickNotifier.GeoObjectSingleClickEvent<E>
Nested classes/interfaces inherited from interface io.jmix.mapsflowui.component.model.source.HasGeoObjectDrag
HasGeoObjectDrag.AbstractGeoObjectDragEvent<E>, HasGeoObjectDrag.GeoObjectDragEndEvent<E>, HasGeoObjectDrag.GeoObjectDragStartEvent<E>
Nested classes/interfaces inherited from interface io.jmix.mapsflowui.component.model.source.HasGeoObjectModify
HasGeoObjectModify.AbstractGeoObjectModifyEndEvent<E>, HasGeoObjectModify.GeoObjectModifyEndEvent<E>, HasGeoObjectModify.GeoObjectModifyStartEvent<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected HeatmapDataVectorSourceBinding<E>
Fields inherited from class io.jmix.mapsflowui.component.model.source.AbstractDataVectorSource
items
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractEditableVectorSource
featureDragEnabled, featureModifyEnabled, featureSelectEnabled, jmixSourceFeatureDeleteRegistration, jmixSourceFeatureDragEndRegistration, jmixSourceFeatureDragStartRegistration, jmixSourceFeatureModifyEndRegistration, jmixSourceFeatureModifyStartRegistration, jmixSourceFeatureSelectionRegistration
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
overlaps, useSpatialIndex
Fields inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
attributions, attributionsCollapsible, id, projection, wrapX
Fields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, metaProperties, parent, removedChildren, syncId
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
Adds geo-object click listener.com.vaadin.flow.shared.Registration
addGeoObjectDoubleClickListener
(Consumer<GeoObjectClickNotifier.GeoObjectDoubleClickEvent<E>> listener) Adds geo-object double click listener.com.vaadin.flow.shared.Registration
Adds geo-object drag end listener.com.vaadin.flow.shared.Registration
Adds geo-object drag start listener.com.vaadin.flow.shared.Registration
Adds geo-object modify end listener.com.vaadin.flow.shared.Registration
Adds geo-object modify start listener.com.vaadin.flow.shared.Registration
addGeoObjectSingleClickListener
(Consumer<GeoObjectClickNotifier.GeoObjectSingleClickEvent<E>> listener) Adds geo-object single click listener.protected void
applyDeletion
(Collection<E> itemsTuUpdate) protected void
applyModifyChanges
(Map<Feature, SimpleGeometry<?>> features) protected void
protected Collection<E>
convertFeaturesToItems
(Collection<Feature> features) protected void
protected void
protected void
protected void
protected void
void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setFeatureDragEnabled
(Boolean enabled) Enables / disables feature drag mode.void
setFeatureModifyEnabled
(Boolean enabled) Enables / disables feature modify mode.void
setModifyStyleProvider
(Function<? super E, List<Style>> modifyStyleProvider) Sets modify style provider for a layer's geo-objects.void
setWeightProvider
(Function<E, Double> weightProvider) Sets weight (intensity) provider.protected void
withAttributions
(List<String> attributions) withFeatureDragEnabled
(Boolean enabled) withFeatureModifyEnabled
(Boolean enabled) withItems
(DataVectorSourceItems<E> items) withWeightProvider
(Function<E, Double> weightProvider) Methods inherited from class io.jmix.mapsflowui.component.model.source.AbstractDataVectorSource
getAttributions, getItems, getType, getWrapX, setAttributions, setItems, setWrapX
Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractEditableVectorSource
attachJmixSourceFeatureDeleteListener, attachJmixSourceFeatureDragEndListener, attachJmixSourceFeatureDragStartListener, attachJmixSourceFeatureModifyEndListener, attachJmixSourceFeatureModifyStartListener, attachJmixSourceFeatureSelectionListener, getFeatureSelectEnabled, onJmixSourceFeatureSelection, setFeatureSelectEnabled
Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
getOverlaps, getUseSpatialIndex, setOverlaps, setUseSpatialIndex
Methods inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
getAttributionsCollapsible, getId, getProjection, setAttributionsCollapsible, setId, setProjection
Methods inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
addChild, addListener, clearRemovedChildren, clearRemovedChildrenInDepth, equals, fireChangeEvent, getChildren, getEventBus, getMetaProperties, getRemovedChildren, getSuperParent, getSyncId, hashCode, isAttachedToMap, isDirty, isDirtyInDepth, markAsDirty, markAsDirtyInDepth, removeChild, setMetaProperty, setParent, unmarkDirtyInDepth
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
binder
-
weightProvider
-
modifyStyleProvider
-
-
Constructor Details
-
HeatmapDataVectorSource
public HeatmapDataVectorSource()
-
-
Method Details
-
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
-
getWeightProvider
- Returns:
- weight (intensity) provider or
null
if not set
-
setWeightProvider
Sets weight (intensity) provider. It has precedence over theHeatmapLayer.setWeightProperty(String)
. The provider is called for each item and should return calculated weight value. For instance:source.setWeightProvider(office -> { int employeesNumber = office.getEmployeesNumber(); if (employeesNumber > 50) { return 0.7; } return 0.3; });
- Parameters:
weightProvider
- provider to set
-
addGeoObjectClickListener
public com.vaadin.flow.shared.Registration addGeoObjectClickListener(Consumer<GeoObjectClickNotifier.GeoObjectClickEvent<E>> listener) Description copied from interface:GeoObjectClickNotifier
Adds geo-object click listener. Note, if the user makes double click, theGeoObjectClickNotifier.GeoObjectClickEvent
will be fired twice.- Specified by:
addGeoObjectClickListener
in interfaceGeoObjectClickNotifier<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectSingleClickListener
public com.vaadin.flow.shared.Registration addGeoObjectSingleClickListener(Consumer<GeoObjectClickNotifier.GeoObjectSingleClickEvent<E>> listener) Description copied from interface:GeoObjectClickNotifier
Adds geo-object single click listener. Single click means that an event won't be fired if the user makes double click.- Specified by:
addGeoObjectSingleClickListener
in interfaceGeoObjectClickNotifier<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectDoubleClickListener
public com.vaadin.flow.shared.Registration addGeoObjectDoubleClickListener(Consumer<GeoObjectClickNotifier.GeoObjectDoubleClickEvent<E>> listener) Description copied from interface:GeoObjectClickNotifier
Adds geo-object double click listener.- Specified by:
addGeoObjectDoubleClickListener
in interfaceGeoObjectClickNotifier<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectDragStartListener
public com.vaadin.flow.shared.Registration addGeoObjectDragStartListener(Consumer<HasGeoObjectDrag.GeoObjectDragStartEvent<E>> listener) Description copied from interface:HasGeoObjectDrag
Adds geo-object drag start listener.- Specified by:
addGeoObjectDragStartListener
in interfaceHasGeoObjectDrag<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectDragEndListener
public com.vaadin.flow.shared.Registration addGeoObjectDragEndListener(Consumer<HasGeoObjectDrag.GeoObjectDragEndEvent<E>> listener) Description copied from interface:HasGeoObjectDrag
Adds geo-object drag end listener.- Specified by:
addGeoObjectDragEndListener
in interfaceHasGeoObjectDrag<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectModifyStartListener
public com.vaadin.flow.shared.Registration addGeoObjectModifyStartListener(Consumer<HasGeoObjectModify.GeoObjectModifyStartEvent<E>> listener) Description copied from interface:HasGeoObjectModify
Adds geo-object modify start listener.- Specified by:
addGeoObjectModifyStartListener
in interfaceHasGeoObjectModify<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
addGeoObjectModifyEndListener
public com.vaadin.flow.shared.Registration addGeoObjectModifyEndListener(Consumer<HasGeoObjectModify.GeoObjectModifyEndEvent<E>> listener) Description copied from interface:HasGeoObjectModify
Adds geo-object modify end listener.- Specified by:
addGeoObjectModifyEndListener
in interfaceHasGeoObjectModify<E>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
getFeatureDragEnabled
- Specified by:
getFeatureDragEnabled
in interfaceSupportsFeatureDrag
- Overrides:
getFeatureDragEnabled
in classAbstractEditableVectorSource
- Returns:
- whether drag mode is enabled or not
-
setFeatureDragEnabled
Description copied from interface:SupportsFeatureDrag
Enables / disables feature drag mode.The default value is
false
.- Specified by:
setFeatureDragEnabled
in interfaceSupportsFeatureDrag
- Overrides:
setFeatureDragEnabled
in classAbstractEditableVectorSource
- Parameters:
enabled
- whether to enable drag mode
-
getFeatureModifyEnabled
- Specified by:
getFeatureModifyEnabled
in interfaceSupportsFeatureModify
- Overrides:
getFeatureModifyEnabled
in classAbstractEditableVectorSource
- Returns:
- whether modify mode is enabled or not
-
setFeatureModifyEnabled
Description copied from interface:SupportsFeatureModify
Enables / disables feature modify mode.The default value is
false
.- Specified by:
setFeatureModifyEnabled
in interfaceSupportsFeatureModify
- Overrides:
setFeatureModifyEnabled
in classAbstractEditableVectorSource
- Parameters:
enabled
- whether to enable modify mode
-
getModifyStyleProvider
- Returns:
- modify style provider for a layer's geo-objects or
null
if not set
-
setModifyStyleProvider
Sets modify style provider for a layer's geo-objects. This function determines styles for generated vertex's point of a corresponding entity's geometry that is displayed on a map. The map generates a point for geometry's vertices to enable modification.Thus, the styles generated by the provider will be applied not to the entity's geometry, but to the generated vertex point of the entity's geometry.
Note that modify styles will be applied if
getFeatureModifyEnabled()
is enabled.For instance, a function can return a style that colors a generated vertex to red:
source.setModifyStyleProvider(entity -> List.of(new Style() .withImage(new CircleStyle() .withFill(new Fill("#FF1E00")) .withRadius(6) .withStroke(new Stroke() .withWidth(2d) .withColor("#04819E")))));
- Parameters:
modifyStyleProvider
- function that takes an entity as an argument and produces aStyle
for the entity's geometry
-
withWeightProvider
- Parameters:
weightProvider
- provider to set- Returns:
- current instance
-
withAttributions
- Parameters:
attributions
- info about copyrights and licences- Returns:
- current instance
-
withWrapX
- Parameters:
wrapX
- whether the source should be looped along the X coordinate- Returns:
- current instance
-
withItems
- Parameters:
items
- items to set- Returns:
- current instance
-
withFeatureDragEnabled
- Parameters:
enabled
- whether to enable drag mode- Returns:
- current instance
-
withFeatureModifyEnabled
- Parameters:
enabled
- whether modify mode is enabled or not- Returns:
- current instance
-
unbindItems
protected void unbindItems()- Specified by:
unbindItems
in classAbstractDataVectorSource<E>
-
bindItems
protected void bindItems()- Specified by:
bindItems
in classAbstractDataVectorSource<E>
-
onJmixSourceFeatureDragStart
- Overrides:
onJmixSourceFeatureDragStart
in classAbstractEditableVectorSource
-
onJmixSourceFeatureDragEnd
- Overrides:
onJmixSourceFeatureDragEnd
in classAbstractEditableVectorSource
-
onJmixSourceFeatureModifyStart
- Overrides:
onJmixSourceFeatureModifyStart
in classAbstractEditableVectorSource
-
onJmixSourceFeatureModifyEnd
- Overrides:
onJmixSourceFeatureModifyEnd
in classAbstractEditableVectorSource
-
onJmixSourceFeatureDelete
- Overrides:
onJmixSourceFeatureDelete
in classAbstractEditableVectorSource
-
applyDeletion
-
applyModifyChanges
-
convertFeaturesToItems
-