NorMIT-nav  22.09
An IGT application
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) 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 CXVIEWLINKINGVIEWWIDGET_H_
13 #define CXVIEWLINKINGVIEWWIDGET_H_
14 
15 #include "cxView.h"
16 #include "cxViewWidget.h"
17 #include <QPointer>
18 #include "cxBoundingBox3D.h"
19 #include "cxViewRepCollection.h"
20 
21 namespace cx
22 {
23 
30 {
31 public:
33  {
34  boost::shared_ptr<ViewLinkingViewWidget> retval(new ViewLinkingViewWidget(base, renderWindow));
35  retval->mSelf = retval;
36  return retval;
37  }
38 
40  ViewRepCollection(renderWindow, "")
41  {
42  mBase = base;
43 
44  connect(base, SIGNAL(resized(QSize)), this, SIGNAL(resized(QSize)));
45  connect(base, SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SIGNAL(mouseMove(int, int, Qt::MouseButtons)));
46  connect(base, SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SIGNAL(mousePress(int, int, Qt::MouseButtons)));
47  connect(base, SIGNAL(mouseRelease(int, int, Qt::MouseButtons)), this, SIGNAL(mouseRelease(int, int, Qt::MouseButtons)));
48  connect(base, SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)));
49  connect(base, SIGNAL(shown()), this, SIGNAL(shown()));
50  connect(base, SIGNAL(focusChange(bool, Qt::FocusReason)), this, SIGNAL(focusChange(bool, Qt::FocusReason)));
51  connect(base, SIGNAL(customContextMenuRequestedInGlobalPos(const QPoint &)), this, SIGNAL(customContextMenuRequested(const QPoint &)));
52 
53  }
54 
56  virtual QSize size() const
57  {
58  if (mBase)
59  return mBase->size();
60  return QSize(0,0);
61  }
62  virtual void setZoomFactor(double factor)
63  {
64  if (mBase)
65  mBase->setZoomFactor(factor);
66  }
67  virtual double getZoomFactor() const
68  {
69  if (mBase)
70  return mBase->getZoomFactor();
71  return 0;
72  }
73  virtual Transform3D get_vpMs() const
74  {
75  if (mBase)
76  return mBase->get_vpMs();
77  return Transform3D::Identity();
78  }
80  {
81  if (mBase)
82  return mBase->getViewport();
84  }
86  {
87  if (mBase)
88  return mBase->getViewport_s();
90  }
91 
92 private:
93  QPointer<ViewWidget> mBase;
94 };
95 
96 } /* namespace cx */
97 #endif /* CXVIEWLINKINGVIEWWIDGET_H_ */
cx::ViewLinkingViewWidget::getViewport
virtual DoubleBoundingBox3D getViewport() const
Definition: cxViewLinkingViewWidget.h:79
cx::ViewLinkingViewWidget
Definition: cxViewLinkingViewWidget.h:29
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cxViewRepCollection.h
vtkRenderWindowPtr
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
Definition: vtkForwardDeclarations.h:124
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::View::resized
void resized(QSize size)
cx::View::focusChange
void focusChange(bool gotFocus, Qt::FocusReason reason)
cx::ViewLinkingViewWidget::size
virtual QSize size() const
Definition: cxViewLinkingViewWidget.h:56
cx::DoubleBoundingBox3D::zero
static DoubleBoundingBox3D zero()
Definition: cxBoundingBox3D.h:75
cxBoundingBox3D.h
cx::View::mouseMove
void mouseMove(int x, int y, Qt::MouseButtons buttons)
cx::ViewWidget
Definition: cxViewWidget.h:29
cx::ViewRepCollectionPtr
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
Definition: cxViewRepCollection.h:23
cxViewWidget.h
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cxView.h
cx::View::shown
void shown()
cx::ViewRepCollection
Definition: cxViewRepCollection.h:30
cx::ViewLinkingViewWidget::setZoomFactor
virtual void setZoomFactor(double factor)
Definition: cxViewLinkingViewWidget.h:62
cx::View::customContextMenuRequested
void customContextMenuRequested(const QPoint &)
cx::ViewLinkingViewWidget::ViewLinkingViewWidget
ViewLinkingViewWidget(ViewWidget *base, vtkRenderWindowPtr renderWindow)
Definition: cxViewLinkingViewWidget.h:39
cx::View::mouseRelease
void mouseRelease(int x, int y, Qt::MouseButtons buttons)
cx::ViewLinkingViewWidget::getZoomFactor
virtual double getZoomFactor() const
Definition: cxViewLinkingViewWidget.h:67
cx::ViewLinkingViewWidget::~ViewLinkingViewWidget
virtual ~ViewLinkingViewWidget()
Definition: cxViewLinkingViewWidget.h:55
cx::ViewLinkingViewWidget::create
static ViewRepCollectionPtr create(ViewWidget *base, vtkRenderWindowPtr renderWindow)
Definition: cxViewLinkingViewWidget.h:32
cx::ViewLinkingViewWidget::getViewport_s
virtual DoubleBoundingBox3D getViewport_s() const
Definition: cxViewLinkingViewWidget.h:85
cx::View::mousePress
void mousePress(int x, int y, Qt::MouseButtons buttons)
cx::ViewLinkingViewWidget::get_vpMs
virtual Transform3D get_vpMs() const
Definition: cxViewLinkingViewWidget.h:73
cx::View::mouseWheel
void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)