ImagingTools Core SDK
CPointCloudShape.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// STL includes
6#include <set>
7
8// ACF includes
9#include <istd/TRange.h>
10
11// ImtCore includes
12#include <imt3dgui/CShape3dBase.h>
13#include <imt3d/IPointCloud3d.h>
14
15
16namespace imt3dgui
17{
18
19
24{
26
27public:
29
30 void SetColor(const QVector3D& color);
31 void SetPointSize(float pointSize);
32 void SetPointSelection(const QPoint& selectionPoint, bool clearPreviousSelection);
33 void SetBoxSelection(const QRect& selectionRect, bool clearPreviousSelection);
34 void SetCircleSelection(const QRect& selectionRect, bool clearPreviousSelection);
35 void ClearSelection();
36 void AllSelection();
37 void InvertSelection();
38 void DeleteSelection();
39 void SetInfoBoxEnabled(bool isEnabled = true);
40
41protected:
42 // reimplemented (imt3dview::CShape3dBase)
43 virtual void UpdateShapeGeometry(const istd::IChangeable::ChangeSet& changeSet) override;
44 virtual void DrawShapeGl(QOpenGLShaderProgram& program, QOpenGLFunctions& functions) override;
45
46 // reimplemented (imt3dview::IDrawable)
47 virtual void Draw(QPainter& painter) override;
48
49 // reimplemented (imt3dgui::IShape3d)
50 virtual QVector3D GetColor() const override;
51
52private:
53 void SetRectSelection(const QRect& selectionRect, bool isCircle, bool clearPreviousSelection);
54 template <typename PointType> void DeleteSelectionHelper(imt3d::IPointCloud3d& pointCloud);
55 static bool IsPointWithin(const QPoint& point, const QRect& rect, bool isCircle);
56
57private:
58 typedef std::set<int> SelectedVerticesIndicies;
59
60 QVector3D m_color;
61 float m_pointSize;
62 SelectedVerticesIndicies m_selectedVerticesIndicies;
63 bool m_isInfoBoxEnabled;
64
65 static const QVector3D s_selectionColor;
66};
67
68
69} // namespace imt3dgui