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>
13 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
14 : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){}
16 void GeomAPI_DataMapOfShapeShape::clear()
18 implPtr<TopTools_DataMapOfShapeShape>()->Clear();
21 int GeomAPI_DataMapOfShapeShape::size()
23 return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
26 bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
27 std::shared_ptr<GeomAPI_Shape> theItem)
30 if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
31 theItem->impl<TopoDS_Shape>()))
36 void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap)
38 const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl<TopTools_DataMapOfShapeShape>();
39 TopTools_DataMapOfShapeShape* myDataMap = implPtr<TopTools_DataMapOfShapeShape>();
40 for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) {
41 myDataMap->Bind(anIt.Key(), anIt.Value());
45 void GeomAPI_DataMapOfShapeShape::
46 merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
48 if(theDataMap.get()) {
49 merge(*theDataMap.get());
53 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
56 if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
61 const std::shared_ptr<GeomAPI_Shape>
62 GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
64 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
66 new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
70 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
73 if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
78 GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
81 implPtr<TopTools_DataMapOfShapeShape>()->Clear();