Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxViewLinkingViewWidget.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 CXVIEWLINKINGVIEWWIDGET_H_
34 #define CXVIEWLINKINGVIEWWIDGET_H_
35 
36 #include "cxView.h"
37 #include "cxViewWidget.h"
38 #include <QPointer>
39 #include "cxBoundingBox3D.h"
40 #include "cxViewRepCollection.h"
41 
42 namespace cx
43 {
44 
51 {
52 public:
54  {
55  boost::shared_ptr<ViewLinkingViewWidget> retval(new ViewLinkingViewWidget(base, renderWindow));
56  retval->mSelf = retval;
57  return retval;
58  }
59 
61  ViewRepCollection(renderWindow, "")
62  {
63  mBase = base;
64 
65  connect(base, SIGNAL(resized(QSize)), this, SIGNAL(resized(QSize)));
66  connect(base, SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SIGNAL(mouseMove(int, int, Qt::MouseButtons)));
67  connect(base, SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SIGNAL(mousePress(int, int, Qt::MouseButtons)));
68  connect(base, SIGNAL(mouseRelease(int, int, Qt::MouseButtons)), this, SIGNAL(mouseRelease(int, int, Qt::MouseButtons)));
69  connect(base, SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)));
70  connect(base, SIGNAL(shown()), this, SIGNAL(shown()));
71  connect(base, SIGNAL(focusChange(bool, Qt::FocusReason)), this, SIGNAL(focusChange(bool, Qt::FocusReason)));
72  connect(base, SIGNAL(customContextMenuRequestedInGlobalPos(const QPoint &)), this, SIGNAL(customContextMenuRequested(const QPoint &)));
73 
74  }
75 
77  virtual QSize size() const
78  {
79  if (mBase)
80  return mBase->size();
81  return QSize(0,0);
82  }
83  virtual void setZoomFactor(double factor)
84  {
85  if (mBase)
86  mBase->setZoomFactor(factor);
87  }
88  virtual double getZoomFactor() const
89  {
90  if (mBase)
91  return mBase->getZoomFactor();
92  return 0;
93  }
94  virtual Transform3D get_vpMs() const
95  {
96  if (mBase)
97  return mBase->get_vpMs();
98  return Transform3D::Identity();
99  }
101  {
102  if (mBase)
103  return mBase->getViewport();
104  return DoubleBoundingBox3D::zero();
105  }
107  {
108  if (mBase)
109  return mBase->getViewport_s();
110  return DoubleBoundingBox3D::zero();
111  }
112 
113 private:
114  QPointer<ViewWidget> mBase;
115 };
116 
117 } /* namespace cx */
118 #endif /* CXVIEWLINKINGVIEWWIDGET_H_ */
void customContextMenuRequested(const QPoint &)
virtual void setZoomFactor(double factor)
void resized(QSize size)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
void focusChange(bool gotFocus, Qt::FocusReason reason)
static ViewRepCollectionPtr create(ViewWidget *base, vtkRenderWindowPtr renderWindow)
void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
ViewLinkingViewWidget(ViewWidget *base, vtkRenderWindowPtr renderWindow)
void mouseRelease(int x, int y, Qt::MouseButtons buttons)
void mousePress(int x, int y, Qt::MouseButtons buttons)
virtual DoubleBoundingBox3D getViewport_s() const
static DoubleBoundingBox3D zero()
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
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 Transform3D get_vpMs() const
void mouseMove(int x, int y, Qt::MouseButtons buttons)
virtual DoubleBoundingBox3D getViewport() const
void shown()
virtual double getZoomFactor() const