BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
representation.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
6 #define BALL_VIEW_KERNEL_REPRESENTATION_H
7 
8 #ifndef BALL_CONCEPT_PROPERTY_H
9 # include <BALL/CONCEPT/property.h>
10 #endif
11 
12 #ifndef BALL_CONCEPT_COMPOSITE_H
13 # include <BALL/CONCEPT/composite.h>
14 #endif
15 
16 #ifndef BALL_VIEW_KERNEL_COMMON_H
17 # include <BALL/VIEW/KERNEL/common.h>
18 #endif
19 
20 #ifndef BALL_CONCEPT_MOLECULARINFORMATION_H
22 #endif
23 
24 #ifndef BALL_VIEW_KERNEL_MODELINFORMATION_H
26 #endif
27 
28 // next two defines need to be included in header file, because of iC file
29 #ifndef BALL_VIEW_MODELS_MODELPROCESSOR_H
31 #endif
32 
33 #ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
35 #endif
36 
37 
38 namespace BALL
39 {
40  namespace VIEW
41  {
42  class ModelProcessor;
43  class ColorProcessor;
44  class GeometricObject;
45  class UpdateRepresentationThread;
46  class RepresentationManager;
47 
58  : public PropertyManager
59  {
61  friend class RepresentationManager;
62  public:
63 
65 
66 
69 
70 
72  {
74  PROPERTY__ALWAYS_FRONT = 0,
75 
77  PROPERTY__IS_COORDINATE_SYSTEM
78  };
79 
81 
84 
88 
90  Representation(ModelType model_type,
91  DrawingPrecision drawing_precision,
92  DrawingMode drawing_mode);
93 
96  Representation(const Representation& representation);
97 
100  virtual ~Representation();
101 
103 
106 
108  const Representation& operator = (const Representation& rep);
109 
111  void clear();
112 
114  void setHidden(bool state) ;
115 
117  bool isHidden() const;
118 
120  void setDrawingPrecision(DrawingPrecision precision);
121 
123  DrawingPrecision getDrawingPrecision() const;
124 
126  float getSurfaceDrawingPrecision() const;
127 
129  void setSurfaceDrawingPrecision(float precision);
130 
132  void setDrawingMode(DrawingMode mode);
133 
135  DrawingMode getDrawingMode() const;
136 
138  Size getTransparency() const;
139 
141  void setTransparency(Size value);
142 
144  const GeometricObjectList& getGeometricObjects() const;
145 
147  GeometricObjectList& getGeometricObjects();
148 
150  void setGeometricObjects(GeometricObjectList& gol)
151  { geometric_objects_ = gol;}
152 
154  void insert(GeometricObject& object) ;
155 
157  const std::list<const Composite*>& getComposites() const
158  { return composites_;}
159 
161  void setComposites(const std::list<const Composite*>& composites);
162 
164  void setComposite(const Composite* composite);
165 
167  const ModelProcessor* getModelProcessor() const;
168 
170  ModelProcessor* getModelProcessor();
171 
173  void setModelProcessor(ModelProcessor* processor);
174 
176  ColorProcessor* getColorProcessor();
177 
179  void setColorProcessor(ColorProcessor* processor);
180 
182  void setModelType(ModelType type);
183 
185  ModelType getModelType() const;
186 
188  String getName() const;
189 
191  void setName(const String& name);
192 
194  String getCompositeName() const;
195 
197  void setColoringMethod(ColoringMethod type);
198 
200  ColoringMethod getColoringMethod() const;
201 
203  void enableModelUpdate(bool state);
204 
206  void enableColoringUpdate(bool state) { coloring_update_enabled_ = state;}
207 
209  bool modelUpdateEnabled() const { return model_update_enabled_;}
210 
212  bool coloringUpdateEnabled() const { return coloring_update_enabled_;}
213 
215  String getProperties() const;
216 
218  bool isValid() const;
219 
224  void update(bool rebuild);
225 
227  void clearGeometricObjects();
228 
234  const PreciseTime& getModelBuildTime() const;
235 
240  bool needsUpdate() const;
241 
243  void setNeedsUpdate(bool state=true);
244 
246  void dump(std::ostream& s = std::cout, Size depth = 0) const;
247 
249  String toString() const;
250 
252  void setModelInformation(const ModelInformation& mi);
253 
255  const ModelInformation& getModelInformation() const;
256 
258  bool operator == (const Representation& object) const;
259 
260 
262  bool operator < (const Representation& object) const
263  { return this < &object;}
264 
266 
267  protected:
268 
273  void update_();
274 
275  // Create a hashmap with the numerical position of every composite in its root Composite.
276  // Needed for toString().
277  void collectRecursive_(const Composite& c, HashMap<const Composite*, Position>& hashmap) const;
278 
279  //_
281 
282  //_
284 
285  //_
287 
288  //_
290 
291  //_
293 
294  //_
296 
297  //_
299 
300  //_
302 
303  //_
304  std::list<const Composite*> composites_;
305 
306  //_
308 
309  //_ set to true, if update is called, while representation is hidden
311 
312  //_ true means the ModelProcessor will be applied in the next update
313  bool rebuild_;
314 
315  //_ true means the ColorProcessor was changed since the last update call, so apply it!
317 
318  //_
319  bool hidden_;
320 
321  //_
323 
324  //_
326 
327  //_
329 
331 
332  //_ used for getName()
334 
335  //_ used for getName()
337 
339  };
340 
342  typedef std::list<Representation*> RepresentationList;
343 
344 # ifndef BALL_NO_INLINE_FUNCTIONS
345 # include <BALL/VIEW/KERNEL/representation.iC>
346 # endif
347 
348  } // namespace VIEW
349 } // namespace BALL
350 
351 #endif // BALL_VIEW_KERNEL_REPRESENTATION_H