From a0a1d545ffd554500e61415083257e7ee924aeb2 Mon Sep 17 00:00:00 2001 From: Daniel Girardeau-Montaut Date: Sat, 24 Nov 2018 18:18:28 +0100 Subject: [PATCH] Compute features at various scales in a smarter way (finished) --- q3DMASCClassifier.cpp | 2 +- q3DMASCTools.cpp | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/q3DMASCClassifier.cpp b/q3DMASCClassifier.cpp index e6a8ece..3a50662 100644 --- a/q3DMASCClassifier.cpp +++ b/q3DMASCClassifier.cpp @@ -120,7 +120,7 @@ bool Classifier::classify(const Feature::Set& features, ccPointCloud* cloud, QSt //look for the classification field CCLib::ScalarField* classificationSF = nullptr; int classifSFIdx = cloud->getScalarFieldIndexByName(LAS_FIELD_NAMES[LAS_CLASSIFICATION]); //LAS_FIELD_NAMES[LAS_CLASSIFICATION] = "Classification" - if (!classifSFIdx) + if (classifSFIdx < 0) { //create it if necessary ccScalarField* _classificationSF = new ccScalarField(LAS_FIELD_NAMES[LAS_CLASSIFICATION]); diff --git a/q3DMASCTools.cpp b/q3DMASCTools.cpp index dff3975..d65dc46 100644 --- a/q3DMASCTools.cpp +++ b/q3DMASCTools.cpp @@ -894,7 +894,8 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features unsigned pointCount = corePoints.size(); if (progressCb) { - progressCb->setInfo(qPrintable(QString("Computing fields for cloud %1\n(core points: %2)").arg(sourceCloud->getName()).arg(pointCount))); + progressCb->setMethodTitle("Point features"); + progressCb->setInfo(qPrintable(QString("Computing %1 featrues on cloud %2\n(core points: %3)").arg(fas.features.size()).arg(sourceCloud->getName()).arg(pointCount))); } ccLog::Print(QString("Computing fields for cloud %1 (core points: %2)").arg(sourceCloud->getName()).arg(pointCount)); CCLib::NormalizedProgress nProgress(progressCb, pointCount); @@ -980,21 +981,31 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features break; } - if (progressCb && !nProgress.oneStep()) - { - //process cancelled by the user - ccLog::Warning("Process cancelled"); - error = true; - break; - } - } //for each scale + if (progressCb && !nProgress.oneStep()) + { + //process cancelled by the user + ccLog::Warning("Process cancelled"); + error = true; + break; + } + } //for each point } //for each cloud + } - //now we can end + for (const Feature::Shared& feature : features) + { + //we have to 'finish' the process for Point features + if (feature->getType() == Feature::Type::PointFeature && feature->scaled()) + { + if (!qSharedPointerCast(feature)->finish(corePoints, error)) + { + return false; + } + } } return success;