From 4dfc90d967d50e32edf8f918e1e149779decc1b5 Mon Sep 17 00:00:00 2001 From: Daniel Girardeau-Montaut Date: Fri, 29 Mar 2019 13:40:57 +0100 Subject: [PATCH] THe GUI version can now handle 4 clouds --- Classify3DMASCDialog.ui | 88 ++++++++++++++++++++++----------------- q3DMASC.cpp | 8 ++-- qClassify3DMASCDialog.cpp | 22 ++++++++++ 3 files changed, 75 insertions(+), 43 deletions(-) diff --git a/Classify3DMASCDialog.ui b/Classify3DMASCDialog.ui index 7ba0881..be9d5fd 100644 --- a/Classify3DMASCDialog.ui +++ b/Classify3DMASCDialog.ui @@ -52,7 +52,49 @@ Data - + + + + PC2 + + + + + + + CTX + + + + + + + Role + + + + + + + Cloud + + + + + + + PC1 + + + + + + + TEST (optional) + + + + color:red; @@ -75,27 +117,6 @@ - - - - Cloud - - - - - - - Role - - - - - - - PC1 - - - @@ -106,20 +127,6 @@ - - - - PC2 - - - - - - - CTX - - - @@ -130,7 +137,7 @@ - + @@ -140,10 +147,13 @@ + + + - + - TEST (optional) + PCX diff --git a/q3DMASC.cpp b/q3DMASC.cpp index 731e972..18ca002 100644 --- a/q3DMASC.cpp +++ b/q3DMASC.cpp @@ -129,9 +129,9 @@ void q3DMASCPlugin::doClassifyAction() m_app->dispToConsole("Invalid classifier file (no cloud label defined)", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } - else if (cloudLabels.size() > (cloudLabels.contains("TEST") ? 4 : 3)) + else if (cloudLabels.size() > 4 + (cloudLabels.contains("TEST") ? 1 : 0)) { - m_app->dispToConsole("This classifier uses more than 3 clouds (the GUI version cannot handle it)", ccMainAppInterface::ERR_CONSOLE_MESSAGE); + m_app->dispToConsole("This classifier uses more than 4 clouds (the GUI version cannot handle it)", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } @@ -266,9 +266,9 @@ void q3DMASCPlugin::doTrainAction() QString mainCloudLabel = corePointsLabel; if (useCloudsFromDB) { - if (cloudLabels.size() > (cloudLabels.contains("TEST") ? 4 : 3)) + if (cloudLabels.size() > 4 + (cloudLabels.contains("TEST") ? 1 : 0)) { - m_app->dispToConsole("This classifier uses more than 3 different clouds (the GUI version cannot handle it)", ccMainAppInterface::WRN_CONSOLE_MESSAGE); + m_app->dispToConsole("This classifier uses more than 4 different clouds (the GUI version cannot handle it)", ccMainAppInterface::WRN_CONSOLE_MESSAGE); return; } diff --git a/qClassify3DMASCDialog.cpp b/qClassify3DMASCDialog.cpp index ac8e58a..fb04467 100644 --- a/qClassify3DMASCDialog.cpp +++ b/qClassify3DMASCDialog.cpp @@ -84,6 +84,7 @@ Classify3DMASCDialog::Classify3DMASCDialog(ccMainAppInterface* app, bool trainMo cloud1ComboBox->addItem(name, uniqueID); cloud2ComboBox->addItem(name, uniqueID); cloud3ComboBox->addItem(name, uniqueID); + cloud4ComboBox->addItem(name, uniqueID); testCloudComboBox->addItem(name, uniqueID); ++cloudCount; } @@ -96,6 +97,8 @@ Classify3DMASCDialog::Classify3DMASCDialog(ccMainAppInterface* app, bool trainMo connect(cloud2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCloudChanged(int))); cloud3ComboBox->setCurrentIndex(/*cloudCount > 2 ? 0 : */-1); connect(cloud3ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCloudChanged(int))); + cloud4ComboBox->setCurrentIndex(/*cloudCount > 3 ? 0 : */-1); + connect(cloud4ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCloudChanged(int))); testCloudComboBox->setCurrentIndex(-1); if (cloudCount == 0 && app) @@ -135,6 +138,11 @@ void Classify3DMASCDialog::setCloudRoles(const QList& roles, QString co if (corePointsLabel == role) cloud3RadioButton->setChecked(true); break; + case 3: + cloud4RadioButton->setText(role); + if (corePointsLabel == role) + cloud4RadioButton->setChecked(true); + break; default: //this dialog can't handle more than 3 roles! break; @@ -159,6 +167,12 @@ void Classify3DMASCDialog::setCloudRoles(const QList& roles, QString co cloud3RadioButton->setVisible(false); cloud3ComboBox->setVisible(false); } + if (index < 4) + { + cloud4RadioButton->setEnabled(false); + cloud4RadioButton->setVisible(false); + cloud4ComboBox->setVisible(false); + } } void Classify3DMASCDialog::getClouds(QMap& clouds, QString& mainCloud) const @@ -193,6 +207,14 @@ void Classify3DMASCDialog::getClouds(QMap& clouds, QStri mainCloud = cloud3RadioButton->text(); } } + if (cloud4RadioButton->isEnabled()) + { + clouds.insert(cloud4RadioButton->text(), GetCloudFromCombo(cloud3ComboBox, m_app->dbRootObject())); + if (cloud4RadioButton->isChecked()) + { + mainCloud = cloud4RadioButton->text(); + } + } if (testCloudComboBox->currentIndex() >= 0) { clouds.insert("TEST", GetCloudFromCombo(testCloudComboBox, m_app->dbRootObject()));