X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_CompoundBuilder.cpp;h=48d430fad38db7a0d5c34357a9170651f6f348a6;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=2882ee2fae576ef9973cb9b07a9e4de6229af816;hpb=0eb1324aa68cf606e0c556f900c289c6a485c13e;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp index 2882ee2fa..48d430fad 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp @@ -1,28 +1,44 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAlgoAPI_CompoundBuilder.cpp // Created: 24 Apr 2014 // Author: Natalia ERMOLAEVA #include -//#include -//#include -//#include #include #include +#include +#include -boost::shared_ptr GeomAlgoAPI_CompoundBuilder::compound - (std::list > theShapes) +std::shared_ptr GeomAlgoAPI_CompoundBuilder::compound( + std::list > theShapes) { BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - std::list >::const_iterator anIt = theShapes.begin(), - aLast = theShapes.end(); + std::list >::const_iterator anIt = theShapes.begin(), aLast = + theShapes.end(); for (; anIt != aLast; anIt++) { aBuilder.Add(aComp, (*anIt)->impl()); } - boost::shared_ptr aRes(new GeomAPI_Shape); + std::shared_ptr aRes(new GeomAPI_Shape); aRes->setImpl(new TopoDS_Shape(aComp)); return aRes; } + +int GeomAlgoAPI_CompoundBuilder::id( + std::shared_ptr theContext, std::shared_ptr theSub) +{ + int anID = 0; + TopoDS_Shape aMainShape = theContext->impl(); + const TopoDS_Shape& aSubShape = theSub->impl(); + if (!aMainShape.IsNull() && !aSubShape.IsNull()) { + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(aMainShape, aSubShapesMap); + anID = aSubShapesMap.FindIndex(aSubShape); + } + + return anID; +}