X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_MakeShape.cpp;h=f28779de5f60f244d5c41124d2541b00fdeefcbf;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=d743b567ab15c82663d048240e85dc207bd2d99f;hpb=d9db5498b576854aae37ddf8c0bb6fceb264712e;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index d743b567a..f28779de5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -1,58 +1,71 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAlgoAPI_MakeShape.cpp // Created: 20 Oct 2014 // Author: Sergey ZARITCHNY #include +#include #include #include -GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(BRepBuilderAPI_MakeShape * theMkShape) -{ myBuilder = theMkShape;} +GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(void* theMkShape) + : GeomAPI_Interface(theMkShape),myShape(new GeomAPI_Shape()) +{ + myShape->setImpl((void *)&implPtr()->Shape()); +} -const boost::shared_ptr GeomAlgoAPI_MakeShape::shape() const +GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() + : GeomAPI_Interface(),myShape(new GeomAPI_Shape()) +{} +void GeomAlgoAPI_MakeShape::init(void* theMkShape) { - boost::shared_ptr aShape(new GeomAPI_Shape()); - if(myBuilder != NULL) - aShape->setImpl(new TopoDS_Shape(myBuilder->Shape())); - return aShape; + setImpl((void *)implPtr()); } - /// Returns the list of shapes generated from the shape -const ListOfShape& GeomAlgoAPI_MakeShape::generated(const boost::shared_ptr theShape) +const std::shared_ptr GeomAlgoAPI_MakeShape::shape() const { - myHistory.clear(); - if(myBuilder != NULL) { - const TopTools_ListOfShape& aList = myBuilder->Generated(theShape->impl()); + return myShape; +} + +/// Returns the list of shapes generated from the shape +void GeomAlgoAPI_MakeShape::generated( + const std::shared_ptr theShape, ListOfShape& theHistory) +{ + BRepBuilderAPI_MakeShape* aBuilder = implPtr(); + if(aBuilder) { + const TopTools_ListOfShape& aList = aBuilder->Generated(theShape->impl()); TopTools_ListIteratorOfListOfShape it(aList); - for(;it.More();it.Next()) { - boost::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(&(it.Value())); - myHistory.push_back(aShape); - } + for(;it.More();it.Next()) { + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(it.Value())); + theHistory.push_back(aShape); + } } - return myHistory; } - /// Returns the list of shapes modified from the shape -const ListOfShape& GeomAlgoAPI_MakeShape::modified(const boost::shared_ptr theShape) +/// Returns the list of shapes modified from the shape +void GeomAlgoAPI_MakeShape::modified( + const std::shared_ptr theShape, ListOfShape& theHistory) { - myHistory.clear(); - if(myBuilder != NULL) { - const TopTools_ListOfShape& aList = myBuilder->Modified(theShape->impl()); - TopTools_ListIteratorOfListOfShape it(aList); - for(;it.More();it.Next()) { - boost::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(&(it.Value())); - myHistory.push_back(aShape); - } + BRepBuilderAPI_MakeShape* aBuilder = implPtr(); + if(aBuilder) { + const TopTools_ListOfShape& aList = aBuilder->Modified(theShape->impl()); + TopTools_ListIteratorOfListOfShape it(aList); + for(;it.More();it.Next()) { + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(it.Value())); + theHistory.push_back(aShape); + } } - return myHistory; } - /// Returns whether the shape is an edge -bool GeomAlgoAPI_MakeShape::isDeleted(const boost::shared_ptr theShape) +/// Returns whether the shape is an edge +bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr theShape) { bool isDeleted(false); - if (myBuilder != NULL) - isDeleted = (bool) myBuilder->IsDeleted(theShape->impl()); + BRepBuilderAPI_MakeShape* aBuilder = implPtr(); + if(aBuilder) { + isDeleted = aBuilder->IsDeleted(theShape->impl()) == Standard_True; + } return isDeleted; -} \ No newline at end of file +}