VR-Forces 4.1.1 Class Documentation
DtRangeRingsSettingsRecord.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2011 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtRangeRingsSettingsRecord.h,v $ $Revision: 1.4 $ $State: Exp $
7 ******************************************************************************/
8 
11 
14 
15 #pragma once
16 
17 #include <vrfGuiCore/vrfGuiCore.h>
18 #include <vrvUtil/DtUnicode.h>
19 
20 #include <boost/serialization/access.hpp>
21 #include <boost/serialization/nvp.hpp>
22 #include <boost/serialization/list.hpp>
23 #include <boost/serialization/map.hpp>
24 #include <boost/serialization/vector.hpp>
25 #include <boost/serialization/string.hpp>
26 
27 namespace makVrf
28 {
29  const int USING_FORCE_COLOR = 0x00666666;
30  const int DEFAULT_OPACITY = 0x66000000;
31 
33  {
34  public:
36  {
37  DtRangeRingsNone = 0,
38  DtRangeRingsFill2D = 0x00000001,
39  DtRangeRingsShowRangeSphere = 0x00000002,
40  DtRangeRingsShowWeaponNameLabel = 0x00000004,
41  DtRangeRingsShowEntityNameLabel = 0x00000008,
42  DtRangeRingsShowRangeValueLabel = 0x00000010
43  };
44  struct ColorOption
45  {
46  ColorOption() : color(USING_FORCE_COLOR), label(makVrv::DtUnicode::tr("Unknown")) {};
47  ColorOption(int c, const makVrv::DtUnicode& v) : color(c), label(v) {};
48  ColorOption(const ColorOption& c) : color(c.color), label(c.label) {};
49 
50  ColorOption& operator=(const ColorOption& c) { color = c.color; label = c.label; return *this; };
51 
52  bool operator==(const ColorOption& c) const { return ((c.color == color) && (c.label == label)); };
53  int color;
55 
56  protected:
57  friend class boost::serialization::access;
58 
62  template<class Archive>
63  void serialize(Archive & ar, const unsigned int version)
64  {
65  ar & BOOST_SERIALIZATION_NVP(color);
66 
67  if (Archive::is_loading::value)
68  {
69  std::string serLabel;
70  ar & BOOST_SERIALIZATION_NVP(serLabel);
71 
72  label = makVrv::DtUnicode::fromAscii(serLabel.c_str());
73  }
74  else
75  {
76  std::string serLabel = label.toAscii();
77  ar & BOOST_SERIALIZATION_NVP(serLabel);
78  }
79  }
80  };
81 
82  typedef std::map<int, ColorOption> ColorOptions;
83 
84  public:
87 
88  virtual ~DtRangeRingsSettingsRecord();
89 
90  public:
91 
92  virtual void setFlag(int flag, bool set);
93  RangeRingsDisplayOptions displayOptions() const;
94 
95  void setFill2D(bool);
96  bool fill2D() const;
97 
98  void setShowRangeSphere( bool );
99  bool showRangeSphere() const;
100 
101  void setShowWeaponNameLabel( bool );
102  bool showWeaponNameLabel() const;
103 
104  void setShowEntityNameLabel( bool );
105  bool showEntityNameLabel() const;
106 
107  void setShowRangeValueLabel( bool );
108  bool showRangeValueLabel() const;
109 
112  void addColorOption(int type, int color, const makVrv::DtUnicode&);
113  bool getColorOption(int type, int& color, makVrv::DtUnicode&) const;
114  void setColorOptions(const ColorOptions&);
115  void removeColorOption(int type);
116 
117  virtual bool operator==(const DtRangeRingsSettingsRecord&) const;
118  bool operator!=(const DtRangeRingsSettingsRecord&) const;
119 
120  const ColorOptions& colorOptions() const
121  {
122  return myColorOptions;
123  }
124 
125  protected:
126  friend class boost::serialization::access;
127 
131  template<class Archive>
132  void serialize(Archive & ar, const unsigned int version)
133  {
134  ar & BOOST_SERIALIZATION_NVP(myDisplayOptions);
135  ar & BOOST_SERIALIZATION_NVP(myColorOptions);
136  }
137 
138  protected:
141  };
142 }
143 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)