Debian Codegraph @

plugins/core/Standard/qCanupo/include/qCanupo2DViewDialog.h

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qCANUPO #
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: UEB (UNIVERSITE EUROPEENNE DE BRETAGNE) / CNRS #
15 //# #
16 //##########################################################################
17
18 #ifndef Q_CANUPO_2DVIEW_DIALOG_HEADER
19 #define Q_CANUPO_2DVIEW_DIALOG_HEADER
20
21 #include <ui_qCanupo2DViewDialog.h>
22
23 //Local
24 #include "classifier.h"
25
26 //CCCoreLib
27 #include <CCGeom.h>
28
29 class ccMainAppInterface;
30 class ccGLWindowInterface;
31 class ccHObject;
32 class ccPointCloud;
33 class ccPolyline;
34
35 //! CANUPO plugin's 2D view dialog
36 class qCanupo2DViewDialog : public QDialog, public Ui::Canupo2DViewDialog
37 {
38 Q_OBJECT
39
40 public:
41
42 //! Default constructor
43 qCanupo2DViewDialog(const CorePointDescSet* descriptors1,
44 const CorePointDescSet* descriptors2,
45 QString cloud1Name,
46 QString cloud2Name,
47 int class1 = 1,
48 int class2 = 2,
49 const CorePointDescSet* evaluationDescriptors = nullptr,
50 ccMainAppInterface* app = nullptr);
51
52 //! Destructor
53 virtual ~qCanupo2DViewDialog();
54
55 //! Sets picking radius (for polyline vertices)
56 void setPickingRadius(int radius);
57
58 //! Returns classifier
59 const Classifier& getClassifier() { return m_classifier; }
60
61 public:
62
63 //! Trains the classifier (with the current number of scales!)
64 bool trainClassifier();
65
66 protected:
67
68 //! Updates the boundary representation
69 void resetBoundary();
70
71 //! Computes statistics with the current classifier
72 void computeStatistics();
73
74 void saveClassifier();
75 void checkBeforeAccept();
76 void setPointSize(int);
77 void onScalesCountSpinBoxChanged(int);
78
79 void addOrSelectPoint(int,int);
80 void removePoint(int,int);
81 void moveSelectedPoint(int,int,Qt::MouseButtons);
82 void deselectPoint();
83
84 protected:
85
86 //! Resets display
87 void reset();
88
89 //! Updates the list of active scales
90 void updateScalesList(bool firstTime);
91
92 //! Returns the list of active scales
93 void getActiveScales(std::vector<float>& scales) const;
94
95 //! Adds a custom object to the 2D view
96 void addObject(ccHObject* obj);
97
98 //! Updates zoom
99 void updateZoom();
100
101 //! Updates classifier path with the currently displayed polyline
102 void updateClassifierPath(Classifier& classifier) const;
103
104 //! Returns the click position in 3D
105 CCVector3 getClickPos(int x, int y) const;
106 //! Returns closest vertex
107 int getClosestVertex(int x, int y, CCVector3& P) const;
108
109 //! Gives access to the application (data-base, UI, etc.)
110 ccMainAppInterface* m_app;
111
112 //! Associated GL window
113 ccGLWindowInterface* m_glWindow;
114
115 //! Associated classifier
116 Classifier m_classifier;
117 //! Whether the classifier has been saved (at least once)
118 bool m_classifierSaved;
119
120 //descritpors
121 const CorePointDescSet* m_descriptors1;
122 const CorePointDescSet* m_descriptors2;
123 const CorePointDescSet* m_evaluationDescriptors;
124
125 //classes
126 int m_class1;
127 QString m_cloud1Name;
128 int m_class2;
129 QString m_cloud2Name;
130
131 //! Associated cloud
132 ccPointCloud* m_cloud;
133 //! Associated polyline
134 ccPolyline* m_poly;
135 //! Associated polyline vertices
136 ccPointCloud* m_polyVertices;
137
138 //! Currently selected polyline point
139 int m_selectedPointIndex;
140 //! Picking radius
141 int m_pickingRadius;
142 };
143
144 #endif //Q_CANUPO_2DVIEW_DIALOG_HEADER