X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_DataMapOfShapeShape.cpp;h=166922710c2e4d7ea9c1366fba1c664c9307e36d;hb=4d6bb9de0e54f09a9bbacc94a058cb7cd437d535;hp=b573c5a0ad685452a4fcffdce14b17864843c0e4;hpb=232697ee8e2e35dde4272544561222e37abf368e;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp index b573c5a0a..166922710 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_DataMapOfShapeShape.cpp // Created: 28 Oct 2014 // Author: Sergey Zaritchny @@ -5,29 +7,47 @@ #include #include #include +#include +#include using namespace std; GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape() - :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){} +: GeomAPI_Interface(new TopTools_DataMapOfShapeShape){} -/// Clear void GeomAPI_DataMapOfShapeShape::clear() { implPtr()->Clear(); } -/// Adds the Key to the Map with the Item. Returns True if the Key was not already in the map -bool GeomAPI_DataMapOfShapeShape::bind (const boost::shared_ptr& theKey, const boost::shared_ptr& theItem) +int GeomAPI_DataMapOfShapeShape::size() +{ + return implPtr()->Extent(); +} + +bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr theKey, std::shared_ptr theItem) { bool flag(false); if(implPtr()->Bind(theKey->impl(), theItem->impl())) - flag = true; + flag = true; return flag; } -/// Returns true if theKey is stored in the map. -bool GeomAPI_DataMapOfShapeShape::isBound (const boost::shared_ptr& theKey) +void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDataMap) +{ + const TopTools_DataMapOfShapeShape& aDataMap = theDataMap.impl(); + TopTools_DataMapOfShapeShape* myDataMap = implPtr(); + for(TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) { + myDataMap->Bind(anIt.Key(), anIt.Value()); + } +} + +void GeomAPI_DataMapOfShapeShape::merge(const std::shared_ptr theDataMap) +{ + merge(*theDataMap.get()); +} + +bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr theKey) { bool flag(false); if(impl().IsBound(theKey->impl())) @@ -35,19 +55,24 @@ bool GeomAPI_DataMapOfShapeShape::isBound (const boost::shared_ptr GeomAPI_DataMapOfShapeShape::find(const boost::shared_ptr& theKey) +const std::shared_ptr GeomAPI_DataMapOfShapeShape::find(std::shared_ptr theKey) { - boost::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl((void *)&(impl().Find(theKey->impl()))); + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(impl().Find(theKey->impl()))); return aShape; } - -/// Removes the Key from the map. Returns true if the Key was in the Map -bool GeomAPI_DataMapOfShapeShape::unBind(const boost::shared_ptr& theKey) + +bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr theKey) { bool flag(false); if(implPtr()->UnBind(theKey->impl())) - flag = true; + flag = true; return flag; -} \ No newline at end of file +} + + GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape() + { + if (!empty()) { + implPtr()->Clear(); + } + }