BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
representationManager.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: representationManager.h,v 1.1.4.2 2007/03/28 13:11:43 amoll Exp $
5 
6 #ifndef BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
7 #define BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
8 
9 #ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
11 #endif
12 
13 #ifndef BALL_SYSTEM_MUTEX_H
14 #include <BALL/SYSTEM/mutex.h>
15 #endif
16 
17 #include <QtCore/QCoreApplication>
18 #include <QtCore/QWaitCondition>
19 
20 #include <vector>
21 
22 using std::vector;
23 
24 namespace BALL
25 {
26  class Composite;
27  class INIFile;
28 
29  namespace VIEW
30  {
31  class MainControl;
32  class UpdateRepresentationThread;
33  class ClippingPlane;
34 
46  : public Object
47  {
48  friend class Representation;
50  friend class BALLThread;
51  friend class MainControl;
52 
53  public:
54 
56 
57 
63 
66 
69 
71 
74 
79 
83 
86  virtual ~RepresentationManager();
87 
89 
92 
94  const RepresentationManager& operator = (const RepresentationManager& pm);
95 
97  bool operator == (const RepresentationManager& pm) const;
98 
100  void clear();
101 
108  bool remove(Representation& representation, bool send_message = true);
109 
114  bool insert(Representation& representation, bool send_message = true);
115 
117  const RepresentationList& getRepresentations() const
118  { return representations_;}
119 
122  { return representations_.size();}
123 
125  Representation* createRepresentation();
126 
128  bool has(const Representation& representation) const;
129 
131  void dump(std::ostream& s, Size depth = 0) const;
132 
135  { return representations_.begin();}
136 
139  { return representations_.begin();}
140 
143  { return representations_.end();}
144 
147  { return representations_.end();}
148 
156  RepresentationList removedComposite(const Composite& composite, bool update = true);
157 
162  RepresentationList getRepresentationsOf(const Composite& composite);
163 
165  void rebuildAllRepresentations();
166 
168  const vector<ClippingPlane*>& getClippingPlanes() const { return clipping_planes_;}
169 
171  bool removeClippingPlane(ClippingPlane* plane);
172 
174  void insertClippingPlane(ClippingPlane* plane);
175 
177  void storeRepresentations(INIFile& out);
178 
180  void restoreRepresentations(const INIFile& in, const vector<const Composite*>& new_systems);
181 
183  void focusRepresentation(const Representation& rep);
184 
186  bool willBeUpdated(const Representation& rep) const;
187 
189  bool updateRunning() const ;
190 
192  bool startRendering(Representation* rep);
193 
195  void finishedRendering(Representation* rep);
196 
198  bool isBeeingRendered(const Representation* rep) const;
199 
200  protected:
201 
203  Representation* popRepresentationToUpdate();
204 
205  void finishedUpdate_(Representation* rep);
206 
207  /*_ Called by Representation::update() to start a multithreaded
208  Update of the Representation.
209  (Only used in Multithreaded code.)
210  */
211  void update_(Representation& rep);
212 
213  //_ List with all representations
215 
219 
220  vector<ClippingPlane*> clipping_planes_;
221 
222  // we need to ensure that the mutex is always created correctly before
223  // the thread that tries to access it!
225 
229 
231  };
232 
233  } // namespace VIEW
234 } // namespace BALL
235 
236 #endif // BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
#define BALL_CREATE(name)
Definition: create.h:62
RepresentationsConstIterator begin() const
ConstIterator to the first Representation.
HashSet< Representation * > to_update_
std::list< Representation * > RepresentationList
RepresentationsConstIterator end() const
Const Iterator pointing behind the last Representation.
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
RepresentationsIterator end()
Iterator pointing behind the last Representation.
RepresentationsIterator begin()
Iterator to the first Representation.
RepresentationList::const_iterator RepresentationsConstIterator
ConstIterator to the Representations.
UpdateRepresentationThread * thread_
HashSet< Representation * > beeing_updated_
HashSet< Representation * > beeing_rendered_
vector< ClippingPlane * > clipping_planes_
RepresentationList::iterator RepresentationsIterator
Iteration to the Representations.
const vector< ClippingPlane * > & getClippingPlanes() const
Size getNumberOfRepresentations() const
Get the number of the Representations.