From: nds Date: Fri, 20 Mar 2015 16:18:49 +0000 (+0300) Subject: Code improvement: it removes the obsolete commented code to do not give the shape... X-Git-Tag: V_1.1.0~92^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fdf65567341c890ba3d8c18c3d9a8a562e913935;p=modules%2Fshaper.git Code improvement: it removes the obsolete commented code to do not give the shape if the result has the same shape. --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index bba656f87..af08a6533 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -210,12 +210,10 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() } //******************************************************************** -#include -#include void ModuleBase_WidgetMultiSelector::onSelectionChanged() { ModuleBase_ISelection* aSelection = myWorkshop->selection(); - NCollection_List aSelectedShapes; //, aFilteredShapes; + NCollection_List aSelectedShapes; std::list aOwnersList; aSelection->selectedShapes(aSelectedShapes, aOwnersList); @@ -225,56 +223,29 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged() GeomShapePtr aShape; for (aIt = aOwnersList.cbegin(); aIt != aOwnersList.cend(); aShpIt.Next(), aIt++) { ResultPtr aResult = std::dynamic_pointer_cast(*aIt); - // this case should be moved to PartSet module after redesign this class - /*if (aShpIt.Value().ShapeType() == TopAbs_COMPOUND) { - int aValue = 0; - AIS_ListOfInteractive aList; - aSelection->selectedAISObjects(aList); - AIS_ListIteratorOfListOfInteractive aLIt(aList); - Handle(AIS_InteractiveObject) anAISIO; - for(; aLIt.More(); aLIt.Next()){ - anAISIO = aLIt.Value(); - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(anAISIO); - if (!aResultPrs.IsNull()) { - const std::list >& aResultFaces = aResultPrs->facesList(); - std::list>::const_iterator aIt; - for (aIt = aResultFaces.cbegin(); aIt != aResultFaces.cend(); ++aIt) { - TopoDS_Shape aFace = (*aIt)->impl(); - - aShape = std::shared_ptr(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aShpIt.Value())); - - mySelection.append(GeomSelection(aResult, aShape)); - } + if (myFeature) { + // We can not select a result of our feature + const std::list& aResList = myFeature->results(); + std::list::const_iterator aIt; + bool isSkipSelf = false; + for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) { + if ((*aIt) == aResult) { + isSkipSelf = true; + break; } } + if(isSkipSelf) + continue; } - else*/ - { - if (myFeature) { - // We can not select a result of our feature - const std::list& aResList = myFeature->results(); - std::list::const_iterator aIt; - bool isSkipSelf = false; - for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) { - if ((*aIt) == aResult) { - isSkipSelf = true; - break; - } - } - if(isSkipSelf) - continue; - } - aShape = std::shared_ptr(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aShpIt.Value())); - - if (aShape->isEqual(aResult->shape())) { - //aShape = std::shared_ptr(new GeomAPI_Shape()); - mySelection.append(GeomSelection(aResult, NULL));//aShape)); - } - else - mySelection.append(GeomSelection(aResult, aShape)); - } + aShape = std::shared_ptr(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(aShpIt.Value())); + + // if the result has the similar shap as the parameter shape, just the context is set to the + // selection list attribute. + if (aShape->isEqual(aResult->shape())) + mySelection.append(GeomSelection(aResult, NULL)); + else + mySelection.append(GeomSelection(aResult, aShape)); } //updateSelectionList(); emit valuesChanged();