]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1369: Removed redundant includes in BuildPlugin_Face.cpp, fixed naming for...
authordbv <dbv@opencascade.com>
Fri, 22 Apr 2016 12:37:38 +0000 (15:37 +0300)
committerdbv <dbv@opencascade.com>
Tue, 26 Apr 2016 13:52:19 +0000 (16:52 +0300)
src/BuildPlugin/BuildPlugin_Face.cpp
src/BuildPlugin/BuildPlugin_Wire.cpp

index 36ef2b3e8a73f3dfb9bf35c7ff3ebcf7454d69f3..14314ddbaaa2e77f71989bcef38dac407d780bf4 100644 (file)
@@ -8,21 +8,13 @@
 
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_ResultBody.h>
-#include <ModelAPI_ResultConstruction.h>
 
-#include <Events_Error.h>
-
-#include <GeomAPI_DataMapOfShapeShape.h>
-#include <GeomAPI_PlanarEdges.h>
+#include <GeomAPI_Edge.h>
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_ShapeExplorer.h>
 
 #include <GeomAlgoAPI_ShapeTools.h>
 #include <GeomAlgoAPI_SketchBuilder.h>
-#include <GeomAlgoAPI_WireBuilder.h>
-
-#include <algorithm>
-#include <sstream>
 
 //=================================================================================================
 BuildPlugin_Face::BuildPlugin_Face()
index 99d6bd74ed7cb704e9d5bea0d831852aac9f6f9a..439b082b015e7d9bfad04a19aef9dc9cc8f125fd 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <Events_Error.h>
 
-#include <GeomAPI_DataMapOfShapeShape.h>
 #include <GeomAPI_PlanarEdges.h>
 #include <GeomAPI_ShapeExplorer.h>
 
@@ -47,25 +46,21 @@ void BuildPlugin_Wire::execute()
   }
 
   // Collect base shapes.
-  ListOfShape aListOfShapes;
+  ListOfShape anEdges;
   for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
     AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
     GeomShapePtr aShape = aSelection->value();
     if(!aShape.get()) {
-      setError("Error: Empty shape selected.");
-      return;
+      aShape = aSelection->context()->shape();
     }
-
-    if(aShape->shapeType() != GeomAPI_Shape::EDGE && aShape->shapeType() != GeomAPI_Shape::WIRE) {
-      setError("Error: Selected shape has wrong type. Only edges and wires acceptable.");
-      return;
+    for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
+      GeomShapePtr anEdge = anExp.current();
+      anEdges.push_back(anEdge);
     }
-
-    aListOfShapes.push_back(aShape);
   }
 
   // Create wire.
-  GeomShapePtr aWire = GeomAlgoAPI_WireBuilder::wire(aListOfShapes);
+  GeomShapePtr aWire = GeomAlgoAPI_WireBuilder::wire(anEdges);
   if(!aWire.get()) {
     setError("Error: Result wire is empty. Probably it has disconnected edges or non-manifold.");
     return;
@@ -74,6 +69,16 @@ void BuildPlugin_Wire::execute()
   // Store result.
   ResultBodyPtr aResultBody = document()->createBody(data());
   aResultBody->store(aWire);
+  for(GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
+    GeomShapePtr anEdgeInResult = anExp.current();
+    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");
+        break;
+      }
+    }
+  }
   setResult(aResultBody);
 }