X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_DataMapOfShapeShape.cpp;h=a21ac5f04297702f079461ee8e642134d5239984;hb=e32f95642855a63da2727cb324ce2a75632a712f;hp=97e3f10683127f11da42d3fe25b3b18ba3540267;hpb=88ca95388a92f9bbe96d81bf5b1456ca1179100e;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp index 97e3f1068..a21ac5f04 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp @@ -7,12 +7,13 @@ #include #include #include +#include #include using namespace std; GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape() - :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){} +: GeomAPI_Interface(new TopTools_DataMapOfShapeShape){} void GeomAPI_DataMapOfShapeShape::clear() { @@ -28,10 +29,26 @@ bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr theKey, s { bool flag(false); if(implPtr()->Bind(theKey->impl(), theItem->impl())) - flag = true; + flag = true; return flag; } +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) +{ + if(theDataMap.get()) { + merge(*theDataMap.get()); + } +} + bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr theKey) { bool flag(false); @@ -46,19 +63,18 @@ const std::shared_ptr GeomAPI_DataMapOfShapeShape::find(std::shar aShape->setImpl(new TopoDS_Shape(impl().Find(theKey->impl()))); return aShape; } - + bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr theKey) { bool flag(false); if(implPtr()->UnBind(theKey->impl())) - flag = true; + flag = true; return flag; } GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape() { - if (myImpl) { - implPtr()->Clear(); - //delete myImpl; + if (!empty()) { + implPtr()->Clear(); } - } \ No newline at end of file + }