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.WrapperNested 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.ZoomEndEventNested 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, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
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.voidAdds 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.PointReturns 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, ornullif 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) doubleReturns current map zoom level.voidopenPopup(PopupWindow popupWindow) Opens the given popup window.voidremoveLayer(Layer layer) Removes the given layer from the map.voidselectLayer(Layer layer) Sets the selected (i.e.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetCenter(double x, double y) Sets the initial geographic center of the map.voidsetMaxZoom(int maxZoom) Set maximum map zoom level.voidsetMinZoom(int minZoom) Set minimum map zoom level.voidsetReadOnly(boolean readOnly) Switch map to a read-only mode.voidsetZoomLevel(double zoomLevel) Set map zoom level.voidzoomToBounds(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.voidzoomToGeometry(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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods 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:
setApplicationContextin classAbstractComponent<LMap>
-
addLayer
Description copied from interface:GeoMapAdds the given layer to the map.Preserves an order of the layers, but tile layers (such as
TileLayerorWMSTileLayer) should be added first, otherwiseIllegalStateExceptionis 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
IllegalArgumentExceptionis to be thrown. -
removeLayer
Description copied from interface:GeoMapRemoves the given layer from the map.- Specified by:
removeLayerin interfaceGeoMap- Parameters:
layer- to be removed from the map
-
getLayer
Description copied from interface:GeoMapReturns a layer by its ID. -
getLayerOrNull
Description copied from interface:GeoMapReturns a layer by its ID, ornullif the map does not contain a layer with the given ID.- Specified by:
getLayerOrNullin interfaceGeoMap- Parameters:
layerId- ID of a layer- Returns:
- layer
-
getLayers
Description copied from interface:GeoMapReturns 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:GeoMapSets the initial geographic center of the map. -
getCenter
public org.locationtech.jts.geom.Point getCenter()Description copied from interface:GeoMapReturns current geographic center of the map. -
setZoomLevel
public void setZoomLevel(double zoomLevel) Set map zoom level.- Specified by:
setZoomLevelin interfaceGeoMap- Parameters:
zoomLevel- of the map
-
getZoomLevel
public double getZoomLevel()Description copied from interface:GeoMapReturns current map zoom level.- Specified by:
getZoomLevelin interfaceGeoMap
-
setMaxZoom
public void setMaxZoom(int maxZoom) Set maximum map zoom level.- Specified by:
setMaxZoomin interfaceGeoMap- Parameters:
maxZoom- maximum map zoom level
-
setMinZoom
public void setMinZoom(int minZoom) Set minimum map zoom level.- Specified by:
setMinZoomin 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:
setReadOnlyin interfaceGeoMap- Parameters:
readOnly- true/false
-
getCanvas
Description copied from interface:GeoMapReturns the canvas layer of the map. -
selectLayer
Description copied from interface:GeoMapSets the selected (i.e. the active) layer of the map.A
nullparameter deselects currently selected layer.- Specified by:
selectLayerin interfaceGeoMap- Parameters:
layer- selected layer
-
getSelectedLayer
Description copied from interface:GeoMapReturns the selected layer of the map.- Specified by:
getSelectedLayerin interfaceGeoMap- Returns:
- the selected layer or
nullwhen none of the layers is selected
-
getBounds
Description copied from interface:GeoMapReturns 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:GeoMapSets a map view that contains the given geographical bounds with the maximum zoom level possible.- Specified by:
zoomToBoundsin interfaceGeoMap- Parameters:
topLeft- NorthWest pointbottomRight- SouthEast point
-
zoomToGeometry
public void zoomToGeometry(org.locationtech.jts.geom.Geometry geometry) Description copied from interface:GeoMapSets 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:
zoomToGeometryin interfaceGeoMap
-
openPopup
Description copied from interface:GeoMapOpens the given popup window. -
addClickListener
Description copied from interface:GeoMapRegisters a new click listener.- Specified by:
addClickListenerin 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:GeoMapRegisters a new right click listener.- Specified by:
addRightClickListenerin 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:GeoMapRegisters a new move end listener.- Specified by:
addMoveEndListenerin 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:GeoMapRegisters a new zoom end listener.- Specified by:
addZoomEndListenerin 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:GeoMapRegisters a new drag end listener.- Specified by:
addDragEndListenerin 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:GeoMapRegisters a new layer added listener.- Specified by:
addLayerAddedListenerin 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:GeoMapRegisters a new layer removed listener.- Specified by:
addLayerRemovedListenerin 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:GeoMapRegisters a new selected layer changed listener.- Specified by:
addSelectedLayerChangedListenerin interfaceGeoMap- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
getEventHub
- Overrides:
getEventHubin 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:
getSubPartin interfaceHasSubParts
-