CustusX  22.04-rc2
An IGT application
cxViewWidget.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 CXVIEWWIDGET_H_
13 #define CXVIEWWIDGET_H_
14 
15 #include "QVTKWidget.h"
16 
17 #include "cxTransform3D.h"
18 #include "cxView.h"
19 #include "cxViewRepCollection.h"
20 #include "cxViewService.h"
21 
22 namespace cx
23 {
24 
29 class cxResourceVisualization_EXPORT ViewWidget : public QVTKWidget
30 {
31 Q_OBJECT
32  typedef QVTKWidget inherited;
33 
34 public:
35  ViewRepCollectionPtr getView();
36 
37  ViewWidget(RenderWindowFactoryPtr factory, const QString& uid="", const QString& name = "", QWidget *parent = NULL, Qt::WindowFlags f = 0);
38  virtual ~ViewWidget();
39 
40  virtual vtkRenderWindowPtr getRenderWindow() { return this->getView()->getRenderWindow(); }
41  virtual QSize size() const { return inherited::size(); }
42  virtual void setZoomFactor(double factor);
43  virtual vtkRendererPtr getRenderer();
44  virtual double getZoomFactor() const;
45  virtual Transform3D get_vpMs() const;
46  virtual double mmPerPix() const;
47  virtual DoubleBoundingBox3D getViewport() const;
48  virtual DoubleBoundingBox3D getViewport_s() const;
49 
50  virtual void setModified() { mView->setModified(); }
51  void render();
52 
53 signals:
54  void resized(QSize size);
55  void mouseMove(int x, int y, Qt::MouseButtons buttons);
56  void mousePress(int x, int y, Qt::MouseButtons buttons);
57  void mouseRelease(int x, int y, Qt::MouseButtons buttons);
58  void mouseWheel(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
59  void shown();
60  void focusChange(bool gotFocus, Qt::FocusReason reason);
61  void customContextMenuRequestedInGlobalPos(const QPoint&);
62 
63 private slots:
64  void customContextMenuRequestedSlot(const QPoint& point);
65 private:
66  virtual void showEvent(QShowEvent* event);
67  virtual void wheelEvent(QWheelEvent*);
68  virtual void mouseMoveEvent(QMouseEvent *event);
69  virtual void mousePressEvent(QMouseEvent *event);
70  virtual void mouseReleaseEvent(QMouseEvent *event);
71  virtual void focusInEvent(QFocusEvent* event);
72  virtual void resizeEvent(QResizeEvent *event);
73  virtual void paintEvent(QPaintEvent *event);
74 
75  double mZoomFactor;
76  boost::shared_ptr<class ViewRepCollection> mView;
77  unsigned long mMTimeHash;
78 
79 // SharedOpenGLContextPtr mSharedOpenGLContext;
80 };
81 
82 } // namespace cx
83 
84 #endif /* CXVIEWWIDGET_H_ */
virtual vtkRenderWindowPtr getRenderWindow()
Get the vtkRenderWindow used by this View.
Definition: cxViewWidget.h:40
virtual QSize size() const
Definition: cxViewWidget.h:41
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
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 void setModified()
Definition: cxViewWidget.h:50
boost::shared_ptr< class RenderWindowFactory > RenderWindowFactoryPtr
Namespace for all CustusX production code.