]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Symmetry.cpp
index 9656fc0e8822a0f6900e925b9d2f33987cadb724..87886d787f53d2c480daaef677af261a617c4023 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
 
 #include <FeaturesPlugin_Tools.h>
 
-static const std::string SCALE_VERSION_1("v9.5");
+static const std::string SYMMETRY_VERSION_1("v9.5");
 
 //=================================================================================================
 FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry()
@@ -75,7 +76,7 @@ void FeaturesPlugin_Symmetry::initAttributes()
 
   if (!aSelection->isInitialized()) {
     // new feature, not read from file
-    data()->setVersion(SCALE_VERSION_1);
+    data()->setVersion(SYMMETRY_VERSION_1);
   }
 }
 
@@ -203,12 +204,15 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPlane()
 void FeaturesPlugin_Symmetry::buildResult(
     const std::shared_ptr<GeomAlgoAPI_MakeShapeList>& theAlgo,
     const std::list<std::shared_ptr<GeomAPI_Shape> >& theOriginalShapes,
-    std::shared_ptr<GeomAPI_Shape> theTargetShape, int& theResultIndex)
+    std::shared_ptr<GeomAPI_Shape> theTargetShape, int& theResultIndex,
+    const ResultPtr& theTextureSource)
 {
   // Store and name the result.
   ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
-  FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
-                                           theAlgo, theTargetShape, "Symmetried");
+  ModelAPI_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
+                                     theAlgo, theTargetShape, "Symmetried");
+  // Copy image data, if any
+  ModelAPI_Tools::copyImageAttribute(theTextureSource, aResultBody);
   setResult(aResultBody, theResultIndex++);
 }
 
@@ -274,14 +278,15 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf)
   }
 
   bool isKeepOriginal = boolean(KEEP_ORIGINAL_RESULT())->value();
-  bool isKeepSubShapes = data()->version() == SCALE_VERSION_1;
+  bool isKeepSubShapes = data()->version() == SYMMETRY_VERSION_1;
 
   // Getting objects.
   GeomAPI_ShapeHierarchy anObjects;
   std::list<ResultPtr> aParts;
+  ResultPtr aTextureSource;
   AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID());
   if (!FeaturesPlugin_Tools::shapesFromSelectionList(
-       anObjSelList, isKeepSubShapes, anObjects, aParts))
+       anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource))
     return;
 
   std::string anError;
@@ -309,7 +314,7 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf)
   ListOfShape aTopLevel;
   anObjects.topLevelObjects(aTopLevel);
   for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt)
-    buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex);
+    buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex, aTextureSource);
 
   // Remove the rest results if there were produced in the previous pass.
   removeResults(aResultIndex);