Salome HOME
Revert "Merge remote-tracking branch 'origin/cbr/export_to_geom_via_xao'"
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.cpp
index 8b7f59638cf9edba2b1703e94b083a35d36b98f1..0c78b27e19d564ea586603b39054585ecea74786 100644 (file)
@@ -225,7 +225,6 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
 
   // make shape for export from all results
   std::list<GeomShapePtr> aShapes;
-  std::list<ResultBodyPtr> aResults;
   int aBodyCount = document()->size(ModelAPI_ResultBody::group());
   for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
     ResultBodyPtr aResultBody =
@@ -234,7 +233,6 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
     if (!aResultBody.get())
       continue;
     aShapes.push_back(aResultBody->shape());
-    aResults.push_back(aResultBody);
   }
   GeomShapePtr aShape = (aShapes.size() == 1)
       ? *aShapes.begin()
@@ -248,13 +246,8 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
   }
 
   // geometry name
-  std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
-  if (aGeometryName.empty() and aBodyCount == 1){
-    // get the name from the first result
-    ResultBodyPtr aResultBody = *aResults.begin();
-    aGeometryName = aResultBody->data()->name();
-  }
 
+  std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
   aXao.getGeometry()->setName(aGeometryName);
 
   // groups
@@ -283,12 +276,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
       AttributeSelectionPtr aSelection = aSelectionList->value(aSelectionIndex);
 
       // complex conversion of reference id to element index
-      // gives bad id in case the selection is done from python script
-      // => using GeomAlgoAPI_CompoundBuilder::id instead
-      // int aReferenceID_old = aSelection->Id();
-
-      int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
-
+      int aReferenceID = aSelection->Id();
       std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
       int anElementID =
         aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString);
@@ -347,12 +335,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
             AttributeSelectionPtr aSelection = aSelectionList->value(aRow - 1);
 
             // complex conversion of reference id to element index
-            // gives bad id in case the selection is done from python script
-            // => using GeomAlgoAPI_CompoundBuilder::id instead
-            //int aReferenceID_old = aSelection->Id();
-
-            int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSelection->value());
-
+            int aReferenceID = aSelection->Id();
             std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
             anElementID =
               aXao.getGeometry()->getElementIndexByReference(aFieldDimension, aReferenceString);