From: dbv Date: Fri, 22 Apr 2016 12:37:38 +0000 (+0300) Subject: Issue #1369: Removed redundant includes in BuildPlugin_Face.cpp, fixed naming for... X-Git-Tag: V_2.3.0~101 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4a62ffb1f5db2404930e61f2a107511373312eda;p=modules%2Fshaper.git Issue #1369: Removed redundant includes in BuildPlugin_Face.cpp, fixed naming for Wire feature. --- diff --git a/src/BuildPlugin/BuildPlugin_Face.cpp b/src/BuildPlugin/BuildPlugin_Face.cpp index 36ef2b3e8..14314ddba 100644 --- a/src/BuildPlugin/BuildPlugin_Face.cpp +++ b/src/BuildPlugin/BuildPlugin_Face.cpp @@ -8,21 +8,13 @@ #include #include -#include -#include - -#include -#include +#include #include #include #include #include -#include - -#include -#include //================================================================================================= BuildPlugin_Face::BuildPlugin_Face() diff --git a/src/BuildPlugin/BuildPlugin_Wire.cpp b/src/BuildPlugin/BuildPlugin_Wire.cpp index 99d6bd74e..439b082b0 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.cpp +++ b/src/BuildPlugin/BuildPlugin_Wire.cpp @@ -12,7 +12,6 @@ #include -#include #include #include @@ -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 anEdgeInList(new GeomAPI_Edge(*anIt)); + if(anEdgeInList->isEqual(anEdgeInResult)) { + aResultBody->modified(anEdgeInList, anEdgeInResult, "Edge"); + break; + } + } + } setResult(aResultBody); }