public class GeoMapImpl extends io.jmix.ui.component.impl.AbstractComponent<LMap> implements GeoMap
GeoMap.Bounds, GeoMap.ClickEvent, GeoMap.DragEndEvent, GeoMap.LayerAddedEvent, GeoMap.LayerRemovedEvent, GeoMap.MoveEndEvent, GeoMap.RightClickEvent, GeoMap.SelectedLayerChangedEvent, GeoMap.ZoomEndEventio.jmix.ui.component.Component.Alignment, io.jmix.ui.component.Component.BelongToFrame, io.jmix.ui.component.Component.Disposable, io.jmix.ui.component.Component.Editable, io.jmix.ui.component.Component.Focusable, io.jmix.ui.component.Component.HasCaption, io.jmix.ui.component.Component.HasDescription, io.jmix.ui.component.Component.HasIcon, io.jmix.ui.component.Component.HasXmlDescriptor, io.jmix.ui.component.Component.Wrapper| Constructor and Description |
|---|
GeoMapImpl() |
| Modifier and Type | Method and Description |
|---|---|
io.jmix.core.common.event.Subscription |
addClickListener(java.util.function.Consumer<GeoMap.ClickEvent> listener)
Registers a new click listener.
|
io.jmix.core.common.event.Subscription |
addDragEndListener(java.util.function.Consumer<GeoMap.DragEndEvent> listener)
Registers a new drag end listener.
|
void |
addLayer(Layer layer)
Adds the given layer to the map.
|
io.jmix.core.common.event.Subscription |
addLayerAddedListener(java.util.function.Consumer<GeoMap.LayerAddedEvent> listener)
Registers a new layer added listener.
|
io.jmix.core.common.event.Subscription |
addLayerRemovedListener(java.util.function.Consumer<GeoMap.LayerRemovedEvent> listener)
Registers a new layer removed listener.
|
io.jmix.core.common.event.Subscription |
addMoveEndListener(java.util.function.Consumer<GeoMap.MoveEndEvent> listener)
Registers a new move end listener.
|
io.jmix.core.common.event.Subscription |
addRightClickListener(java.util.function.Consumer<GeoMap.RightClickEvent> listener)
Registers a new right click listener.
|
io.jmix.core.common.event.Subscription |
addSelectedLayerChangedListener(java.util.function.Consumer<GeoMap.SelectedLayerChangedEvent> listener)
Registers a new selected layer changed listener.
|
io.jmix.core.common.event.Subscription |
addZoomEndListener(java.util.function.Consumer<GeoMap.ZoomEndEvent> listener)
Registers a new zoom end listener.
|
GeoMap.Bounds |
getBounds()
Returns the bounds of the map which define the viewport of the map.
|
CanvasLayer |
getCanvas()
Returns the canvas layer of the map.
|
org.locationtech.jts.geom.Point |
getCenter()
Returns current geographic center of the map.
|
protected io.jmix.core.common.event.EventHub |
getEventHub() |
<T> java.util.Map<?,GeoObjectWrapper<T>> |
getGeoObjectWrappersMap(VectorLayer<T> layer)
Returns a map of pairs [geo-object ID: geoObjectWrapper] for geo-objects of the given vector layer.
|
<T extends Layer> |
getLayer(java.lang.String layerId)
Returns a layer by its ID.
|
<T extends Layer> |
getLayerOrNull(java.lang.String layerId)
Returns a layer by its ID, or
null if the map does not contain a layer with the given ID. |
java.util.List<Layer> |
getLayers()
Returns the list of layers currently added to the map.
|
Layer |
getSelectedLayer()
Returns the selected layer of the map.
|
java.lang.Object |
getSubPart(java.lang.String name) |
double |
getZoomLevel()
Returns current map zoom level.
|
void |
openPopup(PopupWindow popupWindow)
Opens the given popup window.
|
void |
removeLayer(Layer layer)
Removes the given layer from the map.
|
void |
selectLayer(Layer layer)
Sets the selected (i.e.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCenter(double x,
double y)
Sets the initial geographic center of the map.
|
void |
setMaxZoom(int maxZoom)
Set maximum map zoom level.
|
void |
setMinZoom(int minZoom)
Set minimum map zoom level.
|
void |
setReadOnly(boolean readOnly)
Switch map to a read-only mode.
|
void |
setZoomLevel(double zoomLevel)
Set map zoom level.
|
void |
zoomToBounds(org.locationtech.jts.geom.Point topLeft,
org.locationtech.jts.geom.Point bottomRight)
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.
|
void |
zoomToGeometry(org.locationtech.jts.geom.Geometry geometry)
Sets a map view that contains envelope of the given geometry with the maximum zoom level possible.
|
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitselectLayerByIdaddStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in class io.jmix.ui.component.impl.AbstractComponent<LMap>public void addLayer(Layer layer)
GeoMap
Preserves an order of the layers, but tile layers
(such as TileLayer
or WMSTileLayer) should be added first, otherwise
IllegalStateException is to be thrown.
If a layer with the same ID is already on the map, the given layer will not be added to the map and
IllegalArgumentException is to be thrown.
public void removeLayer(Layer layer)
GeoMapremoveLayer in interface GeoMaplayer - to be removed from the map@Nonnull public <T extends Layer> T getLayer(java.lang.String layerId)
GeoMap@Nullable public <T extends Layer> T getLayerOrNull(java.lang.String layerId)
GeoMapnull if the map does not contain a layer with the given ID.getLayerOrNull in interface GeoMaplayerId - ID of a layerpublic java.util.List<Layer> getLayers()
GeoMappublic void setCenter(double x,
double y)
GeoMappublic org.locationtech.jts.geom.Point getCenter()
GeoMappublic void setZoomLevel(double zoomLevel)
setZoomLevel in interface GeoMapzoomLevel - of the mappublic double getZoomLevel()
GeoMapgetZoomLevel in interface GeoMappublic void setMaxZoom(int maxZoom)
setMaxZoom in interface GeoMapmaxZoom - maximum map zoom levelpublic void setMinZoom(int minZoom)
setMinZoom in interface GeoMapminZoom - minimum map zoom levelpublic void setReadOnly(boolean readOnly)
setReadOnly in interface GeoMapreadOnly - true/falsepublic CanvasLayer getCanvas()
GeoMappublic void selectLayer(Layer layer)
GeoMap
A null parameter deselects currently selected layer.
selectLayer in interface GeoMaplayer - selected layerpublic Layer getSelectedLayer()
GeoMapgetSelectedLayer in interface GeoMapnull when none of the layers is selectedpublic GeoMap.Bounds getBounds()
GeoMappublic void zoomToBounds(org.locationtech.jts.geom.Point topLeft,
org.locationtech.jts.geom.Point bottomRight)
GeoMapzoomToBounds in interface GeoMaptopLeft - NorthWest pointbottomRight - SouthEast pointpublic void zoomToGeometry(org.locationtech.jts.geom.Geometry geometry)
GeoMapNote: if the given geometry is point, map will be centered to this point with the current zoom level.
zoomToGeometry in interface GeoMappublic void openPopup(PopupWindow popupWindow)
GeoMappublic io.jmix.core.common.event.Subscription addClickListener(java.util.function.Consumer<GeoMap.ClickEvent> listener)
GeoMapaddClickListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addRightClickListener(java.util.function.Consumer<GeoMap.RightClickEvent> listener)
GeoMapaddRightClickListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addMoveEndListener(java.util.function.Consumer<GeoMap.MoveEndEvent> listener)
GeoMapaddMoveEndListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addZoomEndListener(java.util.function.Consumer<GeoMap.ZoomEndEvent> listener)
GeoMapaddZoomEndListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addDragEndListener(java.util.function.Consumer<GeoMap.DragEndEvent> listener)
GeoMapaddDragEndListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addLayerAddedListener(java.util.function.Consumer<GeoMap.LayerAddedEvent> listener)
GeoMapaddLayerAddedListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addLayerRemovedListener(java.util.function.Consumer<GeoMap.LayerRemovedEvent> listener)
GeoMapaddLayerRemovedListener in interface GeoMaplistener - the listener to be addedpublic io.jmix.core.common.event.Subscription addSelectedLayerChangedListener(java.util.function.Consumer<GeoMap.SelectedLayerChangedEvent> listener)
GeoMapaddSelectedLayerChangedListener in interface GeoMaplistener - the listener to be addedprotected io.jmix.core.common.event.EventHub getEventHub()
getEventHub in class io.jmix.ui.component.impl.AbstractComponent<LMap>public <T> java.util.Map<?,GeoObjectWrapper<T>> getGeoObjectWrappersMap(VectorLayer<T> layer)
In case when geo-object's geometry is null, then wrapper is also null. So perform null check before operating with a wrapper. Geo-object wrappers can be replaced with another instance after layer refresh or geometry update, so always use this map to get the relevant wrapper instance.
java.lang.IllegalArgumentException - when map does not contain the specified layer@Nullable public java.lang.Object getSubPart(java.lang.String name)
getSubPart in interface io.jmix.ui.component.HasSubParts