VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtObserverModeManager.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (c) 2012 MAK Technologies, Inc.
00003  * All rights reserved.
00004  *****************************************************************************/ 
00005 
00009 
00010 #pragma once
00011 
00012 #include <vrvCore/vrvCore.h>
00013 #include <vrvUtil/DtBaseSettingsManager.h>
00014 #include <makArchives/DtObserverModesRecord.h>
00015 #include <vrvCore/DtObserverMode.h>
00016 #include <string>
00017 #include <map>
00018 
00019 namespace makVrv
00020 {
00021 
00022    class DtDe;
00023    class DtStringKeyConverter;
00024 
00029    class DT_DLL_VRVCORE DtObserverModeManager
00030       : public DtBaseSettingsManager<makArchives::DtObserverModesRecord>
00031    {
00032    public:
00033 
00035       typedef std::map<int, DtObserverMode> ObserverModes;
00036 
00037    public:
00038 
00040       static DtObserverModeManager& instance( DtDe& de );
00041 
00043       virtual ~DtObserverModeManager();
00044 
00047       const ObserverModes& observerModes() const;
00048 
00050       int numberOfObserverModes() const;
00051 
00055       virtual int createObserverMode( const std::string& stringKey,
00056          const std::string& displayName );
00057 
00061       virtual int createIntKey( const std::string& stringKey );
00062 
00064       virtual void removeObserverMode( int mode );
00065 
00068       int lookupObserverModeIntKey( std::string stringKey ) const;
00069 
00071       const std::string* findObserverModeStringKey( int intKey )  const;
00072 
00074       bool getObserverModeById( int intKey, DtObserverMode& result ) const;
00075 
00080       bool getObserverModeByName( const std::string& observerModeName,
00081          DtObserverMode& result );
00082 
00084       std::string name( int intKey ) const;
00085 
00087       void setName( int intKey, const std::string& name );
00088 
00090       int modelSet( int intKey ) const;
00091 
00094       void setModelSet( int intKey, int modelSet );
00095 
00097       std::string keyMap( int intKey ) const;
00098 
00101       void setKeyMap( int intKey, const std::string& keyMap );
00102 
00104       void setIs2D( int intKey, bool trueOrFalse );
00105 
00107       bool is2D( int intKey ) const;
00108 
00110       void setGainPrecision( int intKey, int precision );
00111 
00113       int gainPrecision( int intKey ) const;
00114 
00116       void setModelScaleFactor( int intKey, double modelScaleFactor );
00117 
00119       double modelScaleFactor( int intKey ) const;
00120 
00122       void setModelScaleType( int intKey, DtObserverObject::ScaleType modelScaleType );
00123 
00125       DtObserverObject::ScaleType modelScaleType( int intKey ) const;
00126 
00128       void setMaxModelScaleFactor( int intKey, double maxModelScaleFactor );
00129 
00131       double maxModelScaleFactor( int intKey ) const;
00132 
00134       void setMaxLinearModelScaleFactor( int intKey, double maxLinearModelScaleFactor );
00135 
00137       double maxLinearModelScaleFactor( int intKey ) const;
00138 
00140       void setOrbitSpeedGain( int intKey, int gain );
00141 
00143       int orbitSpeedGain( int intKey ) const;
00144 
00146       void setLinearScaledSpeedGain( int intKey, int gain ); 
00147 
00149       int linearScaledSpeedGain( int intKey ) const;
00150 
00152       void setLinearUnscaledSpeedGain( int intKey, int gain );
00153 
00155       int linearUnscaledSpeedGain( int intKey ) const;
00156 
00158       void setRotationSpeedGain( int intKey, int gain );
00159 
00161       int rotationSpeedGain( int intKey ) const;
00162 
00167       void setObserverSetting( int intKey, int settingKey, bool val );
00168 
00173       bool observerSetting( int intKey, int settingKey ) const;
00174 
00177 
00179       virtual void loadDefaultSettings( bool loadOnlyDefaultSettings );
00180 
00182       virtual void loadDefaultSettings( bool loadOnlyDefaultSettings, bool merge );
00183 
00186       using DtBaseSettingsManager<makArchives::DtObserverModesRecord>::importSettings;
00187 
00189       virtual void importSettings( const std::string& filepath, bool merge );
00190 
00192       virtual void exportObserverMode( int intKey,
00193          const std::string& filepath ) const;
00194 
00196       virtual void setFromRecord( const makArchives::DtObserverModesRecord& record );
00197 
00202       virtual void setFromRecord( const makArchives::DtObserverModesRecord& record,
00203          bool merge );
00204 
00206       virtual void setObserverModeFromRecord( const makArchives::DtObserverModesRecord& record,
00207          int intKey );
00208 
00210       virtual void getRecord( makArchives::DtObserverModesRecord& record ) const;
00211 
00213 
00214    public:
00215 
00217       boost::signal<void (int)> observerModeKeyMapChanged;
00218 
00220       boost::signal<void (int)> observerModeModelSetChanged;
00221 
00222       // \brief signal that the indicated observer mode's dimension changed
00223       boost::signal<void (int)> observerModeIs2DChanged;
00224 
00226       boost::signal<void (int)> observerModeNameChanged;
00227 
00229       boost::signal<void (int, int,bool)> observerModeSettingChanged;
00230 
00232       boost::signal<void (int)> observerModeGainPrecisionChanged;
00233 
00235       boost::signal<void (int)> observerModeOrbitSpeedGainChanged;
00236 
00238       boost::signal<void (int)> observerModeRotationSpeedGainChanged;
00239 
00241       boost::signal<void (int)> observerModeLinearScaledSpeedGainChanged;
00242 
00244       boost::signal<void (int)> observerModeLinearUnscaledSpeedGainChanged;
00245 
00247       boost::signal<void (int)> observerModeModelScaleFactorChanged;
00248 
00250       boost::signal<void (int)> observerModeModelScaleTypeChanged;
00251 
00253       boost::signal<void (int)> observerModeMaxModelScaleFactorChanged;
00254 
00256       boost::signal<void (int)> observerModeMaxLinearModelScaleFactorChanged;
00257 
00259       boost::signal<void (int)> observerModeAdded;
00260 
00262       boost::signal<void (int)> observerModeToBeRemoved;
00263 
00264    protected:
00265 
00267       template <typename ManagerClass>
00268       friend ManagerClass& defaultManagerInstanceFunction( DtDe&, bool );
00269 
00271       template <typename ManagerClass>
00272       friend void defaultManagerRegisterInstanceFunction( DtDe&, ManagerClass* );
00273 
00275       friend class DtObserverModeManagerCreator;
00276 
00278       DtObserverModeManager( DtDe& );
00279 
00282       DtObserverMode* getObserverModePtr( int intKey );
00283 
00286       virtual void addObserverMode( const DtObserverMode& mode );
00287 
00289       virtual void clear();
00290 
00291    protected:
00292 
00294       typedef std::map<std::string,int> ObserverModesMap;
00295 
00296       DtStringKeyConverter* myStringKeyConverter;
00297 
00298       // The map of visual modes (from id to DtObserverMode)
00299       ObserverModes myObserverModes;
00300 
00301       // map from name to id
00302       ObserverModesMap myObserverModesMap;
00303 
00304    };
00305 
00306 
00309    class DT_DLL_VRVCORE DtObserverModeManagerCreator : public DtVirtualBaseClass
00310    {
00311    public:
00312 
00314       DtObserverModeManagerCreator();
00315 
00317       virtual ~DtObserverModeManagerCreator();
00318 
00321       static DtObserverModeManagerCreator& instance( DtDe& de );
00322 
00324       virtual DtObserverModeManager* create( DtDe& );
00325 
00326    };
00327 
00328 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)