]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp
Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_MakeShape.cpp
1 // File:        GeomAlgoAPI_MakeShape.cpp
2 // Created:     20 Oct 2014
3 // Author:      Sergey ZARITCHNY
4
5 #include <GeomAlgoAPI_MakeShape.h>
6 #include <TopTools_ListOfShape.hxx>
7 #include <TopTools_ListIteratorOfListOfShape.hxx>
8 GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(void* theMkShape)
9   : GeomAPI_Interface(theMkShape)
10 {}
11
12 const boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
13 {
14   return myShape;
15 }
16
17 /// Returns the  list   of shapes generated   from the shape <theShape>
18 void GeomAlgoAPI_MakeShape::generated(
19   const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
20 {
21   BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
22   if(aBuilder) {
23     const TopTools_ListOfShape& aList =  aBuilder->Generated(theShape->impl<TopoDS_Shape>());
24     TopTools_ListIteratorOfListOfShape it(aList);
25     for(;it.More();it.Next()) {
26       boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
27       aShape->setImpl(&(it.Value()));
28       theHistory.push_back(aShape);
29     }
30   }
31 }
32
33 /// Returns the  list   of shapes modified   from the shape <theShape>
34 void GeomAlgoAPI_MakeShape::modified(
35   const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
36 {
37   BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
38   if(aBuilder) {
39     const TopTools_ListOfShape& aList =  aBuilder->Modified(theShape->impl<TopoDS_Shape>());
40     TopTools_ListIteratorOfListOfShape it(aList);
41     for(;it.More();it.Next()) {
42       boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
43       aShape->setImpl(&(it.Value()));
44       theHistory.push_back(aShape);
45     }
46   }
47 }
48
49 /// Returns whether the shape is an edge
50 bool GeomAlgoAPI_MakeShape::isDeleted(const boost::shared_ptr<GeomAPI_Shape> theShape)
51 {
52   bool isDeleted(false);
53   BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
54   if(aBuilder) {
55     isDeleted = aBuilder->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
56   }
57   return isDeleted;
58 }