Bayeux  3.4.1
Core Foundation library for SuperNEMO
display_data.h
Go to the documentation of this file.
1 /* Author (s) : François Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-10-19
4  * Last modified: 2012-10-20
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Generic display data for 3D wired rendering
11  *
12  *
13  * History:
14  *
15  */
16 
17 #ifndef GEOMTOOLS_DISPLAY_DATA_H
18 #define GEOMTOOLS_DISPLAY_DATA_H 1
19 
20 // Standard library:
21 #include <string>
22 #include <vector>
23 #include <map>
24 #include <list>
25 
26 // Third party:
27 // - Boost :
28 #include <boost/serialization/access.hpp>
29 #include <boost/cstdint.hpp>
30 // - Bayeux/datatools :
32 #include <datatools/i_tree_dump.h>
33 #include <datatools/i_clear.h>
34 #include <datatools/properties.h>
35 // - Bayeux/geomtools :
36 #include <geomtools/polyline_3d.h>
37 #include <geomtools/placement.h>
38 
39 namespace geomtools {
40 
41  class display_data :
44  public datatools::i_clear
45  {
46  public:
47 
48  enum display_type {
51  };
52 
56  };
57 
58  struct label_item {
60  std::string text;
61  };
62 
63  struct display_item {
64  std::string frame_info;
65  std::string style;
66  std::string color;
67  std::list<geomtools::polyline_3d> paths;
69  //std::list<geomtools::facet_3d> facets; //!< Future?
70  //std::list<geomtools::vector_3d> markers; //!< Future?
71  //std::map<int,label_item> labels; //!< Future?
72  public:
73  display_item();
74  virtual ~display_item();
75  void reset();
78  };
79 
80  typedef std::map<int32_t, display_item> items_dict_type;
81 
83  {
84  int32_t entry_type;
85  std::string group;
86  std::map<int32_t, display_item> items;
88  public:
89  bool is_static() const;
90  bool is_framed() const;
91  display_entry();
92  virtual ~display_entry();
93  void reset();
94  const std::map<int32_t, display_item> & get_items() const;
95  std::map<int32_t, display_item> & grab_items();
96  const display_item & get_static_item() const;
97  const display_item & get_framed_item(int frame_index_) const;
98  bool has_framed_item(int frame_index_) const;
99 
101  };
102 
103  typedef std::map<std::string, display_entry> entries_dict_type;
104 
105  void reset();
106 
108  display_data();
109 
111  virtual ~display_data();
112 
113  virtual void clear();
114 
115  const std::vector<std::string> & get_colors() const;
116 
117  std::vector<std::string> & grab_colors();
118 
119  const std::vector<std::string> & get_groups() const;
120 
121  std::vector<std::string> & grab_groups();
122 
123  const std::map<std::string, display_entry> & get_entries() const;
124 
125  std::map<std::string, display_entry> & grab_entries();
126 
127  const std::map<int32_t,std::string> & get_frames() const;
128 
129  std::map<int32_t,std::string> & grab_frames();
130 
131  void add_frame_info(int frame_index_, const std::string & frame_info_ = 0);
132 
133  const datatools::properties & get_auxiliaries() const;
134 
136 
137 
138  virtual void tree_dump(std::ostream & a_out = std::clog,
139  const std::string & a_title = "",
140  const std::string & a_indent = "",
141  bool a_inherit = false) const;
142 
143  display_item & add_static_item(const std::string & name_,
144  const std::string & group_ = "",
145  const std::string & color_ = "");
146 
147  display_item & add_framed_item(const std::string & name_,
148  int frame_,
149  const std::string & group_ = "",
150  const std::string & color_ = "",
151  const std::string & frame_info_ = "");
152 
153  void process();
154 
155  protected:
156 
157  display_item & _add_item(const std::string & name_,
158  int entry_type_,
159  int frame_,
160  const std::string & group_,
161  const std::string & color_);
162 
163  private:
164 
165  std::vector<std::string> _colors_;
166  std::vector<std::string> _groups_;
167  std::map<int32_t,std::string> _frames_;
168  std::map<std::string, display_entry> _entries_;
169  datatools::properties _auxiliaries_;
170 
172 
173  };
174 
175 } // end of namespace geomtools
176 
177 #ifdef __clang__
178 #pragma clang diagnostic push
179 #pragma clang diagnostic ignored "-Wunused-local-typedef"
180 #endif
181 #include <boost/serialization/export.hpp>
182 #ifdef __clang__
183 #pragma clang diagnostic pop
184 #endif
185 BOOST_CLASS_EXPORT_KEY2(geomtools::display_data, "geomtools::display_data")
186 
187 // Class version:
188 #include <boost/serialization/version.hpp>
189 BOOST_CLASS_VERSION(geomtools::display_data::display_item, 2)
190 BOOST_CLASS_VERSION(geomtools::display_data, 1)
191 
192 #endif // GEOMTOOLS_DISPLAY_DATA_H
193 
194 /*
195 ** Local Variables: --
196 ** mode: c++ --
197 ** c-file-style: "gnu" --
198 ** tab-width: 2 --
199 ** End: --
200 */
virtual ~display_data()
Destructor.
Base abstract class of all serializable (and possibly introspectable) classes.
Definition: i_serializable.h:51
Definition: display_data.h:49
display_item & _add_item(const std::string &name_, int entry_type_, int frame_, const std::string &group_, const std::string &color_)
Definition: display_data.h:50
Definition: display_data.h:63
std::map< int32_t, display_item > items
Definition: display_data.h:86
datatools::properties & grab_auxiliaries()
virtual void clear()
Clear (reset) the object's internals (typically empty a container)
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
display_item & add_static_item(const std::string &name_, const std::string &group_="", const std::string &color_="")
void reset()
bool is_framed() const
display_data()
Constructor.
std::vector< std::string > & grab_groups()
display_style_type
Definition: display_data.h:53
std::string text
Text of the label.
Definition: display_data.h:60
std::map< int32_t, std::string > & grab_frames()
const std::map< int32_t, std::string > & get_frames() const
bool has_framed_item(int frame_index_) const
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
void add_frame_info(int frame_index_, const std::string &frame_info_=0)
geomtools::placement posrot
Placement of the text.
Definition: display_data.h:59
virtual void tree_dump(std::ostream &a_out=std::clog, const std::string &a_title="", const std::string &a_indent="", bool a_inherit=false) const
Main old interface method for printing.
Definition: display_data.h:58
Definition: display_data.h:82
std::map< std::string, display_entry > entries_dict_type
Definition: display_data.h:103
std::string color
Definition: display_data.h:66
const datatools::properties & get_auxiliaries() const
const std::map< std::string, display_entry > & get_entries() const
int32_t entry_type
Definition: display_data.h:84
display_item & add_framed_item(const std::string &name_, int frame_, const std::string &group_="", const std::string &color_="", const std::string &frame_info_="")
datatools::properties auxiliaries
Auxiliary properties.
Definition: display_data.h:87
const std::map< int32_t, display_item > & get_items() const
A pure abstract class (interface) for inherited clearable classes.
Definition: i_clear.h:9
std::vector< std::string > & grab_colors()
bool is_static() const
const display_item & get_framed_item(int frame_index_) const
display_type
Definition: display_data.h:48
std::map< int32_t, display_item > items_dict_type
Definition: display_data.h:80
wires_type wires
Collection of polylines (in 'wires' style)
Definition: display_data.h:68
const std::vector< std::string > & get_colors() const
const std::vector< std::string > & get_groups() const
virtual ~display_entry()
const display_item & get_static_item() const
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
std::list< geomtools::polyline_3d > paths
Obsolete.
Definition: display_data.h:67
std::map< std::string, display_entry > & grab_entries()
std::map< int32_t, display_item > & grab_items()
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
std::string group
Definition: display_data.h:85
std::string frame_info
Definition: display_data.h:64
std::string style
Definition: display_data.h:65
Definition: display_data.h:41
display_entry()
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125