00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_LDM_NODE_FRONT_MGR__
00025 #define _SO_LDM_NODE_FRONT_MGR__
00026
00027 #include <LDM/SoLDMLargeDataManagement.h>
00028 #include <LDM/SoLDMTileID.h>
00029 #include <Inventor/STL/vector>
00030 #include <Inventor/SbBox.h>
00031 #include <Inventor/sensors/SoAlarmSensor.h>
00032
00033 class SoTimerSensor;
00034 class SoLdmShape;
00035 class SoShape;
00036 class SbThreadMutex;
00037 class SoBufferAsyncNotifierInterface;
00038 class SoLDMAsyncBufferNotifier;
00039
00086 SoEXTENDER_Documented class SoLDMNodeFrontManager : public SoLDMLargeDataManagement
00087 {
00088
00089 public:
00090
00094 SoLDMNodeFrontManager();
00095
00099 virtual ~SoLDMNodeFrontManager();
00100
00101
00102
00103
00104
00105
00119 LDM_TILE_ID_TYPE getNumTileIDs();
00120
00138 int getNumFileIDs();
00139
00145 virtual int getFileID( SoLDMTileID tileID ) = 0;
00146
00150 virtual SbBox3i32 getTilePos( SoLDMTileID tileID ) = 0;
00151
00156 virtual int getMinResolution() = 0;
00161 virtual SoLDMTileID getTileID( const SbVec3i32& cellPos, int resolution = 0 ) = 0;
00162
00170 virtual SoLDMTileID getTexTileID ( SoLDMTileID tileID ) = 0;
00171
00172
00176 virtual SoLDMTileID getShape2dTexTileID ( SoLdmShape* shape, const SoLDMTileID& tileID );
00177
00184 virtual SoLDMTileID getDataTileID ( SoLDMTileID tileID ) = 0;
00185
00186
00187
00188
00194 virtual void getTexFront(std::vector<SoLDMTileID>& toLoad, std::vector<SoLDMTileID>& toUnload) = 0;
00195
00196
00204 virtual void getNextTexFront(std::vector<SoLDMTileID>& toLoad, std::vector<SoLDMTileID>& toUnload,
00205 int maxRes = 0) = 0;
00206
00213 virtual void getNextShape2dTexFront(SoLdmShape* hf,
00214 std::vector<SoLDMTileID>& toLoad,
00215 std::vector<SoLDMTileID>& toUnload);
00216
00217 virtual void reset2dTexFronts( SoLdmShape* shape ) = 0;
00218
00226 virtual void getNextSkinTexFront(std::vector<SoLDMTileID>& toLoad,
00227 std::vector<SoLDMTileID>& toUnload,
00228 const std::vector<SbBox3i32>& boxes);
00236 virtual void getOrderedTexFront(const SbVec3i32 &viewPoint, std::vector<SoLDMTileID>& orderedTexFront) = 0;
00237
00242 virtual void getOrderedSkinTexFront(const SbVec3i32 &viewPoint, std::vector<SoLDMTileID>& orderedTexFront);
00243
00248 virtual void getOrderedShape2dTexFront(SoLdmShape* shape,
00249 const SbVec3i32 &viewPoint, std::vector<SoLDMTileID>& orderedTexFront);
00250
00256 virtual void getOrderedDataFront(const SbVec3i32 &viewPoint, std::vector<SoLDMTileID>& orderedDataFront) = 0;
00257
00258
00259
00260
00264 virtual void getTiles(const SbBox3i32 ®ion, std::vector<SoLDMTileID> &tiles) = 0;
00265
00271 virtual bool getTiles(const SbBox3i32 ®ion, int resolution, std::vector<SoLDMTileID> &tiles) = 0;
00272
00279 virtual bool registerSlice(int& id,SoShape*) = 0;
00283 virtual void unRegisterSlice( int sliceID ) = 0;
00287 virtual void setSlicePlane( int sliceID, const SbPlane &plane ) = 0;
00292 virtual void getNextSliceTexFront( int sliceID, std::vector<SoLDMTileID>& toLoad, std::vector<SoLDMTileID>& toUnload ) = 0;
00293
00294
00295
00296
00302 virtual void geomChangeNotify(SbBool redraw=FALSE);
00303
00308 virtual void resourceChangeNotify();
00309
00314 void movingChangeNotify(SbBool movingValue);
00315
00320 virtual bool isTextureFrontEmpty(){return true;}
00325 virtual bool isSliceTexFrontEmpty(int){return true;};
00326
00332 virtual void startTraversalNotify(){};
00333
00337 virtual float getWeight(SoLDMTileID tileID);
00338
00343 virtual LDM_TILE_ID_TYPE getMaxTileIDAtResolution( int level ) = 0;
00344
00348 virtual int getTileLevel(SoLDMTileID tileID) = 0;
00349
00353 virtual void shouldInit()
00354 {;}
00355
00359 virtual void setSliceMaxVisualResolution(int sliceID, int res) = 0;
00360
00364 virtual int getNextLoadedStepLevel(int id);
00365
00366 private:
00367 static void initClass();
00368
00369 virtual void init(SbBool initTm = TRUE);
00370
00371
00372 virtual int getNumFileIDsAtResolution(int resolution);
00373 void setUpdatingTopology(bool val){ m_updatingTopology = val; };
00374 bool isUpdatingTopology(){return m_updatingTopology; };
00375
00376
00377
00378
00379
00380
00381 virtual void tryUpdateNode(int& count, LDM_TILE_ID_TYPE node,int octreeLevel, int resolution );
00382
00383 virtual int getMaxLevel() const
00384 { return m_levelMax ; }
00385
00389 SbBool isMoving() const { return m_moving; }
00390
00395 inline void setFixedResolution(bool flag);
00396
00401 virtual size_t getNumTiles(const std::vector<SbBox3i32>& regions, int resolution);
00402
00403 virtual bool getTiles(const SbBox3i32 &, int , std::vector<SoLDMTileID> &, std::vector<SoLDMTileID> &, std::vector<SoLDMTileID> &, bool ) {return true; };
00404
00406 SbBox3i32 getTilePosWithoutBorders( const SoLDMTileID& tileID );
00407
00409 void scheduleStoppedInteraction(const SbTime& time);
00410
00412 SoBufferAsyncNotifierInterface* getAsyncBufferNotifier() const;
00413
00414
00415 private:
00419 bool m_fixedResolution;
00420
00421
00422 static void redrawSensorCB(void *data, SoSensor *sensor);
00423 void scheduleRedraw();
00424
00426 static void stoppedInteractionCB(void *data, SoSensor *sensor);
00427
00428
00429
00430
00431
00432
00433 SoTimerSensor *m_scheduleRedrawSensor;
00434 bool m_scheduleRedrawIndicator;
00435 SbThreadMutex* m_redrawSensorMutex;
00436
00437
00438
00439
00440 SbBool m_geomChangeNotify;
00441 SbThreadMutex* m_geomChangeNotifyMutex;
00442 SbBool m_moving;
00443
00444
00445 LDM_TILE_ID_TYPE m_numTileIDs;
00446 int m_numFileIDs;
00447 int m_levelMax;
00448
00449
00450
00451 bool m_updatingTopology;
00452
00453 int m_maxSliceVisualRes;
00454
00456 SoAlarmSensor m_userInteractionAlarm;
00457 private:
00458
00459
00460 SoLDMAsyncBufferNotifier* m_asyncBufferNotifier;
00461
00462
00463 static float s_ldmRedrawRate;
00464 };
00465
00466
00467 void
00468 SoLDMNodeFrontManager::setFixedResolution(bool flag)
00469 {
00470 m_fixedResolution = flag;
00471 }
00472
00473
00474 inline float SoLDMNodeFrontManager::getWeight(SoLDMTileID)
00475 {
00476 return 0.f;
00477 }
00478
00479 inline int SoLDMNodeFrontManager::getNextLoadedStepLevel(int)
00480 {
00481 return 0;
00482 }
00483
00484 inline void SoLDMNodeFrontManager::init(SbBool)
00485 {
00486 }
00487
00488 inline int
00489 SoLDMNodeFrontManager::getNumFileIDsAtResolution(int)
00490 {
00491 return 0;
00492 }
00493
00494 inline void
00495 SoLDMNodeFrontManager::tryUpdateNode(int& , LDM_TILE_ID_TYPE ,int , int )
00496 {
00497 }
00498
00499 #endif // _SO_LDM_NODE_FRONT_MGR__
00500
00501
00502