X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_UnifySameDomain.cpp;h=ee9c6fecac07a7e1f67ee24b67edc6119ebdb8bf;hb=f60dc9dd94d5d4b0ea07e3e3cbfd5b3028f0942d;hp=356c15be15ba47b6bc755a3c6964d22e25fe07d2;hpb=1e696647e5203fc6f23c7acc9e78a720163a225e;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp index 356c15be1..ee9c6feca 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp @@ -33,6 +33,13 @@ GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const ListOfShape& theS build(theShapes); } +//================================================================================================== +GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const GeomShapePtr& theShape) +{ + build(theShape, false); +} + +//================================================================================================== void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) { if(theShapes.empty()) { @@ -54,11 +61,20 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) const TopoDS_Shape& aShell = aCombined.front()->impl(); + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(aShell)); + build(aShape, true); +} + +//================================================================================================== +void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr& theShape, + const bool theIsToSimplifyShell) +{ ShapeUpgrade_UnifySameDomain* aUnifyAlgo = new ShapeUpgrade_UnifySameDomain(); this->setImpl(aUnifyAlgo); - aUnifyAlgo->Initialize(aShell); - aUnifyAlgo->UnifyFacesAndEdges(); + const TopoDS_Shape& aShape = theShape->impl(); + aUnifyAlgo->Initialize(aShape); aUnifyAlgo->Build(); TopoDS_Shape aResult = aUnifyAlgo->Shape(); @@ -66,7 +82,7 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) return; } - if (aResult.ShapeType() == TopAbs_SHELL) { + if (theIsToSimplifyShell && aResult.ShapeType() == TopAbs_SHELL) { int aNb = 0; TopoDS_Iterator anIt(aResult); for (; anIt.More(); anIt.Next()) { @@ -79,9 +95,9 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape& theShapes) } } - std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aResult)); - this->setShape(aShape); + std::shared_ptr aResShape(new GeomAPI_Shape()); + aResShape->setImpl(new TopoDS_Shape(aResult)); + this->setShape(aResShape); this->setDone(true); } @@ -96,13 +112,16 @@ void GeomAlgoAPI_UnifySameDomain::modified(const std::shared_ptr const TopoDS_Shape& aShape = theShape->impl(); const ShapeUpgrade_UnifySameDomain& aUnifyAlgo = this->impl(); - const TopTools_ListOfShape& aMList = aUnifyAlgo.History()->Generated(aShape); - for(TopTools_ListIteratorOfListOfShape aModified(aMList); aModified.More(); aModified.Next()) { - - for(TopExp_Explorer anExp(aModified.Value(), aShape.ShapeType()); anExp.More(); anExp.Next()) { - GeomShapePtr aGeomShape(new GeomAPI_Shape()); - aGeomShape->setImpl(new TopoDS_Shape(anExp.Current())); - theHistory.push_back(aGeomShape); + for (int aIsModified = 0; aIsModified <= 1; aIsModified++) { + const TopTools_ListOfShape& aMList = aIsModified ? + aUnifyAlgo.History()->Modified(aShape) : aUnifyAlgo.History()->Generated(aShape); + for (TopTools_ListIteratorOfListOfShape aModified(aMList); aModified.More(); aModified.Next()) { + for (TopExp_Explorer anExp(aModified.Value(), aShape.ShapeType()); + anExp.More(); anExp.Next()) { + GeomShapePtr aGeomShape(new GeomAPI_Shape()); + aGeomShape->setImpl(new TopoDS_Shape(anExp.Current())); + theHistory.push_back(aGeomShape); + } } } }