MapCamera class abstract
Represents the camera looking onto the map view.
Each map instance has exactly one camera that is used to manipulate the way the map is displayed.
Any updates to the state of the camera will be applied while drawing the next map view frame and the current state of the camera reflects what is currently drawn inside the map view.
Note: The camera can be configured and positioned even before a map scene is loaded for the first time. This allows for pre-setting the desired camera position, orientation, and zoom level, which will be applied once the map scene becomes available.
Camera Model
Camera Concepts and Units
By default, HERE SDK uses an idealized Earth globe with a 3D-capable camera model. Being a 3D camera model means that the world position can be freely specified in geodetic 3D space (i.e. Earth centric) and the orientation can be freely changed around two axes - bearing (also known as head) and tilt (also known as pitch).
The camera supports the look-at target with orientation on the ground way of setting up the camera in space. The camera is placed
so that it looks at a specific geo-coordinates (placed at the principal point) from a given orientation and distance.
- the look-at target in geo-coordinates (latitude, longitude) in degrees and an
altitudein meters above MSL (mean sea level) at theprincipal point - the
orientationat the look-at target - the distance of the camera from the look-at target, given as
distancein meters or aszoom-level
Getting the current camera state
The current camera state can be obtained by the MapCamera.state call. It contains information about the camera look-at target (geo-coordinates and orientation) in geodetic space.
The values are returned for the current principal point. This can lead to surprising or unexpected values in cases where the camera position/orientation was specified for another screen point,
e.g. when using MapCameraUpdateFactory.lookAtArea with a view rectangle, whose center does not coincide with the principal point. In this case, the geo-coordinates of the
look-at target will differ from the center of the geo-box used in the lookAt call.
Geo coordinates
Geo-coordinates are given in degrees and follow the common nomenclature of positive northern latitudes and positive eastern longitudes.
Altitude
When altitude is specified, it is always in meters above mean sea level (MSL).
If this value is invalid (not-a-number) or not specified, then the terrain height at the given geo-coordinates will be looked up from the map.
This is especially interesting in cases where terrain elevation is used within the map display.
Distance vs zoom-level vs scale
Map camera distance, zoom-level and scale determine how much of the world is visible on the HERE map. Distance, zoom-level and scale are
directly connected and changing one will automatically change the others as well (except for distance/scale changes that map to zoom-level values < 0 or > 23).
distance: the distance from the camera to the look-at target on the surface of the Earth, in meterszoom-level: the map zoom level, in the range [0, 3]. The relation between the width of the equator in logical pixelswand the zoom levelzis:w = 256 * 2^(z)scale: the scale of the map at the look-at target in meters on screen per meters on Earth. So a scale of 0.001 shows 10 meters on Earth within 1 cm on screen.
The following mapping represents the zoom-level values:
| zoom-level | ~ scale on screen (130dpi) | width of the equator in logical pixels | what can be seen |
|---|---|---|---|
| 0 | 1:800 million | 256 | Earth |
| 1 | 1:400 million | 512 | |
| 2 | 1:200 million | 1024 | |
| 3 | 1:100 million | 2048 | |
| 4 | 1:50 million | 4096 | A continent |
| 5 | 1:25 million | 8192 | Large roads |
| 6 | 1:12 million | 16384 | Large rivers |
| 7 | 1:6 million | 32768 | A country |
| 8 | 1:3 million | 65536 | |
| 9 | 1:1 million | 131072 | |
| 10 | 1:780 thousand | 262144 | |
| 11 | 1:390 thousand | 524288 | |
| 12 | 1:195 thousand | 1048576 | |
| 13 | 1:100 thousand | 2097152 | |
| 14 | 1:50 thousand | 4194304 | A city |
| 15 | 1:25 thousand | 8388608 | |
| 16 | 1:12 thousand | 16777216 | Buildings |
| 17 | 1:6 thousand | 33554432 | Landmarks |
| 18 | 1:3 thousand | 67108864 | |
| 19 | 1:1 thousand | 134217728 | |
| 20 | 1:7 hundred | 268435456 | Streets |
| 21 | 1:3 hundred | 536870912 | |
| 22 | 1:1 hundred | 1073741824 | |
| 23 | 1:95 | 2147483648 |
Orientation
The camera orientation is composed of two parts:
bearing: also known as azimuth, the view direction in clockwise degrees; 0° = north, 90° = east, 180° = south, 270° = westtilt: the angle in degrees from the vertical that the camera is looking down at the Earth; 0° = straight down.
Changing the Camera
All changes to the camera are encapsulated in camera updates that are created using the methods in the MapCameraUpdateFactory class.
These updates can then be applied to the HereMapControllerCore using MapCamera.applyUpdate.
Camera updates are queued and executed when the next frame is rendered. They are executed in the order in which they were applied.
Animating the Camera
Camera updates can be animated by first creating a camera animation using the methods in the MapCameraAnimationFactory class and then applying this animation to the HereMapControllerCore using MapCamera.startAnimationWithListener.
Only one camera animation for one camera component at a time is supported. Applying a new animation will cancel the active animation before the new one is started.
The start position in this case is where ever the active animation happened to be at the time. Different components are camera state (target pose and distance/zoom level/scale)
and camera projection (field of view, focal length and principal point).
The running animations can also be canceled using MapCamera.cancelAnimations or individual ones using MapCamera.cancelAnimation.
Constructors
Properties
- boundingBox → GeoBox?
-
Currently visible map area encompassed in a GeoBox.
Note that this bounding box is always rectangular, and its sides are always
parallel to the latitude and longitude. If the camera is rotated, the returned
bounding box will be a circumscribed rectangle that is larger than the
visible map area. Similarly, when the map is tilted (for example, if
the map is tilted by 45 degrees), the visible map area represents
a trapezoidal area in the world. Resulting value will then be a larger
circumscribed rectangle that contains this trapezoid area.
Because on this, corners of the resulting bounding box may be located
outside of the currently visible area.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- limits → MapCameraLimits
-
Controls limits for the camera settings.
Gets a MapCameraLimits instance that controls limits for the camera settings.
no setter
- principalPoint ↔ Point2D
-
Determines the pixel point where the target is placed within the map view. Setting a new
principal point instantly moves the map to render the current target coordinates
at the new principal point.
Gets the pixel point that determines where the target is placed within the map view.
By default, the principal point is located at the center of the map view.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → MapCameraState
-
Current state of the camera that reflects what is currently drawn by the map view.
Gets state of the camera that reflects what is currently drawn inside the map view.
no setter
Methods
-
addListener(
MapCameraListener listener) → void - Adds a listener to this camera that will be notified every time the map is redrawn with new camera parameters.
-
applyUpdate(
MapCameraUpdate cameraUpdate) → void - Applies camera update to the map camera.
-
cancelAnimation(
MapCameraAnimation cameraAnimation) → void - Cancels an ongoing camera animation.
-
cancelAnimations(
) → void - Cancels any ongoing camera animation.
-
dryApplyUpdate(
MapCameraUpdate cameraUpdate, MapCameraDryCameraUpdateCallback callback) → void - Computes result of applying camera update without changing state of the map camera.
-
lookAtAreaWithGeoOrientation(
GeoBox target, GeoOrientationUpdate orientation) → void - Makes the camera look at the specified geodetic area.
-
lookAtAreaWithGeoOrientationAndViewRectangle(
GeoBox target, GeoOrientationUpdate orientation, Rectangle2D viewRectangle) → void - Makes the camera look at the specified geodetic area and pass a rectangle which specifies where the area should appear inside of the map view.
-
lookAtPoint(
GeoCoordinates target) → void - Makes the camera look at a new geodetic target, while preserving the current orientation and distance to the target.
-
lookAtPointWithGeoOrientationAndMeasure(
GeoCoordinates target, GeoOrientationUpdate orientation, MapMeasure zoom) → void - Makes the camera look at the geodetic target with the given zoom and orientation.
-
lookAtPointWithMeasure(
GeoCoordinates target, MapMeasure zoom) → void - Makes the camera look at the geodetic target with the given zoom.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orbitByWithGeoOrientation(
GeoOrientationUpdate delta, Point2D origin) → void - Orbits the camera around a specified view point by increasing tilt and bearing by specified delta values.
-
removeListener(
MapCameraListener observer) → void - Removes the listener from the camera.
-
removeListeners(
) → void - Removes all registered listeners.
-
setDistanceToTarget(
double distanceInMeters) → void - Makes the camera look at current target from certain distance
-
setFarPlaneConfiguration(
Map< double, MapCameraFarPlaneConfiguration> configs) → void - Sets far plane distance configs per zoom level.
-
setOrientationAtTarget(
GeoOrientationUpdate orientation) → void - Changes camera orientation in relation to target location.
-
startAnimation(
MapCameraAnimation cameraAnimation) → void - Starts a given camera animation.
-
startAnimationWithListener(
MapCameraAnimation cameraAnimation, AnimationListener animationListener) → void - Starts a given camera animation.
-
toString(
) → String -
A string representation of this object.
inherited
-
zoomBy(
double factor, Point2D origin) → void - Zooms in or out by a specified factor.
-
zoomTo(
double zoomLevel) → void - Zooms to the specified zoom level.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited