NorMIT-nav  22.09
An IGT application
cxViewContainerItem.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 CXVIEWCONTAINERITEM_H_
13 #define CXVIEWCONTAINERITEM_H_
14 
15 #include "cxConfig.h"
16 #include <boost/shared_ptr.hpp>
17 #include "vtkForwardDeclarations.h"
18 #include "cxIndent.h"
19 #include <QLayoutItem>
20 #include <QWidget>
21 #include "cxTransform3D.h"
22 #include "cxViewRepCollection.h"
23 
24 class QGridLayout;
25 
26 namespace cx
27 {
28 class DoubleBoundingBox3D;
29 typedef boost::shared_ptr<class Rep> RepPtr;
30 
38 class ViewItem : public QObject, public QLayoutItem
39 {
40 Q_OBJECT
41 
42 public:
43  ViewRepCollectionPtr getView() { return mView; }
44 
45  ViewItem(QString uid, QString name, QWidget *parent, vtkRenderWindowPtr renderWindow, QRect rect);
46  virtual ~ViewItem();
47 
48  virtual vtkRenderWindowPtr getRenderWindow() { return this->getView()->getRenderWindow(); }
49  virtual vtkRendererPtr getRenderer() { return this->getView()->getRenderer(); }
50  virtual QSize size() const { return mGeometry.size(); }
51  virtual void setZoomFactor(double factor);
52 
53  virtual double getZoomFactor() const { return mZoomFactor; }
54  virtual Transform3D get_vpMs() const;
55  virtual DoubleBoundingBox3D getViewport() const;
56  virtual DoubleBoundingBox3D getViewport_s() const;
57  virtual void setModified() { return this->getView()->setModified(); }
58 
59  // Implementing QLayoutItem's pure virtuals
60  virtual Qt::Orientations expandingDirections() const { return Qt::Vertical | Qt::Horizontal; }
61  virtual QRect geometry() const { return mGeometry; }
62  virtual bool isEmpty() const { return false; }
63  virtual QSize maximumSize() const { return mParent->size(); }
64  virtual QSize minimumSize() const { return QSize(100, 100); }
65  virtual void setGeometry(const QRect &r);
66  virtual QSize sizeHint() const { return this->size(); }
67  // end QLayoutItem virtuals
68 
69  // Force signal output
70  void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons) { emit mouseMove(x, y, buttons); }
71  void mousePressSlot(int x, int y, Qt::MouseButtons buttons) { emit mousePress(x, y, buttons); }
72  void mouseReleaseSlot(int x, int y, Qt::MouseButtons buttons) { emit mouseRelease(x, y, buttons); }
73  void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons) { emit mouseWheel(x, y, delta, orientation, buttons); }
74  void resizedSlot(QSize size) { emit resized(size); }
76 
77 signals:
78  void resized(QSize size);
79  void mouseMove(int x, int y, Qt::MouseButtons buttons);
80  void mousePress(int x, int y, Qt::MouseButtons buttons);
81  void mouseRelease(int x, int y, Qt::MouseButtons buttons);
82  void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
83  void shown();
84  void focusChange(bool gotFocus, Qt::FocusReason reason);
85  void customContextMenuRequestedInGlobalPos(const QPoint&);
86 
87 private:
88  double mmPerPix() const;
89 
90  QRect mGeometry;
91  QWidget* mParent;
92  double mZoomFactor;
93  boost::shared_ptr<class ViewRepCollection> mView;
94 };
95 
96 } /* namespace cx */
97 #endif /* CXVIEWCONTAINERITEM_H_ */
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cxViewRepCollection.h
cx::ViewItem::getZoomFactor
virtual double getZoomFactor() const
Definition: cxViewContainerItem.h:53
cx::ViewItem::getRenderer
virtual vtkRendererPtr getRenderer()
Definition: cxViewContainerItem.h:49
cx::ViewItem::shown
void shown()
vtkRenderWindowPtr
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
Definition: vtkForwardDeclarations.h:124
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ViewItem::mouseWheel
void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
cx::ViewItem
Definition: cxViewContainerItem.h:38
cx::ViewItem::customContextMenuRequestedInGlobalPos
void customContextMenuRequestedInGlobalPos(const QPoint &)
cx::ViewItem::isEmpty
virtual bool isEmpty() const
Definition: cxViewContainerItem.h:62
cx::ViewItem::size
virtual QSize size() const
Definition: cxViewContainerItem.h:50
cx::ViewItem::maximumSize
virtual QSize maximumSize() const
Definition: cxViewContainerItem.h:63
cx::ViewItem::getRenderWindow
virtual vtkRenderWindowPtr getRenderWindow()
Definition: cxViewContainerItem.h:48
cx::ViewItem::resized
void resized(QSize size)
cx::ViewItem::getViewport_s
virtual DoubleBoundingBox3D getViewport_s() const
Definition: cxViewContainerItem.cpp:59
cx::ViewRepCollectionPtr
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
Definition: cxViewRepCollection.h:23
cx::ViewItem::sizeHint
virtual QSize sizeHint() const
Definition: cxViewContainerItem.h:66
cx::ViewItem::getView
ViewRepCollectionPtr getView()
Definition: cxViewContainerItem.h:43
cx::ViewItem::mouseMove
void mouseMove(int x, int y, Qt::MouseButtons buttons)
cx::ViewItem::resizedSlot
void resizedSlot(QSize size)
Definition: cxViewContainerItem.h:74
cx::RepPtr
boost::shared_ptr< class Rep > RepPtr
Definition: cxRepManager.h:24
cx::ViewItem::customContextMenuRequestedGlobalSlot
void customContextMenuRequestedGlobalSlot(const QPoint &point)
Definition: cxViewContainerItem.h:75
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::ViewItem::get_vpMs
virtual Transform3D get_vpMs() const
Definition: cxViewContainerItem.cpp:64
vtkForwardDeclarations.h
cx::ViewItem::expandingDirections
virtual Qt::Orientations expandingDirections() const
Definition: cxViewContainerItem.h:60
cx::ViewItem::mouseWheelSlot
void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
Definition: cxViewContainerItem.h:73
cx::ViewItem::setModified
virtual void setModified()
Definition: cxViewContainerItem.h:57
cx::ViewItem::setGeometry
virtual void setGeometry(const QRect &r)
Definition: cxViewContainerItem.cpp:47
cxIndent.h
cx::ViewItem::mouseRelease
void mouseRelease(int x, int y, Qt::MouseButtons buttons)
cx::ViewItem::setZoomFactor
virtual void setZoomFactor(double factor)
Definition: cxViewContainerItem.cpp:37
cx::ViewItem::mouseReleaseSlot
void mouseReleaseSlot(int x, int y, Qt::MouseButtons buttons)
Definition: cxViewContainerItem.h:72
cx::ViewItem::~ViewItem
virtual ~ViewItem()
Definition: cxViewContainerItem.cpp:33
cxTransform3D.h
cx::ViewItem::mousePress
void mousePress(int x, int y, Qt::MouseButtons buttons)
cx::ViewItem::minimumSize
virtual QSize minimumSize() const
Definition: cxViewContainerItem.h:64
cx::ViewItem::focusChange
void focusChange(bool gotFocus, Qt::FocusReason reason)
vtkRendererPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Definition: vtkForwardDeclarations.h:122
cx::ViewItem::mouseMoveSlot
void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons)
Definition: cxViewContainerItem.h:70
cx::ViewItem::getViewport
virtual DoubleBoundingBox3D getViewport() const
Definition: cxViewContainerItem.cpp:76
cx::ViewItem::ViewItem
ViewItem(QString uid, QString name, QWidget *parent, vtkRenderWindowPtr renderWindow, QRect rect)
Definition: cxViewContainerItem.cpp:23
cx::ViewItem::geometry
virtual QRect geometry() const
Definition: cxViewContainerItem.h:61
cx::ViewItem::mousePressSlot
void mousePressSlot(int x, int y, Qt::MouseButtons buttons)
Definition: cxViewContainerItem.h:71