ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvMatchScalesDlg.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 "ecvMatchScalesDlg.h"
9 
10 // Qt
11 #include <QDoubleValidator>
12 #include <QListWidgetItem>
13 
14 // system
15 #include <assert.h>
16 
18  int defaultSelectedIndex /*=0*/,
19  QWidget* parent /*=0*/)
20  : QDialog(parent, Qt::Tool), Ui::MatchScalesDialog() {
21  setupUi(this);
22 
23  for (size_t i = 0; i < entities.size(); ++i) {
24  // add one line per entity in the combo-box
25  listWidget->insertItem(
26  static_cast<int>(i),
27  new QListWidgetItem(QString("%1 (ID=%2)")
28  .arg(entities[i]->getName())
29  .arg(entities[i]->getUniqueID())));
30  }
31 
32  // default selection
33  if (defaultSelectedIndex >= 0 &&
34  static_cast<size_t>(defaultSelectedIndex) < entities.size()) {
35  listWidget->item(defaultSelectedIndex)->setSelected(true);
36  // listWidget->setItemSelected(listWidget->item(defaultSelectedIndex),true);
37  }
38 
39  rmsDifferenceLineEdit->setValidator(
40  new QDoubleValidator(rmsDifferenceLineEdit));
41 }
42 
44  // get selected items
45  QList<QListWidgetItem*> list = listWidget->selectedItems();
46  return list.empty() ? -1 : listWidget->row(list.front());
47 }
48 
51  switch (algorithm) {
53  bbMaxDimRadioButton->setChecked(true);
54  return;
56  bbVolumeRadioButton->setChecked(true);
57  return;
59  pcaRadioButton->setChecked(true);
60  return;
62  icpRadioButton->setChecked(true);
63  return;
64  default:
65  assert(false);
66  break;
67  }
68 }
69 
71  const {
72  if (bbMaxDimRadioButton->isChecked()) {
74  } else if (bbVolumeRadioButton->isChecked()) {
76  } else if (pcaRadioButton->isChecked()) {
78  } else if (icpRadioButton->isChecked()) {
80  }
81 
82  assert(false);
84 }
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
ccLibAlgorithms::ScaleMatchingAlgorithm getSelectedAlgorithm() const
Returns the selected matching algorithm.
ccMatchScalesDlg(const ccHObject::Container &entities, int defaultSelectedIndex=0, QWidget *parent=0)
Default constructor.
int getSelectedIndex() const
Returns selected index.
void setSelectedAlgorithm(ccLibAlgorithms::ScaleMatchingAlgorithm algorithm)
Sets the selected matching algorithm.
ScaleMatchingAlgorithm
Scale matching algorithms.