X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Extrusion.cpp;h=29c4aec277baa4167af118b36f05d4f343f9e261;hb=0cea3be102af7247b2fe2c8035a1bb38b7bf82ae;hp=6955ee89a96e993929a0865ef9d6147cff0cad5f;hpb=5b841e9801c659d762d708378df8c4d85565fda0;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp index 6955ee89a..29c4aec27 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAlgoAPI_Extrusion.cpp // Created: 06 Jun 2014 // Author: Artem ZHIDKOV @@ -19,14 +21,14 @@ #include #include #include -#include +#include #include #include const double tolerance = Precision::Angular(); // Constructor GeomAlgoAPI_Extrusion::GeomAlgoAPI_Extrusion( - boost::shared_ptr theBasis, double theSize) + std::shared_ptr theBasis, double theSize) : mySize(theSize), myDone(false), myShape(new GeomAPI_Shape()), myFirst(new GeomAPI_Shape()), myLast(new GeomAPI_Shape()) { @@ -34,11 +36,10 @@ GeomAlgoAPI_Extrusion::GeomAlgoAPI_Extrusion( } //============================================================================ -void GeomAlgoAPI_Extrusion::build(const boost::shared_ptr& theBasis) +void GeomAlgoAPI_Extrusion::build(const std::shared_ptr& theBasis) { bool isFirstNorm = true; gp_Dir aShapeNormal; - TopoDS_Face aBasis = TopoDS::Face(theBasis->impl()); Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface(aBasis)); @@ -53,29 +54,24 @@ void GeomAlgoAPI_Extrusion::build(const boost::shared_ptr& theBas if(aBuilder) { setImpl(aBuilder); myDone = aBuilder->IsDone() == Standard_True; - if (myDone) { - BRepCheck_Analyzer aChecker(aBuilder->Shape()); - myDone = aChecker.IsValid() == Standard_True; - } - if(myDone) { + if (myDone) { TopoDS_Shape aResult; if(aBuilder->Shape().ShapeType() == TopAbs_COMPOUND) aResult = GeomAlgoAPI_DFLoader::refineResult(aBuilder->Shape()); else aResult = aBuilder->Shape(); - - for (TopExp_Explorer Exp(aResult,TopAbs_FACE); Exp.More(); Exp.Next()) { - boost::shared_ptr aCurrentShape(new GeomAPI_Shape()); - aCurrentShape->setImpl(new TopoDS_Shape(Exp.Current())); - myMap.bind(aCurrentShape, aCurrentShape); - } - + // fill data map to keep correct orientation of sub-shapes + for (TopExp_Explorer Exp(aResult,TopAbs_FACE); Exp.More(); Exp.Next()) { + std::shared_ptr aCurrentShape(new GeomAPI_Shape()); + aCurrentShape->setImpl(new TopoDS_Shape(Exp.Current())); + myMap.bind(aCurrentShape, aCurrentShape); + } myShape->setImpl(new TopoDS_Shape(aResult)); myFirst->setImpl(new TopoDS_Shape(aBuilder->FirstShape())); myLast->setImpl(new TopoDS_Shape(aBuilder-> LastShape())); myMkShape = new GeomAlgoAPI_MakeShape (aBuilder); - } - } + } + } } //============================================================================ @@ -85,7 +81,8 @@ const bool GeomAlgoAPI_Extrusion::isDone() const //============================================================================ const bool GeomAlgoAPI_Extrusion::isValid() const { - return myDone; + BRepCheck_Analyzer aChecker(myShape->impl()); + return (aChecker.IsValid() == Standard_True); } //============================================================================ @@ -103,34 +100,19 @@ const bool GeomAlgoAPI_Extrusion::hasVolume() const } //============================================================================ -const boost::shared_ptr& GeomAlgoAPI_Extrusion::shape () const -{return myShape;} - -//============================================================================ -/*void GeomAlgoAPI_Extrusion::generated( - const boost::shared_ptr theShape, ListOfShape& theHistory) +const std::shared_ptr& GeomAlgoAPI_Extrusion::shape () const { - theHistory.clear(); - if(myDone) { - const TopTools_ListOfShape& aList = implPtr() - ->Generated(theShape->impl()); - TopTools_ListIteratorOfListOfShape it(aList); - for(;it.More();it.Next()) { - boost::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(&(it.Value())); - theHistory.push_back(aShape); - } - } + return myShape; } -*/ + //============================================================================ -const boost::shared_ptr& GeomAlgoAPI_Extrusion::firstShape() +const std::shared_ptr& GeomAlgoAPI_Extrusion::firstShape() { return myFirst; } //============================================================================ -const boost::shared_ptr& GeomAlgoAPI_Extrusion::lastShape() +const std::shared_ptr& GeomAlgoAPI_Extrusion::lastShape() { return myLast; } @@ -152,6 +134,5 @@ GeomAlgoAPI_Extrusion::~GeomAlgoAPI_Extrusion() { if (myImpl) { myMap.clear(); - //delete myImpl; } } \ No newline at end of file