Fraxinus  16.5.0-fx-rc9
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 <QObject>
37 #include "sscConfig.h"
38 #include <boost/shared_ptr.hpp>
39 #include <boost/weak_ptr.hpp>
40 #include "vtkForwardDeclarations.h"
41 #include "cxIndent.h"
42 #include <QSize>
43 class QColor;
44 
45 #include "cxTransform3D.h"
46 
47 namespace cx
48 {
49 class DoubleBoundingBox3D;
50 typedef boost::shared_ptr<class Rep> RepPtr;
51 
69 class View : public QObject
70 {
71  Q_OBJECT
72 public:
73  enum Type
74  {
76  };
77 
78  virtual ~View() {}
79 
80  virtual Type getType() const = 0;
81  virtual QString getTypeString() const = 0;
82  virtual QString getUid() = 0;
83  virtual QString getName() = 0;
84 
85  virtual void addRep(const RepPtr& rep) = 0;
86  virtual void removeRep(const RepPtr& rep) = 0;
87  virtual bool hasRep(const RepPtr& rep) const = 0;
88  virtual std::vector<RepPtr> getReps() = 0;
89  virtual void removeReps() = 0;
90 
91  virtual vtkRendererPtr getRenderer() const = 0;
92  virtual vtkRenderWindowPtr getRenderWindow() const = 0;
93  virtual void setModified() = 0;
94  virtual void setBackgroundColor(QColor color) = 0;
95  virtual QSize size() const = 0;
96  virtual void setZoomFactor(double factor) = 0;
97  virtual double getZoomFactor() const = 0;
98  virtual Transform3D get_vpMs() const = 0;
99  virtual DoubleBoundingBox3D getViewport() const = 0;
100  virtual DoubleBoundingBox3D getViewport_s() const = 0;
101 
102 signals:
103  void resized(QSize size);
104  void mouseMove(int x, int y, Qt::MouseButtons buttons);
105  void mousePress(int x, int y, Qt::MouseButtons buttons);
106  void mouseRelease(int x, int y, Qt::MouseButtons buttons);
107  void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
108  void shown();
109  void focusChange(bool gotFocus, Qt::FocusReason reason);
110  void customContextMenuRequested(const QPoint&);
111 };
112 typedef boost::shared_ptr<View> ViewPtr;
113 
114 } // namespace cx
115 
116 #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:78
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