BALL  1.5.0
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 
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 
121 
124 
127 
130 
133 
136 
139 
141  void setTransparency(Size value);
142 
145 
148 
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 
168 
171 
174 
177 
180 
183 
186 
188  String getName() const;
189 
191  void setName(const String& name);
192 
195 
198 
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 
216 
218  bool isValid() const;
219 
224  void update(bool rebuild);
225 
228 
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 
253 
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().
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
#define BALL_CREATE(name)
Definition: create.h:62
Definition: constants.h:13
BALL_EXPORT bool operator<(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXTERN_VARIABLE const double c
Definition: constants.h:149
double precision
Definition: classTest.h:30
DrawingPrecision
Enumeration for Drawing Precisions.
std::list< Representation * > RepresentationList
std::list< GeometricObject * > GeometricObjectList
DrawingMode
Enumeration for Drawing Modes.
HashMap class based on the STL map (containing serveral convenience functions)
Definition: hashMap.h:74
ColoringMethod coloring_method_
void setNeedsUpdate(bool state=true)
static MolecularInformation information_
Representation(const Representation &representation)
ColorProcessor * color_processor_
ModelProcessor * model_processor_
String getProperties() const
Get a descpription string (nr triangles and geometric objects, transparency, mode)
DrawingPrecision drawing_precision_
const PreciseTime & getModelBuildTime() const
GeometricObjectList geometric_objects_
bool isValid() const
Check if drawing mode, transparency and drawing precision have reasonable values.
void setSurfaceDrawingPrecision(float precision)
void enableModelUpdate(bool state)
const ModelProcessor * getModelProcessor() const
Size getTransparency() const
get transparency (0 - 255)
ModelProcessor * getModelProcessor()
void setModelInformation(const ModelInformation &mi)
Set a custom ModelInformation e.g. when new models were added external of the library.
void clearGeometricObjects()
Clear and destroy all stored GeometricObject.
void setHidden(bool state)
void setModelType(ModelType type)
const std::list< const Composite * > & getComposites() const
void collectRecursive_(const Composite &c, HashMap< const Composite *, Position > &hashmap) const
float getSurfaceDrawingPrecision() const
std::list< const Composite * > composites_
void setDrawingMode(DrawingMode mode)
void setTransparency(Size value)
set transparency (0 - 255)
DrawingPrecision getDrawingPrecision() const
void enableColoringUpdate(bool state)
void dump(std::ostream &s=std::cout, Size depth=0) const
Dum to ostream for debugging.
void setComposite(const Composite *composite)
String getCompositeName() const
Returns a human-readable, potentially abbreviated string describing the molecular entity this represe...
ModelType getModelType() const
const ModelInformation * custom_model_information_
void clear()
Clears all properties.
void setName(const String &name)
void setColorProcessor(ColorProcessor *processor)
ColoringMethod getColoringMethod() const
DrawingMode getDrawingMode() const
ColorProcessor * getColorProcessor()
void update(bool rebuild)
static ModelInformation model_information_
void setDrawingPrecision(DrawingPrecision precision)
GeometricObjectList & getGeometricObjects()
Representation(ModelType model_type, DrawingPrecision drawing_precision, DrawingMode drawing_mode)
void insert(GeometricObject &object)
void setComposites(const std::list< const Composite * > &composites)
const ModelInformation & getModelInformation() const
void setColoringMethod(ColoringMethod type)
String toString() const
Get a String containing all settings for Usage in project files.
const GeometricObjectList & getGeometricObjects() const
void setModelProcessor(ModelProcessor *processor)
bool coloringUpdateEnabled() const
void setGeometricObjects(GeometricObjectList &gol)
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52