ImagingTools Core SDK
CGridShape.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 <optional>
7
8// ImtCore includes
9#include <imt3dgui/CShape3dBase.h>
10#include <imt3d/CPointCloud3d.h>
11
12
13namespace imt3dgui
14{
15
16
17class CGridShape: public CShape3dBase
18{
19 typedef CShape3dBase BaseClass;
20
21public:
22 enum PlaneMode
23 {
24 PM_XY,
25 PM_XZ,
26 PM_YZ
27 };
28
29 CGridShape();
30
31 void SetGridValue(double gridValue);
32 void SetCount(int count);
33 void SetPlanePosition(double position);
34 void SetPlaneMode(PlaneMode planeMode);
35
36protected:
37 // reimplement (imt3dgui::CShape3dBase)
38 virtual void UpdateShapeGeometry(const istd::IChangeable::ChangeSet& changeSet) override;
39 virtual void DrawShapeGl(QOpenGLShaderProgram& program, QOpenGLFunctions& functions) override;
40
41 // reimplement (imt3dgui::IShape3d)
42 virtual QVector3D GetColor() const override { return QVector3D(0.5, 0.5, 0.5); }
43
44private:
45 typedef std::vector<imt3d::CPointCloud3d::PointXyz32> Vertices;
46 void CreateXyPlane(Vertices& vertices, double planePosition) const;
47 void CreateXzPlane(Vertices& vertices, double planePosition) const;
48 void CreateYzPlane(Vertices& vertices, double planePosition) const;
49
50private:
51 double m_gridValue = 0.1;
52 int m_count = 10;
54 bool m_doUpdate = false;
55 PlaneMode m_planeMode = PM_XY;
56
57 std::optional<double> m_planePosition;
58};
59
60
61} // namespace imt3dgui
62
63