From: Nicolas RECHATIN Date: Mon, 9 Oct 2023 14:44:05 +0000 (+0200) Subject: feat : Added error if TopVolume not in Volume list X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e40b861ff8e1d09dc4ac46ee438396d76c23cb12;p=modules%2Fshaper.git feat : Added error if TopVolume not in Volume list --- diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 685d3f96f..ed49b8b21 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -698,6 +698,7 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string &theFileName) std::list aListOfMedias; // Add feature in the file + std::list aVolumeFeatureList; std::list aFeatures = document()->allFeatures(); std::list::iterator itFeature = aFeatures.begin(); int aMediumIndex = 0; @@ -720,6 +721,7 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string &theFileName) } else if (aFeature->getKind() == "Volume") { + aVolumeFeatureList.push_back(aFeature); std::list> aFeatureDimensionsList; aFeatureDimensionsList = ExchangePlugin_ExportRoot::computeVolume(aFeature); @@ -765,6 +767,17 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string &theFileName) aNameShape = Locale::Convert::toString(anObject->data()->name()); } + // Check if top volume in Volume list + bool err = true; + std::list::iterator jtFeature = aVolumeFeatureList.begin(); + for (; jtFeature != aVolumeFeatureList.end(); ++jtFeature){ + std::string aCurrName = Locale::Convert::toString((*jtFeature)->firstResult()->data()->name()); + if (aCurrName == aNameShape) + err = false; + } + if (err) + setError("An error occured while exporting : The selected ROOT top volume \"" + aNameShape + "\" is not in the volume list and thus seems to not be a proper Volume result"); + // Create the end of file std::string aExportFileName = string(ExchangePlugin_ExportFeature::EXP_NAME_FILE_ID())->value(); anAlgo->buildEnd(aNameShape, aExportFileName);