00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SOTVIZCAMERAMANAGER_H
00026 #define SOTVIZCAMERAMANAGER_H
00027
00028 #include <Inventor/SbLinear.h>
00029 #include <Inventor/fields/SoMFVec3f.h>
00030
00031
00032
00033
00034 #define DEFAULT_TERRAINSIZE_TO_MINELEV .01f
00035
00036 class SoNode;
00037 class SoCamera;
00038 class SoSensor;
00039 class SoFieldSensor;
00040
00041 class SoDEPRECATED SoTVizCameraManager
00059 {
00060
00064 typedef double SoElevationCB(SoTVizCameraManager*tcm, SbVec3f point, void* data);
00065
00066
00067 public:
00068
00078 virtual void setTerrain(SoNode *);
00079
00083 virtual const SoNode* getTerrain() const;
00084
00085
00090 virtual void setUpDirection (SbVec3f& newUpDirection);
00091
00095 virtual SbVec3f getUpDirection () const;
00096
00101 virtual void setReferencePoint (const SbVec3f& newReferencePointCoords,
00102 double newReferencePointElevation = 0);
00103
00107 virtual void getReferencePoint (SbVec3f& referencePointCoords, double& referencePointElevation) const;
00108
00112 virtual void setCamera (SoCamera *);
00113
00117 virtual SoCamera* getCamera () const;
00118
00119 enum lengthUnits {
00123 KILOMETERS,
00127 METERS,
00131 FEET
00132 };
00133
00138 virtual void setIOLengthUnit (SoTVizCameraManager::lengthUnits newIOLengthUnit = SoTVizCameraManager::METERS);
00139
00143 virtual SoTVizCameraManager::lengthUnits getIOLengthUnit () const;
00144
00150 virtual void setToRealLength (double factor = 1, SoTVizCameraManager::lengthUnits units = SoTVizCameraManager::METERS);
00151
00155 virtual void getToRealLength (double& factor, SoTVizCameraManager::lengthUnits & units) const;
00156
00165 virtual void setMinimumElevation (double newMinimalElevation);
00166
00170 virtual double getMinimumElevation () const;
00171
00176 virtual void setTargetRelativeElevation (double newElevation);
00177
00181 virtual double getRelativeElevation () const;
00182
00186 virtual double getGroundElevation () const;
00187
00193 virtual void setCameraCorrection (SbBool onOff);
00194
00198 virtual SbBool isCameraCorrection () const;
00199
00205 virtual void setConstantElevationMode (SbBool onOff, SbBool resetElevation = FALSE);
00206
00210 virtual SbBool isConstantElevationMode () const;
00211
00218 virtual void setElevationCallback (SoElevationCB * f, void *data);
00219
00224 virtual void setBorderRespect (SbBool onOff);
00225
00229 virtual SbBool isBorderRespect () const;
00230
00231 private:
00232
00233 SoTVizCameraManager ();
00234
00235 virtual ~SoTVizCameraManager ();
00236
00237 void getElevation(SbVec3f& cameraPosition, double& groundElevation, double& relativeElevation);
00238
00239 double getTargetElevation() {return m_targetElevation;};
00240
00241
00242
00243 virtual void useTVizData (SbBool onOff);
00244
00245 void setSmoothedHeight(float height, float relativeHeight);
00246
00247 SbBool isOutside(SbVec3f& cameraPos);
00248
00249
00250
00251
00252
00253 virtual void updateIOUnits();
00254 double m_toIOLength;
00255
00256
00257
00258 double m_terrainMaxSize;
00259 double m_terrainMinSize;
00260
00261
00262 SbVec3f m_internalUpDirection;
00263
00264 SoNode* m_sceneGraph;
00265 SbBool m_useTVizData;
00266 SbBool m_useQuadMesh;
00267
00268 private:
00269
00270 SoNode* m_terrain;
00271 SbVec3f m_upDirection;
00272 SbVec3f m_referencePointCoords;
00273 double m_referencePointElevation;
00274 SoCamera* m_camera;
00275
00276 SoTVizCameraManager::lengthUnits m_IOLengthUnit;
00277 SoTVizCameraManager::lengthUnits m_toRealLengthUnit;
00278 double m_toRealLength;
00279
00280
00281 double m_minimalElevation;
00282 double m_targetElevation;
00283 double m_relativeElevation;
00284 double m_groundElevation;
00285
00286 SbBool m_cameraCorrection;
00287 SbBool m_constantElevationMode;
00288 SbBool m_borderRespect;
00289 double m_borders[4];
00290
00291
00292 SoFieldSensor* m_cameraPositionSensor;
00293 static void cameraPositionCB (void*, SoSensor*);
00294
00295 void checkCameraPosition ();
00296
00297 SoElevationCB* m_userFunc;
00298 void* m_userData;
00299
00300 double getQuadMeshElevation (SbVec3f& point);
00301 SoMFVec3f m_vertexQuadMesh;
00302 int m_dimQuadMesh[2];
00303
00304 float m_smoothedHeight;
00305 float m_smoothedRelativeHeight;
00306 SbBool m_smoothedHeightFlag;
00307
00308 private:
00309 virtual void setSceneGraph(SoNode* newSceneGraph) = 0;
00310
00311 };
00312
00313
00314 #endif // SOTVIZCAMERAMANAGER_H
00315
00316
00317