VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtObserverModeManager.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2012 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
15 #include <vrvCore/DtObserverMode.h>
16 #include <string>
17 #include <map>
18 
19 namespace makVrv
20 {
21  class DtObserverModeManager;
22 
24  : public DtRecordSettingsBackup< DtBaseSettingsManager<makArchives::DtObserverModesRecord>,
25  makArchives::DtObserverModesRecord >
26  {
27  public:
28 
30  const std::string& name, const std::string& displayName );
31 
33 
34  virtual void restoreSelected( const DtSettingsBackup* );
35 
36  virtual int currentSelectedObserverMode() const;
37  virtual void setCurrentSelectedObserverMode( int modeKey );
38 
39  protected:
41  };
42 
43  class DtDe;
45 
51  : public DtBaseSettingsManager<makArchives::DtObserverModesRecord>
52  {
53  public:
54 
56  typedef std::map<int, DtObserverMode> ObserverModes;
57 
58  public:
59 
61  static DtObserverModeManager& instance( DtDe& de );
62 
64  virtual ~DtObserverModeManager();
65 
68  const ObserverModes& observerModes() const;
69 
71  int numberOfObserverModes() const;
72 
76  virtual int createObserverMode( const std::string& stringKey,
77  const std::string& displayName );
78 
82  virtual int createModeKey( const std::string& stringKey );
83 
85  virtual void removeObserverMode( int mode );
86 
89  int lookupObserverModeKey( std::string stringKey ) const;
90 
92  const std::string* findObserverModeStringKey( int modeKey ) const;
93 
95  bool getObserverModeById( int modeKey, DtObserverMode& result ) const;
96 
101  bool getObserverModeByName( const std::string& observerModeName,
102  DtObserverMode& result );
103 
105  std::string name( int modeKey ) const;
106 
108  void setName( int modeKey, const std::string& name );
109 
111  int modelSet( int modeKey ) const;
112 
115  void setModelSet( int modeKey, int modelSet );
116 
118  std::string keyMap( int modeKey ) const;
119 
122  void setKeyMap( int modeKey, const std::string& keyMap );
123 
125  void setIs2D( int modeKey, bool trueOrFalse );
126 
128  bool is2D( int modeKey ) const;
129 
131  void setSensor(int modeKey, const std::string& sensorName);
132 
134  std::string sensor( int modeKey ) const;
135 
137  void setGainPrecision( int modeKey, int precision );
138 
140  int gainPrecision( int modeKey ) const;
141 
143  void setModelScaleFactor( int modeKey, double modelScaleFactor );
144 
146  double modelScaleFactor( int modeKey ) const;
147 
149  void setModelScaleType( int modeKey, DtObserverObject::ScaleType modelScaleType );
150 
152  DtObserverObject::ScaleType modelScaleType( int modeKey ) const;
153 
155  void setMaxModelScaleFactor( int modeKey, double maxModelScaleFactor );
156 
158  double maxModelScaleFactor( int modeKey ) const;
159 
161  void setMaxLinearModelScaleFactor( int modeKey, double maxLinearModelScaleFactor );
162 
164  double maxLinearModelScaleFactor( int modeKey ) const;
165 
167  void setOrbitSpeedGain( int modeKey, int gain );
168 
170  int orbitSpeedGain( int modeKey ) const;
171 
173  void setLinearScaledSpeedGain( int modeKey, int gain );
174 
176  int linearScaledSpeedGain( int modeKey ) const;
177 
179  void setLinearUnscaledSpeedGain( int modeKey, int gain );
180 
182  int linearUnscaledSpeedGain( int modeKey ) const;
183 
185  void setRotationSpeedGain( int modeKey, int gain );
186 
188  int rotationSpeedGain( int modeKey ) const;
189 
194  void setObserverSetting( int modeKey, int settingKey, bool val );
195 
200  bool observerSetting( int modeKey, int settingKey ) const;
201 
204 
206  virtual void loadDefaultSettings( bool loadOnlyDefaultSettings );
207 
209  virtual void loadDefaultSettings( bool loadOnlyDefaultSettings, bool merge );
210 
214 
216  virtual void importSettings( const std::string& filepath, bool merge );
217 
219  virtual void exportObserverMode( int modeKey,
220  const std::string& filepath ) const;
221 
223  virtual void setFromRecord( const makArchives::DtObserverModesRecord& record );
224 
229  virtual void setFromRecord( const makArchives::DtObserverModesRecord& record,
230  bool merge );
231 
233  virtual void setObserverModeFromRecord( const makArchives::DtObserverModesRecord& record,
234  int modeKey );
235 
237  virtual void getRecord( makArchives::DtObserverModesRecord& record ) const;
238 
241  virtual DtObserverModesSettingsBackup* observerModeSettingsBackup();
243 
244  public:
245 
247  boost::signal<void (int)> observerModeKeyMapChanged;
248 
250  boost::signal<void (int)> observerModeModelSetChanged;
251 
252  // \brief signal that the indicated observer mode's dimension changed
253  boost::signal<void (int)> observerModeIs2DChanged;
254 
256  boost::signal<void (int)> observerModeNameChanged;
257 
259  boost::signal<void (int)> observerModeSensorChanged;
260 
262  boost::signal<void (int, int,bool)> observerModeSettingChanged;
263 
265  boost::signal<void (int)> observerModeGainPrecisionChanged;
266 
268  boost::signal<void (int)> observerModeOrbitSpeedGainChanged;
269 
271  boost::signal<void (int)> observerModeRotationSpeedGainChanged;
272 
274  boost::signal<void (int)> observerModeLinearScaledSpeedGainChanged;
275 
278 
280  boost::signal<void (int)> observerModeModelScaleFactorChanged;
281 
283  boost::signal<void (int)> observerModeModelScaleTypeChanged;
284 
286  boost::signal<void (int)> observerModeMaxModelScaleFactorChanged;
287 
290 
292  boost::signal<void (int)> observerModeAdded;
293 
295  boost::signal<void (int)> observerModeToBeRemoved;
296 
297  protected:
298 
300  template <typename ManagerClass>
301  friend ManagerClass& defaultManagerInstanceFunction( DtDe&, bool );
302 
304  template <typename ManagerClass>
305  friend void defaultManagerRegisterInstanceFunction( DtDe&, ManagerClass* );
306 
309 
312 
315  DtObserverMode* getObserverModePtr( int modeKey );
316 
319  virtual void addObserverMode( const DtObserverMode& mode );
320 
322  virtual void clear();
323 
324  virtual void initializeBackup();
325 
326  protected:
327 
329  typedef std::map<std::string,int> ObserverModesMap;
330 
332 
333  // The map of visual modes (from id to DtObserverMode)
335 
336  // map from name to id
338 
339  };
340 
341 
345  {
346  public:
347 
350 
352  virtual ~DtObserverModeManagerCreator();
353 
356  static DtObserverModeManagerCreator& instance( DtDe& de );
357 
359  virtual DtObserverModeManager* create( DtDe& );
360 
361  };
362 
363 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)