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_TILE_MANAGER_
00025 #define _SO_LDM_TILE_MANAGER_
00026
00027 class SbBox3i32;
00028 class SoLDMTileID;
00029 class SoTransferFunction;
00030 class SoLDMDataAccess;
00031 class SoLdmSubDivisionPolicy;
00032 class SoState;
00033 class SoBufferObject;
00034
00035 #include <LDM/SoLDMLargeDataManagement.h>
00036 #include <LDM/SoLDMNodeFrontManager.h>
00037
00038 #include <Inventor/STL/vector>
00099 SoEXTENDER_Documented class SoLDMTileManager : public SoLDMLargeDataManagement {
00100
00101 public:
00105 SoLDMTileManager(){};
00106
00110 virtual ~SoLDMTileManager(){};
00111
00112 SoEXTENDER_Documented public:
00120 virtual void init(SoLDMTileID tilesToLoad) = 0;
00121
00125 virtual void startNumDataNotify(int id = -1, int entry = -1) = 0;
00126
00130 virtual void endNumDataNotify (bool isAdded, bool sync, bool shouldInit=false) = 0;
00131
00136 virtual SbVec3i32 getTileDimension(SoLDMTileID tileID) const = 0;
00137
00163 virtual void startTransaction() = 0;
00164
00168 virtual void endTransaction() = 0;
00169
00176 virtual bool checkResidencyAndUpdateWeight(SoLDMTileID tileID, float weight) = 0;
00177
00182 virtual bool isInMemory(SoLDMTileID tileID) const = 0;
00183
00193 virtual bool isDataInMemory(const SoLDMTileID& tileID) const = 0;
00194
00200 virtual bool requestRefetch(const SoLDMTileID& tileID, const double weight) const = 0;
00201
00202
00210 virtual const SoBufferObject* getTile(SoLDMTileID tileID, unsigned short dataSetId) = 0;
00211
00218 virtual const SoBufferObject* getTileExt(SoLDMTileID tileID, unsigned short dataSetId) = 0;
00219
00225 class LDMSliceAccessor {
00226
00227 public:
00231 virtual ~LDMSliceAccessor() {}
00232
00237 virtual SoBufferObject* getOrthoSliceBuffer(const SoLDMTileID& tile, int sliceAxis, int slice, SoState * state=NULL, bool useExtendedData=false) = 0;
00238
00242 virtual void releaseOrthoSliceBuffer(SoBufferObject*) = 0;
00243
00247 virtual void setLargeSliceSupport (SbBool flag) =0;
00248 };
00249
00257 virtual LDMSliceAccessor* getLdmSliceAccessor(const SoLDM::DataSetIdPair& p) = 0;
00258
00265 virtual bool getMinMax(SoLDMTileID tile, double& min, double& max) const = 0;
00266
00273 virtual void getTileData( const std::vector<SoLDMTileID>& tileIDs, int& errorIndicator, unsigned short volumeDataId,SoLDMDataAccess* pDataAccess ) = 0;
00274
00281 virtual bool requestTileData(int requestId, int& memError, SoLDMDataAccess& dataAccess);
00282
00288 virtual void releaseTileData(SoLDMTileID tileID, unsigned short dataSetId = -1) = 0;
00289
00296 virtual void resourceChangeNotify() = 0;
00297
00302 virtual void setAllowLoading(bool allowLoad) = 0;
00303
00308 virtual void resetWeights() = 0;
00309
00316 virtual void prioritizeTiles(SoLDMTileID maxTileId) = 0;
00317
00323 virtual void updateRegions(const SbBox3i32* region, int numRegions) = 0;
00324
00330 virtual int getMemoryUsed() const = 0;
00331
00337 virtual void flushTilesOfRes(int resolution) = 0;
00338
00343 virtual void getTileIDInMemory(std::vector<LDM_TILE_ID_TYPE>& tilesInMemory) const;
00344
00348 virtual void shouldInit() {};
00349
00353 virtual void unLockTiles()=0;
00354
00358 virtual void lockTiles() =0;
00359
00363 virtual void lockTile( const SoLDMTileID& tileId ) =0;
00364
00368 virtual void unLockTile( const SoLDMTileID& tileId, bool forceUnload = false ) =0;
00369
00370 #if 1 SoDEPRECATED
00379 virtual void getTileData( const std::vector<SoLDMTileID>& tileIDs, int& errorIndicator, unsigned short volumeDataId)
00380 {
00381 getTileData( tileIDs, errorIndicator, volumeDataId, NULL);
00382 }
00383
00384 #endif
00386 private:
00387 typedef std::vector<SbBox3i32> BoxesList;
00388
00392 virtual void setSubTileManager(const SoType& type);
00393
00397 virtual void getSubDivisedTiles(BoxesList* &tilesBoxes, SoLdmSubDivisionPolicy* policy, SoLDMTileID tile, bool ordered);
00398
00399 virtual bool isLoadOver() { return false; };
00400
00401 virtual void replaceTileBuffer(const SoLDMTileID &, const unsigned short &, SoBufferObject* ) {};
00402
00403
00404 virtual void cacheTileBuffer(const SoLDMTileID& SO_UNUSED_PARAM(tileId), unsigned short SO_UNUSED_PARAM(datasetid)) {};
00405
00406
00407
00408 virtual void prefetchTiles(SoLDMMediator* SO_UNUSED_PARAM(mediator), const SoLDM::TileIdVector& SO_UNUSED_PARAM(tilesList), int SO_UNUSED_PARAM(startPos = 0)) {};
00409
00410 virtual void updateTile(const SbBox3i32& , const SoLDMTileID& );
00411
00412
00413 virtual bool getSaveState();
00414 virtual void setSaveState(bool flag );
00415
00416
00417 virtual void waitForAllLoadersIdle() {};
00418 virtual void setTileHasChanged ( const SoLDMTileID& , const unsigned short &) {};
00419
00421 virtual void recomputeSubtiles(const SoLDMTileID&, unsigned short) {}
00422
00423 private:
00424
00431 virtual void notifyDataChange(const SbBox3i32* region, int numRegions);
00432
00438 virtual void notifyDataAvailable(){getNodeFrontManager()->geomChangeNotify(TRUE);};
00439 virtual SoBufferObject* getTilePointer( SoLDMTileID , unsigned short ) { return NULL;};
00440
00441 bool m_bSaveState;
00442
00443 };
00444
00445 inline bool
00446 SoLDMTileManager::requestTileData(int , int& , SoLDMDataAccess& )
00447 {
00448 SoError::post("Doing an synchronous request with a base SoLDMTileManager class."
00449 " You must create your own TileManager implementing requestTileData method.");
00450 return false;
00451 }
00452
00453 inline void
00454 SoLDMTileManager::getTileIDInMemory(std::vector<LDM_TILE_ID_TYPE>& ) const
00455 {
00456 }
00457
00458 inline void
00459 SoLDMTileManager::getSubDivisedTiles(BoxesList* &, SoLdmSubDivisionPolicy* , SoLDMTileID , bool )
00460 {
00461 }
00462
00463 inline void
00464 SoLDMTileManager::setSubTileManager(const SoType&)
00465 {
00466 }
00467
00468 inline void
00469 SoLDMTileManager::notifyDataChange(const SbBox3i32* , int )
00470 {
00471 }
00472
00473 inline void
00474 SoLDMTileManager::updateTile(const SbBox3i32& , const SoLDMTileID& )
00475 {
00476 }
00477
00478 inline bool
00479 SoLDMTileManager::getSaveState()
00480 {
00481 return FALSE;
00482 }
00483
00484 inline void
00485 SoLDMTileManager::setSaveState(bool flag)
00486 {
00487 m_bSaveState = flag;
00488 }
00489
00490 #endif // _SO_LDM_TILE_MANAGER_
00491
00492
00493