Fraxinus  2023.01.05-dev+develop.0da12
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_ */
virtual QSize sizeHint() const
void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
void mouseMove(int x, int y, Qt::MouseButtons buttons)
virtual void setModified()
virtual DoubleBoundingBox3D getViewport_s() const
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
void mouseRelease(int x, int y, Qt::MouseButtons buttons)
void mousePress(int x, int y, Qt::MouseButtons buttons)
virtual void setGeometry(const QRect &r)
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
virtual void setZoomFactor(double factor)
virtual QSize maximumSize() const
virtual bool isEmpty() const
void mouseReleaseSlot(int x, int y, Qt::MouseButtons buttons)
virtual Qt::Orientations expandingDirections() const
void mousePressSlot(int x, int y, Qt::MouseButtons buttons)
void focusChange(bool gotFocus, Qt::FocusReason reason)
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
ViewItem(QString uid, QString name, QWidget *parent, vtkRenderWindowPtr renderWindow, QRect rect)
void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
virtual vtkRendererPtr getRenderer()
void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons)
virtual QSize minimumSize() const
boost::shared_ptr< class ViewRepCollection > ViewRepCollectionPtr
virtual DoubleBoundingBox3D getViewport() const
virtual Transform3D get_vpMs() const
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.
void resized(QSize size)
void customContextMenuRequestedInGlobalPos(const QPoint &)
virtual vtkRenderWindowPtr getRenderWindow()
void resizedSlot(QSize size)
void customContextMenuRequestedGlobalSlot(const QPoint &point)
virtual double getZoomFactor() const
boost::shared_ptr< class Rep > RepPtr
Definition: cxRepManager.h:24
ViewRepCollectionPtr getView()
virtual QSize size() const
virtual QRect geometry() const
Namespace for all CustusX production code.