Salome HOME
27.10.2014. Naming data structure for Extrusion feature.
[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(BRepBuilderAPI_MakeShape *  theMkShape)
9 { myBuilder = theMkShape;}
10
11 const boost::shared_ptr<GeomAPI_Shape>  GeomAlgoAPI_MakeShape::shape() const
12 {
13   boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
14   if(myBuilder != NULL) 
15     aShape->setImpl(new TopoDS_Shape(myBuilder->Shape()));
16   return aShape;
17 }
18
19   /// Returns the  list   of shapes generated   from the shape <theShape>
20 const ListOfShape& GeomAlgoAPI_MakeShape::generated(const boost::shared_ptr<GeomAPI_Shape> theShape)
21 {
22   myHistory.clear();
23   if(myBuilder != NULL) {
24         const TopTools_ListOfShape& aList =  myBuilder->Generated(theShape->impl<TopoDS_Shape>());
25     TopTools_ListIteratorOfListOfShape it(aList);
26         for(;it.More();it.Next()) {
27                 boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
28                 aShape->setImpl(&(it.Value()));
29                 myHistory.push_back(aShape);
30         }
31   }
32   return myHistory;
33 }
34
35   /// Returns the  list   of shapes modified   from the shape <theShape>
36 const ListOfShape& GeomAlgoAPI_MakeShape::modified(const boost::shared_ptr<GeomAPI_Shape> theShape)
37 {
38   myHistory.clear();
39   if(myBuilder != NULL) {
40         const TopTools_ListOfShape& aList =  myBuilder->Modified(theShape->impl<TopoDS_Shape>());
41         TopTools_ListIteratorOfListOfShape it(aList);
42         for(;it.More();it.Next()) {
43                 boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
44                 aShape->setImpl(&(it.Value()));
45                 myHistory.push_back(aShape);
46         }
47   }
48   return myHistory;
49 }
50
51   /// Returns whether the shape is an edge
52 bool GeomAlgoAPI_MakeShape::isDeleted(const boost::shared_ptr<GeomAPI_Shape> theShape)
53 {
54   bool isDeleted(false);
55   if (myBuilder != NULL) 
56         isDeleted = (bool) myBuilder->IsDeleted(theShape->impl<TopoDS_Shape>());        
57   return isDeleted;
58 }