1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #include <GeomAPI_Shape.h>
21 #include <GeomAPI_DataMapOfShapeShape.h>
22 #include <TopTools_DataMapOfShapeShape.hxx>
23 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
24 #include <TopoDS_Shape.hxx>
26 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
27 : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){}
29 void GeomAPI_DataMapOfShapeShape::clear()
31 implPtr<TopTools_DataMapOfShapeShape>()->Clear();
34 int GeomAPI_DataMapOfShapeShape::size()
36 return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
39 bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
40 std::shared_ptr<GeomAPI_Shape> theItem)
43 if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
44 theItem->impl<TopoDS_Shape>()))
49 void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap)
51 const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl<TopTools_DataMapOfShapeShape>();
52 TopTools_DataMapOfShapeShape* myDataMap = implPtr<TopTools_DataMapOfShapeShape>();
53 for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) {
54 myDataMap->Bind(anIt.Key(), anIt.Value());
58 void GeomAPI_DataMapOfShapeShape::
59 merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
61 if(theDataMap.get()) {
62 merge(*theDataMap.get());
66 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
69 if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
74 const std::shared_ptr<GeomAPI_Shape>
75 GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
77 std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
79 new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
83 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
86 if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
91 GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
94 implPtr<TopTools_DataMapOfShapeShape>()->Clear();