Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxViewRepCollection.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXVIEWREPCOLLECTION_H
13 #define CXVIEWREPCOLLECTION_H
14 
15 #include <QObject>
16 #include "cxForwardDeclarations.h"
17 #include "cxView.h"
18 #include <QColor>
19 
20 namespace cx
21 {
22 
23 typedef boost::shared_ptr<class ViewRepCollection> ViewRepCollectionPtr;
24 
30 class ViewRepCollection : public View
31 {
32 Q_OBJECT
33 
34 public:
35  ViewRepCollection(vtkRenderWindowPtr renderWindow, const QString& uid, const QString& name = "");
36  virtual ~ViewRepCollection();
37 
38  void print(std::ostream& os);
39  virtual void printSelf(std::ostream & os, Indent indent);
40  virtual void clear();
41 
42  // Implement pure virtuals in base class
43  virtual vtkRenderWindowPtr getRenderWindow() const { return mRenderWindow; }
44 
45  virtual View::Type getType() const
46  {
47  return mType;
48  }
49  virtual void setType(View::Type type)
50  {
51  mType = type;
52  }
53  virtual QString getTypeString() const;
54  virtual QString getUid();
55  virtual QString getName();
56  virtual vtkRendererPtr getRenderer() const;
57  virtual void addRep(const RepPtr& rep);
58  virtual void removeRep(const RepPtr& rep);
59  virtual bool hasRep(const RepPtr& rep) const;
60  virtual std::vector<RepPtr> getReps();
61  virtual void removeReps();
62  virtual void setBackgroundColor(QColor color);
63 
64  virtual void setModified();
65  int computeTotalMTime();
66 
68  QString mUid;
69  QString mName;
72  std::vector<RepPtr> mReps;
73  typedef std::vector<RepPtr>::iterator RepsIter;
75  boost::weak_ptr<class View> mSelf;
76 };
77 
78 } // namespace cx
79 
80 #endif // CXVIEWREPCOLLECTION_H
boost::weak_ptr< class View > mSelf
virtual View::Type getType() const
virtual bool hasRep(const RepPtr &rep) const
Checks if the view already have the rep.
virtual QString getTypeString() const
virtual vtkRenderWindowPtr getRenderWindow() const
Get the vtkRenderWindow used by this View.
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
std::vector< RepPtr >::iterator RepsIter
Iterator typedef for the internal rep vector.
virtual std::vector< RepPtr > getReps()
Returns all reps in the view.
virtual void removeReps()
Removes all reps in the view.
virtual void addRep(const RepPtr &rep)
Adds and connects a rep to the view.
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
virtual void setBackgroundColor(QColor color)
QString mName
The view&#39;s name.
vtkRenderWindowPtr mRenderWindow
virtual void setType(View::Type type)
QString mUid
The view&#39;s unique id.
Formatting class for debug printing of the ssc library.
Definition: cxIndent.h:28
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
virtual QString getName()
Get a views name.
void print(std::ostream &os)
virtual void removeRep(const RepPtr &rep)
Removes and disconnects the rep from the view.
std::vector< RepPtr > mReps
Storage for internal reps.
ViewRepCollection(vtkRenderWindowPtr renderWindow, const QString &uid, const QString &name="")
constructor
virtual QString getUid()
Get a views unique id.
virtual void clear()
Removes everything in the view, inluding reps.
boost::shared_ptr< class Rep > RepPtr
Definition: cxRepManager.h:24
virtual vtkRendererPtr getRenderer() const
Get the renderer used by this View.
virtual void printSelf(std::ostream &os, Indent indent)
Namespace for all CustusX production code.