VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfExtendedIntervisibilitySettings.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 
12 namespace makVrv
13 {
14  class DtDe;
15 }
16 
17 #define DtIntervisibilitySettingsLine "line"
18 #define DtIntervisibilitySettingsFan "fan"
19 #define DtIntervisibilitySettingsObjectFan "object_fan"
20 
21 namespace makVrf
22 {
26  {
27  public:
28  struct Color
29  {
30  Color() : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {};
31  Color(unsigned int color)
32  {
33  r = ((float)COLOR_R(color) / 255.0f);
34  g = ((float)COLOR_G(color) / 255.0f);
35  b = ((float)COLOR_B(color) / 255.0f);
36  a = ((float)COLOR_A(color) / 255.0f);
37  }
38 
39  explicit Color(unsigned int iR, unsigned int iG, unsigned int iB, unsigned int iA)
40  : r((float)iR / 255.0f)
41  , g((float)iG / 255.0f)
42  , b((float)iB / 255.0f)
43  , a((float)iA / 255.0f)
44  {
45  }
46 
47  explicit Color(float iR, float iG, float iB, float iA)
48  : r(iR)
49  , g(iG)
50  , b(iB)
51  , a(iA)
52  {
53  }
54 
55  Color(const Color& orig) : r(orig.r), g(orig.g), b(orig.b), a(orig.a) {};
56  Color& operator=(const Color& orig) { r = orig.r; g = orig.g; b = orig.b; a = orig.a; return* this; };
57  bool compare(float c1, float c2) const { return ((int)(c1 * 255.0f) == (int)(c2 * 255.0f)); };
58  bool operator==(const Color& orig) const { return (compare(r, orig.r) && compare(g, orig.g) && compare(b, orig.b) && compare(a, orig.a)); };
59  bool operator!=(const Color& orig) const { return !(*this == orig); };
60  unsigned int color() const
61  {
62  return COLOR_TO_INT((int)(r * 255.0f), (int)(g * 255.0f), (int)(b * 255.0f), (int)(a * 255.0f));
63  }
64 
65  float r, g, b, a;
66  };
67 
68  enum Flags
69  {
70  UseBackendForIntersections = 0x00000001,
71  IntersectTerrain = 0x00000002,
72  IntersectFeatures = 0x00000004,
73  IntersectEntities = 0x00000008,
74  WaitForServer = 0x00000010,
75 
76  Defaults = UseBackendForIntersections | IntersectTerrain
77  };
78 
80  {
83 
84  int flags;
85  double alpha;
88  unsigned int waitingForServerColor;
89 
90  friend class boost::serialization::access;
91 
92  Color waitingForServerColorRGBA() const
93  {
94  return Color(COLOR_R(waitingForServerColor), COLOR_G(waitingForServerColor),
95  COLOR_B(waitingForServerColor), COLOR_A(waitingForServerColor));
96  }
97 
98  bool useBackendForIntersections() const
99  {
100  return ((flags & UseBackendForIntersections) != 0);
101  }
102 
103  bool intersectTerrain() const
104  {
105  return ((flags & IntersectTerrain) != 0);
106  }
107 
108  bool intersectFeatures() const
109  {
110  return ((flags & IntersectFeatures) != 0);
111  }
112 
113  bool intersectEntities() const
114  {
115  return ((flags & IntersectEntities) != 0);
116  }
117 
118  bool waitForServer() const
119  {
120  return ((flags & WaitForServer) != 0);
121  }
122 
124 
128  template<class Archive>
129  void serialize(Archive & ar, const unsigned int version)
130  {
131  ar & BOOST_SERIALIZATION_NVP(flags);
132  ar & BOOST_SERIALIZATION_NVP(waitTimeRequest);
133  ar & BOOST_SERIALIZATION_NVP(fanModeSamplingRate);
134  ar & BOOST_SERIALIZATION_NVP(waitingForServerColor);
135  }
136  };
137 
138  public:
141 
143 
145  virtual void setUseBackendForIntersections(const std::string& key, bool);
146  virtual bool useBackendForIntersections(const std::string& key) const;
147 
149  virtual void setIntersectTerrain(const std::string& key, bool);
150  virtual bool intersectTerrain(const std::string& key) const;
151 
153  virtual void setIntersectFeatures(const std::string& key, bool);
154  virtual bool intersectFeatures(const std::string& key) const;
155 
157  virtual void setIntersectEntities(const std::string& key, bool);
158  virtual bool intersectEntities(const std::string& key) const;
159 
161  virtual void setFanModeSamplingRate(const std::string& key, double);
162  virtual double fanModeSamplingRate(const std::string& key) const;
163 
165  virtual DtVrfGuiApplicationSetting* clone() const;
166 
168  virtual std::string classType() const;
169 
170  virtual const IntervisibilitySettings& settingsFor(const std::string& key) const;
171  virtual IntervisibilitySettings& settingsFor(const std::string& key);
172 
174  virtual void write(boost::archive::xml_oarchive& out, const unsigned int);
175  virtual void read(boost::archive::xml_iarchive& in, const unsigned int);
176 
180  virtual void setWaitTimeRequest(const std::string& key, double);
181  virtual double waitTimeRequest(const std::string& key) const;
182 
184  virtual void setWaitingForServerColor(const std::string& key, unsigned int);
185  virtual unsigned int waitingForServerColor(const std::string& key) const;
186 
187  virtual void setWaitForServer(const std::string& key, bool);
188  virtual bool waitForServer(const std::string& key) const;
189 
191  virtual int dataVersion() { return 1; };
192 
193  protected:
194  virtual void setFlag(const std::string& key, Flags, bool);
195  virtual bool flagSet(const std::string&, Flags) const;
196 
197  protected:
198  typedef std::map<std::string, IntervisibilitySettings> ExtendedSettings;
200  };
201 
206  {
207  public:
209 
211 
212  virtual const DtVrfExtendedIntervisibilitySettingsData::IntervisibilitySettings& settingsFor(const std::string& key) const;
213  virtual DtVrfExtendedIntervisibilitySettingsData::IntervisibilitySettings& settingsFor(const std::string& key);
214 
216  virtual void setUseBackendForIntersections(const std::string& key, bool);
217  virtual bool useBackendForIntersections(const std::string& key) const;
218 
220  virtual void setIntersectTerrain(const std::string& key, bool);
221  virtual bool intersectTerrain(const std::string& key) const;
222 
224  virtual void setIntersectFeatures(const std::string& key, bool);
225  virtual bool intersectFeatures(const std::string& key) const;
226 
228  virtual void setIntersectEntities(const std::string& key, bool);
229  virtual bool intersectEntities(const std::string& key) const;
230 
234  virtual void setWaitTimeRequest(const std::string& key, double);
235  virtual double waitTimeRequest(const std::string& key) const;
236 
237  static DtVrfExtendedIntervisibilitySettings& instance( makVrv::DtDe& de );
238  static void registerInstance(makVrv::DtDe&, DtVrfExtendedIntervisibilitySettings*);
239 
241  virtual void setWaitingForServerColor(const std::string&, unsigned int);
242  virtual unsigned int waitingForServerColor(const std::string&) const;
243 
245  virtual void setFanModeSamplingRate(const std::string& key, double);
246  virtual double fanModeSamplingRate(const std::string& key) const;
247 
248  virtual void setWaitForServer(const std::string&, bool);
249  virtual bool waitForServer(const std::string&) const;
250 
252  boost::signal<void (const std::string&, DtVrfExtendedIntervisibilitySettingsData::IntervisibilitySettings)> signal_extendedIntervisibilityOptionsChanged;
253 
254  protected:
256  };
257 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)