Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / GeomAPI / GeomAPI_DataMapOfShapeShape.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_DataMapOfShapeShape.cpp
4 // Created:     28 Oct 2014
5 // Author:      Sergey Zaritchny
6
7 #include <GeomAPI_Shape.h>
8 #include <GeomAPI_DataMapOfShapeShape.h>
9 #include <TopTools_DataMapOfShapeShape.hxx>
10 #include <TopoDS_Shape.hxx>
11 using namespace std;
12
13
14 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
15         :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){}
16
17 void GeomAPI_DataMapOfShapeShape::clear()
18 {
19   implPtr<TopTools_DataMapOfShapeShape>()->Clear();
20 }
21
22 int GeomAPI_DataMapOfShapeShape::size()
23 {
24   return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
25 }
26
27 bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem)
28 {
29   bool flag(false);
30   if(implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(), theItem->impl<TopoDS_Shape>()))
31         flag = true;
32   return flag;
33 }
34
35 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
36 {
37   bool flag(false);
38   if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
39     flag = true;
40   return flag;
41 }
42
43 const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
44 {
45   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());  
46   aShape->setImpl(new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
47   return aShape;
48 }  
49   
50 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
51 {
52   bool flag(false);
53   if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
54         flag = true;
55   return flag;
56 }
57
58  GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
59  {
60   if (myImpl) {
61         implPtr<TopTools_DataMapOfShapeShape>()->Clear();
62     //delete myImpl;
63   }
64  }