]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
feat : Added error if TopVolume not in Volume list
authorNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 14:44:05 +0000 (16:44 +0200)
committerNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 14:44:05 +0000 (16:44 +0200)
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp

index 685d3f96f4c59116da3c1b55c55963211333d0c1..ed49b8b21af047f68354996871ab8326e5ec83a9 100644 (file)
@@ -698,6 +698,7 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string &theFileName)
     std::list<std::string> aListOfMedias;
 
     // Add feature in the file
+    std::list<FeaturePtr> aVolumeFeatureList;
     std::list<FeaturePtr> aFeatures = document()->allFeatures();
     std::list<FeaturePtr>::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<std::map<std::string, std::string>> 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<FeaturePtr>::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);