Class MapView
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GeoMapView,NoOpMapView
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected Extentprotected Extentprotected Doubleprotected Doubleprotected CRSprotected Doubleprotected Booleanprotected Booleanprotected doubleFields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, metaProperties, parent, removedChildren, syncId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets whether theextentconstraint applies to the view center only rather than to the whole viewport.Gets the extent (or bounding box) of the currently visible area.Note, the rotation can be updated from the client-side and can be available after the first view change.Gets whether the view can be zoomed out far enough to show the whole configuredextent, even when the viewport aspect ratio differs from it.Gets whether theextentconstraint is applied smoothly, allowing the view to move slightly outside the extent before being constrained back.protected StringgetType()doublegetZoom()protected voidvoidsetConstrainOnlyCenter(Boolean constrainOnlyCenter) Sets whether the extent constraint applies to the view center only.voidSets the view extent.voidsetMaxZoom(Double maxZoom) Sets the maximum zoom level for the view.voidsetMinZoom(Double minZoom) Sets a minimum zoom level for the view.voidsetProjection(CRS projection) Sets the projection to view.voidsetRotation(Double rotation) Sets the rotation for the view in radians (positive rotation clockwise, 0 means North).voidsetShowFullExtent(Boolean showFullExtent) Sets whether the view can be zoomed out far enough to show the whole configured extent.voidsetSmoothExtentConstraint(Boolean smoothExtentConstraint) Sets whether the extent constraint is applied smoothly.voidsetZoom(double zoom) Zooms to a specific zoom level.Methods 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
-
extent
-
showFullExtent
-
constrainOnlyCenter
-
smoothExtentConstraint
-
projection
-
rotation
-
maxZoom
-
minZoom
-
zoom
protected double zoom -
currentExtent
-
-
Constructor Details
-
MapView
public MapView()
-
-
Method Details
-
getExtent
- Returns:
- view extent or
nullif not set
-
setExtent
Sets the view extent. This extent is a constraint that does not enable to move map visible area outside specified extent.Note, extent attribute is set only at creation time and cannot be changed at runtime.
For more details see: View docs
- Parameters:
extent- extent to set
-
getShowFullExtent
Gets whether the view can be zoomed out far enough to show the whole configuredextent, even when the viewport aspect ratio differs from it.- Returns:
trueif the full extent may be shown,falseif not, ornullif not set (OpenLayers default isfalse)
-
setShowFullExtent
Sets whether the view can be zoomed out far enough to show the whole configured extent. Useful together withsetExtent(Extent)in responsive layouts, where the container aspect ratio may differ from the extent. The OpenLayers default isfalse.Note, this attribute is set only at creation time and cannot be changed at runtime.
For more details see: View docs
- Parameters:
showFullExtent- whether to allow showing the full extent
-
getConstrainOnlyCenter
Gets whether theextentconstraint applies to the view center only rather than to the whole viewport.- Returns:
trueif only the center is constrained,falseif the whole viewport is, ornullif not set (OpenLayers default isfalse)
-
setConstrainOnlyCenter
Sets whether the extent constraint applies to the view center only. Whentrue, the center cannot leave the extent, but the viewport may. The OpenLayers default isfalse.Note, this attribute is set only at creation time and cannot be changed at runtime.
For more details see: View docs
- Parameters:
constrainOnlyCenter- whether to constrain only the center
-
getSmoothExtentConstraint
Gets whether theextentconstraint is applied smoothly, allowing the view to move slightly outside the extent before being constrained back.- Returns:
trueif the constraint is applied smoothly,falseif strictly, ornullif not set (OpenLayers default istrue)
-
setSmoothExtentConstraint
Sets whether the extent constraint is applied smoothly. Whentrue, the view may move slightly outside the extent and is eased back; whenfalse, the constraint is hard. The OpenLayers default istrue.Note, this attribute is set only at creation time and cannot be changed at runtime.
For more details see: View docs
- Parameters:
smoothExtentConstraint- whether to apply the extent constraint smoothly
-
getProjection
- Returns:
- projection or
nullif not set
-
setProjection
Sets the projection to view. The default projection is "EPSG:3857" (Pseudo-Mercator). If a source (based onTileImageSourceorImageSource) has a projection different from the current map view’s projection then the reprojection happens automatically.There are available two options:
-
CRSvalue - sets value as CRS constant, e.g.CRS.EPSG_4326or as anonymous implementation, e.g.setProjection(() -> "EPSG:4326");. -
Projectionvalue - sets custom projection.
- Parameters:
projection- projection to set
-
-
getRotation
Note, the rotation can be updated from the client-side and can be available after the first view change.- Returns:
- the rotation in radians or
nullif not set or is not updated from the client-side
-
setRotation
Sets the rotation for the view in radians (positive rotation clockwise, 0 means North).For more details see: setRotation docs
- Parameters:
rotation- rotation to set
-
getMaxZoom
- Returns:
- maximum zoom level or
nullif not set
-
setMaxZoom
Sets the maximum zoom level for the view. The default value is28.For more details see: setMaxZoom docs
- Parameters:
maxZoom- maximum zoom to set
-
getMinZoom
- Returns:
- minimum zoom level or
nullif not set
-
setMinZoom
Sets a minimum zoom level for the view. The default value is0.For more details see: setMinZoom docs
- Parameters:
minZoom- minimum zoom level to set
-
getZoom
public double getZoom()- Returns:
- zoom level
-
setZoom
public void setZoom(double zoom) Zooms to a specific zoom level. The zoom level starts at 0 as the most zoomed-out level, and then continually increases to zoom further in.- Parameters:
zoom- zoom level
-
getCurrentExtent
Gets the extent (or bounding box) of the currently visible area.Note, the extent is calculated on the client-side and will only be available after the first view change.
- Returns:
- the coordinates of the view's extent
-
getType
- Specified by:
getTypein classMapObservableObject
-
onStateChangeEvent
-