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.HasVectorSourceOptionsNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
Source.HasAttributions, Source.HasAttributionsCollapsible, Source.HasProjection, Source.HasSourceOptions, Source.HasWrapXNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEventNested 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.ApplicationContextprotected HeatmapDataVectorSourceBinding<E>Fields inherited from class io.jmix.mapsflowui.component.model.source.AbstractDataVectorSource
itemsFields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractEditableVectorSource
featureDragEnabled, featureModifyEnabled, featureSelectEnabled, jmixSourceFeatureDeleteRegistration, jmixSourceFeatureDragEndRegistration, jmixSourceFeatureDragStartRegistration, jmixSourceFeatureModifyEndRegistration, jmixSourceFeatureModifyStartRegistration, jmixSourceFeatureSelectionRegistrationFields inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
overlaps, useSpatialIndexFields inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
attributions, attributionsCollapsible, id, projection, wrapXFields 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.RegistrationAdds geo-object click listener.com.vaadin.flow.shared.RegistrationaddGeoObjectDoubleClickListener(Consumer<GeoObjectClickNotifier.GeoObjectDoubleClickEvent<E>> listener) Adds geo-object double click listener.com.vaadin.flow.shared.RegistrationAdds geo-object drag end listener.com.vaadin.flow.shared.RegistrationAdds geo-object drag start listener.com.vaadin.flow.shared.RegistrationAdds geo-object modify end listener.com.vaadin.flow.shared.RegistrationAdds geo-object modify start listener.com.vaadin.flow.shared.RegistrationaddGeoObjectSingleClickListener(Consumer<GeoObjectClickNotifier.GeoObjectSingleClickEvent<E>> listener) Adds geo-object single click listener.protected voidapplyDeletion(Collection<E> itemsTuUpdate) protected voidapplyModifyChanges(Map<Feature, SimpleGeometry<?>> features) protected voidprotected Collection<E>convertFeaturesToItems(Collection<Feature> features) protected voidprotected voidprotected voidprotected voidprotected voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetFeatureDragEnabled(Boolean enabled) Enables / disables feature drag mode.voidsetFeatureModifyEnabled(Boolean enabled) Enables / disables feature modify mode.voidsetModifyStyleProvider(Function<? super E, List<Style>> modifyStyleProvider) Sets modify style provider for a layer's geo-objects.voidsetWeightProvider(Function<E, Double> weightProvider) Sets weight (intensity) provider.protected voidwithAttributions(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, setWrapXMethods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractEditableVectorSource
attachJmixSourceFeatureDeleteListener, attachJmixSourceFeatureDragEndListener, attachJmixSourceFeatureDragStartListener, attachJmixSourceFeatureModifyEndListener, attachJmixSourceFeatureModifyStartListener, attachJmixSourceFeatureSelectionListener, getFeatureSelectEnabled, onJmixSourceFeatureSelection, setFeatureSelectEnabledMethods inherited from class io.jmix.mapsflowui.kit.component.model.source.AbstractVectorSource
getOverlaps, getUseSpatialIndex, setOverlaps, setUseSpatialIndexMethods inherited from class io.jmix.mapsflowui.kit.component.model.source.Source
getAttributionsCollapsible, getId, getProjection, setAttributionsCollapsible, setId, setProjectionMethods 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getWeightProvider
- Returns:
- weight (intensity) provider or
nullif 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:GeoObjectClickNotifierAdds geo-object click listener. Note, if the user makes double click, theGeoObjectClickNotifier.GeoObjectClickEventwill be fired twice.- Specified by:
addGeoObjectClickListenerin 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:GeoObjectClickNotifierAdds geo-object single click listener. Single click means that an event won't be fired if the user makes double click.- Specified by:
addGeoObjectSingleClickListenerin 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:GeoObjectClickNotifierAdds geo-object double click listener.- Specified by:
addGeoObjectDoubleClickListenerin 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:HasGeoObjectDragAdds geo-object drag start listener.- Specified by:
addGeoObjectDragStartListenerin 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:HasGeoObjectDragAdds geo-object drag end listener.- Specified by:
addGeoObjectDragEndListenerin 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:HasGeoObjectModifyAdds geo-object modify start listener.- Specified by:
addGeoObjectModifyStartListenerin 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:HasGeoObjectModifyAdds geo-object modify end listener.- Specified by:
addGeoObjectModifyEndListenerin interfaceHasGeoObjectModify<E>- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-
getFeatureDragEnabled
- Specified by:
getFeatureDragEnabledin interfaceSupportsFeatureDrag- Overrides:
getFeatureDragEnabledin classAbstractEditableVectorSource- Returns:
- whether drag mode is enabled or not
-
setFeatureDragEnabled
Description copied from interface:SupportsFeatureDragEnables / disables feature drag mode.The default value is
false.- Specified by:
setFeatureDragEnabledin interfaceSupportsFeatureDrag- Overrides:
setFeatureDragEnabledin classAbstractEditableVectorSource- Parameters:
enabled- whether to enable drag mode
-
getFeatureModifyEnabled
- Specified by:
getFeatureModifyEnabledin interfaceSupportsFeatureModify- Overrides:
getFeatureModifyEnabledin classAbstractEditableVectorSource- Returns:
- whether modify mode is enabled or not
-
setFeatureModifyEnabled
Description copied from interface:SupportsFeatureModifyEnables / disables feature modify mode.The default value is
false.- Specified by:
setFeatureModifyEnabledin interfaceSupportsFeatureModify- Overrides:
setFeatureModifyEnabledin classAbstractEditableVectorSource- Parameters:
enabled- whether to enable modify mode
-
getModifyStyleProvider
- Returns:
- modify style provider for a layer's geo-objects or
nullif 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 aStylefor 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:
unbindItemsin classAbstractDataVectorSource<E>
-
bindItems
protected void bindItems()- Specified by:
bindItemsin classAbstractDataVectorSource<E>
-
onJmixSourceFeatureDragStart
- Overrides:
onJmixSourceFeatureDragStartin classAbstractEditableVectorSource
-
onJmixSourceFeatureDragEnd
- Overrides:
onJmixSourceFeatureDragEndin classAbstractEditableVectorSource
-
onJmixSourceFeatureModifyStart
- Overrides:
onJmixSourceFeatureModifyStartin classAbstractEditableVectorSource
-
onJmixSourceFeatureModifyEnd
- Overrides:
onJmixSourceFeatureModifyEndin classAbstractEditableVectorSource
-
onJmixSourceFeatureDelete
- Overrides:
onJmixSourceFeatureDeletein classAbstractEditableVectorSource
-
applyDeletion
-
applyModifyChanges
-
convertFeaturesToItems
-