Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxTransform3DWidget.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 #ifndef CXTRANSFORM3DWIDGET_H_
12 #define CXTRANSFORM3DWIDGET_H_
13 
14 #include "cxResourceWidgetsExport.h"
15 
16 #include "cxBaseWidget.h"
17 #include "cxTransform3D.h"
18 #include "cxFrame3D.h"
19 
20 class QTextEdit;
21 class QVBoxLayout;
22 class QAction;
23 class QFrame;
24 
25 namespace cx
26 {
27 
28 class MatrixTextEdit;
29 typedef boost::shared_ptr<class DoubleProperty> DoublePropertyPtr;
30 
38 class cxResourceWidgets_EXPORT Transform3DWidget : public BaseWidget
39 {
40  Q_OBJECT
41 public:
42  Transform3DWidget(QWidget* parent = NULL);
43  virtual ~Transform3DWidget();
44 
45  void setMatrix(const Transform3D& M);
46  Transform3D getMatrix() const;
47  void setEditable(bool edit);
48 
49 signals:
50  void changed();
51 
52 protected slots:
53  virtual void prePaintEvent();
54 private slots:
55  void changedSlot();
56  void toggleEditSlot();
57  void textEditChangedSlot();
58  void toggleInvertSlot();
59 
60 private:
61  void setMatrixInternal(const Transform3D& M);
62  Transform3D getMatrixInternal() const;
63 
64  void addAngleControls(QString uid, QString name, int index, QVBoxLayout* layout);
65  void addTranslationControls(QString uid, QString name, int index, QVBoxLayout* layout);
66  void rotateSlot(QPointF delta, int index);
67  void translateSlot(QPointF delta, int index);
68  void updateAdapter(DoublePropertyPtr adapter, double value);
69  void setActionText(QAction* action, QString text, QString tip);
70  Transform3D convertToFromExternal(const Transform3D& M) const;
71  void updateInvertAction();
72 
73 // Frame3D mFrame;
74  MatrixTextEdit* mTextEdit;
75  boost::array<DoublePropertyPtr, 3> mAngleAdapter;
76  boost::array<DoublePropertyPtr, 3> mTranslationAdapter;
77  bool recursive;
78  bool mBlockChanges;
79  QAction* mEditAction;
80  QAction* mInvertAction;
81  QFrame* aGroupBox;
82  QFrame* tGroupBox;
83  DecomposedTransform3D mDecomposition;
84 };
85 
86 }
87 
88 #endif /* CXTRANSFORM3DWIDGET_H_ */
Helper class for visualizing rotational angles to a human user.
Definition: cxFrame3D.h:40
Widget for displaying and manipulating an affine matrix, i.e. a rotation+translation matrix...
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Namespace for all CustusX production code.