X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FBuildPlugin%2FBuildPlugin_Compound.cpp;h=69c8551bbbc6ee15bb9625feb7433c0858631ea6;hb=9d8267a424a809d0f96593b13f8472666553ce2e;hp=4df84ee1f77a96b588399785685da2be9cd70066;hpb=dfa8d5cc9a33eb949f364e1999dc36e75fd1ffe8;p=modules%2Fshaper.git diff --git a/src/BuildPlugin/BuildPlugin_Compound.cpp b/src/BuildPlugin/BuildPlugin_Compound.cpp index 4df84ee1f..69c8551bb 100644 --- a/src/BuildPlugin/BuildPlugin_Compound.cpp +++ b/src/BuildPlugin/BuildPlugin_Compound.cpp @@ -23,6 +23,7 @@ #include #include +#include #include @@ -56,28 +57,37 @@ void BuildPlugin_Compound::execute() for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); GeomShapePtr aShape = aSelection->value(); - if (!aShape.get()) + if (!aShape.get()) { + if (!aSelection->context().get()) { + setError("Invalid selection"); + return; + } aShape = aSelection->context()->shape(); + } anOriginalShapes.push_back(aShape); } // Build compound. GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(anOriginalShapes); - int anIndexToRemove = 0; - if (aCompound) { - ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++); - aResultBody->store(aCompound); + // Copy shape. + GeomAlgoAPI_Copy aCopyAlgo(aCompound); + GeomShapePtr aCopyCompound = aCopyAlgo.shape(); -//// // Store faces -//// std::shared_ptr aMapOfSubs = theAlgorithm->mapOfSubShapes(); -//// int aModifiedTag = 1; -//// for(ListOfShape::const_iterator anIt = theOriginalShapes.cbegin(); -//// anIt != theOriginalShapes.cend(); ++anIt) { -//// GeomShapePtr aShape = *anIt; -//// aResultBody->loadAndOrientModifiedShapes(theAlgorithm.get(), aShape, GeomAPI_Shape::FACE, -//// aModifiedTag, "Modified_Face", *aMapOfSubs.get(), false, true, true); -//// } + int anIndexToRemove = 0; + if (aCopyCompound) { + std::shared_ptr aMapOfShapes = aCopyAlgo.mapOfSubShapes(); + ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++); + aResultBody->store(aCopyCompound); + aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX, + 1, "Modified_Vertex", *aMapOfShapes.get(), + true, false, true); + aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::EDGE, + 100000, "Modified_Edge", *aMapOfShapes.get(), + true, false, true); + aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::FACE, + 200000, "Modified_Face", *aMapOfShapes.get(), + true, false, true); setResult(aResultBody); } removeResults(anIndexToRemove);