X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_CompoundBuilder.cpp;h=48d430fad38db7a0d5c34357a9170651f6f348a6;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=934390faa84f286b04a3f95f4d2b941f55ea41ee;hpb=cd9217d7e87997ec8bc150a6d8c389e742ca0f84;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp index 934390faa..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 = + 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; +}