Fraxinus  2023.01.05-dev+develop.0da12
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_ */
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
Namespace for all CustusX production code.