1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_DataMapOfShapeShape.cpp
4 // Created: 28 Oct 2014
5 // Author: Sergey Zaritchny
7 #include <GeomAPI_Shape.h>
8 #include <GeomAPI_DataMapOfShapeShape.h>
9 #include <TopTools_DataMapOfShapeShape.hxx>
10 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
11 #include <TopoDS_Shape.hxx>
15 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
16 : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){}
18 void GeomAPI_DataMapOfShapeShape::clear()
20 implPtr<TopTools_DataMapOfShapeShape>()->Clear();
23 int GeomAPI_DataMapOfShapeShape::size()
25 return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
28 bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
29 std::shared_ptr<GeomAPI_Shape> theItem)
32 if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
33 theItem->impl<TopoDS_Shape>()))
38 void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap)
40 const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl<TopTools_DataMapOfShapeShape>();
41 TopTools_DataMapOfShapeShape* myDataMap = implPtr<TopTools_DataMapOfShapeShape>();
42 for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) {
43 myDataMap->Bind(anIt.Key(), anIt.Value());
47 void GeomAPI_DataMapOfShapeShape::
48 merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
50 if(theDataMap.get()) {
51 merge(*theDataMap.get());
55 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
58 if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
63 const std::shared_ptr<GeomAPI_Shape>
64 GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
66 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
68 new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
72 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
75 if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
80 GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
83 implPtr<TopTools_DataMapOfShapeShape>()->Clear();