![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtTerrainPatch.h,v $ $Revision: 1.46 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtTerrainPatch_H_ 00014 #define DtTerrainPatch_H_ 00015 00016 #include <vrvCore/vrvCore.h> 00017 #include <vrvCore/DtTerrainLayer.h> 00018 #include <vrvCore/DtOverlaySettings.h> 00019 #include <vrvCore/DtSurfacesSettings.h> 00020 #include <vrvUtil/DtVirtualBaseClass.h> 00021 00022 #include <makArchives/DtTerrainPatchRecord.h> 00023 00024 #include <string> 00025 #include <map> 00026 #include <vector> 00027 #include <list> 00028 00029 namespace makVrv 00030 { 00031 class DtTerrainPatchObject; 00032 class DtTerrainPatchObjectAgent; 00033 class DtSceneObjectAgent; 00034 class DtAgentManagerInterface; 00035 class DtModelAgent; 00036 class DtDe; 00037 00040 class DT_DLL_VRVCORE DtTerrainPatch : public DtTerrainLayer 00041 { 00042 public: 00043 00045 enum GdbSurface { 00046 AsphaltOrOtherHardSurface=0, 00047 Boulder=1, 00048 Building=2, 00049 CultivatedFields=3, 00050 DeepBrook=4, 00051 DeepLake=5, 00052 DeepPond=6, 00053 DeepRiver=7, 00054 DeepStream=8, 00055 DirtRoad=9, 00056 DryGround=10, 00057 EuroRailRoad=11, 00058 Flimsy=12, 00059 Forest=13, 00060 Grass=14, 00061 GravelRoad=15, 00062 Icy=16, 00063 IcyGround=17, 00064 Moon=18, 00065 Mud=19, 00066 MuddyRoad=20, 00067 Ocean=21, 00068 Orchards=22, 00069 PavedRoad=23, 00070 Rock=24, 00071 Sand=25, 00072 ShallowBrook=26, 00073 ShallowLake=27, 00074 ShallowPond=28, 00075 ShallowRiver=29, 00076 ShallowStream=30, 00077 SnowGround=31, 00078 SoftSoil=32, 00079 Swamp=33, 00080 Tree=34, 00081 USRailRoad=35, 00082 UndefinedSoilType=36, 00083 Unspecified=37, 00084 UnspecifiedBodyOfWater=38, 00085 UnspecifiedCulturalFeature=39, 00086 UnspecifiedEnvStateGround=40, 00087 WetGround=41, 00088 }; 00089 00091 DtTerrainPatch(DtDe& de, DtAgentManagerInterface& sceneInterface, 00092 const std::string& terrainDefinition); 00093 00095 ~DtTerrainPatch(); 00096 00097 private: 00098 //not copyable. 00099 DtTerrainPatch(const DtTerrainPatch& copy); 00100 DtTerrainPatch& operator=(const DtTerrainPatch& copy); 00101 00102 public: 00103 00105 00106 00108 virtual void getRecord(makArchives::DtTerrainPatchRecord& rec) const; 00109 00111 virtual void setFromRecord(const makArchives::DtTerrainPatchRecord& rec); 00112 00114 00116 00117 00119 const std::string& definition() const; 00120 00122 DtUniqueID uniqueID() const; 00123 00125 DtTerrainPatchObjectAgent* agent(); 00126 00128 const DtTerrainPatchObjectAgent* agent() const; 00129 00131 inline DtDe& de() { return myDe;} 00132 00134 inline const DtDe& de() const { return myDe; } 00135 00137 DtOverlaySettings& overlaySettings(); 00138 00140 const DtOverlaySettings& overlaySettings() const; 00141 00143 const makArchives::DtTerrainPatchRecord::ExtractionOperations& 00144 extractionOperations() const; 00146 00148 00149 00151 void setSurfaceVisible(int surfaceId, bool state); 00152 00154 bool surfaceVisible(int surfaceId); 00155 00157 DtSurfacesSettings::SurfaceIdList const& surfaceIds(); 00158 00160 void loadSurfacesSettings(); 00161 00163 00165 00166 00171 virtual void setExtractedNodeAsPropModel( DtProp* prop , 00172 bool setObjectPosition = false); 00173 00175 virtual int countNodes(const std::string& rules) const; 00176 00178 virtual void extractNodes(const std::string& rule, bool isRegEx); 00179 00182 virtual void moveNode(DtSceneObjectAgent* objectDriver, 00183 DtModelAgent* model, const std::string& rule, unsigned int index); 00184 00186 virtual void addExtractNodeOperation(std::string const& searchExp, 00187 bool isRegEx, std::string const& propType, unsigned int count); 00188 00189 00191 void extractNodesToProps(const std::string& exp, bool isRegEx, 00192 const std::string& type, const std::string& modelDefinition); 00193 00195 void executeExtractionOperation( const 00196 makArchives::DtExtractionOperationRecord& extractionRec); 00197 00198 typedef std::pair<std::string, std::string> ExtractionRule; 00199 typedef std::vector<ExtractionRule> ExtractionRuleList; 00201 ExtractionRuleList extractionRules(); 00202 00204 00207 void extractNodesToTrees(std::string const& searchExp, bool isRegEx, 00208 std::string const& treeSpecies); 00209 00210 00211 protected: 00212 00214 void onTerrainPatchObjectAvailable(DtUniqueID id); 00215 00218 void executeExtractionOperations( const 00219 makArchives::DtTerrainPatchRecord::ExtractionOperations& ops ); 00220 00222 void createPropsFromRecord(const 00223 makArchives::DtPropSettingsRecord& propSettings); 00224 00226 void getPropSettingsRecord( 00227 makArchives::DtPropSettingsRecord& record) const; 00228 00233 void createPropsFromExtraction( DtTerrainPatchObject& tpo, 00234 makArchives::DtPropRecord* protoTypeRecord, 00235 const std::string& exp, bool isRegEx, std::vector<std::string> matches);//unsigned int numProps); 00236 00237 protected: 00238 00239 std::string myDefinition; 00240 00241 DtTerrainPatchObjectAgent* myTerrainAgent; 00242 00243 DtOverlaySettings myOverlaySettings; 00244 DtSurfacesSettings mySurfacesSettings; 00245 00246 makArchives::DtTerrainPatchRecord::ExtractionOperations myExtractionHistory; 00247 }; 00248 00251 class DT_DLL_VRVCORE DtTerrainPatchSignaler : public DtVirtualBaseClass 00252 { 00253 public: 00254 00256 static DtTerrainPatchSignaler& instance(DtDe& de); 00257 00259 virtual ~DtTerrainPatchSignaler(); 00260 00262 boost::signal<void (DtTerrainPatch&,int surfaceId, bool state)> 00263 signal_surfaceVisibilityChanged; 00264 00265 protected: 00266 DtTerrainPatchSignaler(); 00267 00268 }; 00269 } 00270 00271 #endif 00272