| 1 |
//########################################################################## |
| 2 |
//# # |
| 3 |
//# CLOUDCOMPARE PLUGIN: qMPlane # |
| 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 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: AIT Austrian Institute of Technology GmbH # |
| 15 |
//# # |
| 16 |
//########################################################################## |
| 17 |
|
| 18 |
#ifndef Q_MPLANE_DIALOG_CONTROLLER |
| 19 |
#define Q_MPLANE_DIALOG_CONTROLLER |
| 20 |
|
| 21 |
// Std |
| 22 |
#include <memory> |
| 23 |
|
| 24 |
// Qt |
| 25 |
#include <QtGui> |
| 26 |
|
| 27 |
// CC |
| 28 |
#include "ccMainAppInterface.h" |
| 29 |
#include <ccPickingListener.h> |
| 30 |
|
| 31 |
// Local dependencies |
| 32 |
#include "ccMPlaneDlg.h" |
| 33 |
#include "ccMeasurementRecorder.h" |
| 34 |
#include "ccMeasurementDevice.h" |
| 35 |
|
| 36 |
class ccMPlaneDlgController : public QObject, public ccPickingListener { |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
explicit ccMPlaneDlgController(ccMainAppInterface *app); |
| 41 |
void openDialog(ccPointCloud *selectedCloud); |
| 42 |
|
| 43 |
protected slots: |
| 44 |
void onCloseButtonPressed(); |
| 45 |
void onNewTab(int tabIndex); |
| 46 |
void onMeasureNameChanged(QTableWidgetItem *); |
| 47 |
void onMeasurementModeChanged(); |
| 48 |
void onFittingPointDelete(int index); |
| 49 |
void onNormalCheckBoxClicked(bool checked); |
| 50 |
void onSaveButtonClicked(); |
| 51 |
virtual void onItemPicked(const ccPickingListener::PickedItem& pi) override; |
| 52 |
|
| 53 |
private: |
| 54 |
void loadDataFromSelectedCloud(); |
| 55 |
void registerDialog(); |
| 56 |
void startPicking(); |
| 57 |
void stopPicking(); |
| 58 |
void pickFittingPoint(const ccPickingListener::PickedItem & item); |
| 59 |
void pickMeasurementPoint(const ccPickingListener::PickedItem & item); |
| 60 |
void updatePlane(); |
| 61 |
void updateScalarfield(); |
| 62 |
void updateMeasurements(); |
| 63 |
void updateFittingPoints(); |
| 64 |
void updatAllMeasurementEntities(); |
| 65 |
|
| 66 |
private: |
| 67 |
ccMainAppInterface *m_app; |
| 68 |
ccMPlaneDlg *m_dialog; |
| 69 |
std::unique_ptr<ccMeasurementRecorder> m_data; |
| 70 |
std::unique_ptr<ccMeasurementDevice> m_device; |
| 71 |
ccPointCloud *m_selectedCloud = nullptr; |
| 72 |
|
| 73 |
enum CC_Mode { CC_POINT_SELECTION, CC_MEASUREMENT }; |
| 74 |
CC_Mode m_mode = CC_POINT_SELECTION; |
| 75 |
|
| 76 |
bool m_signedMeasurement = false; |
| 77 |
bool m_showNormal = false; |
| 78 |
}; |
| 79 |
|
| 80 |
|
| 81 |
#endif |