Debian Codegraph @

plugins/core/Standard/qFacets/include/qFacets.h

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qFacets #
4 //# #
5 //# This program is free software; you can redistribute it and/or modify #
6 //# it under the terms of the GNU General Public License as published by #
7 //# the Free Software Foundation; version 2 or later of the License. #
8 //# #
9 //# This program is distributed in the hope that it will be useful, #
10 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 //# GNU General Public License for more details. #
13 //# #
14 //# COPYRIGHT: Thomas Dewez, BRGM #
15 //# #
16 //##########################################################################
17
18 #ifndef QFACET_PLUGIN_HEADER
19 #define QFACET_PLUGIN_HEADER
20
21 //Local
22 #include "cellsFusionDlg.h"
23
24 //Qt
25 #include <QObject>
26
27 //qCC
28 #include "ccStdPluginInterface.h"
29
30 //CCCoreLib
31 #include <AutoSegmentationTools.h>
32 #include <ReferenceCloud.h>
33
34 //System
35 #include <unordered_set>
36
37 class QAction;
38 class ccHObject;
39 class ccPointCloud;
40 class ccPolyline;
41 class ccFacet;
42
43 class StereogramDialog;
44
45 //! Facet detection plugin (BRGM)
46 /** BRGM: BUREAU DE RECHERCHES GEOLOGIQUES ET MINIERES - http://www.brgm.fr/
47 **/
48 class qFacets : public QObject, public ccStdPluginInterface
49 {
50 Q_OBJECT
51 Q_INTERFACES( ccPluginInterface ccStdPluginInterface )
52
53 Q_PLUGIN_METADATA( IID "cccorp.cloudcompare.plugin.qFacets" FILE "../info.json" )
54
55 public:
56
57 //! Default constructor
58 qFacets(QObject* parent = nullptr);
59
60 //! Destructor
61 virtual ~qFacets() = default;
62
63 //inherited from ccStdPluginInterface
64 virtual void onNewSelection(const ccHObject::Container& selectedEntities) override;
65 virtual QList<QAction *> getActions() override;
66
67 protected:
68
69 //! Fuses the cells of a kd-tree to produces planar facets
70 void fuseKdTreeCells();
71
72 //! Uses Fast Marching to detect planar facets
73 void extractFacetsWithFM();
74
75 //! Exports facets (as shapefiles)
76 void exportFacets();
77
78 //! Exports statistics on a set of facets
79 void exportFacetsInfo();
80
81 //! Classifies facets by orientation
82 void classifyFacetsByAngle();
83
84 //! Displays the selected entity stereogram
85 void showStereogram();
86
87 protected:
88
89 //! Uses the given algorithm to detect planar facets
90 void extractFacets(CellsFusionDlg::Algorithm algo);
91
92 //! Creates facets from components
93 ccHObject* createFacets(ccPointCloud* cloud,
94 CCCoreLib::ReferenceCloudContainer& components,
95 unsigned minPointsPerComponent,
96 double maxEdgeLength,
97 bool randomColors,
98 bool& error);
99
100 //! Set of facets (pointers)
101 typedef std::unordered_set<ccFacet*> FacetSet;
102
103 //! Returns all the facets in the current selection
104 void getFacetsInCurrentSelection(FacetSet& facets) const;
105
106 //! Classifies facets by orientation
107 void classifyFacetsByAngle( ccHObject* group,
108 double angleStep_deg,
109 double maxDist);
110
111 //! Associated action
112 QAction* m_doFuseKdTreeCells;
113 //! Associated action
114 QAction* m_fastMarchingExtraction;
115 //! Associated action
116 QAction* m_doExportFacets;
117 //! Associated action
118 QAction* m_doExportFacetsInfo;
119 //! Associated action
120 QAction* m_doClassifyFacetsByAngle;
121 //! Associated action
122 QAction* m_doShowStereogram;
123
124 StereogramDialog* m_stereogramDialog;
125 };
126
127 #endif //QFACET_PLUGIN_HEADER