Class GeoMapImpl
- All Implemented Interfaces:
GeoMap
,AttachNotifier
,Component
,Component.BelongToFrame
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasSubParts
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.mapsui.component.GeoMap
GeoMap.Bounds, GeoMap.ClickEvent, GeoMap.DragEndEvent, GeoMap.LayerAddedEvent, GeoMap.LayerRemovedEvent, GeoMap.MoveEndEvent, GeoMap.RightClickEvent, GeoMap.SelectedLayerChangedEvent, GeoMap.ZoomEndEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
-
Field Summary
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddClickListener
(Consumer<GeoMap.ClickEvent> listener) Registers a new click listener.addDragEndListener
(Consumer<GeoMap.DragEndEvent> listener) Registers a new drag end listener.void
Adds the given layer to the map.addLayerAddedListener
(Consumer<GeoMap.LayerAddedEvent> listener) Registers a new layer added listener.Registers a new layer removed listener.addMoveEndListener
(Consumer<GeoMap.MoveEndEvent> listener) Registers a new move end listener.addRightClickListener
(Consumer<GeoMap.RightClickEvent> listener) Registers a new right click listener.Registers a new selected layer changed listener.addZoomEndListener
(Consumer<GeoMap.ZoomEndEvent> listener) Registers a new zoom end listener.Returns the bounds of the map which define the viewport of the map.Returns the canvas layer of the map.org.locationtech.jts.geom.Point
Returns current geographic center of the map.protected EventHub
<T> 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>
TReturns a layer by its ID.<T extends Layer>
TgetLayerOrNull
(String layerId) Returns a layer by its ID, ornull
if the map does not contain a layer with the given ID.Returns the list of layers currently added to the map.Returns the selected layer of the map.getSubPart
(String name) double
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.Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
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, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, 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
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.mapsui.component.GeoMap
selectLayerById
-
Constructor Details
-
GeoMapImpl
public GeoMapImpl()
-
-
Method Details
-
setApplicationContext
@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Overrides:
setApplicationContext
in classAbstractComponent<LMap>
-
addLayer
Description copied from interface:GeoMap
Adds the given layer to the map.Preserves an order of the layers, but tile layers (such as
TileLayer
orWMSTileLayer
) should be added first, otherwiseIllegalStateException
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. -
removeLayer
Description copied from interface:GeoMap
Removes the given layer from the map.- Specified by:
removeLayer
in interfaceGeoMap
- Parameters:
layer
- to be removed from the map
-
getLayer
Description copied from interface:GeoMap
Returns a layer by its ID. -
getLayerOrNull
Description copied from interface:GeoMap
Returns a layer by its ID, ornull
if the map does not contain a layer with the given ID.- Specified by:
getLayerOrNull
in interfaceGeoMap
- Parameters:
layerId
- ID of a layer- Returns:
- layer
-
getLayers
Description copied from interface:GeoMap
Returns the list of layers currently added to the map. The resulting list preserves the order of layers (from the first added layer to the last). The Canvas layer is not included in this list. -
setCenter
public void setCenter(double x, double y) Description copied from interface:GeoMap
Sets the initial geographic center of the map. -
getCenter
public org.locationtech.jts.geom.Point getCenter()Description copied from interface:GeoMap
Returns current geographic center of the map. -
setZoomLevel
public void setZoomLevel(double zoomLevel) Set map zoom level.- Specified by:
setZoomLevel
in interfaceGeoMap
- Parameters:
zoomLevel
- of the map
-
getZoomLevel
public double getZoomLevel()Description copied from interface:GeoMap
Returns current map zoom level.- Specified by:
getZoomLevel
in interfaceGeoMap
-
setMaxZoom
public void setMaxZoom(int maxZoom) Set maximum map zoom level.- Specified by:
setMaxZoom
in interfaceGeoMap
- Parameters:
maxZoom
- maximum map zoom level
-
setMinZoom
public void setMinZoom(int minZoom) Set minimum map zoom level.- Specified by:
setMinZoom
in interfaceGeoMap
- Parameters:
minZoom
- minimum map zoom level
-
setReadOnly
public void setReadOnly(boolean readOnly) Switch map to a read-only mode. Virtually, it means an impossibility of changing zoom, position, etc., via mouse.- Specified by:
setReadOnly
in interfaceGeoMap
- Parameters:
readOnly
- true/false
-
getCanvas
Description copied from interface:GeoMap
Returns the canvas layer of the map. -
selectLayer
Description copied from interface:GeoMap
Sets the selected (i.e. the active) layer of the map.A
null
parameter deselects currently selected layer.- Specified by:
selectLayer
in interfaceGeoMap
- Parameters:
layer
- selected layer
-
getSelectedLayer
Description copied from interface:GeoMap
Returns the selected layer of the map.- Specified by:
getSelectedLayer
in interfaceGeoMap
- Returns:
- the selected layer or
null
when none of the layers is selected
-
getBounds
Description copied from interface:GeoMap
Returns the bounds of the map which define the viewport of the map. -
zoomToBounds
public void zoomToBounds(org.locationtech.jts.geom.Point topLeft, org.locationtech.jts.geom.Point bottomRight) Description copied from interface:GeoMap
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.- Specified by:
zoomToBounds
in interfaceGeoMap
- Parameters:
topLeft
- NorthWest pointbottomRight
- SouthEast point
-
zoomToGeometry
public void zoomToGeometry(org.locationtech.jts.geom.Geometry geometry) Description copied from interface:GeoMap
Sets a map view that contains envelope of the given geometry with the maximum zoom level possible.Note: if the given geometry is point, map will be centered to this point with the current zoom level.
- Specified by:
zoomToGeometry
in interfaceGeoMap
-
openPopup
Description copied from interface:GeoMap
Opens the given popup window. -
addClickListener
Description copied from interface:GeoMap
Registers a new click listener.- Specified by:
addClickListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addRightClickListener
Description copied from interface:GeoMap
Registers a new right click listener.- Specified by:
addRightClickListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addMoveEndListener
Description copied from interface:GeoMap
Registers a new move end listener.- Specified by:
addMoveEndListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addZoomEndListener
Description copied from interface:GeoMap
Registers a new zoom end listener.- Specified by:
addZoomEndListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addDragEndListener
Description copied from interface:GeoMap
Registers a new drag end listener.- Specified by:
addDragEndListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addLayerAddedListener
Description copied from interface:GeoMap
Registers a new layer added listener.- Specified by:
addLayerAddedListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addLayerRemovedListener
Description copied from interface:GeoMap
Registers a new layer removed listener.- Specified by:
addLayerRemovedListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addSelectedLayerChangedListener
public Subscription addSelectedLayerChangedListener(Consumer<GeoMap.SelectedLayerChangedEvent> listener) Description copied from interface:GeoMap
Registers a new selected layer changed listener.- Specified by:
addSelectedLayerChangedListener
in interfaceGeoMap
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
getEventHub
- Overrides:
getEventHub
in classAbstractComponent<LMap>
-
getGeoObjectWrappersMap
Returns a map of pairs [geo-object ID: geoObjectWrapper] for geo-objects of the given vector 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.
- Throws:
IllegalArgumentException
- when map does not contain the specified layer
-
getSubPart
- Specified by:
getSubPart
in interfaceHasSubParts
-