X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_WidgetSelector.cpp;h=e2233ab7c96229ed3866d3d88f9117bd93a94184;hb=f9fd953bf814fad40ae045f6164c7f80229b0872;hp=dcfb86bec31f814fce42413e07561fbfa6a4fd5b;hpb=ed8328e26b6e8f5ecedc8348b5eb7d650c065564;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index dcfb86bec..e2233ab7c 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -// File: ModuleBase_WidgetSelector.h +// File: ModuleBase_WidgetSelector.cpp // Created: 19 June 2015 // Author: Natalia ERMOLAEVA @@ -11,12 +11,13 @@ #include +#include + ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId) - : ModuleBase_WidgetValidated(theParent, theData, theParentId), - myWorkshop(theWorkshop) + : ModuleBase_WidgetValidated(theParent, theWorkshop, theData, theParentId) { } @@ -46,10 +47,9 @@ void ModuleBase_WidgetSelector::onSelectionChanged() { clearAttribute(); - QList aSelected = myWorkshop->selection()->getSelected( - ModuleBase_ISelection::AllControls); - bool isDone = setSelection(aSelected); + QList aSelected = getFilteredSelected(); + bool isDone = setSelection(aSelected, false); emit valuesChanged(); // the updateObject method should be called to flush the updated sigal. The workshop listens it, // calls validators for the feature and, as a result, updates the Apply button state. @@ -59,8 +59,6 @@ void ModuleBase_WidgetSelector::onSelectionChanged() updateFocus(); } -#include - //******************************************************************** bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape, const ResultPtr& theResult) const @@ -138,13 +136,10 @@ void ModuleBase_WidgetSelector::activateCustom() // Restore selection in the viewer by the attribute selection list myWorkshop->setSelected(getAttributeSelection()); - activateFilters(myWorkshop, true); + activateFilters(true); } //******************************************************************** -#include -#include -#include bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs) { GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs); @@ -157,30 +152,6 @@ bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPr FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aResult); aValid = aSelectedFeature != myFeature; } - - // selection happens in the Object browser. - // it creates a selection owner and check whether the viewer filters process it - if (thePrs.owner().IsNull() && thePrs.object().get()) { - ResultPtr aResult = myWorkshop->selection()->getResult(thePrs); - if (aResult.get()) - aShape = aResult->shape(); - - const TopoDS_Shape aTDShape = aShape->impl(); - - Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); - Handle(StdSelect_BRepOwner) aShapeOwner = new StdSelect_BRepOwner(aTDShape, anIO); - - const SelectMgr_ListOfFilter& aFilters = myWorkshop->viewer()->AISContext()->Filters(); - SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); - for (; anIt.More() && aValid; anIt.Next()) { - Handle(SelectMgr_Filter) aFilter = anIt.Value(); - if (aFilter == myWorkshop->validatorFilter()) - continue; - - aValid = aFilter->IsOk(aShapeOwner); - } - aShapeOwner.Nullify(); - } return aValid; } @@ -200,5 +171,6 @@ void ModuleBase_WidgetSelector::deactivate() { disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); activateSelection(false); - activateFilters(myWorkshop, false); + activateFilters(false); } +