VR-Vantage API Documentation
DtFaccManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: $ $Revision: $ $State: $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvCore/vrvCore.h>
15 #include <vrvCore/DtFeature.h>
16 #include <vrvUtil/DtUnicode.h>
18 #include <vrvUtil/DtFaccCode.h>
19 #include <boost/unordered_map.hpp>
20 #include <boost/signal.hpp>
21 #include <map>
22 
23 namespace makArchives
24 {
25  class DtFeatureSettingsRecord;
26 }
27 
28 namespace makVrv
29 {
30  class DtFaccSignaler;
31  class DtDeSettings;
32 
33  class DtFaccInfo
34  {
35  public:
36 
38  : myName(name)
39  {
40  myColor[3] = myColor[2] = myColor[1] = myColor[0] = 1.0f;
41  }
42 
43  DtFaccInfo(const DtUnicode& name, float r, float g, float b, float a)
44  : myName(name)
45  {
46  myColor[0] = r;
47  myColor[1] = g;
48  myColor[2] = b;
49  myColor[3] = a;
50  }
51 
52  const DtUnicode& name() const
53  {
54  return myName;
55  }
56 
57  void setName(const DtUnicode& name)
58  {
59  myName = name;
60  }
61 
62  const float* color() const
63  {
64  return myColor;
65  }
66 
67  void setColor(const float color[4])
68  {
69  memcpy(myColor,color,sizeof(float[4]));
70  }
71 
72  protected:
74  float myColor[4];
75  };
76 
81  {
82  public:
83 
84  //Using std::map to ensure that the Info is sorted by facc code.
85  typedef std::map<DtFaccCode, DtFaccInfo> FaccCodeInfo;
86 
88  static DtFaccManager& instance(DtDe& de);
89 
92  static void registerInstance(DtDe& de, DtFaccManager* );
93 
95  virtual ~DtFaccManager();
96 
98  DtFaccInfo categoryInfo(const DtFaccCode& code) const;
99 
101  DtFaccInfo subcategoryInfo(const DtFaccCode& code) const;
102 
104  DtFaccInfo info(const DtFaccCode& code) const;
105 
108  virtual void setFaccInfo(const DtFaccCode& code, const DtFaccInfo& info,
109  bool disableAutoSave = false);
110 
112  virtual void removeFaccInfo(const DtFaccCode& code);
113 
115  const FaccCodeInfo& features() const;
116 
118  virtual void setFromRecord(const makArchives::DtFeatureSettingsRecord& record);
119 
121  virtual void getRecord(makArchives::DtFeatureSettingsRecord& record) const;
122 
124  virtual void exportSettings(const std::string& filename);
125 
127  virtual void importSettings(const std::string& filename);
128 
130  virtual DtDeSettings* settings();
131 
132  protected:
133 
135  DtFaccManager(DtDe& de);
136 
137  virtual void loadDefaults();
138  virtual void autoSave();
139 
140  protected:
144  };
145 
149  {
150  public:
151 
153  static DtFaccSignaler& instance(DtDe&);
154 
155  virtual ~DtFaccSignaler();
156 
158  boost::signal< void (const DtFaccCode&, const DtFaccInfo&) > signal_infoChanged;
159 
160  protected:
161 
162  DtFaccSignaler();
163 
164  };
165 }


Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)