![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2012 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvUtil/vrvUtil.h> 00013 #include <vrvUtil/DtConfiguration.h> 00014 #include <vrvUtil/DtDebugLog.h> 00015 #include <vrvUtil/DtDeConfiguration.h> 00016 #include <vrvUtil/DtDriverConfiguration.h> 00017 #include <vrvUtil/DtGuiConfiguration.h> 00018 #include <vrvUtil/DtDePathConfiguration.h> 00019 #include <vrvUtil/DtInputDriverConfiguration.h> 00020 #include <vrvUtil/DtRecordHolder.h> 00021 00022 #include <makArchives/DtObserverStateRecord.h> 00023 #include <makArchives/DtSerialize.h> 00024 00025 #include <vector> 00026 00027 namespace makVrv 00028 { 00029 00030 class DtBaseRecordHolder; 00031 00034 class DT_DLL_VRVUTIL DtDeInitializer : public DtConfiguration 00035 { 00036 public: 00037 00038 enum DeMode 00039 { 00040 NoMode = 0, 00041 MasterMode = 1, 00042 SlaveMode = 2, 00043 DeMode_end 00044 00045 }; 00046 00049 enum DeFeatures 00050 { 00051 Features_None = 0, 00052 Features_2D = 1, 00053 Features_3D = 2, 00054 Features_XR = Features_3D | Features_2D, 00055 DeFeatures_end 00056 }; 00057 00058 00062 typedef std::vector<std::pair<std::string,DtConfiguration> > 00063 DriverInstanceList; 00064 00068 typedef std::map<std::string, std::string> AuthorizationCodeMap; 00069 00071 typedef std::vector<std::pair<std::string, makArchives::DtObserverStateRecord> > 00072 ObserverStateMap; 00073 00075 typedef std::map<std::string,DtBaseRecordHolder*> DefaultRecordMap; 00076 00077 struct DisplayConnection 00078 { 00079 int port; 00080 std::string address; 00081 DtDisplayConfiguration configuration; 00082 00083 template<class Archive> 00084 void serialize(Archive & ar, const unsigned int version) 00085 { 00086 ar & BOOST_SERIALIZATION_NVP(port); 00087 ar & BOOST_SERIALIZATION_NVP(address); 00088 ar & BOOST_SERIALIZATION_NVP(configuration); 00089 } 00090 }; 00091 00092 typedef std::vector<DisplayConnection> DisplayConnections; 00093 00094 public: 00095 00098 DtDeInitializer( const std::string& name = "" ); 00099 00101 DtDeInitializer( const DtDeInitializer& initializer ); 00102 00104 DtDeInitializer& operator = ( const DtDeInitializer& initializer ); 00105 00107 virtual ~DtDeInitializer(); 00108 00110 void setFeatures( DeFeatures features ); 00111 00113 DeFeatures features() const; 00114 00116 bool featureSupported( DeFeatures feature ) const; 00117 00123 DT_DECLARE_serialize_FUNCTIONS 00124 00127 const DtDriverConfiguration& driverConfiguration() const; 00128 DtDriverConfiguration& driverConfiguration(); 00130 00132 void setDriverConfiguration(const DtDriverConfiguration&); 00133 00136 const DtGuiConfiguration& guiConfiguration() const; 00137 DtGuiConfiguration& guiConfiguration(); 00139 00141 void setGuiConfiguration( const DtGuiConfiguration& config ); 00142 00145 const DtInputDriverConfiguration& inputDriverConfiguration() const; 00146 DtInputDriverConfiguration& inputDriverConfiguration(); 00148 00150 void setInputDriverConfiguration( const DtInputDriverConfiguration& config ); 00151 00153 const std::string& displayName() const; 00154 00156 void setDisplayEngineName( const std::string& name ); 00157 00159 DtDeInitializer::DeMode deMode() const; 00160 00162 void setDeMode( DtDeInitializer::DeMode mode ); 00163 00165 void setDefaultDrivers( const DriverInstanceList& drivers ); 00166 00168 const DriverInstanceList& defaultDrivers() const; 00169 00171 void setDeConfiguration( const DtDeConfiguration& config ); 00172 00174 DtDeConfiguration& deConfiguration(); 00175 00177 const DtDeConfiguration& deConfiguration() const; 00178 00180 void setCoordinateSystem( const std::string& coordinateSystem, 00181 const std::string& parameters ); 00182 00184 const std::string& coordinateSystem() const; 00185 00187 const std::string& coordinateSystemParameters() const; 00188 00190 void setNotifyLevel( DtDebugLog::PrintLevel level ); 00191 00193 DtDebugLog::PrintLevel notifyLevel() const; 00194 00196 void setLogFileName( const std::string& filename ); 00197 00199 const std::string& logFileName() const; 00200 00203 void setAutoLoadDrivers( bool autoLoad ); 00204 00207 bool autoLoadDrivers() const; 00208 00210 void setAutoStartDrivers( const std::vector<std::string>& names ); 00211 00213 const std::vector<std::string>& autoStartDrivers() const; 00214 00216 void setAuthorizationCodeMap( const AuthorizationCodeMap& map ); 00217 00219 void addAuthorizationCodeMapping( const std::string& key, 00220 const std::string& value ); 00221 00223 void removeAuthorizationCodeMapping( const std::string& key ); 00224 00227 const std::string* findAuthorizationCodeValue( const std::string& key ) const; 00228 00230 void setObserverStateMap( const ObserverStateMap& osm ); 00231 00233 const ObserverStateMap& observerStateMap() const; 00234 00236 const std::vector<std::string>& mappingFilesToLoad() const; 00237 00239 void setMappingFilesToLoad( const std::vector<std::string>& ); 00240 00242 const DisplayConnections& displayConnections() const; 00243 DisplayConnections& displayConnections(); 00244 00245 void setDisplayConnections( const DisplayConnections& displayConnections ); 00246 00248 void setAutoLoadFile( const std::string& file ); 00249 00251 const std::string& autoLoadFile() const; 00252 00254 void setStartFullScreen( bool ); 00255 00257 bool startFullScreen() const; 00258 00260 void addDefaultSettingsRecord( const std::string& recordName, 00261 const DtBaseRecordHolder& record ); 00262 00264 void removeDefaultSettingsRecord( const std::string& record ); 00265 00267 template <typename RecordType> 00268 bool findDefaultSettingsRecord( const std::string& name, RecordType& record ) const 00269 { 00270 DefaultRecordMap::const_iterator iter = myDefaultRecords.find( name ); 00271 if ( iter != myDefaultRecords.end() ) 00272 { 00273 const DtRecordHolder<RecordType>* holder = 00274 dynamic_cast<const DtRecordHolder<RecordType>*>( iter->second ); 00275 if ( holder ) 00276 { 00277 record = holder->record(); 00278 return true; 00279 } 00280 } 00281 00282 return false; 00283 } 00284 00286 void setConstrainToTerrain( bool constrain ); 00287 bool constrainToTerrain() const; 00288 00290 void setSpeedScaling( bool scale ); 00291 bool speedScaling() const; 00292 00294 void setVertexSelectsParent( bool selectsParent ); 00295 bool vertexSelectsParent() const; 00296 00298 void setDoubleBuffering( bool buffer ); 00299 bool doubleBuffer() const; 00300 00302 void setVSync( bool sync ); 00303 bool vsync() const; 00304 00307 void setFixedFrameRate( unsigned int framesPerSecond ); 00308 unsigned int fixedFrameRate() const; 00309 00311 void setPathConfiguration( const DtDePathConfiguration& pathConfig ); 00312 00314 DtDePathConfiguration& pathConfiguration(); 00315 00317 const DtDePathConfiguration& pathConfiguration() const; 00318 00321 void setInitLibXml( bool enabled ); 00322 00325 bool initLibXml() const; 00326 00328 void setCheckForData( bool check ); 00329 00331 bool checkForData() const; 00332 00333 protected: 00334 00335 template<class Archive> 00336 void _serialize(Archive & ar, const unsigned int version) 00337 { 00338 ar & DT_SERIALIZE_BASE(DtConfiguration); 00339 ar & DT_SERIALIZE_MEMBER(myDriverConfiguration); 00340 ar & DT_SERIALIZE_MEMBER(myGuiConfiguration); 00341 ar & DT_SERIALIZE_MEMBER(myInputDriverConfiguration); 00342 ar & DT_SERIALIZE_MEMBER(myDisplayEngineName); 00343 00344 ar & DT_SERIALIZE_MEMBER(myDeMode); 00345 ar & DT_SERIALIZE_MEMBER(myDriverInstances); 00346 ar & DT_SERIALIZE_MEMBER(myCoordinateSystem); 00347 ar & DT_SERIALIZE_MEMBER(myCoordinateSystemParameters); 00348 00349 ar & DT_SERIALIZE_MEMBER(myDeConfiguration); 00350 00351 ar & DT_SERIALIZE_MEMBER(myAutoLoadDriversFlag); 00352 00353 ar & DT_SERIALIZE_MEMBER(myAutoStartDrivers); 00354 ar & DT_SERIALIZE_MEMBER(myMappingFilesToLoad); 00355 00356 ar & DT_SERIALIZE_MEMBER(myDisplayConnections); 00357 ar & DT_SERIALIZE_MEMBER(myAutoLoadFile); 00358 ar & DT_SERIALIZE_MEMBER(myFullScreenFlag); 00359 ar & DT_SERIALIZE_MEMBER(myConstrainToTerrainFlag); 00360 ar & DT_SERIALIZE_MEMBER(mySpeedScalingFlag); 00361 00362 ar & DT_SERIALIZE_MEMBER(myDoubleBufferFlag); 00363 ar & DT_SERIALIZE_MEMBER(myVSyncFlag); 00364 00365 ar & DT_SERIALIZE_MEMBER(myDefaultRecords); 00366 00367 if (version >= 2) 00368 { 00369 ar & BOOST_SERIALIZATION_NVP(myInitLibXml); 00370 } 00371 if(version >= 3) 00372 { 00373 ar & BOOST_SERIALIZATION_NVP(myFeatures); 00374 } 00375 if(version >= 4) 00376 { 00377 ar & BOOST_SERIALIZATION_NVP(myVertexSelectsParentFlag); 00378 } 00379 00380 if(version >= 5) 00381 { 00382 ar & BOOST_SERIALIZATION_NVP(myCheckForData); 00383 } 00384 } 00385 00386 protected: 00387 00388 DtDriverConfiguration myDriverConfiguration; 00389 DtGuiConfiguration myGuiConfiguration; 00390 DtInputDriverConfiguration myInputDriverConfiguration; 00391 std::string myDisplayEngineName; 00392 00393 DtDePathConfiguration myPathConfiguration; 00394 DtDeConfiguration myDeConfiguration; 00395 00396 DeMode myDeMode; 00397 DriverInstanceList myDriverInstances; 00398 std::string myCoordinateSystem; 00399 std::string myCoordinateSystemParameters; 00400 int myNotifyLevel; 00401 std::string myLogFileName; 00402 00403 bool myAutoLoadDriversFlag; 00404 00406 AuthorizationCodeMap myAuthorizationCodeMap; 00407 00408 std::vector<std::string> myAutoStartDrivers; 00409 ObserverStateMap myObserverStateMap; 00410 std::vector<std::string> myMappingFilesToLoad; 00411 00412 DisplayConnections myDisplayConnections; 00413 std::string myAutoLoadFile; 00414 00415 bool myFullScreenFlag; 00416 bool myConstrainToTerrainFlag; 00417 bool mySpeedScalingFlag; 00418 bool myVertexSelectsParentFlag; 00419 00420 bool myDoubleBufferFlag; 00421 bool myVSyncFlag; 00422 unsigned int myFrameRate; 00423 bool myInitLibXml; 00424 bool myCheckForData; 00425 00426 DefaultRecordMap myDefaultRecords; 00427 00428 DeFeatures myFeatures; 00429 00430 }; 00431 00432 } 00433 00434 BOOST_CLASS_VERSION( makVrv::DtDeInitializer, 5 )