Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_MultiTranslation.cpp
index 64bfef004ed2adb8ecade7b275e34fde1fc9aaca..78f0aa2fddd2e7bbb19f262188e2a2f05f58ff54 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <FeaturesAPI_MultiTranslation.h>
@@ -156,20 +155,10 @@ void FeaturesAPI_MultiTranslation::dump(ModelHighAPI_Dumper& theDumper) const
     theDumper << ", " << anAttrSecondNumber;
   }
 
-  theDumper << ")" << std::endl;
-}
+  if (!aBase->data()->version().empty())
+    theDumper << ", keepSubResults = True";
 
-//==================================================================================================
-MultiTranslationPtr addMultiTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
-                                        const std::list<ModelHighAPI_Selection>& theMainObjects,
-                                        const ModelHighAPI_Selection& theAxisObject,
-                                        const ModelHighAPI_Double& theStep,
-                                        const ModelHighAPI_Integer& theNumber)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature =
-    thePart->addFeature(FeaturesAPI_MultiTranslation::ID());
-  return MultiTranslationPtr(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects,
-                                                              theAxisObject, theStep, theNumber));
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
@@ -180,13 +169,22 @@ MultiTranslationPtr addMultiTranslation(const std::shared_ptr<ModelAPI_Document>
                                         const ModelHighAPI_Integer& theFirstNumber,
                                         const ModelHighAPI_Selection& theSecondAxisObject,
                                         const ModelHighAPI_Double& theSecondStep,
-                                        const ModelHighAPI_Integer& theSecondNumber)
+                                        const ModelHighAPI_Integer& theSecondNumber,
+                                        const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     thePart->addFeature(FeaturesAPI_MultiTranslation::ID());
-  return MultiTranslationPtr(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects,
-                                                              theFirstAxisObject, theFirstStep,
-                                                              theFirstNumber,
-                                                              theSecondAxisObject, theSecondStep,
-                                                              theSecondNumber));
+  if (!keepSubResults)
+    aFeature->data()->setVersion("");
+  MultiTranslationPtr aMT;
+  if (theSecondAxisObject.variantType() == ModelHighAPI_Selection::VT_Empty) {
+    aMT.reset(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects,
+        theFirstAxisObject, theFirstStep, theFirstNumber));
+  }
+  else {
+    aMT.reset(new FeaturesAPI_MultiTranslation(aFeature, theMainObjects,
+        theFirstAxisObject, theFirstStep, theFirstNumber,
+        theSecondAxisObject, theSecondStep, theSecondNumber));
+  }
+  return aMT;
 }