Class GeoMap
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
Layers.
The map is built by superposing layers. Initially, map does not have layers.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected Collection<ProjectionRegistration>Fields inherited from class io.jmix.mapsflowui.kit.component.JmixMap
featureClickDomRegistration, featureDoubleClickDomRegistration, featureSingleClickDomRegistration, mapClickDomRegistration, mapDoubleClickDomRegistration, mapSingleClickDomRegistration, mapZoomChangedDomRegistration, options, serializer, synchronizeMapExecution -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddClickListener(com.vaadin.flow.component.ComponentEventListener<MapClickEvent> listener) Adds map click listener.com.vaadin.flow.shared.RegistrationaddDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<MapDoubleClickEvent> listener) Adds map double click listener.voidAdds layer to the map.com.vaadin.flow.shared.RegistrationaddMoveEndListener(com.vaadin.flow.component.ComponentEventListener<MapMoveEndEvent> listener) Adds map move end listener.com.vaadin.flow.shared.RegistrationaddSingleClickListener(com.vaadin.flow.component.ComponentEventListener<MapSingleClickEvent> listener) Adds map single click listener.com.vaadin.flow.shared.RegistrationaddZoomChangedListener(com.vaadin.flow.component.ComponentEventListener<MapZoomChangedEvent> listener) Adds map zoom changed listener.voidprotected voidprotected MapOptionsprotected JmixMapSerializerprotected voidfireFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature) protected voidfireMapClickEvent(MapClickDomEvent domEvent) protected voidprotected voidfireMapMoveEndEvent(MapMoveEndDomEvent domEvent) protected voidprotected voidfireMapZoomChangeEvent(MapZoomChangedDomEvent domEvent) protected voidfireSourceFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature, AbstractFeatureSource source) voidfit(FitOptions options) Fits the given geometry or extent based on the given map size and border and provided options.org.locationtech.jts.geom.CoordinateGets coordinates of the geographic center of the map's visible area.<L extends Layer<?>>
LgetLayerOrNull(String layerId) Returns a layer by its ID ornullif the map does not contain a layer with the provided ID.protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) protected voidprotected voidprotected voidprotected voidprotected voidonMapZoomChangedEvent(MapZoomChangedDomEvent domEvent) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetCenter(org.locationtech.jts.geom.Coordinate center) Sets the geographic center of the map's visible area.voidsetMapView(MapView view) Sets map view.voidsetProjection(CRS projection) Sets the projection for coordinates supplied from and returned by API methods.voidzoomToExtent(org.locationtech.jts.geom.Coordinate bottomLeft, org.locationtech.jts.geom.Coordinate topRight) Sets a map's visible area that contains the given geographical bounds with the maximum zoom level possible.voidzoomToFeature(Feature feature) Sets a map's visible area that contains envelope of the geometry from given feature.voidzoomToGeometry(org.locationtech.jts.geom.Geometry geometry) Sets a map's visible area that contains envelope of the given geometry with the maximum zoom level possible.Methods inherited from class io.jmix.mapsflowui.kit.component.JmixMap
attachFeatureClickDomEventListeners, attachMapClickDomEventListener, attachMapDoubleClickDomEventListener, attachMapMoveEndListener, attachMapOptionsChangeListener, attachMapSingleClickDomEventListener, attachMapZoomChangedListener, getFeatureBySyncId, getLayer, getLayerBySyncId, getLayers, getZoom, onAttach, onFeatureClickEvent, onMapOptionsChange, performUpdateMap, removeLayer, requestUpdateMap, setZoom, zoomToExtentMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
projections
-
-
Constructor Details
-
GeoMap
public GeoMap()
-
-
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
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
autowireDependencies
protected void autowireDependencies() -
addLayer
Adds layer to the map. -
getLayerOrNull
Returns a layer by its ID ornullif the map does not contain a layer with the provided ID.- Overrides:
getLayerOrNullin classJmixMap- Type Parameters:
L- layer type- Parameters:
layerId- ID of a layer- Returns:
- layer
-
getMapView
- Overrides:
getMapViewin classJmixMap- Returns:
- map view
-
setMapView
Sets map view. It replaces previous default map view. To change zoom or center coordinate, useJmixMap.getMapView(), for instance:map.getMapView().setZoom(10);
- Overrides:
setMapViewin classJmixMap- Parameters:
view- map view to set- See Also:
-
setProjection
Sets the projection for coordinates supplied from and returned by API methods.Note, the projection will be used for all maps on the page.
- Parameters:
projection- projection to set
-
getCenter
public org.locationtech.jts.geom.Coordinate getCenter()Gets coordinates of the geographic center of the map's visible area.Delegates to the map's view. See
getMapView().- Returns:
- current center of the map's visible area
-
setCenter
public void setCenter(org.locationtech.jts.geom.Coordinate center) Sets the geographic center of the map's visible area. Coordinates must be specified in the map projection, which isEPSG:4326.If the map projection has been changed using
setProjection(CRS), then coordinates must be specified in that projection.Note that the map projection is a different concept than the view projection set in the map's
GeoMapView. The view projection affects how map data is interpreted and rendered, while the map projection defines the coordinate system that all coordinates passed to, or returned from the public API must be in.Delegates to the map's view. See
getMapView().- Parameters:
center- new center of the visible area
-
zoomToExtent
public void zoomToExtent(org.locationtech.jts.geom.Coordinate bottomLeft, org.locationtech.jts.geom.Coordinate topRight) Sets a map's visible area that contains the given geographical bounds with the maximum zoom level possible.To zoom to an extent more advanced way, use
fit(FitOptions).- Parameters:
bottomLeft- bottom left point coordinates of visible area (SouthWest)topRight- top right point coordinates of visible area (NorthEast)
-
zoomToFeature
Sets a map's visible area that contains envelope of the geometry from given feature.This is the convenience method that delegates to
zoomToGeometry(Geometry).- Parameters:
feature- feature from which geometry will be zoomed to
-
zoomToGeometry
public void zoomToGeometry(org.locationtech.jts.geom.Geometry geometry) Sets a map's visible area that contains envelope of the given geometry with the maximum zoom level possible.To zoom to a geometry more advanced way, use
fit(FitOptions).Note: if the given geometry is a point, map will be centered to this point with the current zoom level.
- Parameters:
geometry- geometry to zoom
-
fit
Fits the given geometry or extent based on the given map size and border and provided options. For instance, if it is needed to specify maximum zoom level and animation we can do the following:map.fit(new FitOptions(feature) .withMaxZoom(9.0) .withDuration(1500) .withEasing(Easing.LINEAR));For more details see: View#fit() docs
- Parameters:
options- options that configure zooming to an extent or geometry
-
addClickListener
public com.vaadin.flow.shared.Registration addClickListener(com.vaadin.flow.component.ComponentEventListener<MapClickEvent> listener) Adds map click listener. Note, if the user makes double click on a map, theMapClickEventwill be fired twice.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener
-
addSingleClickListener
public com.vaadin.flow.shared.Registration addSingleClickListener(com.vaadin.flow.component.ComponentEventListener<MapSingleClickEvent> listener) Adds map single click listener. Single click means that an event won't be fired if the user makes double click.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener
-
addDoubleClickListener
public com.vaadin.flow.shared.Registration addDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<MapDoubleClickEvent> listener) Adds map double click listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener
-
addZoomChangedListener
public com.vaadin.flow.shared.Registration addZoomChangedListener(com.vaadin.flow.component.ComponentEventListener<MapZoomChangedEvent> listener) Adds map zoom changed listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener
-
addMoveEndListener
public com.vaadin.flow.shared.Registration addMoveEndListener(com.vaadin.flow.component.ComponentEventListener<MapMoveEndEvent> listener) Adds map move end listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener
-
getAdditionalPropertiesToUpdate
- Overrides:
getAdditionalPropertiesToUpdatein classJmixMap
-
createSerializer
- Overrides:
createSerializerin classJmixMap
-
createMapOptions
- Overrides:
createMapOptionsin classJmixMap
-
fireFeatureClickEvent
protected void fireFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature) - Overrides:
fireFeatureClickEventin classJmixMap
-
fireSourceFeatureClickEvent
protected void fireSourceFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature, AbstractFeatureSource source) - Overrides:
fireSourceFeatureClickEventin classJmixMap
-
onMapClickDomEvent
- Overrides:
onMapClickDomEventin classJmixMap
-
fireMapClickEvent
-
onMapSingleClickDomEvent
- Overrides:
onMapSingleClickDomEventin classJmixMap
-
fireMapSingleClickDomEvent
-
onMapDoubleClickDomEvent
- Overrides:
onMapDoubleClickDomEventin classJmixMap
-
fireMapDoubleClickDomEvent
-
onMapMoveEndEvent
- Overrides:
onMapMoveEndEventin classJmixMap
-
fireMapMoveEndEvent
-
onMapZoomChangedEvent
- Overrides:
onMapZoomChangedEventin classJmixMap
-
fireMapZoomChangeEvent
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-