-
Notifications
You must be signed in to change notification settings - Fork 19
concepts navigation
Navigation is used to provide user friendly and map like controls over a camera.
New navigation instance is obtained as Camera::createNavigation
.
Each camera may have at most one navigation associated with it. When a new navigation is created, the previous navigation of the camera is disassociated from the camera and may not be used any more.
These methods of class Navigation
are designed for incremental changes made by user.
You pass in directly the differences in mouse position since last frame, measured in pixels.
These setters/getters directly change/retrieve the target position of the map.
The point is the target position given in navigation coordinates. The rotation is pitch, yaw and roll in degrees. The view extent is physical length that should be entirely visible in the camera, at the distance of the center of orbit. And the fov (field of view) is angle in degrees, at which the camera sees the view extent.
The distance between camera center and orbit pivot is computed directly from the fov and view extent.
Navigation type determines how changes to position (and rotation) are applied. There are several options:
- Instant - will immediately apply the change, without any inertia or delay.
- Quick - is for regular navigation, the camera moves the faster the further it is from the desired value.
- FlyOver - is designed for flies over long distances with perceptually invariant speed of changes on the screen.
Method Map::resetAltitude
will move the current position vertically to sit directly on the terrain.
Methods Map::setPosition
and Map::getPosition
set or retrieve current position as a single set of parameters.
The position can be converted to/from json or url format or manipulated directly.
The json format is used in the map config and the url format is useful for copying from/to the javascript browser.
These two are the basic navigation modes.
- Azimuthal - the camera is always aligned north-up and is forbidden to move too close to the poles.
- Free - yaw rotation is unlimited and the camera may move freely over poles.
However, as the azimuthal mode implies limitations that are unnecessary in close zoom levels, and the free mode allows people to lose context, the following modes are compromises bewteen the two.
- Dynamic - the navigation starts as if in azimuthal mode and switches to free mode when the camera gets too close to a pole, or when the camera orientation is changed.
- Seamless - allows to switch between the two basic modes back and forth based on the zoom level with a smooth transition.