41 #include <QColorDialog>
43 #include <QFileDialog>
45 #include <QFontMetrics>
46 #include <QHBoxLayout>
48 #include <QMainWindow>
49 #include <QProgressDialog>
51 #include <QTextStream>
70 return angle_rad /
M_PI * 200.0;
86 return angle / 200.0 *
M_PI;
99 : QDialog(app ? app->getMainWindow() : 0),
105 m_angularUnits(ANG_GRAD),
107 m_colorScaleSelector(0),
110 m_gridColor(Qt::gray),
111 m_symbolColor(Qt::
black) {
122 QString::fromUtf8(
":/CC/plugin/qSRA/gearIcon.png"));
131 if (!colorRampGroupBox->layout())
132 colorRampGroupBox->setLayout(
new QHBoxLayout());
145 if (scale && !scale->isLocked())
151 bool validProfile =
false;
160 axisDimComboBox->setCurrentIndex(profileDesc.
revolDim);
162 xOriginDoubleSpinBox->setValue(profileDesc.
origin.
x);
163 yOriginDoubleSpinBox->setValue(profileDesc.
origin.
y);
164 zOriginDoubleSpinBox->setValue(profileDesc.
origin.
z);
186 if (hMax - hMin <= 0) {
189 QString(
"Cloud is flat: can't generate a proper map!"),
192 hStepDoubleSpinBox->setMaximum(hMax - hMin);
202 params.drawBackgroundGradient =
false;
203 params.colorScaleShowHistogram =
false;
204 params.colorScaleRampWidth = 30;
205 params.decimateMeshOnMove =
false;
206 params.displayCross =
false;
207 params.colorScaleUseShader =
false;
218 mapFrame->setLayout(
new QHBoxLayout());
219 #ifdef CV_GL_WINDOW_USE_QWINDOW
220 mapFrame->layout()->addWidget(QWidget::createWindowContainer(
m_window));
222 mapFrame->layout()->addWidget(
m_window);
224 precisionSpinBox->setValue(
params.displayedNumPrecision);
243 connect(projectionComboBox, SIGNAL(currentIndexChanged(
int)),
this,
245 connect(angularUnitComboBox, SIGNAL(currentIndexChanged(
int)),
this,
247 connect(xStepDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
249 connect(hStepDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
251 connect(latStepDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
253 connect(xMinDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
255 connect(xMaxDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
257 connect(hMinDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
259 connect(hMaxDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
261 connect(latMinDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
263 connect(latMaxDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
265 connect(axisDimComboBox, SIGNAL(currentIndexChanged(
int)),
this,
267 connect(xOriginDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
269 connect(yOriginDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
271 connect(zOriginDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
273 connect(baseRadiusDoubleSpinBox, SIGNAL(valueChanged(
double)),
this,
275 connect(heightUnitLineEdit, SIGNAL(editingFinished()),
this,
277 connect(exportCloudPushButton, SIGNAL(clicked()),
this,
279 connect(exportMeshPushButton, SIGNAL(clicked()),
this,
281 connect(exportMatrixPushButton, SIGNAL(clicked()),
this,
283 connect(exportImagePushButton, SIGNAL(clicked()),
this,
285 connect(loadLabelsPushButton, SIGNAL(clicked()),
this,
287 connect(clearLabelsPushButton, SIGNAL(clicked()),
this,
289 connect(symbolSizeSpinBox, SIGNAL(valueChanged(
int)),
this,
291 connect(fontSizeSpinBox, SIGNAL(valueChanged(
int)),
this,
293 connect(precisionSpinBox, SIGNAL(valueChanged(
int)),
this,
296 connect(colorScaleStepsSpinBox, SIGNAL(valueChanged(
int)),
this,
298 connect(overlayGridGroupBox, SIGNAL(toggled(
bool)),
this,
300 connect(scaleXStepDoubleSpinBox, SIGNAL(editingFinished()),
this,
302 connect(scaleHStepDoubleSpinBox, SIGNAL(editingFinished()),
this,
304 connect(scaleLatStepDoubleSpinBox, SIGNAL(editingFinished()),
this,
308 connect(gridColorButton, SIGNAL(clicked()),
this, SLOT(
changeGridColor()));
309 connect(symbolColorButton, SIGNAL(clicked()),
this,
311 connect(displayColorScaleCheckBox, SIGNAL(toggled(
bool)),
this,
313 connect(updateVolumesPushButton, SIGNAL(clicked()),
this,
319 connect(exportImageDXFButton, SIGNAL(clicked()),
this,
322 exportImageDXFButton->hide();
327 QPushButton* applyButton = buttonBox->button(QDialogButtonBox::Apply);
328 QPushButton* closeButton = buttonBox->button(QDialogButtonBox::Close);
329 connect(applyButton, SIGNAL(clicked()),
this, SLOT(
update()));
330 connect(closeButton, SIGNAL(clicked()),
this, SLOT(accept()));
350 double baseRadius = 0.0;
351 double minHeight = 0.0;
352 double maxHeight = 0.0;
355 double radius = P->
x;
357 baseRadius += radius;
362 else if (
height > maxHeight)
365 minHeight = maxHeight =
height;
371 if (baseRadius == 0.0) baseRadius = 1.0;
373 baseRadiusDoubleSpinBox->blockSignals(
true);
374 baseRadiusDoubleSpinBox->setValue(baseRadius);
375 baseRadiusDoubleSpinBox->blockSignals(
false);
378 hMinDoubleSpinBox->blockSignals(
true);
379 hMinDoubleSpinBox->setValue(minHeight);
380 hMinDoubleSpinBox->blockSignals(
false);
382 hMaxDoubleSpinBox->blockSignals(
true);
383 hMaxDoubleSpinBox->setValue(maxHeight);
384 hMaxDoubleSpinBox->blockSignals(
false);
393 double minLat_rad = 0.0, maxLat_rad = 0.0;
395 m_cloud, minLat_rad, maxLat_rad, cloudToSurfaceOrigin,
396 static_cast<unsigned char>(profileDesc.
revolDim))) {
397 latMinDoubleSpinBox->blockSignals(
true);
398 latMinDoubleSpinBox->setValue(
400 latMinDoubleSpinBox->blockSignals(
false);
402 latMaxDoubleSpinBox->blockSignals(
true);
403 latMaxDoubleSpinBox->setValue(
405 latMaxDoubleSpinBox->blockSignals(
false);
424 scaleLatStepDoubleSpinBox->setVisible(mode ==
PROJ_CONICAL);
447 switch (projectionComboBox->currentIndex()) {
493 return QChar(0x00B0);
506 QDoubleSpinBox* spinBox,
525 bool yLabelDisplayed =
527 float centerPos = 0.5f;
542 .horizontalAdvance(
"123.456789");
547 if (yLabelDisplayed) {
551 QFontMetrics fm(labelFont);
555 if (!label.isNull()) {
557 int width = fm.horizontalAdvance(label);
561 labelsWidth = maxWidth;
565 int mapWidth =
std::max(1, screenWidth - scaleWidth - labelsWidth);
568 float mapPart =
static_cast<float>(mapWidth) /
569 static_cast<float>(screenWidth);
574 float mapStart =
static_cast<float>(labelsWidth) /
575 static_cast<float>(screenWidth);
576 centerPos = (0.5f - mapStart) / mapPart;
581 params.pixelSize =
static_cast<float>(
613 for (
size_t i = 0; i < maps.size(); ++i) {
622 for (
size_t i = 0; i < polylines.size(); ++i) {
635 double yMin, yMax, yStep;
638 m_map->conicalSpanRatio !=
639 conicSpanRatioDoubleSpinBox->value()) {
642 }
else if (
m_map->conical) {
657 exportGroupBox->setEnabled(
m_map != 0);
668 double dx =
static_cast<double>(
m_map->xSteps) *
m_map->xStep;
669 double dy =
static_cast<double>(
m_map->ySteps) *
m_map->yStep;
677 mapMesh =
static_cast<ccMesh*
>(mapPlane);
681 bool ccw = ccwCheckBox->isChecked();
682 m_map->conicalSpanRatio = conicSpanRatioDoubleSpinBox->value();
698 ScalarType smin =
static_cast<ScalarType
>(
m_map->minVal);
699 ScalarType smax =
static_cast<ScalarType
>(
m_map->maxVal);
714 QString(
"Not enough memory to display the map!"),
734 scaleHStepDoubleSpinBox->setSuffix(QString(
" ") +
735 heightUnitLineEdit->text());
764 QProgressDialog progressDlg(QString(
"Updating..."), 0, 0, 0, 0, Qt::Popup);
765 progressDlg.setMinimumDuration(0);
766 progressDlg.setModal(
true);
768 QApplication::processEvents();
781 m_map, colorScale, colorScaleStepsSpinBox->value());
782 if (mapImage.isNull()) {
785 QString(
"Failed to create map texture! Not enough memory?"),
790 for (
size_t i = 0; i < texturedEntities.size(); ++i) {
798 if (!
static_cast<ccPlane*
>(texturedEntities[i])
799 ->setAsTexture(mapImage)) {
802 QString(
"Not enough memory to update the map!"),
808 ccMesh* mesh =
static_cast<ccMesh*
>(texturedEntities[i]);
834 unsigned steps =
static_cast<unsigned>(colorScaleStepsSpinBox->value());
876 spinBox->setDecimals(decimals);
877 spinBox->setRange(minVal, maxVal);
878 spinBox->setSingleStep(step);
879 spinBox->setValue(value);
888 double scaleXStep_rad =
895 double scaleLatStep_rad =
921 xMaxDoubleSpinBox->setMaximum(360.0);
922 xMaxDoubleSpinBox->setValue(360.0);
930 double PIx2 = 2.0 *
M_PI;
938 double PIdiv2 =
M_PI / 2.0 - 0.0001;
948 xMaxDoubleSpinBox->setMaximum(PIx2);
949 xMaxDoubleSpinBox->setValue(PIx2);
958 xStep_rad * 200.0 /
M_PI);
960 scaleXStep_rad * 200.0 /
M_PI);
962 xMin_rad * 200.0 /
M_PI);
964 xMax_rad * 200.0 /
M_PI);
967 scaleLatStep_rad * 200.0 /
M_PI);
969 latStep_rad * 200.0 /
M_PI);
971 latMin_rad * 200.0 /
M_PI);
973 latMax_rad * 200.0 /
M_PI);
975 xMaxDoubleSpinBox->setMaximum(400.0);
976 xMaxDoubleSpinBox->setValue(400.0);
987 scaleXStepDoubleSpinBox->setSuffix(suffix);
988 latMinDoubleSpinBox->setSuffix(suffix);
989 latMaxDoubleSpinBox->setSuffix(suffix);
990 scaleLatStepDoubleSpinBox->setSuffix(suffix);
1013 minY = hMinDoubleSpinBox->value();
1014 maxY = hMaxDoubleSpinBox->value();
1015 step = hStepDoubleSpinBox->value();
1031 return scaleHStepDoubleSpinBox->value();
1043 assert(dim >= 0 && dim < 3);
1064 double dShift = origin.
u[profileDesc.
revolDim] -
1083 double minX, maxX, step;
1085 xStepsStr = (step > 0 ? QString::number(
1093 double minY, maxY, step;
1095 yStepsStr = (step > 0 ? QString::number(
1100 gridSizeLabel->setText(QString(
"%1 x %2").arg(xStepsStr).arg(yStepsStr));
1106 : baseRadiusDoubleSpinBox->value();
1119 return heightUnitLineEdit->text();
1124 switch (fillingStrategyComboxBox->currentIndex()) {
1139 switch (emptyCellsComboBox->currentIndex()) {
1152 QSharedPointer<DistanceMapGenerationTool::Map>
1156 return QSharedPointer<DistanceMapGenerationTool::Map>(0);
1164 return QSharedPointer<DistanceMapGenerationTool::Map>(0);
1173 bool ccw = ccwCheckBox->isChecked();
1176 double yMin, yMax, yStep;
1209 QString(
".map(%1,%2)").arg(
m_map->xSteps).arg(
m_map->ySteps));
1239 m_map, colorScale, colorScaleStepsSpinBox->value());
1240 if (mapImage.isNull()) {
1258 QString(
".map(%1,%2)").arg(
m_map->xSteps).arg(
m_map->ySteps));
1263 QString(
"Failed to generate mesh! Not enough memory?"),
1278 settings.beginGroup(
"qSRA");
1282 QString filter(
"Grid file (*.csv)");
1286 QFileDialog::getSaveFileName(0,
"Select output file",
path, filter);
1290 settings.setValue(
"exportPath", QFileInfo(
filename).absolutePath());
1295 double yConversionFactor = 1.0;
1299 yConversionFactor,
m_app)) {
1302 QString(
"File '%1' saved successfully").arg(
filename),
1315 if (rtfDlg.exec()) {
1316 QApplication::processEvents();
1328 if (!dpeDlg.exec())
return;
1335 params.legendTheoProfileTitle = dpeDlg.theoNameLineEdit->text();
1336 params.legendRealProfileTitle = dpeDlg.realNameLineEdit->text();
1337 params.scaledDevUnits = dpeDlg.scaledDevUnitsLineEdit->text();
1338 params.devLabelMultCoef = dpeDlg.devValuesScaleDoubleSpinBox->value();
1339 params.devMagnifyCoef = dpeDlg.magnifyCoefSpinBox->value();
1340 params.precision = dpeDlg.precisionSpinBox->value();
1344 int angularStepCount = dpeDlg.angularStepsSpinBox->value();
1345 assert(angularStepCount >= 1);
1348 if (!vertFilename.isNull()) {
1350 params.profileTitles.clear();
1351 QString vertProfileBaseTitle = dpeDlg.vertTitleLineEdit->text();
1352 for (
int i = 0; i < angularStepCount; ++i) {
1354 static_cast<double>(i) * 2.0 *
M_PI / angularStepCount;
1356 params.profileTitles << QString(
"%1 - %2 %3")
1357 .arg(vertProfileBaseTitle)
1368 QString(
"Failed to save file '%1'!").arg(vertFilename),
1382 int heightStepCount = dpeDlg.heightStepsSpinBox->value();
1383 assert(heightStepCount >= 1);
1385 if (!horizFilename.isNull()) {
1387 params.profileTitles.clear();
1388 QString horizProfileBaseTitle = dpeDlg.horizTitleLineEdit->text();
1390 << QString(
"%1 - %2 ").arg(horizProfileBaseTitle).arg(
"%1") +
1393 double angleStep_rad =
1397 heightShift, angleStep_rad,
1402 QString(
"Failed to save file '%1'!").arg(horizFilename),
1408 .arg(horizFilename),
1433 settings.beginGroup(
"qSRA");
1437 QString filter(
"Symbols (*.txt)");
1440 QString
filename = QFileDialog::getOpenFileName(0,
"Select symbols file",
1445 if (!fileInfo.exists())
1449 QString(
"Failed to find symbol file '%1'?!").arg(
filename),
1455 settings.setValue(
"importPath", fileInfo.absolutePath());
1461 assert(file.exists());
1462 if (!file.open(QFile::ReadOnly)) {
1472 QTextStream stream(&file);
1473 QString currentLine = stream.readLine();
1475 while (!currentLine.isNull()) {
1478 if (tokens.size() == 4) {
1481 tokens[1].toDouble(&okX)),
1483 tokens[2].toDouble(&okY)),
1485 tokens[3].toDouble(&okZ)));
1487 if (!okX || !okY || !okZ) {
1492 QString label = tokens[0];
1495 symbolCloud->
size() + 64) ||
1500 QString(
"Not enough memory!"),
1517 currentLine = stream.readLine();
1520 if (symbolCloud->
size() == 0) {
1529 symbolCloud =
nullptr;
1533 QString(
"An error occurred while loading the file! "
1534 "Result may be incomplete"),
1547 bool ccw = ccwCheckBox->isChecked();
1551 symbolCloud, cloudToSurface, profileDesc.
revolDim, ccw);
1554 double conicalSpanRatio = conicSpanRatioDoubleSpinBox->value();
1556 symbolCloud, cloudToSurface, profileDesc.
revolDim,
1557 m_map->yMin,
m_map->yMax, conicalSpanRatio, ccw);
1561 static_cast<double>(symbolSizeSpinBox->value()));
1562 symbolCloud->
setFontSize(fontSizeSpinBox->value());
1574 clearLabelsPushButton->setEnabled(
true);
1575 clearLabelsPushButton->setText(
1576 QString(
"Clear (%1)").arg(symbolCloud->
size()));
1591 for (
size_t i = 0; i < clouds.size(); ++i)
1595 clearLabelsPushButton->setEnabled(
false);
1596 clearLabelsPushButton->setText(
"Clear");
1603 double symbolSize = (double)symbolSizeSpinBox->value();
1611 static_cast<ccSymbolCloud*
>(child)->setSymbolSize(symbolSize);
1665 int fontSize = fontSizeSpinBox->value();
1677 params.defaultFontSize = fontSize;
1688 params.displayedNumPrecision = prec;
1713 for (
size_t i = 0; i < polylines.size(); ++i)
1729 double xMin_rad, xMax_rad, xStep_rad;
1731 double scaleXStep_rad =
1734 double yMin, yMax, yStep;
1738 if (scaleXStep_rad == 0 || scaleYStep == 0) {
1741 QString(
"Internal error: invalid step values?!"),
1747 unsigned xStepCount =
static_cast<unsigned>(
1748 ceil(
std::max(xMax_rad - xMin_rad, 0.0) / scaleXStep_rad));
1749 unsigned yStepCount =
static_cast<unsigned>(
1753 xMax_rad = xMin_rad +
static_cast<double>(xStepCount) * scaleXStep_rad;
1754 yMax = yMin +
static_cast<double>(yStepCount) * scaleYStep;
1760 double conicalSpanRatio = conicSpanRatioDoubleSpinBox->value();
1765 bool ccw = ccwCheckBox->isChecked();
1775 QString(
"Not engouh memory to display the 'X' "
1783 for (
unsigned i = 0; i <= xStepCount; ++i) {
1785 xMin_rad +
static_cast<double>(i) * scaleXStep_rad;
1796 Pbottom.x, Pbottom.y,
m_map->yMin, nProj, ccw);
1798 Pup.
x, Pup.
y,
m_map->yMin, nProj, ccw);
1826 .arg(angularUnitsStr));
1838 QString(
"Not enough memory to display the 'Y' "
1846 for (
unsigned i = 0; i <= yStepCount; ++i) {
1847 double y = yMin +
static_cast<double>(i) * scaleYStep;
1856 const unsigned polySteps = 100;
1857 if (vertices->reserve(polySteps + 1))
1858 for (
unsigned j = 0; j <= polySteps; ++j) {
1861 static_cast<double>(j) /
1862 static_cast<double>(polySteps) *
1863 (xMax_rad - xMin_rad);
1866 m_map->yMin, nProj, ccw);
1868 vertices->addPoint(P);
1877 vertices->reserve(2);
1878 vertices->addPoint(Pleft);
1879 vertices->addPoint(Pright);
1882 unsigned vertCount = vertices->size();
1887 vertices->setEnabled(
false);
1915 QColor newCol = QColorDialog::getColor(
m_gridColor,
this);
1916 if (!newCol.isValid())
return;
1924 QColor newCol = QColorDialog::getColor(
m_symbolColor,
this);
1925 if (!newCol.isValid())
return;
1941 volumeTextEdit->setText(
"Cylindrical projection mode only!");
1950 QLocale locale(QLocale::English);
1952 text.append(QString(
"[Theoretical]\n"));
1953 text.append(QString(
"surface = %1\n")
1955 text.append(QString(
"volume = %1\n")
1957 text.append(QString(
"\n"));
1958 text.append(QString(
"[Actual]\n"));
1959 text.append(QString(
"Surface: %1\n")
1960 .arg(locale.toString(surfaces.
total)));
1961 text.append(QString(
"Volume: %1\n")
1962 .arg(locale.toString(volumes.
total)));
1963 text.append(QString(
"\n"));
1964 text.append(QString(
"Positive (deviations) surface:\n%1\n")
1965 .arg(locale.toString(surfaces.
positive)));
1966 text.append(QString(
"Negative (deviations) surface:\n%1\n")
1967 .arg(locale.toString(surfaces.
negative)));
1968 text.append(QString(
"\n"));
1969 text.append(QString(
"Positive volume (gain of matter):\n%1\n")
1970 .arg(locale.toString(volumes.
positive)));
1971 text.append(QString(
"Negative volume (loss of matter):\n%1\n")
1972 .arg(locale.toString(volumes.
negative)));
1973 text.append(QString(
"Sum:\n%1\n")
1974 .arg(locale.toString(volumes.
positive +
1976 volumeTextEdit->setText(text);
1978 volumeTextEdit->setText(
"Volume(s) computation failed!");
1982 volumeTextEdit->setText(
"No map!");
1984 volumeTextEdit->setText(
"No profile defined!");
1990 settings.beginGroup(
"DistanceMapGenerationDialog");
1993 double conicSpanRatio = settings.value(
"conicSpanRatio",
1994 conicSpanRatioDoubleSpinBox->value())
1997 settings.value(
"angularUnit", angularUnitComboBox->currentIndex())
1999 QString heightUnit =
2000 settings.value(
"heightUnit", heightUnitLineEdit->text()).toString();
2001 double angularStep =
2002 settings.value(
"angularStep", xStepDoubleSpinBox->value())
2005 settings.value(
"heightStep", hStepDoubleSpinBox->value())
2007 double latitudeStep =
2008 settings.value(
"latitudeStep", latStepDoubleSpinBox->value())
2010 double scaleAngularStep =
2011 settings.value(
"scaleAngularStep", scaleXStepDoubleSpinBox->value())
2013 double scaleHeightStep =
2014 settings.value(
"scaleHeightStep", scaleHStepDoubleSpinBox->value())
2016 double scaleLatitudeStep =
2017 settings.value(
"scaleLatitudeStep",
2018 scaleLatStepDoubleSpinBox->value())
2020 bool ccw = settings.value(
"CCW", ccwCheckBox->isChecked()).toBool();
2021 int fillStrategy = settings.value(
"fillStrategy",
2022 fillingStrategyComboxBox->currentIndex())
2025 settings.value(
"emptyCells", emptyCellsComboBox->currentIndex())
2027 bool showOverlayGrid =
2028 settings.value(
"showOverlayGrid", overlayGridGroupBox->isChecked())
2031 settings.value(
"showXScale", xScaleCheckBox->isChecked()).toBool();
2033 settings.value(
"showYScale", yScaleCheckBox->isChecked()).toBool();
2034 bool showColorScale = settings.value(
"showColorScale",
2035 displayColorScaleCheckBox->isChecked())
2037 QString uuid = settings.value(
"colorScale", QString()).toString();
2038 int colorScaleSteps =
2039 settings.value(
"colorScaleSteps", colorScaleStepsSpinBox->value())
2042 settings.value(
"symbolSize", symbolSizeSpinBox->value()).toInt();
2043 int fontSize = settings.value(
"fontSize", fontSizeSpinBox->value()).toInt();
2046 conicSpanRatioDoubleSpinBox->setValue(conicSpanRatio);
2047 angularUnitComboBox->setCurrentIndex(angularUnit);
2049 heightUnitLineEdit->setText(heightUnit);
2051 xStepDoubleSpinBox->setValue(angularStep);
2052 hStepDoubleSpinBox->setValue(heightStep);
2053 latStepDoubleSpinBox->setValue(latitudeStep);
2054 scaleXStepDoubleSpinBox->setValue(scaleAngularStep);
2055 scaleHStepDoubleSpinBox->setValue(scaleHeightStep);
2056 scaleLatStepDoubleSpinBox->setValue(scaleLatitudeStep);
2057 ccwCheckBox->setChecked(ccw);
2058 fillingStrategyComboxBox->setCurrentIndex(fillStrategy);
2059 emptyCellsComboBox->setCurrentIndex(emptyCells);
2060 overlayGridGroupBox->setChecked(showOverlayGrid);
2061 xScaleCheckBox->setChecked(showXScale);
2062 yScaleCheckBox->setChecked(showYScale);
2063 displayColorScaleCheckBox->setChecked(showColorScale);
2066 colorScaleStepsSpinBox->setValue(colorScaleSteps);
2067 symbolSizeSpinBox->setValue(symbolSize);
2068 fontSizeSpinBox->setValue(fontSize);
2070 settings.endGroup();
2075 settings.beginGroup(
"DistanceMapGenerationDialog");
2078 settings.setValue(
"conicSpanRatio", conicSpanRatioDoubleSpinBox->value());
2079 settings.setValue(
"angularUnit", angularUnitComboBox->currentIndex());
2080 settings.setValue(
"heightUnit", heightUnitLineEdit->text());
2081 settings.setValue(
"angularStep", xStepDoubleSpinBox->value());
2082 settings.setValue(
"heightStep", hStepDoubleSpinBox->value());
2083 settings.setValue(
"latitudeStep", latStepDoubleSpinBox->value());
2084 settings.setValue(
"scaleAngularStep", scaleXStepDoubleSpinBox->value());
2085 settings.setValue(
"scaleHeightStep", scaleHStepDoubleSpinBox->value());
2086 settings.setValue(
"scaleLatitudeStep", scaleLatStepDoubleSpinBox->value());
2087 settings.setValue(
"CCW", ccwCheckBox->isChecked());
2088 settings.setValue(
"fillStrategy", fillingStrategyComboxBox->currentIndex());
2089 settings.setValue(
"emptyCells", emptyCellsComboBox->currentIndex());
2090 settings.setValue(
"showOverlayGrid", overlayGridGroupBox->isChecked());
2091 settings.setValue(
"showXScale", xScaleCheckBox->isChecked());
2092 settings.setValue(
"showYScale", yScaleCheckBox->isChecked());
2093 settings.setValue(
"showColorScale", displayColorScaleCheckBox->isChecked());
2097 if (colorScale) settings.setValue(
"colorScale", colorScale->getUuid());
2099 settings.setValue(
"colorScaleSteps", colorScaleStepsSpinBox->value());
2100 settings.setValue(
"symbolSize", symbolSizeSpinBox->value());
2101 settings.setValue(
"fontSize", fontSizeSpinBox->value());
2103 settings.endGroup();
constexpr PointCoordinateType PC_ONE
'1' as a PointCoordinateType value
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
QStringList qtCompatSplitRegex(const QString &str, const QString &pattern, Qt::SplitBehavior behavior=Qt::KeepEmptyParts)
cmdLineReadable * params[]
void updateOverlayGrid()
Updates overlat grid (if any)
ccColorScaleSelector * m_colorScaleSelector
Color scale selector.
ccPointCloud * m_cloud
Associated cloud.
DistanceMapGenerationTool::EmptyCellFillOption getEmptyCellFillingOption() const
Returns the empty cells filling option.
void toggleOverlayGrid(bool)
void updateProfileRevolDim(int)
ccSymbolCloud * m_xLabels
X labels.
double getBaseRadius() const
Returns currently applicable base radius.
DistanceMapGenerationDlg(ccPointCloud *cloud, ccScalarField *sf, ccPolyline *polyline, ecvMainAppInterface *app=0)
Default constructor.
ProjectionMode
Projection mode.
void updateMinAndMaxLimits()
Updates the min and max limits (fields)
ANGULAR_UNIT getAngularUnit() const
Returns selected angular unit.
void getGridXValues(double &minX, double &maxX, double &step, ANGULAR_UNIT unit=ANG_RAD) const
Returns the current 'X' parameters.
double getSpinboxAngularValue(QDoubleSpinBox *spinBox, DistanceMapGenerationDlg::ANGULAR_UNIT unit) const
Returns the angle in a particular spinbox in the specified units.
void clearView()
Clears the 3D view.
QSharedPointer< DistanceMapGenerationTool::Map > m_map
Internal map structure.
ccPolyline * m_profile
Associated profile.
void update()
Updates map (and display)
QString getAngularUnitString() const
Returns selected angular unit as a string.
void spawnColorScaleEditor()
void toggleColorScaleDisplay(bool)
ANGULAR_UNIT
Angular units.
QColor m_gridColor
Grid color.
ccMapWindow * m_window
2D display
void colorScaleChanged(int)
void colorRampStepsChanged(int)
ccScalarField * m_sf
Associated scalar field.
DistanceMapGenerationTool::FillStrategyType getFillingStrategy() const
Returns the grid filling strategy.
QSharedPointer< DistanceMapGenerationTool::Map > updateMap()
Updates internal map.
void overlaySymbolsSizeChanged(int)
QColor m_symbolColor
Symbols color.
ProjectionMode getProjectionMode() const
Returns current projection mode.
void overlaySymbolsColorChanged()
double getScaleYStep(ANGULAR_UNIT unit=ANG_RAD) const
Returns scale 'Y' step (current unit)
void loadOverlaySymbols()
void updateProfileOrigin()
void getGridYValues(double &minY, double &maxY, double &step, ANGULAR_UNIT unit=ANG_RAD) const
Returns the current 'Y' parameters.
void saveToPersistentSettings()
Saves parameters to persistent settings.
void updateMapTexture()
Updates internal map texture (if any)
void clearOverlaySymbols()
QString getHeightUnitString() const
Returns height unit.
QString getCondensedAngularUnitString() const
Returns selected angular unit as a condensed string.
void initFromPersistentSettings()
Loads parameters from persistent settings.
void projectionModeChanged(int)
void exportProfilesAsDXF()
void updateZoom(ccBBox &box)
Updates 2D view zoom.
ANGULAR_UNIT m_angularUnits
Current angular units.
void overlayGridColorChanged()
void labelFontSizeChanged(int)
ecvMainAppInterface * m_app
Application interface.
void baseRadiusChanged(double)
void angularUnitChanged(int)
ccSymbolCloud * m_yLabels
Y labels.
virtual ~DistanceMapGenerationDlg()
Default destructor.
void labelPrecisionChanged(int)
Dialog for export multiple 2D profiles in a single DXF file (qSRA plugin)
QString getHorizFilename() const
Returns horiz. profiles output filename (on completion)
QString getVertFilename() const
Returns vert. profiles output filename (on completion)
static bool SaveHorizontalProfiles(const QSharedPointer< DistanceMapGenerationTool::Map > &map, ccPolyline *profile, QString filename, unsigned heightStepCount, double heightShift, double angularStep_rad, double radToUnitConvFactor, QString angleUnit, const Parameters ¶ms, ecvMainAppInterface *app=0)
static bool SaveVerticalProfiles(const QSharedPointer< DistanceMapGenerationTool::Map > &map, ccPolyline *profile, QString filename, unsigned angularStepCount, double heightStep, double heightShift, const Parameters ¶ms, ecvMainAppInterface *app=0)
static bool IsEnabled()
Returns whether DXF support is enabled or not.
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
Dialog to edit/create color scales.
ccColorScale::Shared getActiveScale()
Returns active scale.
Advanced editor for color scales.
void init()
Inits selector with the Color Scales Manager.
void setSelectedScale(QString uuid)
Sets selected combo box item (scale) by UUID.
ccColorScale::Shared getSelectedScale() const
Returns currently selected color scale.
static const unsigned MIN_STEPS
Minimum number of steps.
QSharedPointer< ccColorScale > Shared
Shared pointer type.
static const unsigned MAX_STEPS
Maximum number of steps (internal representation)
static ccColorScale::Shared GetDefaultScale(DEFAULT_SCALES scale=BGYR)
Returns a pre-defined color scale (static shortcut)
void toPersistentSettings() const
Save custom color scales to persistent settings.
ccColorScale::Shared getDefaultScale(DEFAULT_SCALES scale) const
Returns a pre-defined color scale.
virtual bool isVisible() const
Returns whether entity is visible or not.
virtual void setTempColor(const ecvColor::Rgb &col, bool autoActivate=true)
Sets current temporary (unique)
virtual void setVisible(bool state)
Sets entity visibility.
virtual void showColors(bool state)
Sets colors visibility.
void setTranslation(const Vector3Tpl< float > &Tr)
Sets translation (float version)
Float version of ccGLMatrixTpl.
void showNormals(bool state) override
Sets normals visibility.
ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
Hierarchical CLOUDVIEWER Object.
virtual ccBBox getDisplayBB_recursive(bool relative)
Returns the bounding-box of this entity and it's children WHEN DISPLAYED.
unsigned getChildrenNumber() const
Returns the number of children.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
bool sfShown() const
Returns whether associated SF should be shown or not.
void showSF(bool state)
Whether to show associated SF or not.
void setAssociatedScalarField(ccScalarField *sf)
Sets associated scalar-field.
ccScalarField * getAssociatedScalarField() const
Returns associated scalar field.
virtual QString getName() const
Returns object name.
bool isA(CV_CLASS_ENUM type) const
virtual void setName(const QString &name)
Sets object name.
virtual void setEnabled(bool state)
Sets the "enabled" property.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
bool reserve(unsigned numberOfPoints) override
Reserves memory for all the active features.
ccScalarField * getCurrentDisplayedScalarField() const
Returns the currently displayed scalar (or 0 if none)
void shrinkToFit()
Removes unused capacity.
bool reserveThePointsTable(unsigned _numberOfPoints)
Reserves memory to store the points coordinates.
void set2DMode(bool state)
Defines if the polyline is considered as 2D or 3D.
void setColor(const ecvColor::Rgb &col)
Sets the polyline color.
static void SetButtonColor(QAbstractButton *button, const QColor &col)
Sets a button background color.
Dialog for screen to file rendering.
void hideOptions()
Disable and hide the scale and overlay checkboxes.
bool dontScalePoints() const
On dialog acceptance, returns whether points should be scaled or not.
bool renderOverlayItems() const
Whether overlay items should be rendered.
float getZoom() const
On dialog acceptance, returns requested zoom.
QString getFilename() const
On dialog acceptance, returns requested output filename.
A scalar field associated to display-related parameters.
const ccColorScale::Shared & getColorScale() const
Returns associated color scale.
void setColorRampSteps(unsigned steps)
Sets number of color ramp steps used for display.
void setColorScale(ccColorScale::Shared scale)
Sets associated color scale.
void computeMinAndMax() override
Determines the min and max values.
void setLabelAlignmentFlags(unsigned char flags)
Sets labels alignment flags.
int getFontSize() const
Returns label font size.
QString getLabel(unsigned index) const
Returns a given label.
void addLabel(QString label)
Adds a label.
virtual void clear() override
Clears the entity from all its points and features.
virtual bool reserve(unsigned numberOfPoints) override
inherited from ccPointCloud
void showSymbols(bool state)
Sets whether symbols should be displayed or not.
void setSymbolSize(double size)
Sets symbol size.
bool reserveLabelArray(unsigned count)
Reserves memory for storing per-point labels.
void setFontSize(int size)
Sets label font size.
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Vector3Tpl< T > getCenter() const
Returns center.
const Vector3Tpl< T > & maxCorner() const
Returns max corner (const)
T getDiagNorm() const
Returns diagonal length.
const Vector3Tpl< T > & minCorner() const
Returns min corner (const)
bool isValid() const
Returns whether bounding box is valid or not.
void addPoint(const CCVector3 &P)
Adds a 3D point to the database.
unsigned size() const override
unsigned capacity() const
Returns cloud capacity (i.e. reserved size)
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
unsigned size() const override
Returns the number of points.
const CCVector3 * getPoint(unsigned index) const override
Returns the ith point.
void addElement(ScalarType value)
void setName(const char *name)
Sets scalar field name.
Main application interface (for plugins)
virtual QMainWindow * getMainWindow()=0
Returns main window.
virtual void addToDB(ccHObject *obj, bool updateZoom=false, bool autoExpandDBTree=true, bool checkDimensions=false, bool autoRedraw=true)=0
virtual void dispToConsole(QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE)=0
virtual ccColorScalesManager * getColorScalesManager()=0
Returns color scale manager (unique instance)
Standard parameters for GL displays/viewports.
static const double DEFAULT_LABEL_MARGIN
static double ConvertAngleToRad(double angle, DistanceMapGenerationDlg::ANGULAR_UNIT srcUnit)
static double ConvertAngleFromRad(double angle_rad, DistanceMapGenerationDlg::ANGULAR_UNIT destUnit)
static void SetSpinBoxValues(QDoubleSpinBox *spinBox, int decimals, double minVal, double maxVal, double step, double value)
static const char YLABEL_CLOUD_NAME[]
static const char XLABEL_CLOUD_NAME[]
unsigned char ColorCompType
Default color components type (R,G and B)
static void error(char *msg)
constexpr Qt::SplitBehavior SkipEmptyParts
bool setColor(ccHObject::Container selectedEntities, bool colorize, QWidget *parent)
static const std::string path
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
float RadiansToDegrees(int radians)
Convert radians to degrees.
bool GreaterThanEpsilon(float x)
Test a floating point number against our epsilon (a very small number).
float DegreesToRadians(int degrees)
Convert degrees to radians.
constexpr Rgb black(0, 0, 0)
constexpr Rgb white(MAX, MAX, MAX)
QString defaultDocPath()
Shortcut for getting the documents location path.
unsigned colorScaleRampWidth
Color scale ramp width (for display)