CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxViewWrapper2D.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 /*
34  * cxViewWrapper2D.h
35  *
36  * \date Mar 24, 2010
37  * \author christiana
38  */
39 #ifndef CXVIEWWRAPPER2D_H_
40 #define CXVIEWWRAPPER2D_H_
41 
42 #include "org_custusx_core_view_Export.h"
43 
44 #include <vector>
45 #include <QPointer>
46 #include "cxForwardDeclarations.h"
47 #include "cxDefinitions.h"
48 #include "cxViewWrapper.h"
49 #include "cxBoundingBox3D.h"
50 #include "cxTransform3D.h"
51 #include "sscConfig.h"
52 
53 class QMouseEvent;
54 class QWheelEvent;
55 
56 namespace cx
57 {
58 typedef boost::shared_ptr<class OrientationAnnotationSmartRep> OrientationAnnotationSmartRepPtr;
59 typedef boost::shared_ptr<class ViewFollower> ViewFollowerPtr;
60 typedef boost::shared_ptr<class Zoom2DHandler> Zoom2DHandlerPtr;
61 typedef boost::shared_ptr<class DataRepContainer> DataRepContainerPtr;
62 }
63 
64 
65 namespace cx
66 {
77 class org_custusx_core_view_EXPORT ViewWrapper2D: public ViewWrapper
78 {
79 Q_OBJECT
80 public:
81  ViewWrapper2D(ViewPtr view, VisServicesPtr backend);
82  virtual ~ViewWrapper2D();
83  virtual void initializePlane(PLANE_TYPE plane);
84  virtual ViewPtr getView();
85  virtual void setOrientationMode(SyncedValuePtr value);
86  virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy);
87  virtual void setViewGroup(ViewGroupDataPtr group);
88 
89  virtual void updateView();
90 
91 protected slots:
92  virtual void dataViewPropertiesChangedSlot(QString uid);
93 private slots:
94  void activeToolChangedSlot();
95  void viewportChanged();
96  void showSlot();
97  void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
98  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
99  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
100  void orientationActionSlot();
101  void orientationModeChanged();
102  void settingsChangedSlot(QString key);
103  void optionChangedSlot();
104 
105 private:
106  void moveManualTool(QPoint point);
107 
108  virtual void appendToContextMenu(QMenu& contextMenu);
109  void addReps();
110  DoubleBoundingBox3D getViewport() const;
111  Vector3D qvp2vp(QPoint pos_qvp);
112  void setAxisPos(Vector3D click_vp);
113  void shiftAxisPos(Vector3D delta_vp);
114 
115  ORIENTATION_TYPE getOrientationType() const;
116  void changeOrientationType(ORIENTATION_TYPE type);
117 
118  virtual void imageAdded(ImagePtr image);
119  virtual void imageRemoved(const QString& uid);
120 
121  virtual void dataAdded(DataPtr data);
122  virtual void dataRemoved(const QString& uid);
123 
124  void resetMultiSlicer();
125  Texture3DSlicerRepPtr mMultiSliceRep;
126  DataRepContainerPtr mDataRepContainer;
127 
128  GeometricRep2DPtr mPickerGlyphRep;
129  SliceProxyPtr mSliceProxy;
130  SliceRepSWPtr mSliceRep;
131  ToolRep2DPtr mToolRep2D;
132  OrientationAnnotationSmartRepPtr mOrientationAnnotationRep;
133  DisplayTextRepPtr mPlaneTypeText;
134  DisplayTextRepPtr mDataNameText;
135  SlicePlanes3DMarkerIn2DRepPtr mSlicePlanes3DMarker;
136  ViewPtr mView;
137  ViewFollowerPtr mViewFollower;
138 
139 
140  // synchronized data
141  Zoom2DHandlerPtr mZoom2D;
142 
143  SyncedValuePtr mOrientationMode;
144  Vector3D mClickPos;
145 
146  QActionGroup* mOrientationActionGroup;
147 };
148 typedef boost::shared_ptr<ViewWrapper2D> ViewWrapper2DPtr;
149 
153 } // namespace cx
154 
155 #endif /* CXVIEWWRAPPER2D_H_ */
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
boost::shared_ptr< class ViewFollower > ViewFollowerPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:62
boost::shared_ptr< class SliceProxy > SliceProxyPtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:93
boost::shared_ptr< class DataRepContainer > DataRepContainerPtr
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class ToolRep2D > ToolRep2DPtr
boost::shared_ptr< class SliceRepSW > SliceRepSWPtr
boost::shared_ptr< ViewWrapper2D > ViewWrapper2DPtr
boost::shared_ptr< class OrientationAnnotationSmartRep > OrientationAnnotationSmartRepPtr
boost::shared_ptr< class Data > DataPtr
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.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
boost::shared_ptr< class DisplayTextRep > DisplayTextRepPtr
boost::shared_ptr< class SyncedValue > SyncedValuePtr
Definition: cxViewGroup.h:51
boost::shared_ptr< class Zoom2DHandler > Zoom2DHandlerPtr
boost::shared_ptr< class SlicePlanes3DMarkerIn2DRep > SlicePlanes3DMarkerIn2DRepPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr