Salome HOME
Update of the ExportToGEOM test
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Symmetry.cpp
index b1b34237b6821cb90bea397a4422b7c215fb7c8a..7121e968d710362ec4be831088e383c6ba14f249 100644 (file)
@@ -1,23 +1,41 @@
-// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
-
-// File:        FeaturesPlugin_Symmetry.cpp
-// Created:     30 Nov 2016
-// Author:      Clarisse Genrault (CEA)
+// Copyright (C) 2014-2017  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <FeaturesPlugin_Symmetry.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_FaceBuilder.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultPart.h>
 
+#include <FeaturesPlugin_Tools.h>
+
 //=================================================================================================
 FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry()
 {
@@ -274,15 +292,15 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane()
   std::shared_ptr<GeomAPI_Pln> aPln;
   std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
     selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID());
-  if(anObjRef && anObjRef->value() && anObjRef->value()->isFace()) {
+  if (anObjRef && anObjRef->value() && anObjRef->value()->isFace()) {
     aPln = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->value()))->getPlane();
   }
   else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
-             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isFace()) {
     aPln =
       std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->context()->shape()))->getPlane();
   }
-  if(aPln) {
+  if (aPln) {
     aPlane = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aPln->location(),
                                                           aPln->direction()));
   }
@@ -351,9 +369,8 @@ void FeaturesPlugin_Symmetry::loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo
 
   // Name the faces
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theSymmetryAlgo.mapOfSubShapes();
-  int aReflectedTag = 1;
   std::string aReflectedName = "Symmetried";
-  theResultBody->loadAndOrientModifiedShapes(&theSymmetryAlgo,
-                                              theBaseShape, GeomAPI_Shape::FACE,
-                                              aReflectedTag, aReflectedName, *aSubShapes.get());
+  FeaturesPlugin_Tools::storeModifiedShapes(theSymmetryAlgo, theResultBody,
+                                            theBaseShape, 1, 2, 3, aReflectedName,
+                                            *aSubShapes.get());
 }