Class DataVectorSource<E>
- Type Parameters:
E- item type
- All Implemented Interfaces:
GeoObjectClickNotifier<E>,AbstractVectorSource.HasOverlaps,AbstractVectorSource.HasUseSpatialIndex,AbstractVectorSource.HasVectorSourceOptions,Source.HasAttributions,Source.HasWrapX,Serializable,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
Geometry type).
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> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected AbstractDataVectorSourceBinding<E>Fields inherited from class io.jmix.mapsflowui.component.model.source.AbstractDataVectorSource
itemsFields 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, listener, 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.RegistrationaddGeoObjectSingleClickListener(Consumer<GeoObjectClickNotifier.GeoObjectSingleClickEvent<E>> listener) Adds geo-object single click listener.protected voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetOverlaps(Boolean overlaps) Sets whether source may have overlapping geometries.voidsetStyleProvider(Function<? super E, Style> styleProvider) Sets the style provider for a layer's geo-objects, i.e.voidsetUseSpatialIndex(Boolean useSpatialIndex) Sets whether to use spatial index.protected voidwithAttributions(List<String> attributions) withItems(DataVectorSourceItems<E> items) withOverlaps(Boolean overlaps) SeesetOverlaps(Boolean).withStyleProvider(Function<? super E, Style> styleProvider) withUseSpatialIndex(Boolean useSpatialIndex) 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.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, getSyncId, hashCode, isDirty, isDirtyInDepth, markAsDirty, markAsDirtyInDepth, removeChild, setMapObjectChangeListener, setMetaProperty, setParent, unmarkDirtyInDepth
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
binder
-
styleProvider
-
-
Constructor Details
-
DataVectorSource
public DataVectorSource()
-
-
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
-
getStyleProvider
- Returns:
- style provider for a layer's geo-objects or
nullif not set
-
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.Function should return fully described style for geo-object, otherwise, it may be not displayed. The provided style replaces existing styles in a feature.
For instance, source contains geo-objects for entity with Point datatype. For this datatype map renders
MarkerFeaturethat has default style with icon. So to add, let's say, text under the icon, new style should contain the icon definition too. To achieve this we can create default marker style usingMarkerStyle.createDefaultStyle()and edit it:source.setStyleProvider(shop -> MarkerStyle.createDefaultStyle() .withText(new TextStyle() .withText(shop.getName()) .withFont("15px sans-serif") .withOffsetY(10)));- Parameters:
styleProvider- function that takes an entity as an argument and produces aStylefor the entity's geometry
-
getOverlaps
- Specified by:
getOverlapsin interfaceAbstractVectorSource.HasOverlaps- Overrides:
getOverlapsin classAbstractVectorSource- Returns:
- overlaps value or
nullif not set
-
setOverlaps
Description copied from interface:AbstractVectorSource.HasOverlapsSets whether source may have overlapping geometries. The default value istrue.Setting this to
false(e.g. for sources with polygons that represent administrative boundaries) allows the renderer to optimise fill and stroke operations.Note, overlaps attribute is set only at creation time and cannot be changed at runtime.
- Specified by:
setOverlapsin interfaceAbstractVectorSource.HasOverlaps- Overrides:
setOverlapsin classAbstractVectorSource- Parameters:
overlaps- overlaps option
-
getUseSpatialIndex
- Specified by:
getUseSpatialIndexin interfaceAbstractVectorSource.HasUseSpatialIndex- Overrides:
getUseSpatialIndexin classAbstractVectorSource- Returns:
- useSpatialIndex value or
nullif not set
-
setUseSpatialIndex
Description copied from interface:AbstractVectorSource.HasUseSpatialIndexSets whether to use spatial index. When features are removed and added frequently, and the total number of features is low, setting this tofalsemay improve performance. The default value istrue.- Specified by:
setUseSpatialIndexin interfaceAbstractVectorSource.HasUseSpatialIndex- Overrides:
setUseSpatialIndexin classAbstractVectorSource- Parameters:
useSpatialIndex- whether to use spatial index
-
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
-
withOverlaps
SeesetOverlaps(Boolean).- Parameters:
overlaps- overlaps option- Returns:
- current instance
-
withUseSpatialIndex
- Parameters:
useSpatialIndex- whether to use spatial index- Returns:
- current instance
-
withStyleProvider
- Parameters:
styleProvider- function that takes an entity as an argument and produces aStylefor the entity's geometry- 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
-
unbindItems
protected void unbindItems()- Specified by:
unbindItemsin classAbstractDataVectorSource<E>
-
bindItems
protected void bindItems()- Specified by:
bindItemsin classAbstractDataVectorSource<E>
-