ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
G3PointDialog.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "G3PointDialog.h"
9 
10 #include <QSettings>
11 
12 #include "ui_G3PointDialog.h"
13 
14 G3PointDialog::G3PointDialog(QString cloudName, QWidget *parent)
15  : QDialog(parent), ui(new Ui::G3PointDialog) {
16  ui->setupUi(this);
17 
18  setAttribute(Qt::WA_DeleteOnClose, true);
19  setWindowFlag(Qt::WindowStaysOnTopHint, true);
20  setWindowTitle("G3Point");
21  ui->labelCloud->setText(cloudName);
22 
23  connect(this->ui->spinBoxkNN, &QSpinBox::editingFinished, this,
25  connect(this->ui->pushButtonSegment, &QPushButton::clicked, this,
27  connect(this->ui->pushButtonClusterAndOrClean, &QPushButton::clicked, this,
29  connect(this->ui->pushButtonGetBorders, &QPushButton::clicked, this,
31 
32  connect(this->ui->radioButtonAll, &QRadioButton::clicked, this,
34  connect(this->ui->radioButtonOnlyOne, &QRadioButton::clicked, this,
36  connect(this->ui->spinBoxOnlyOne, qOverload<int>(&QSpinBox::valueChanged),
38 
39  connect(this->ui->pushButtonFit, &QPushButton::clicked, this,
41  connect(this->ui->pushButtonExportResults, &QPushButton::clicked, this,
43  connect(this->ui->pushButtonWolman, &QPushButton::clicked, this,
45  connect(this->ui->pushButtonAngles, &QPushButton::clicked, this,
47  connect(this->ui->checkBoxSurfaces, &QCheckBox::clicked, this,
49  connect(this->ui->checkBoxWireframes, &QCheckBox::clicked, this,
51  connect(this->ui->checkBoxPoints, &QCheckBox::clicked, this,
53  connect(this->ui->spinBoxGLPointSize,
54  qOverload<int>(&QSpinBox::valueChanged), this,
56 
57  connect(this->ui->radioButtonOnlyOne, &QRadioButton::toggled, this,
59 }
60 
62 
64  QSettings settings;
65  settings.beginGroup("G3Point");
66 
67  // kNN
68  int kNN = settings.value("kNN", 20).toInt();
69  this->ui->spinBoxkNN->setValue(kNN);
70  // radius factor
71  double radiusFactor = settings.value("radiusFactor", 0.6).toDouble();
72  this->ui->doubleSpinBoxRadiusFactor->setValue(radiusFactor);
73  // max angle 1
74  double maxAngle1 = settings.value("maxAngle1", 60).toDouble();
75  this->ui->doubleSpinBoxRadiusFactor->setValue(maxAngle1);
76  // wolmanNbIter
77  int wolmanNbIter = settings.value("wolmanNbIter", 20).toInt();
78  this->ui->spinBoxWolmanNbIter->setValue(wolmanNbIter);
79  // anglesNbBins
80  int anglesNbBins = settings.value("anglesNbBins", 10).toInt();
81  this->ui->spinBoxAnglesNbBins->setValue(anglesNbBins);
82 }
83 
85  QSettings settings;
86  settings.beginGroup("G3Point");
87 
88  // kNN
89  settings.setValue("kNN", ui->spinBoxkNN->value());
90  // radius factor
91  settings.setValue("radiusFactor", ui->doubleSpinBoxRadiusFactor->value());
92  // max angle 1
93  settings.setValue("maxAngle1", ui->doubleSpinBoxMaxAngle1->value());
94  // wolmanNbIter
95  settings.setValue("wolmanNbIter", ui->spinBoxWolmanNbIter->value());
96  // anglesNbBins
97  settings.setValue("anglesNbBins", ui->spinBoxAnglesNbBins->value());
98 }
99 
101  return this->ui->doubleSpinBoxMaxAngle1->value();
102 }
103 
105  return this->ui->doubleSpinBoxMaxAngle2->value();
106 }
107 
109  return this->ui->doubleSpinBoxMinFlatness->value();
110 }
111 
112 int G3PointDialog::getNMin() { return this->ui->spinBoxNMin->value(); }
113 
114 int G3PointDialog::getkNN() { return this->ui->spinBoxkNN->value(); }
115 
117  return this->ui->spinBoxWolmanNbIter->value();
118 }
119 
121  if (this->ui->radioButtonAutoNbBins->isChecked()) {
122  return -1;
123  } else {
124  return this->ui->spinBoxAnglesNbBins->value();
125  }
126 }
127 
129  return ui->doubleSpinBoxRadiusFactor->value();
130 }
131 
133  return this->ui->radioButtonSteepestSlope->isChecked();
134 }
135 
137  this->ui->groupBoxClusterAndOrClean->setEnabled(state);
138 }
139 
141  return this->ui->checkBoxClustering->isChecked();
142 }
143 
145  return this->ui->checkBoxCleaning->isChecked();
146 }
147 
149  emit allClicked(this->ui->radioButtonAll->isChecked());
150  emit onlyOneChanged(this->ui->spinBoxOnlyOne->value());
151 }
152 
154  this->ui->spinBoxOnlyOne->setMaximum(max);
155 }
156 
158  this->ui->checkBoxPoints->setEnabled(state);
159  this->ui->spinBoxGLPointSize->setEnabled(state);
160 }
double getMaxAngle1()
void emitClusterAndOrClean()
Definition: G3PointDialog.h:28
void emitAllClicked(bool state)
Definition: G3PointDialog.h:31
G3PointDialog(QString cloudName, QWidget *parent=nullptr)
void enableClusterAndOrClean(bool state)
bool isSteepestSlope()
void emitOnlyOneClicked(bool state)
Definition: G3PointDialog.h:32
void enableDrawPointsForOnlyOneGrain(bool state)
void emitGLPointSizeChanged(int size)
Definition: G3PointDialog.h:44
void emitWolman()
Definition: G3PointDialog.h:36
void emitSegment()
Definition: G3PointDialog.h:27
void emitDrawLines(bool state)
Definition: G3PointDialog.h:42
void onlyOneChanged(int idx)
void emitKNNChanged()
Definition: G3PointDialog.h:26
void emitDrawSurfaces(bool state)
Definition: G3PointDialog.h:41
void allClicked(bool state)
void emitAngles()
Definition: G3PointDialog.h:37
void emitExportResults()
Definition: G3PointDialog.h:35
void setOnlyOneMax(int idx)
double getMinFlatness()
void writeSettings()
double getMaxAngle2()
void emitOnlyOneChanged(int idx)
Definition: G3PointDialog.h:33
double getRadiusFactor()
void emitGetBorders()
Definition: G3PointDialog.h:29
void emitDrawPoints(bool state)
Definition: G3PointDialog.h:43
bool clusterIsChecked()
int max(int a, int b)
Definition: cutil_math.h:48