1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_MakeShape.cpp
4 // Created: 20 Oct 2014
5 // Author: Sergey ZARITCHNY
7 #include <GeomAlgoAPI_MakeShape.h>
8 #include <BRepBuilderAPI_MakeShape.hxx>
9 #include <TopTools_ListOfShape.hxx>
10 #include <TopTools_ListIteratorOfListOfShape.hxx>
11 GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(void* theMkShape)
12 : GeomAPI_Interface(theMkShape),myShape(new GeomAPI_Shape())
14 myShape->setImpl((void *)&implPtr<BRepBuilderAPI_MakeShape>()->Shape());
17 GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape()
18 : GeomAPI_Interface(),myShape(new GeomAPI_Shape())
20 void GeomAlgoAPI_MakeShape::init(void* theMkShape)
22 setImpl((void *)implPtr<BRepBuilderAPI_MakeShape>());
25 const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
30 /// Returns the list of shapes generated from the shape <theShape>
31 void GeomAlgoAPI_MakeShape::generated(
32 const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
34 BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
36 const TopTools_ListOfShape& aList = aBuilder->Generated(theShape->impl<TopoDS_Shape>());
37 TopTools_ListIteratorOfListOfShape it(aList);
38 for(;it.More();it.Next()) {
39 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
40 aShape->setImpl(new TopoDS_Shape(it.Value()));
41 theHistory.push_back(aShape);
46 /// Returns the list of shapes modified from the shape <theShape>
47 void GeomAlgoAPI_MakeShape::modified(
48 const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
50 BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
52 const TopTools_ListOfShape& aList = aBuilder->Modified(theShape->impl<TopoDS_Shape>());
53 TopTools_ListIteratorOfListOfShape it(aList);
54 for(;it.More();it.Next()) {
55 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
56 aShape->setImpl(new TopoDS_Shape(it.Value()));
57 theHistory.push_back(aShape);
62 /// Returns whether the shape is an edge
63 bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
65 bool isDeleted(false);
66 BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
68 isDeleted = aBuilder->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;