VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rangeRingsSettingsRecord.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
11 
12 #pragma once
13 
14 #include <vrfGuiCore/vrfGuiCore.h>
15 #include <vrvUtil/DtUnicode.h>
16 
17 #include <boost/serialization/access.hpp>
18 #include <boost/serialization/nvp.hpp>
19 #include <boost/serialization/list.hpp>
20 #include <boost/serialization/map.hpp>
21 #include <boost/serialization/vector.hpp>
22 #include <boost/serialization/string.hpp>
23 
24 namespace makVrf
25 {
26  const int USING_FORCE_COLOR = 0x00666666;
27  const int DEFAULT_OPACITY = 0x66000000;
28 
30  {
31  public:
33  {
34  DtRangeRingsNone = 0,
35  DtRangeRingsFill2D = 0x00000001,
36  DtRangeRingsShowRangeSphere = 0x00000002,
37  DtRangeRingsShowWeaponNameLabel = 0x00000004,
38  DtRangeRingsShowEntityNameLabel = 0x00000008,
39  DtRangeRingsShowRangeValueLabel = 0x00000010,
40  DtRangeRingsShowByDefault = 0x00000020,
41  DtRangeRingsShowWhenSelected = 0x00000040,
42  DtRangeRingsShowPhysicalFootprint = 0x00000080,
43  };
44 
45  struct ColorOption
46  {
47  ColorOption() : color(USING_FORCE_COLOR), label(makVrv::DtUnicode::tr("Unknown")), visible(true) {};
48  ColorOption(int c, const makVrv::DtUnicode& v, bool visible = true) : color(c), label(v), visible(true) {};
49  ColorOption(const ColorOption& c) : color(c.color), label(c.label), visible(c.visible) {};
50 
51  ColorOption& operator=(const ColorOption& c) { color = c.color; label = c.label; visible = c.visible; return *this; };
52 
53  bool operator==(const ColorOption& c) const { return ((c.color == color) && (c.label == label) && (c.visible == visible)); };
54  int color;
56  bool visible;
57 
58  protected:
59  friend class boost::serialization::access;
60 
64  template<class Archive>
65  void serialize(Archive & ar, const unsigned int version)
66  {
67  ar & BOOST_SERIALIZATION_NVP(color);
68 
69  if (Archive::is_loading::value)
70  {
71  std::string serLabel;
72  ar & BOOST_SERIALIZATION_NVP(serLabel);
73 
74  label = makVrv::DtUnicode::fromAscii(serLabel.c_str());
75  }
76  else
77  {
78  std::string serLabel = label.toAscii();
79  ar & BOOST_SERIALIZATION_NVP(serLabel);
80  }
81 
82  if (version >= 2)
83  {
84  ar & BOOST_SERIALIZATION_NVP(visible);
85  }
86  }
87  };
88 
89  typedef std::map<std::string, ColorOption> ColorOptions;
90 
91  public:
94 
95  virtual ~DtRangeRingsSettingsRecord();
96 
97  public:
98 
99  virtual void setFlag(int flag, bool set);
100  RangeRingsDisplayOptions displayOptions() const;
101 
102  void setFill2D(bool);
103  bool fill2D() const;
104 
105  void setShowRangeSphere( bool );
106  bool showRangeSphere() const;
107 
108  void setShowWeaponNameLabel( bool );
109  bool showWeaponNameLabel() const;
110 
111  void setShowEntityNameLabel( bool );
112  bool showEntityNameLabel() const;
113 
114  void setShowRangeValueLabel( bool );
115  bool showRangeValueLabel() const;
116 
117  void setShowByDefault( bool );
118  bool showByDefault() const;
119 
120  void setShowForSelected( bool );
121  bool showForSelected() const;
122 
123  void setShowPhysicalFootprint( bool );
124  bool showPhysicalFootprint() const;
125 
128  void addColorOption(const std::string& type, int color, const makVrv::DtUnicode&);
129  bool getColorOption(const std::string& type, int& color, makVrv::DtUnicode&) const;
130  void setColorOptions(const ColorOptions&);
131  void removeColorOption(const std::string& type);
132 
133  void setVisible(const std::string& type, bool);
134  bool visible(const std::string& type) const;
135 
136  void setSphereOpacityModifier(double);
137  double sphereOpacityModifier() const;
138 
139  virtual bool operator==(const DtRangeRingsSettingsRecord&) const;
140  bool operator!=(const DtRangeRingsSettingsRecord&) const;
141 
142  const ColorOptions& colorOptions() const
143  {
144  return myColorOptionsNew;
145  }
146 
147  protected:
148  friend class boost::serialization::access;
149 
153  template<class Archive>
154  void serialize(Archive & ar, const unsigned int version)
155  {
156  ar & BOOST_SERIALIZATION_NVP(myDisplayOptions);
157  if (version > 1)
158  {
159  ar & BOOST_SERIALIZATION_NVP(myColorOptionsNew);
160 
161  if (Archive::is_loading::value && (version < 3))
162  {
163  setShowForSelected(true);
164  setShowPhysicalFootprint(true);
165  }
166 
167  if (version >= 4)
168  {
169  ar & BOOST_SERIALIZATION_NVP(mySphereOpacityModifier);
170  }
171  }
172  }
173 
174  protected:
178  };
179 }
180 
182 BOOST_CLASS_VERSION(makVrf::DtRangeRingsSettingsRecord::ColorOption,2)
BOOST_CLASS_VERSION(makArchives::DtDiGuySettingsRecord, 3)
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
double mySphereOpacityModifier
Definition: rangeRingsSettingsRecord.h:177
Definition: rangeRingsSettingsRecord.h:45
int color
Definition: rangeRingsSettingsRecord.h:53
const int DEFAULT_OPACITY
Definition: paletteInformationSettingsRecord.h:26
bool visible
Definition: rangeRingsSettingsRecord.h:56
ColorOption & operator=(const ColorOption &c)
Definition: rangeRingsSettingsRecord.h:51
DT_DLL_VRFGUICORE bool operator==(const std::vector< makArchives::DtEnvironmentRecord::DtElevationalConfigurationRecord > &lhs, const std::vector< makArchives::DtEnvironmentRecord::DtElevationalConfigurationRecord > &rhs)
const ColorOptions & colorOptions() const
Definition: rangeRingsSettingsRecord.h:142
ColorOption()
Definition: rangeRingsSettingsRecord.h:47
#define DT_DLL_VRFGUICORE
Contains DLL export macros.
Definition: vrfGuiCore.h:25
RangeRingsDisplayOptions
Definition: rangeRingsSettingsRecord.h:32
void serialize(Archive &ar, const unsigned int version)
When the class Archive corresponds to an output archive, the &amp; operator is defined similar to &lt;&lt;...
Definition: rangeRingsSettingsRecord.h:154
void toAscii(std::string &str) const
Decode via specifying encoding.
ColorOptions myColorOptionsNew
Definition: rangeRingsSettingsRecord.h:175
const int USING_FORCE_COLOR
Definition: paletteInformationSettingsRecord.h:25
makVrv::DtUnicode label
Definition: rangeRingsSettingsRecord.h:55
DT_DLL_VRFGUICORE bool operator!=(const std::vector< makArchives::DtEnvironmentRecord::DtElevationalConfigurationRecord > &lhs, const std::vector< makArchives::DtEnvironmentRecord::DtElevationalConfigurationRecord > &rhs)
ColorOption(int c, const makVrv::DtUnicode &v, bool visible=true)
Definition: rangeRingsSettingsRecord.h:48
ColorOption(const ColorOption &c)
Definition: rangeRingsSettingsRecord.h:49
void serialize(Archive &ar, const unsigned int version)
When the class Archive corresponds to an output archive, the &amp; operator is defined similar to &lt;&lt;...
Definition: rangeRingsSettingsRecord.h:65
Definition: rangeRingsSettingsRecord.h:29
static DtUnicode fromAscii(const std::string &ascii)
Create a unicode string from an ascii string, the string MUST be zero terminated if the length is not...
std::map< std::string, ColorOption > ColorOptions
Definition: rangeRingsSettingsRecord.h:89
RangeRingsDisplayOptions myDisplayOptions
Definition: rangeRingsSettingsRecord.h:176
bool operator==(const ColorOption &c) const
Definition: rangeRingsSettingsRecord.h:53

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)