Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Wire.cpp
index 4b7231a721a7589295d12e63f319b81d07310f3b..a941765b7d1d0771a3e699995de647c5a1f3b3da 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        BuildPlugin_Wire.cpp
-// Created:     14 April 2016
-// Author:      Dmitry Bobylev
+// 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 "BuildPlugin_Wire.h"
 
@@ -74,7 +88,7 @@ void BuildPlugin_Wire::execute()
     for(ListOfShape::const_iterator anIt = anEdges.cbegin(); anIt != anEdges.cend(); ++anIt) {
       std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(*anIt));
       if(anEdgeInList->isEqual(anEdgeInResult)) {
-        aResultBody->modified(anEdgeInList, anEdgeInResult, "Edge");
+        aResultBody->modified(anEdgeInList, anEdgeInResult);
         break;
       }
     }
@@ -122,12 +136,14 @@ bool BuildPlugin_Wire::addContour()
 
     // Check that it is edge on sketch.
     ResultPtr aContext = aSelection->context();
-    ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
+    ResultConstructionPtr aConstruction =
+      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
     if(!aConstruction.get()) {
       continue;
     }
     GeomShapePtr aContextShape = aConstruction->shape();
-    std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges = std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aContextShape);
+    std::shared_ptr<GeomAPI_PlanarEdges> aPlanarEdges =
+      std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aContextShape);
     if(!aPlanarEdges.get()) {
       continue;
     }
@@ -149,15 +165,18 @@ bool BuildPlugin_Wire::addContour()
     AttributeSelectionPtr aSelection = *aListIt;
     std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(aSelection->value()));
 
-    ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
+    ResultConstructionPtr aConstruction =
+      std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
 
     // Iterate on wires and add wire with this edge.
     std::shared_ptr<GeomAPI_Shape> aFoundWire;
     for(int anIndex = 0; anIndex < aConstruction->facesNum(); ++anIndex) {
       std::shared_ptr<GeomAPI_Face> aFace = aConstruction->face(anIndex);
-      for(GeomAPI_ShapeExplorer aWireExp(aFace, GeomAPI_Shape::WIRE); aWireExp.more(); aWireExp.next()) {
+      for(GeomAPI_ShapeExplorer
+          aWireExp(aFace, GeomAPI_Shape::WIRE); aWireExp.more(); aWireExp.next()) {
         GeomShapePtr aWireOnFace = aWireExp.current();
-        for(GeomAPI_ShapeExplorer anExp(aWireOnFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
+        for(GeomAPI_ShapeExplorer
+            anExp(aWireOnFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
           std::shared_ptr<GeomAPI_Edge> anEdgeOnFace(new GeomAPI_Edge(anExp.current()));
           if(anEdgeInList->isEqual(anEdgeOnFace)) {
             aFoundWire = aWireOnFace;
@@ -172,7 +191,8 @@ bool BuildPlugin_Wire::addContour()
 
     // If wire with the same edge found. Add all other edges to list.
     if(aFoundWire.get()) {
-      for(GeomAPI_ShapeExplorer anExp(aFoundWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
+      for(GeomAPI_ShapeExplorer
+          anExp(aFoundWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
         std::shared_ptr<GeomAPI_Edge> anEdgeOnFace(new GeomAPI_Edge(anExp.current()));
         ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin();
         for(; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) {
@@ -190,7 +210,7 @@ bool BuildPlugin_Wire::addContour()
   }
 
   if(!isAnyContourAdded) {
-    Events_InfoMessage("BuildPlugin_Wire", 
+    Events_InfoMessage("BuildPlugin_Wire",
       "Error: Contours already closed or no contours found for selected edges.").send();
     return false;
   }