CustusX  15.3.3-beta
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxView.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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXVIEW_H_
34 #define CXVIEW_H_
35 
36 #include "sscConfig.h"
37 #include <boost/shared_ptr.hpp>
38 #include <boost/weak_ptr.hpp>
39 #include "vtkForwardDeclarations.h"
40 #include "cxIndent.h"
41 #include <QSize>
42 class QColor;
43 
44 #include "cxTransform3D.h"
45 
46 namespace cx
47 {
48 class DoubleBoundingBox3D;
49 typedef boost::shared_ptr<class Rep> RepPtr;
50 
68 class View : public QObject
69 {
70  Q_OBJECT
71 public:
72  enum Type
73  {
75  };
76 
77  virtual ~View() {}
78 
79  virtual Type getType() const = 0;
80  virtual QString getTypeString() const = 0;
81  virtual QString getUid() = 0;
82  virtual QString getName() = 0;
83 
84  virtual void addRep(const RepPtr& rep) = 0;
85  virtual void removeRep(const RepPtr& rep) = 0;
86  virtual bool hasRep(const RepPtr& rep) const = 0;
87  virtual std::vector<RepPtr> getReps() = 0;
88  virtual void removeReps() = 0;
89 
90  virtual vtkRendererPtr getRenderer() const = 0;
91  virtual vtkRenderWindowPtr getRenderWindow() const = 0;
92  virtual void setModified() = 0;
93  virtual void setBackgroundColor(QColor color) = 0;
94  virtual QSize size() const = 0;
95  virtual void setZoomFactor(double factor) = 0;
96  virtual double getZoomFactor() const = 0;
97  virtual Transform3D get_vpMs() const = 0;
98  virtual DoubleBoundingBox3D getViewport() const = 0;
99  virtual DoubleBoundingBox3D getViewport_s() const = 0;
100 
101 signals:
102  void resized(QSize size);
103  void mouseMove(int x, int y, Qt::MouseButtons buttons);
104  void mousePress(int x, int y, Qt::MouseButtons buttons);
105  void mouseRelease(int x, int y, Qt::MouseButtons buttons);
106  void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
107  void shown();
108  void focusChange(bool gotFocus, Qt::FocusReason reason);
109  void customContextMenuRequested(const QPoint&);
110 };
111 typedef boost::shared_ptr<View> ViewPtr;
112 
113 } // namespace cx
114 
115 #endif /*CXVIEW_H_*/
virtual vtkRendererPtr getRenderer() const =0
Get the renderer used by this View.
virtual DoubleBoundingBox3D getViewport() const =0
virtual QString getTypeString() const =0
virtual void setZoomFactor(double factor)=0
virtual bool hasRep(const RepPtr &rep) const =0
Checks if the view already have the rep.
virtual double getZoomFactor() const =0
void customContextMenuRequested(const QPoint &)
void resized(QSize size)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
void focusChange(bool gotFocus, Qt::FocusReason reason)
void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
virtual vtkRenderWindowPtr getRenderWindow() const =0
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
virtual void setBackgroundColor(QColor color)=0
virtual void removeRep(const RepPtr &rep)=0
Removes and disconnects the rep from the view.
virtual std::vector< RepPtr > getReps()=0
Returns all reps in the view.
boost::shared_ptr< class View > ViewPtr
void mouseRelease(int x, int y, Qt::MouseButtons buttons)
void mousePress(int x, int y, Qt::MouseButtons buttons)
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
virtual void setModified()=0
virtual void addRep(const RepPtr &rep)=0
Adds and connects a rep to the view.
virtual ~View()
Definition: cxView.h:77
virtual QString getName()=0
Get a views name.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
virtual DoubleBoundingBox3D getViewport_s() const =0
virtual QString getUid()=0
Get a views unique id.
virtual QSize size() const =0
void mouseMove(int x, int y, Qt::MouseButtons buttons)
virtual Transform3D get_vpMs() const =0
virtual void removeReps()=0
Removes all reps in the view.
boost::shared_ptr< class Rep > RepPtr
Definition: cxRepManager.h:45
void shown()
virtual Type getType() const =0