ccKrigingParamsDialog.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  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: CloudCompare project #
  15. //# #
  16. //##########################################################################
  17. #include "ccKrigingParamsDialog.h"
  18. //ui
  19. #include <ui_krigingParamsDialog.h>
  20. //system
  21. #include <assert.h>
  22. ccKrigingParamsDialog::ccKrigingParamsDialog(QWidget* parent/*=nullptr*/)
  23. : QDialog(parent, Qt::Tool)
  24. , m_ui(new Ui_KrigingParamsDialog)
  25. {
  26. m_ui->setupUi(this);
  27. }
  28. ccKrigingParamsDialog::~ccKrigingParamsDialog()
  29. {
  30. if (m_ui)
  31. {
  32. delete m_ui;
  33. m_ui = nullptr;
  34. }
  35. }
  36. void ccKrigingParamsDialog::setParameters(const ccRasterGrid::KrigingParams& krigingParams)
  37. {
  38. // altitudes
  39. m_ui->krigeParamsGroupBox->setChecked(!krigingParams.autoGuess);
  40. {
  41. m_ui->nuggetDoubleSpinBox->setValue(krigingParams.params.nugget);
  42. m_ui->sillDoubleSpinBox->setValue(krigingParams.params.sill);
  43. m_ui->rangeDoubleSpinBox->setValue(krigingParams.params.range);
  44. }
  45. // common
  46. m_ui->modelComboBox->setCurrentIndex(static_cast<int>(krigingParams.params.model != Kriging::Invalid ? krigingParams.params.model : Kriging::Spherical));
  47. m_ui->knnSpinBox->setValue(krigingParams.kNN);
  48. }
  49. void ccKrigingParamsDialog::getParameters(ccRasterGrid::KrigingParams& krigingParams)
  50. {
  51. krigingParams.autoGuess = !m_ui->krigeParamsGroupBox->isChecked();
  52. {
  53. krigingParams.params.model = static_cast<Kriging::Model>(m_ui->modelComboBox->currentIndex());
  54. krigingParams.params.nugget = m_ui->nuggetDoubleSpinBox->value();
  55. krigingParams.params.sill = m_ui->sillDoubleSpinBox->value();
  56. krigingParams.params.range = m_ui->rangeDoubleSpinBox->value();
  57. }
  58. krigingParams.kNN = m_ui->knnSpinBox->value();
  59. }