Class VectorLayer
- All Implemented Interfaces:
BaseVectorLayer.HasBackground,BaseVectorLayer.HasBaseVectorLayerOptions,BaseVectorLayer.HasDeclutter,BaseVectorLayer.HasRenderBuffer,BaseVectorLayer.HasUpdateWhileAnimating,BaseVectorLayer.HasUpdateWhileInteracting,HasModifyStyles,HasSelectStyles,HasStyles,HasBaseLayerOptions,Serializable,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
For more details see: VectorLayer docs
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.layer.BaseVectorLayer
BaseVectorLayer.HasBackground, BaseVectorLayer.HasBaseVectorLayerOptions, BaseVectorLayer.HasDeclutter, BaseVectorLayer.HasRenderBuffer, BaseVectorLayer.HasUpdateWhileAnimating, BaseVectorLayer.HasUpdateWhileInteractingNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextFields inherited from class io.jmix.mapsflowui.kit.component.model.layer.BaseEditableVectorLayer
modifyStyles, selectStylesFields inherited from class io.jmix.mapsflowui.kit.component.model.layer.BaseVectorLayer
stylesFields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, metaProperties, parent, removedChildren, syncId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModifyStyles(FeatureType type, Style... styles) Adds modify styles to a provided feature type.voidaddSelectStyles(FeatureType type, Style... styles) Adds select styles to a provided feature type.voidAdds styles that should be merged with default.protected VectorLayerOptionsgetModifyStyles(FeatureType type) getSelectStyles(FeatureType type) <S extends AbstractVectorSource>
Sprotected StringgetType()voidRemoves all modify styles for all feature types.voidRemoves all modify styles for the provided feature type.voidRemoves all select styles for all feature types.voidRemoves all select styles for the provided feature type.voidClears list of styles.voidremoveModifyStyles(FeatureType type, Style... styles) Removes modify styles for the provided feature type.voidremoveSelectStyles(FeatureType type, Style... styles) Removes select styles for the provided feature type.voidremoveStyles(Style... styles) Removes provided styles from layer.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetBackground(String color) Sets the background color for the layer.voidsetDeclutter(Boolean declutter) Sets whether declutter images and texts.voidsetModifyStyles(Map<FeatureType, Collection<Style>> styles) Sets a map of modify styles corresponding to each feature type.voidsetRenderBuffer(Double renderBuffer) Sets the buffer in pixels around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection.voidsetSelectStyles(Map<FeatureType, Collection<Style>> styles) Sets a map of select styles corresponding to each feature type.voidsetSource(AbstractVectorSource source) Sets source to the layer.voidsetUpdateWhileAnimating(Boolean updateWhileAnimating) Sets whether feature batches will be recreated during animations.voidsetUpdateWhileInteracting(Boolean updateWhileInteracting) Sets whether feature batches will be recreated during interactions.withBackground(String color) withClassName(String className) withDeclutter(Boolean declutter) withExtent(Extent extent) SeeLayer.setId(String).withMaxZoom(Double maxZoom) withMinZoom(Double minZoom) withModifyStyles(FeatureType type, Style... styles) withOpacity(Double opacity) withRenderBuffer(Double renderBuffer) withSelectStyles(FeatureType type, Style... styles) withSource(AbstractVectorSource source) withStyles(Style... styles) SeeaddStyles(Style...).withUpdateWhileAnimating(Boolean updateWhileAnimating) withUpdateWhileInteracting(Boolean updateWhileInteracting) withVisible(Boolean visible) withZIndex(Integer zIndex) Methods inherited from class io.jmix.mapsflowui.kit.component.model.layer.BaseEditableVectorLayer
getModifyStyle, getSelectStyle, setModifyStyles, setSelectStylesMethods inherited from class io.jmix.mapsflowui.kit.component.model.layer.BaseVectorLayer
getOptionsMethods inherited from class io.jmix.mapsflowui.kit.component.model.layer.Layer
getClassName, getExtent, getId, getMaxZoom, getMinZoom, getOpacity, getVisible, getZIndex, setClassName, setExtent, setId, setMaxZoom, setMinZoom, setOpacity, setVisible, setZIndexMethods 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
-
-
Constructor Details
-
VectorLayer
public VectorLayer()
-
-
Method Details
-
createOptions
- Specified by:
createOptionsin classLayer<AbstractVectorSource>
-
getType
- Specified by:
getTypein classMapObservableObject
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
withId
Description copied from class:LayerSeeLayer.setId(String).- Overrides:
withIdin classLayer<AbstractVectorSource>- Parameters:
id- id to set ornullto unset value- Returns:
- current instance
-
getSource
- Specified by:
getSourcein classLayer<AbstractVectorSource>- Type Parameters:
S- the source type- Returns:
- the layer source or
nullif not set
-
setSource
Sets source to the layer.For more details see: #setSource docs
The following sources supported:
- Overrides:
setSourcein classLayer<AbstractVectorSource>- Parameters:
source- source to set
-
withSource
- Overrides:
withSourcein classLayer<AbstractVectorSource>- Parameters:
source- source to set- Returns:
- current instance
-
getRenderBuffer
- Specified by:
getRenderBufferin interfaceBaseVectorLayer.HasRenderBuffer- Overrides:
getRenderBufferin classBaseVectorLayer<AbstractVectorSource>- Returns:
- the render buffer in pixels,
nullvalue means that default value is used:100
-
setRenderBuffer
Description copied from interface:BaseVectorLayer.HasRenderBufferSets the buffer in pixels around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. The hit detection only checks features that are within a certain distance of the given position. For large icons, the actual geometry of a feature might be too far away and is not considered. Recommended value: the size of the largest symbol, line width or label.Note, render buffer is set only at creation time and cannot be changed at runtime.
For more details see: BaseVectorLayer docs
- Specified by:
setRenderBufferin interfaceBaseVectorLayer.HasRenderBuffer- Overrides:
setRenderBufferin classBaseVectorLayer<AbstractVectorSource>- Parameters:
renderBuffer- the buffer in pixels
-
withRenderBuffer
- Parameters:
renderBuffer-- Returns:
- current instance
-
getDeclutter
- Specified by:
getDeclutterin interfaceBaseVectorLayer.HasDeclutter- Overrides:
getDeclutterin classBaseVectorLayer<AbstractVectorSource>- Returns:
- whether declutter images and texts,
nullvalue means that default value is used:false
-
setDeclutter
Description copied from interface:BaseVectorLayer.HasDeclutterSets whether declutter images and texts. Decluttering is applied to all image and text styles of all vector layers that have set this totrue. The priority is defined by the z-index of the layer, theStyle.withZIndex(Integer)of the style and the render order of features. Higher z-index means higher priority. Within the same z-index, a feature rendered before another has higher priority.As an optimization decluttered features from layers with the same
Layer.setClassName(String)are rendered above theFillandStrokestyles of all of those layers regardless of z-index. To opt out of this behavior and place declutterd features with their own layer configure the layer with a className other than 'ol-layer'.The default value is
false.Note, declutter is set only at creation time and cannot be changed at runtime.
For more details see: BaseVectorLayer docs
- Specified by:
setDeclutterin interfaceBaseVectorLayer.HasDeclutter- Overrides:
setDeclutterin classBaseVectorLayer<AbstractVectorSource>- Parameters:
declutter- whether declutter images and texts
-
withDeclutter
- Parameters:
declutter-- Returns:
- current instance
-
getBackground
- Specified by:
getBackgroundin interfaceBaseVectorLayer.HasBackground- Overrides:
getBackgroundin classBaseVectorLayer<AbstractVectorSource>- Returns:
- background color for the layer or
nullif not set
-
setBackground
Description copied from interface:BaseVectorLayer.HasBackgroundSets the background color for the layer. If not specified, no background will be rendered.Note, background color is set only at creation time and cannot be changed at runtime.
For more details see: BaseVectorLayer docs
- Specified by:
setBackgroundin interfaceBaseVectorLayer.HasBackground- Overrides:
setBackgroundin classBaseVectorLayer<AbstractVectorSource>- Parameters:
color- color to set
-
withBackground
- Parameters:
color-- Returns:
- current instance
-
getUpdateWhileAnimating
- Specified by:
getUpdateWhileAnimatingin interfaceBaseVectorLayer.HasUpdateWhileAnimating- Overrides:
getUpdateWhileAnimatingin classBaseVectorLayer<AbstractVectorSource>- Returns:
- whether feature batches will be recreated during animations,
nullvalue means that default value is used:false
-
setUpdateWhileAnimating
Description copied from interface:BaseVectorLayer.HasUpdateWhileAnimatingSets whether feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set tofalse, batches will be recreated when no animation is active.The default value is
false.Note, "updateWhileAnimating" is set only at creation time and cannot be changed at runtime. For more details see: BaseVectorLayer docs
- Specified by:
setUpdateWhileAnimatingin interfaceBaseVectorLayer.HasUpdateWhileAnimating- Overrides:
setUpdateWhileAnimatingin classBaseVectorLayer<AbstractVectorSource>- Parameters:
updateWhileAnimating- whether feature batches will be recreated during animations
-
withUpdateWhileAnimating
- Parameters:
updateWhileAnimating-- Returns:
-
getUpdateWhileInteracting
- Specified by:
getUpdateWhileInteractingin interfaceBaseVectorLayer.HasUpdateWhileInteracting- Overrides:
getUpdateWhileInteractingin classBaseVectorLayer<AbstractVectorSource>- Returns:
- whether feature batches will be recreated during interactions,
nullvalue means that default value is used:false
-
setUpdateWhileInteracting
Description copied from interface:BaseVectorLayer.HasUpdateWhileInteractingSets whether feature batches will be recreated during interactions. The default value isfalse.For instance, if the user moves map by mouse, the features that were not visible will be drawn after the user releases the pressed mouse. To enable always drawing features, set property to
true.Note, "updateWhileInteracting" is set only at creation time and cannot be changed at runtime.
For more details see: BaseVectorLayer docs
- Specified by:
setUpdateWhileInteractingin interfaceBaseVectorLayer.HasUpdateWhileInteracting- Overrides:
setUpdateWhileInteractingin classBaseVectorLayer<AbstractVectorSource>- Parameters:
updateWhileInteracting- whether feature batches will be recreated during interactions
-
withUpdateWhileInteracting
- Parameters:
updateWhileInteracting-- Returns:
- current instance
-
withClassName
Description copied from class:Layer- Overrides:
withClassNamein classLayer<AbstractVectorSource>- Parameters:
className- CSS class name- Returns:
- current instance
-
withOpacity
Description copied from class:Layer- Overrides:
withOpacityin classLayer<AbstractVectorSource>- Parameters:
opacity- opacity of the layer- Returns:
- current instance
-
withVisible
Description copied from class:Layer- Overrides:
withVisiblein classLayer<AbstractVectorSource>- Parameters:
visible- whether layer should be visible- Returns:
- current instance
-
withExtent
Description copied from class:Layer- Overrides:
withExtentin classLayer<AbstractVectorSource>- Parameters:
extent- extent at which the layer is visible- Returns:
- current instance
-
withZIndex
Description copied from class:Layer- Overrides:
withZIndexin classLayer<AbstractVectorSource>- Parameters:
zIndex- z-index for layer rendering- Returns:
- current instance
-
withMinZoom
Description copied from class:Layer- Overrides:
withMinZoomin classLayer<AbstractVectorSource>- Parameters:
minZoom- zoom level (exclusive) above which layer will be visible- Returns:
- current instance
-
withMaxZoom
Description copied from class:Layer- Overrides:
withMaxZoomin classLayer<AbstractVectorSource>- Parameters:
maxZoom- zoom level (inclusive) at which layer will be visible- Returns:
- current instance
-
addStyles
Description copied from class:BaseVectorLayerAdds styles that should be merged with default. Layer's styles are applied for all added features, except features with own style.- Specified by:
addStylesin interfaceHasStyles- Overrides:
addStylesin classBaseVectorLayer<AbstractVectorSource>- Parameters:
styles- styles to add
-
withStyles
SeeaddStyles(Style...).- Parameters:
styles- styles to add- Returns:
- current instance
-
getStyles
- Specified by:
getStylesin interfaceHasStyles- Overrides:
getStylesin classBaseVectorLayer<AbstractVectorSource>- Returns:
- layer's styles or empty list
-
removeStyles
Description copied from class:BaseVectorLayerRemoves provided styles from layer.- Specified by:
removeStylesin interfaceHasStyles- Overrides:
removeStylesin classBaseVectorLayer<AbstractVectorSource>- Parameters:
styles- styles to remove
-
removeAllStyles
public void removeAllStyles()Description copied from class:BaseVectorLayerClears list of styles.- Specified by:
removeAllStylesin interfaceHasStyles- Overrides:
removeAllStylesin classBaseVectorLayer<AbstractVectorSource>
-
addSelectStyles
Description copied from interface:HasSelectStylesAdds select styles to a provided feature type.To enable select mode set
SupportsFeatureSelect.setFeatureSelectEnabled(Boolean)totrue.- Specified by:
addSelectStylesin interfaceHasSelectStyles- Overrides:
addSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature typestyles- styles to add
-
withSelectStyles
- Parameters:
type- feature typestyles- styles to add- Returns:
- current instance
-
removeSelectStyles
Description copied from interface:HasSelectStylesRemoves select styles for the provided feature type.- Specified by:
removeSelectStylesin interfaceHasSelectStyles- Overrides:
removeSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature typestyles- styles to remove
-
removeAllSelectStyles
Description copied from interface:HasSelectStylesRemoves all select styles for the provided feature type.- Specified by:
removeAllSelectStylesin interfaceHasSelectStyles- Overrides:
removeAllSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature type
-
removeAllSelectStyles
public void removeAllSelectStyles()Description copied from interface:HasSelectStylesRemoves all select styles for all feature types.- Specified by:
removeAllSelectStylesin interfaceHasSelectStyles- Overrides:
removeAllSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>
-
getSelectStyles
- Specified by:
getSelectStylesin interfaceHasSelectStyles- Overrides:
getSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Returns:
- a map of select styles corresponding to each feature type
-
getSelectStyles
- Specified by:
getSelectStylesin interfaceHasSelectStyles- Parameters:
type- feature type- Returns:
- collection of select styles for the provided feature type
-
setSelectStyles
Description copied from interface:HasSelectStylesSets a map of select styles corresponding to each feature type. A convenient way to set this map is to use theLayerStylesBuilder. It allows you to build a map with selection styles using a fluent API and configure the creation of default selection styles.Note that this method removes all selection styles for all feature types and then applies the styles from the provided map. If the provided map does not contain select styles for a specific feature type, that type will have no styles for selection. This can cause the feature to disappear when the user selects it. To enable select mode set
SupportsFeatureSelect.setFeatureSelectEnabled(Boolean)totrue.- Specified by:
setSelectStylesin interfaceHasSelectStyles- Overrides:
setSelectStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
styles- a map of styles
-
addModifyStyles
Description copied from interface:HasModifyStylesAdds modify styles to a provided feature type.Note, modify styles will be applied not to the feature's geometry, but to the generated vertex point of the feature's geometry. This is because the map generates a point for geometry's vertices to enable modification: adding new vertex, change vertex position. So the provided styles should be valid for the point feature.
To enable modify mode set
SupportsFeatureModify.setFeatureModifyEnabled(Boolean)totrue.- Specified by:
addModifyStylesin interfaceHasModifyStyles- Overrides:
addModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature typestyles- styles to add
-
withModifyStyles
- Parameters:
type- typestyles- styles to add- Returns:
- current instance
-
getModifyStyles
- Specified by:
getModifyStylesin interfaceHasModifyStyles- Parameters:
type- feature type- Returns:
- collection of modify styles for the provided feature type
-
removeModifyStyles
Description copied from interface:HasModifyStylesRemoves modify styles for the provided feature type.- Specified by:
removeModifyStylesin interfaceHasModifyStyles- Overrides:
removeModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature typestyles- styles to remove
-
removeAllModifyStyles
Description copied from interface:HasModifyStylesRemoves all modify styles for the provided feature type.- Specified by:
removeAllModifyStylesin interfaceHasModifyStyles- Overrides:
removeAllModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
type- feature type
-
removeAllModifyStyles
public void removeAllModifyStyles()Description copied from interface:HasModifyStylesRemoves all modify styles for all feature types.- Specified by:
removeAllModifyStylesin interfaceHasModifyStyles- Overrides:
removeAllModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>
-
getModifyStyles
- Specified by:
getModifyStylesin interfaceHasModifyStyles- Overrides:
getModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Returns:
- a map of modify styles corresponding to each feature type
-
setModifyStyles
Description copied from interface:HasModifyStylesSets a map of modify styles corresponding to each feature type. A convenient way to set this map is to use theLayerStylesBuilder. It allows you to build a map with modify styles using a fluent API and configure the creation of default modify styles.The provided styles should be valid for the point feature.
To enable modify mode set
SupportsFeatureModify.setFeatureModifyEnabled(Boolean)totrue.- Specified by:
setModifyStylesin interfaceHasModifyStyles- Overrides:
setModifyStylesin classBaseEditableVectorLayer<AbstractVectorSource>- Parameters:
styles- a map of styles
-