1 // File: GeomAPI_DataMapOfShapeShape.cpp
2 // Created: 28 Oct 2014
3 // Author: Sergey Zaritchny
5 #include <GeomAPI_Shape.h>
6 #include <GeomAPI_DataMapOfShapeShape.h>
7 #include <TopTools_DataMapOfShapeShape.hxx>
8 #include <TopoDS_Shape.hxx>
12 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
13 :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){}
16 void GeomAPI_DataMapOfShapeShape::clear()
18 implPtr<TopTools_DataMapOfShapeShape>()->Clear();
22 int GeomAPI_DataMapOfShapeShape::size()
24 return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
27 /// Adds the Key <K> to the Map <me> with the Item. Returns True if the Key was not already in the map
28 bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem)
31 if(implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(), theItem->impl<TopoDS_Shape>()))
36 /// Returns true if theKey is stored in the map.
37 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
40 if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
45 /// Returns the Item stored with the Key in the Map. To be checked before with isBound()
46 const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
48 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
49 aShape->setImpl(new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
53 /// Removes the Key from the map. Returns true if the Key was in the Map
54 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
57 if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
62 GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
65 implPtr<TopTools_DataMapOfShapeShape>()->Clear();