00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __GZ_ROI_H__
00023 #define __GZ_ROI_H__
00024
00030 #include "gzTransform.h"
00031 #include "gzDynamicLoader.h"
00032 #include "gzSpatial.h"
00033
00034
00035
00036 class gzRoiDependancyInterface : public gzReference
00037 {
00038 public:
00039 GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);
00040
00041 GZ_GRAPH_EXPORT gzRoiDependancyInterface();
00042 GZ_GRAPH_EXPORT virtual ~gzRoiDependancyInterface();
00043
00044 GZ_GRAPH_EXPORT virtual gzULong getDependancyMask()=0;
00045 GZ_GRAPH_EXPORT virtual gzVoid setDependancy(gzBool on)=0;
00046 };
00047
00048 class gzRoi;
00049
00050
00051
00052 class gzRoiNode : public gzTransform , public gzDynamicLoaderInfoInterface
00053 {
00054 public:
00055
00056 GZ_GRAPH_EXPORT gzVoid setRoiPosition(const gzDoubleXYZ & position , gzBool origoAtRoiPosition=TRUE);
00057
00058
00059
00060 GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00061 GZ_GRAPH_EXPORT virtual gzVoid postTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00062
00063 GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);
00064
00065 GZ_GRAPH_EXPORT virtual ~gzRoiNode();
00066
00067 GZ_GRAPH_EXPORT virtual gzVoid onDynamicLoadState(gzDynamicLoadingState state,gzDynamicLoader *loader,gzNode *node);
00068
00069
00070
00071 GZ_GRAPH_EXPORT gzVoid setDependacyManager(gzRoiDependancyInterface *manager);
00072 GZ_GRAPH_EXPORT gzRoiDependancyInterface * getDependacyManager();
00073
00074 private:
00075
00076 friend class gzRoi;
00077
00078 gzRoiNode(const gzString & name=GZ_EMPTY_STRING);
00079
00080 gzDoubleXYZ m_position;
00081
00082 gzDouble m_loadDistanceMag;
00083 gzDouble m_purgeDistanceMag;
00084 gzDouble m_loadDistance;
00085 gzDouble m_purgeDistance;
00086
00087 gzRoi *m_roiManager;
00088
00089 gzDouble m_purgeMinTime;
00090
00091 gzULong m_pendingNodes;
00092
00093 gzRefPointer<gzRoiDependancyInterface> m_depManager;
00094
00095 gzBool m_origoAtRoiPosition;
00096 };
00097
00098
00099
00100 class gzRoi : public gzTransform
00101 {
00102 public:
00103
00104 GZ_GRAPH_EXPORT gzRoi(const gzString & name=GZ_EMPTY_STRING);
00105
00106 GZ_GRAPH_EXPORT virtual ~gzRoi();
00107
00108 GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);
00109
00110
00111
00112 GZ_GRAPH_EXPORT gzVoid setRoiPosition(const gzDoubleXYZ & position);
00113
00114 GZ_GRAPH_EXPORT gzRoiNode *addRoiNode(const gzDoubleXYZ & position , const gzDouble & loadDistance , const gzDouble & purgeDistance , const gzString &url , gzBool origoAtRoiPosition=TRUE, const gzSerializeAdapterFlags & loadFlags=GZ_SERIALIZE_ADAPTER_FLAGS_DEFAULT , const gzReal & scale=0 , const gzReal & heading=0 , const gzReal & pitch=0 , const gzReal & roll=0 , const gzDouble &loadPriority=0.0);
00115
00116 GZ_GRAPH_EXPORT gzVoid removeRoiNode(const gzDoubleXYZ & position , const gzString &url);
00117
00118 GZ_GRAPH_EXPORT gzVoid removeRoiNode(gzRoiNode *node);
00119
00120 GZ_GRAPH_EXPORT gzVoid setPurgeDelayTime(gzDouble seconds);
00121
00122 GZ_GRAPH_EXPORT gzVoid setMinimumCheckDistance(gzDouble distance);
00123
00124 GZ_GRAPH_EXPORT gzVoid loadAtPosition(gzContext *context,const gzDoubleXYZ & position,gzBool waitForLoad);
00125
00126 GZ_GRAPH_EXPORT gzVoid useDistanceValues(gzBool useX , gzBool useY , gzBool useZ);
00127
00128
00129 GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00130
00131
00132 GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00133 GZ_GRAPH_EXPORT virtual gzVoid postTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00134 GZ_GRAPH_EXPORT virtual gzBool isTraversable( gzTraverseAction *action , gzNode *node , gzULong index , gzContext *context );
00135
00136
00137
00138 protected:
00139
00140 friend class gzRoiNode;
00141
00142 GZ_GRAPH_EXPORT gzBool checkRoiNodeActivation(gzContext *context,const gzDoubleXYZ &position,gzRoiNode *node,gzBool waitForLoad,const gzDouble &time,gzMatrix4 *localMat=NULL);
00143
00144 gzDoubleXYZ m_position;
00145
00146
00147 gzDoubleXYZ m_lastRoiPosition;
00148 gzDouble m_lastRoiCheckTime;
00149
00150 gzDouble m_minCheckDistanceMag;
00151 gzDouble m_purgeDelay;
00152
00153 gzBool m_useX,m_useY,m_useZ;
00154
00155 gzSpatialData<gzRefPointer<gzRoiNode> > m_spatialRepository;
00156
00157 gzDouble m_currentInvLodFactorMag;
00158
00159 gzMutex m_nodeLocker;
00160
00161 };
00162
00163
00164
00165 #endif