THe GUI version can now handle 4 clouds

This commit is contained in:
Daniel Girardeau-Montaut
2019-03-29 13:40:57 +01:00
parent 568ed7e292
commit 4dfc90d967
3 changed files with 75 additions and 43 deletions
+49 -39
View File
@@ -52,7 +52,49 @@
<string>Data</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="1">
<item row="4" column="0">
<widget class="QRadioButton" name="cloud2RadioButton">
<property name="text">
<string>PC2</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QRadioButton" name="cloud3RadioButton">
<property name="text">
<string>CTX</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Role</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Cloud</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="cloud1RadioButton">
<property name="text">
<string>PC1</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="testLabel">
<property name="text">
<string>TEST (optional)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="warningLabel">
<property name="styleSheet">
<string notr="true">color:red;</string>
@@ -75,27 +117,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Cloud</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Role</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="cloud1RadioButton">
<property name="text">
<string>PC1</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="cloud1ComboBox">
<property name="sizePolicy">
@@ -106,20 +127,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QRadioButton" name="cloud2RadioButton">
<property name="text">
<string>PC2</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QRadioButton" name="cloud3RadioButton">
<property name="text">
<string>CTX</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="cloud3ComboBox">
<property name="sizePolicy">
@@ -130,7 +137,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="testCloudComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -140,10 +147,13 @@
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="cloud4ComboBox"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="testLabel">
<widget class="QRadioButton" name="cloud4RadioButton">
<property name="text">
<string>TEST (optional)</string>
<string>PCX</string>
</property>
</widget>
</item>
+4 -4
View File
@@ -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;
}
+22
View File
@@ -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<QString>& 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<QString>& 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<QString, ccPointCloud*>& clouds, QString& mainCloud) const
@@ -193,6 +207,14 @@ void Classify3DMASCDialog::getClouds(QMap<QString, ccPointCloud*>& 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()));