ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvBoundingBoxEditorDlg.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <ui_boundingBoxEditorDlg.h>
11 
12 // CV_DB_LIB
13 #include <ecvBBox.h>
14 
16 class ccBoundingBoxEditorDlg : public QDialog,
17  public Ui::BoundingBoxEditorDialog {
18  Q_OBJECT
19 
20 public:
22  explicit ccBoundingBoxEditorDlg(QWidget* parent = 0);
23 
25  const ccBBox& getBox() const { return m_currentBBox; }
26 
28 
32  void setBaseBBox(const ccBBox& box, bool isMinimal = true);
33 
35  void setBoxAxes(const CCVector3& X, const CCVector3& Y, const CCVector3& Z);
36 
39 
42 
44  void showInclusionWarning(bool state) { m_showInclusionWarning = state; }
45 
47  void forceKeepSquare(bool state);
48 
50  bool keepSquare() const;
51 
53  void set2DMode(bool state, unsigned char dim);
54 
56  void showBoxAxes(bool state);
57 
58 public slots:
59 
60  // overloaded from QDialog
61  virtual int exec();
62 
63 protected slots:
64 
65  void squareModeActivated(bool);
66  void resetToDefault();
67  void resetToLast();
68  void cancel();
69  void saveBoxAndAccept();
70 
71  void updateXWidth(double);
72  void updateYWidth(double);
73  void updateZWidth(double);
74 
76  void updateCurrentBBox(double dummy = 0.0);
78  void reflectChanges(int dummy = 0);
79 
81  void onAxisValueChanged(double);
82 
83  void fromClipboardClicked();
84  void toClipboardClicked();
85 
86 protected:
88  void checkBaseInclusion();
89 
92 
95 
98 
101 
104 };
ccGLMatrixTpl::getColumnAsVec3D
Vector3Tpl< T > getColumnAsVec3D(unsigned index) const
Returns a copy of a given column as a CCVector3.
Definition: ecvGLMatrixTpl.h:919
Vector3Tpl::normalize
void normalize()
Sets vector norm to unity.
Definition: CVGeom.h:428
cloudViewer::BoundingBoxTpl::getCenter
Vector3Tpl< T > getCenter() const
Returns center.
Definition: BoundingBox.h:164
Tuple3Tpl::x
Type x
Definition: CVGeom.h:137
MakeSquare
void MakeSquare(ccBBox &box, int pivotType, int defaultDim=-1)
Definition: ecvBoundingBoxEditorDlg.cpp:131
ccBoundingBoxEditorDlg::m_initBBox
ccBBox m_initBBox
Box state at dialog start.
Definition: ecvBoundingBoxEditorDlg.h:100
ccBoundingBoxEditorDlg::updateYWidth
void updateYWidth(double)
Definition: ecvBoundingBoxEditorDlg.cpp:298
ccBoundingBoxEditorDlg::setBaseBBox
void setBaseBBox(const ccBBox &box, bool isMinimal=true)
Sets the (minimal) base box.
Definition: ecvBoundingBoxEditorDlg.cpp:199
ecvBoundingBoxEditorDlg.h
ccGLMatrixTpl::setColumn
void setColumn(unsigned index, const Vector3Tpl< T > &v)
Sets the content of a given column.
Definition: ecvGLMatrixTpl.h:927
ccBBox
Bounding box structure.
Definition: ecvBBox.h:25
CVLog::Print
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
ccGLMatrixTpl::setTranslation
void setTranslation(const Vector3Tpl< float > &Tr)
Sets translation (float version)
Definition: ecvGLMatrixTpl.h:836
ccBoundingBoxEditorDlg::reflectChanges
void reflectChanges(int dummy=0)
Reflects changes on bbox.
Definition: ecvBoundingBoxEditorDlg.cpp:345
ecvBBox.h
ccBoundingBoxEditorDlg::resetToLast
void resetToLast()
Definition: ecvBoundingBoxEditorDlg.cpp:232
ccBoundingBoxEditorDlg::squareModeActivated
void squareModeActivated(bool)
Definition: ecvBoundingBoxEditorDlg.cpp:174
s_lastBBox
static ccBBox s_lastBBox
Definition: ecvBoundingBoxEditorDlg.cpp:17
ccBoundingBoxEditorDlg::keepSquare
bool keepSquare() const
Returns whether 'keep square' mode is enabled or not.
Definition: ecvBoundingBoxEditorDlg.cpp:165
CCVector3d
Vector3Tpl< double > CCVector3d
Double 3D Vector.
Definition: CVGeom.h:804
ccBoundingBoxEditorDlg::onAxisValueChanged
void onAxisValueChanged(double)
Slot called anytime a component of the box axes is modified.
Definition: ecvBoundingBoxEditorDlg.cpp:448
CVLog::Error
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
slots
#define slots
Definition: PythonPlugin.cpp:25
ccGLMatrixTpl::getTranslationAsVec3D
Vector3Tpl< T > getTranslationAsVec3D() const
Returns a copy of the translation as a CCVector3.
Definition: ecvGLMatrixTpl.h:830
ccBoundingBoxEditorDlg::toClipboardClicked
void toClipboardClicked()
Definition: ecvBoundingBoxEditorDlg.cpp:508
Vector3Tpl::cross
Vector3Tpl cross(const Vector3Tpl &v) const
Cross product.
Definition: CVGeom.h:412
ccBoundingBoxEditorDlg::fromClipboardClicked
void fromClipboardClicked()
Definition: ecvBoundingBoxEditorDlg.cpp:482
ccBoundingBoxEditorDlg::showBoxAxes
void showBoxAxes(bool state)
Whether to display or not the box axes.
Definition: ecvBoundingBoxEditorDlg.cpp:404
Vector3Tpl< PointCoordinateType >
ccBoundingBoxEditorDlg::saveBoxAndAccept
void saveBoxAndAccept()
Definition: ecvBoundingBoxEditorDlg.cpp:243
ccBoundingBoxEditorDlg::resetToDefault
void resetToDefault()
Definition: ecvBoundingBoxEditorDlg.cpp:221
ccBoundingBoxEditorDlg::getBox
const ccBBox & getBox() const
Returns bounding box.
Definition: ecvBoundingBoxEditorDlg.h:25
Ui
Definition: sfEditDlg.h:16
ccBoundingBoxEditorDlg::setBoxAxes
void setBoxAxes(const CCVector3 &X, const CCVector3 &Y, const CCVector3 &Z)
Sets the box axes.
Definition: ecvBoundingBoxEditorDlg.cpp:410
cloudViewer::BoundingBoxTpl::isValid
bool isValid() const
Returns whether bounding box is valid or not.
Definition: BoundingBox.h:203
ccBoundingBoxEditorDlg::updateXWidth
void updateXWidth(double)
Definition: ecvBoundingBoxEditorDlg.cpp:288
ccBoundingBoxEditorDlg::updateCurrentBBox
void updateCurrentBBox(double dummy=0.0)
Updates current box based on the dialog state.
Definition: ecvBoundingBoxEditorDlg.cpp:318
Tuple3Tpl::z
Type z
Definition: CVGeom.h:137
ccBoundingBoxEditorDlg::checkBaseInclusion
void checkBaseInclusion()
Checks if currentBox includes baseBox.
Definition: ecvBoundingBoxEditorDlg.cpp:210
ccBoundingBoxEditorDlg
Dialog to define the extents of a 3D box.
Definition: ecvBoundingBoxEditorDlg.h:16
ccBoundingBoxEditorDlg::updateZWidth
void updateZWidth(double)
Definition: ecvBoundingBoxEditorDlg.cpp:308
ccGLMatrix
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
cloudViewer::BoundingBoxTpl::contains
bool contains(const Vector3Tpl< T > &P) const
Returns whether a points is inside the box or not.
Definition: BoundingBox.h:231
ccBoundingBoxEditorDlg::ccBoundingBoxEditorDlg
ccBoundingBoxEditorDlg(QWidget *parent=0)
Default constructor.
Definition: ecvBoundingBoxEditorDlg.cpp:19
ccBoundingBoxEditorDlg::m_baseBBox
ccBBox m_baseBBox
Base box (invalid if none)
Definition: ecvBoundingBoxEditorDlg.h:91
cloudViewer::BoundingBoxTpl::getDiagVec
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Definition: BoundingBox.h:169
Vector3Tpl::norm2d
double norm2d() const
Returns vector square norm (forces double precision output)
Definition: CVGeom.h:419
Tuple3Tpl::y
Type y
Definition: CVGeom.h:137
cloudViewer::BoundingBoxTpl::maxCorner
const Vector3Tpl< T > & maxCorner() const
Returns max corner (const)
Definition: BoundingBox.h:156
ccBoundingBoxEditorDlg::forceKeepSquare
void forceKeepSquare(bool state)
Forces the 'keep square' mode.
Definition: ecvBoundingBoxEditorDlg.cpp:169
ccBoundingBoxEditorDlg::cancel
void cancel()
Definition: ecvBoundingBoxEditorDlg.cpp:281
X
void * X
Definition: SmallVector.cpp:45
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
ccBoundingBoxEditorDlg::m_currentBBox
ccBBox m_currentBBox
Current box.
Definition: ecvBoundingBoxEditorDlg.h:97
Tuple3Tpl::u
Type u[3]
Definition: CVGeom.h:139
ccBoundingBoxEditorDlg::m_showInclusionWarning
bool m_showInclusionWarning
Whether to show 'inclusion' warning or not.
Definition: ecvBoundingBoxEditorDlg.h:103
ccGLMatrixTpl< float >::FromString
static ccGLMatrixTpl< float > FromString(const QString &matText, bool &success)
Converts a 'text' matrix to a ccGLMatrix.
Definition: ecvGLMatrixTpl.h:477
Vector3Tpl< PointCoordinateType >::fromArray
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
Definition: CVGeom.h:268
ccBoundingBoxEditorDlg::m_baseBoxIsMinimal
bool m_baseBoxIsMinimal
Whether base box is minimal or not.
Definition: ecvBoundingBoxEditorDlg.h:94
ccBoundingBoxEditorDlg::set2DMode
void set2DMode(bool state, unsigned char dim)
Sets 2D mode (the line 'dim' will be hidden)
Definition: ecvBoundingBoxEditorDlg.cpp:181
ccBoundingBoxEditorDlg::showInclusionWarning
void showInclusionWarning(bool state)
Definition: ecvBoundingBoxEditorDlg.h:44
ccBoundingBoxEditorDlg::exec
virtual int exec()
Definition: ecvBoundingBoxEditorDlg.cpp:273
cloudViewer::BoundingBoxTpl::minCorner
const Vector3Tpl< T > & minCorner() const
Returns min corner (const)
Definition: BoundingBox.h:154
ccGLMatrixTpl::toString
QString toString(int precision=12, QChar separator=' ') const
Returns matrix as a string.
Definition: ecvGLMatrixTpl.h:502
ccBoundingBoxEditorDlg::getBoxAxes
void getBoxAxes(CCVector3d &X, CCVector3d &Y, CCVector3d &Z)
Returns the box axes.
Definition: ecvBoundingBoxEditorDlg.cpp:435