1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include <GeomAPI_Shape.h>
22 #include <GeomAPI_DataMapOfShapeShape.h>
23 #include <TopTools_DataMapOfShapeShape.hxx>
24 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
25 #include <TopoDS_Shape.hxx>
27 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
28 : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){}
30 void GeomAPI_DataMapOfShapeShape::clear()
32 implPtr<TopTools_DataMapOfShapeShape>()->Clear();
35 int GeomAPI_DataMapOfShapeShape::size()
37 return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
40 bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
41 std::shared_ptr<GeomAPI_Shape> theItem)
44 if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
45 theItem->impl<TopoDS_Shape>()))
50 void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap)
52 const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl<TopTools_DataMapOfShapeShape>();
53 TopTools_DataMapOfShapeShape* myDataMap = implPtr<TopTools_DataMapOfShapeShape>();
54 for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) {
55 myDataMap->Bind(anIt.Key(), anIt.Value());
59 void GeomAPI_DataMapOfShapeShape::
60 merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
62 if(theDataMap.get()) {
63 merge(*theDataMap.get());
67 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
70 if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
75 const std::shared_ptr<GeomAPI_Shape>
76 GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
78 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
80 new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
84 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
87 if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
92 GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
95 implPtr<TopTools_DataMapOfShapeShape>()->Clear();