![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
Simple component for controlling view of 3D Drawing Surfaces.
The default position and orientation of the camera is such that, vertically, it is positioned in the Equatorial plane and its up vector (i.e. 'normal') lies in the prime meridian plane, parallel to the Z axis i.e. it is sitting at the centre of the Earth.
Public Member Functions | |
TSL3DCameraReturn | angleOfView (double angle) |
double | angleOfView () const |
void | getCameraAxis (double &directionX, double &directionY, double &directionZ, double &rightX, double &rightY, double &rightZ, double &normalX, double &normalY, double &normalZ) |
double | horizonAltitude () const |
void | horizonAltitude (double altitude) |
void | limitHeightAboveEarth (bool limit, double heightLimit=100.0, bool ignoreTerrain=false) |
TSL3DCameraReturn | lookAt (double latitude, double longitude, double altitude, bool makeHorizonLevel) |
TSL3DCameraReturn | moveTo (double latitude, double longitude, double altitude, TSL3DCameraMoveAction action=TSL3DCameraMoveActionNone) |
bool | orientation (double directionNorthing, double directionEasting, double directionAltitude, double rotation, bool absolute=false) |
bool | position (double *latitude, double *longitude, double *altitude) const |
void | reset () |
bool | rotateAroundViewAxis (double angle) |
bool | setCameraAxis (double directionX, double directionY, double directionZ, double rightX, double rightY, double rightZ, double normalX, double normalY, double normalZ) |
bool | translate (double forward, double sideways, double vertical, TSL3DCameraMoveAction action, bool maintainAltitude) |
bool | upsideDown () const |
double | viewRotation () const |
void | viewExtent (double &width, double &height) const |
double TSL3DCamera::angleOfView | ( | ) | const |
Query field of view for camera.
Returns field of view angle in degrees.
TSL3DCameraReturn TSL3DCamera::angleOfView | ( | double | angle | ) |
Set field of view for camera.
Defaults to 45 degrees. Make larger for wider field of view.
angle | New field of view angle in degrees |
void TSL3DCamera::getCameraAxis | ( | double & | directionX, |
double & | directionY, | ||
double & | directionZ, | ||
double & | rightX, | ||
double & | rightY, | ||
double & | rightZ, | ||
double & | normalX, | ||
double & | normalY, | ||
double & | normalZ ) |
This method returns the three unit vectors making up the camera axis.
The stored values can then passed back to the Camera by a call to setCamera Axis.
directionX | Direction vector. The direction the camera is pointing in. |
directionY | |
directionZ | |
rightX | Right vector. Defines the rotation about the direction vector. |
rightY | |
rightZ | |
normalX | Up vector. Defines which way the camera thinks is up. |
normalY | |
normalZ |
double TSL3DCamera::horizonAltitude | ( | ) | const |
Query altitude at which horizon becomes acceptable.
This value defines the cut-off point for the 'setHorizonLevel' parameter of the lookAt method. It is necessary since a viewpoint far away from the earth's surface has no sensible horizon.
Returns altitude in metres.
void TSL3DCamera::horizonAltitude | ( | double | altitude | ) |
Set altitude at which horizon becomes acceptable.
This method defines the cut-off point for the 'setHorizonLevel' parameter of the lookAt method. It is necessary since a viewpoint far away from the earth's surface has no sensible horizon.
altitude | Altitude at which horizon is visible - defaults to 1000km |
void TSL3DCamera::limitHeightAboveEarth | ( | bool | limit, |
double | heightLimit = 100.0, | ||
bool | ignoreTerrain = false ) |
This method adds the ability to prevent the camera from descending below a certain altitude above the earth. This can be helpful to stop the camera from entering the earth or going so close to the earth that the drawing intersects with the near clip plane.
limit | Should the camera limit its height above the earth |
heightLimit | The lowest altitude that the camera may descend to. |
ignoreTerrain | Should the height limit parameter be interpreted from the height of the terrain at the point of the camera. |
TSL3DCameraReturn TSL3DCamera::lookAt | ( | double | latitude, |
double | longitude, | ||
double | altitude, | ||
bool | makeHorizonLevel ) |
Sets an orientation by make the camera look at a particular point.
Note that the 'makeHorizonLevel' parameter is only used if the camera altitude is greater than the value set by the horizonAltitude method - or its default value.
latitude | Latitude of target position in degrees |
longitude | Longitude of target position in degrees |
altitude | Altitude of target position in metres above mean sea level |
makeHorizonLevel | If true, adjust the apparent 'roll' so that the horizon is horizontal |
TSL3DCameraReturn TSL3DCamera::moveTo | ( | double | latitude, |
double | longitude, | ||
double | altitude, | ||
TSL3DCameraMoveAction | action = TSL3DCameraMoveActionNone ) |
Sets the camera position to a specific geodetic point.
The action parameter allows the camera to also modify the orientation in a specified manner.
latitude | Latitude of position in degrees |
longitude | Longitude of position in degrees |
altitude | Altitude of position in metres above mean sea level |
action | Action take with regard to the current camera orientation |
bool TSL3DCamera::orientation | ( | double | directionNorthing, |
double | directionEasting, | ||
double | directionAltitude, | ||
double | rotation, | ||
bool | absolute = false ) |
Set orientation of camera via direction ground relative vector (ENU), and rotation around that vector. This is an Angle-Axis representation.
The direction vector must be unit length.
References
Also see the Developers Guide.
directionNorthing | Northing component of the direction vector |
directionEasting | Easting component of the direction vector |
directionAltitude | Vertical, altitude component of the direction vector, |
rotation | Rotation of the viewpoint around the direction vector, in degrees, positive anti-clockwise |
absolute | If true the vector and rotation are applied to a Camera which has its axis aligned to the default ENU axis. If false the rotation specified is cumulative (default). |
bool TSL3DCamera::position | ( | double * | latitude, |
double * | longitude, | ||
double * | altitude ) const |
Query the current lat/long/altitude position of the camera
latitude | Storage for current camera latitude |
longitude | Storage for current camera longitude |
altitude | Storage for current camera altitude |
void TSL3DCamera::reset | ( | ) |
Reset the camera position and orientation to its default values (the default position and orientation of the camera is such that, vertically, it is positioned in the Equatorial plane and its up vector (i.e. 'normal') lies in the prime meridian plane, parallel to the Z axis i.e. it is sitting at the centre of the Earth).
bool TSL3DCamera::rotateAroundViewAxis | ( | double | angle | ) |
Rotate the camera around its view axis.
angle | The angle to rotate by, in degrees (a +ve angle produces a clockwise rotation of the camera around its view axis) |
bool TSL3DCamera::setCameraAxis | ( | double | directionX, |
double | directionY, | ||
double | directionZ, | ||
double | rightX, | ||
double | rightY, | ||
double | rightZ, | ||
double | normalX, | ||
double | normalY, | ||
double | normalZ ) |
This method sets the three unit vectors making up the camera axis.
The vectors shall be at 90 degrees to each other.
The method allows the user to set the camera axis to the values obtained from a previous call to getCameraAxis as such very little checking is carried out to validate the vectors.
The default orientation of the camera is such that, vertically, it is positioned in the Equatorial plane and its up vector (i.e. 'normal') lies in the prime meridian plane, parallel to the Z axis.
directionX | Direction vector. The direction the camera is pointing in. |
directionY | |
directionZ | |
rightX | Right vector. Defines the rotation about the direction vector. |
rightY | |
rightZ | |
normalX | Up vector. Defines which way the camera thinks is up. |
normalY | |
normalZ |
bool TSL3DCamera::translate | ( | double | forward, |
double | sideways, | ||
double | vertical, | ||
TSL3DCameraMoveAction | action, | ||
bool | maintainAltitude ) |
Move camera position by specified delta values, relative to current position and orientation
The orientation may be affected, depending upon the action parameter. Distances are defined in metres
forward | Distance to move along current direction vector |
sideways | Distance to move along current right vector |
vertical | Distance to move along current normal vector |
action | Action to perform on current orientation |
maintainAltitude | If true, then after translation, the camera is adjusted so that it stays at its original altitude. |
bool TSL3DCamera::upsideDown | ( | ) | const |
Query as to whether the camera orientation is upside-down relative to the north direction.
This method is used to allow traversal over the poles.
void TSL3DCamera::viewExtent | ( | double & | width, |
double & | height ) const |
Return the dimensions of the viewed extent at the camera's front plane.
width | |
height |
double TSL3DCamera::viewRotation | ( | ) | const |
Returns the 2D view rotation in degrees.
The value returned is only valid if the following methods are not called:
orientation translate