Abstract class for managing the SoTVizViewer camera. More...
#include <TerrainViz/viewer/SoTVizCameraManager.h>
Public Types | |
enum | lengthUnits { KILOMETERS, METERS, FEET } |
Public Member Functions | |
virtual void | setTerrain (SoNode *) |
virtual const SoNode * | getTerrain () const |
virtual void | setUpDirection (SbVec3f &newUpDirection) |
virtual SbVec3f | getUpDirection () const |
virtual void | setReferencePoint (const SbVec3f &newReferencePointCoords, double newReferencePointElevation=0) |
virtual void | getReferencePoint (SbVec3f &referencePointCoords, double &referencePointElevation) const |
virtual void | setCamera (SoCamera *) |
virtual SoCamera * | getCamera () const |
virtual void | setIOLengthUnit (SoTVizCameraManager::lengthUnits newIOLengthUnit=SoTVizCameraManager::METERS) |
virtual SoTVizCameraManager::lengthUnits | getIOLengthUnit () const |
virtual void | setToRealLength (double factor=1, SoTVizCameraManager::lengthUnits units=SoTVizCameraManager::METERS) |
virtual void | getToRealLength (double &factor, SoTVizCameraManager::lengthUnits &units) const |
virtual void | setMinimumElevation (double newMinimalElevation) |
virtual double | getMinimumElevation () const |
virtual void | setTargetRelativeElevation (double newElevation) |
virtual double | getRelativeElevation () const |
virtual double | getGroundElevation () const |
virtual void | setCameraCorrection (SbBool onOff) |
virtual SbBool | isCameraCorrection () const |
virtual void | setConstantElevationMode (SbBool onOff, SbBool resetElevation=FALSE) |
virtual SbBool | isConstantElevationMode () const |
virtual void | setElevationCallback (SoElevationCB *f, void *data) |
virtual void | setBorderRespect (SbBool onOff) |
virtual SbBool | isBorderRespect () const |
The SoTVizCameraManager class controls the camera position. It prevents the camera from going below the terrain surface, and can force it to maintain a constant elevation above the ground.
virtual SoCamera* SoTVizCameraManager::getCamera | ( | ) | const [virtual] |
Returns a pointer to the camera.
Reimplemented in SoTVizViewer.
virtual double SoTVizCameraManager::getGroundElevation | ( | ) | const [virtual] |
Returns the elevation of the ground directly beneath the camera.
virtual SoTVizCameraManager::lengthUnits SoTVizCameraManager::getIOLengthUnit | ( | ) | const [virtual] |
Returns the type of units used in the getXXXElevation/setXXXElevation methods.
virtual double SoTVizCameraManager::getMinimumElevation | ( | ) | const [virtual] |
Returns the minimum elevation allowed for the camera.
virtual void SoTVizCameraManager::getReferencePoint | ( | SbVec3f & | referencePointCoords, | |
double & | referencePointElevation | |||
) | const [virtual] |
Returns the reference point on the terrain.
virtual double SoTVizCameraManager::getRelativeElevation | ( | ) | const [virtual] |
Returns the distance between camera and ground along the up direction.
virtual const SoNode* SoTVizCameraManager::getTerrain | ( | ) | const [virtual] |
Returns a pointer to the terrain.
virtual void SoTVizCameraManager::getToRealLength | ( | double & | factor, | |
SoTVizCameraManager::lengthUnits & | units | |||
) | const [virtual] |
Returns the scale factor and units.
virtual SbVec3f SoTVizCameraManager::getUpDirection | ( | ) | const [virtual] |
Returns the up direction used by the camera.
Reimplemented in SoTVizViewer.
virtual SbBool SoTVizCameraManager::isBorderRespect | ( | ) | const [virtual] |
Returns TRUE if the camera takes terrain borders into account.
virtual SbBool SoTVizCameraManager::isCameraCorrection | ( | ) | const [virtual] |
Returns TRUE if camera correction is enabled.
virtual SbBool SoTVizCameraManager::isConstantElevationMode | ( | ) | const [virtual] |
Returns TRUE if constant elevation mode is enabled.
virtual void SoTVizCameraManager::setBorderRespect | ( | SbBool | onOff | ) | [virtual] |
If TRUE, prevents the camera from leaving the terrain perimeter.
Default = FALSE.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setCamera | ( | SoCamera * | ) | [virtual] |
Sets the camera node.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setCameraCorrection | ( | SbBool | onOff | ) | [virtual] |
Enables or disables correction of the camera position.
If set to TRUE, the camera is prevented from going through the terrain or below the minimum height. Default = TRUE.
virtual void SoTVizCameraManager::setConstantElevationMode | ( | SbBool | onOff, | |
SbBool | resetElevation = FALSE | |||
) | [virtual] |
Turns constant elevation mode on or off.
If on, resetElevation sets elevation value to the minimum, else resetElevation has no effect. Default = FALSE.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setElevationCallback | ( | SoElevationCB * | f, | |
void * | data | |||
) | [virtual] |
Sets a callback over the terrain elevation directly beneath the camera.
By default, elevation data is retrieved using SbTVizData::getValue, or by ray pick action if the terrain is any other kind of pickable primitive.
virtual void SoTVizCameraManager::setIOLengthUnit | ( | SoTVizCameraManager::lengthUnits | newIOLengthUnit = SoTVizCameraManager::METERS |
) | [virtual] |
Sets the length units of I/O values in the getXXXElevation/setXXXElevation methods.
Default units are meters.
virtual void SoTVizCameraManager::setMinimumElevation | ( | double | newMinimalElevation | ) | [virtual] |
Sets the minimum elevation of the camera.
Be careful when setting SoCamera::nearDistance: too small a value will cause clipping. Default = m_terrainMaxSize*DEFAULT_TERRAINSIZE_TO_MINELEV*getToRealLength()
where m_terrainMaxSize is the dimension of the largest side of the terrain data, DEFAULT_TERRAINSIZE_TO_MINELEV is 0.01, and getToRealLength() is expressed in m/s.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setReferencePoint | ( | const SbVec3f & | newReferencePointCoords, | |
double | newReferencePointElevation = 0 | |||
) | [virtual] |
Sets the reference point on the terrain.
The default is (0,0,0) in world coordinates at elevation 0 in IOLength units.
virtual void SoTVizCameraManager::setTargetRelativeElevation | ( | double | newElevation | ) | [virtual] |
Changes the camera height in constant elevation mode.
Default is the current height.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setTerrain | ( | SoNode * | ) | [virtual] |
Terrain data can be of any type.
You can use SbTVizData, an SoQuadmesh, or any node that supports picking (essentially any node). If the root node is an SoTVizRender node, the camera position will be computed more quickly using the data from the specified elevation file. Otherwise the camera position is computed by picking on the displayed geometry, which is slower.
Reimplemented in SoTVizViewer.
virtual void SoTVizCameraManager::setToRealLength | ( | double | factor = 1 , |
|
SoTVizCameraManager::lengthUnits | units = SoTVizCameraManager::METERS | |||
) | [virtual] |
Associates world coordinates and terrain real size.
A value of 1 in modeling coordinates will correspond to a value of factor in units units.
virtual void SoTVizCameraManager::setUpDirection | ( | SbVec3f & | newUpDirection | ) | [virtual] |
Changes the up direction of the terrain.
The default up vector is the Z axis (0,0,1).
Reimplemented in SoTVizViewer.