X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_FilterValidated.cpp;h=097eb60cb82d4e7dc7acd52169c3ade72c17f5bd;hb=8193b76f73047e852eaecfb4c0ff86cf44e1f8c9;hp=28a43c3d7ee28b0d3bd7046a9817bff49ca87e82;hpb=a90ab0e7171b2dfab838fbc066c2f20217c49c03;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_FilterValidated.cpp b/src/ModuleBase/ModuleBase_FilterValidated.cpp index 28a43c3d7..097eb60cb 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.cpp +++ b/src/ModuleBase/ModuleBase_FilterValidated.cpp @@ -1,35 +1,57 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -// File: ModuleBase_FilterValidated.h +// File: ModuleBase_FilterValidated.cpp // Created: 17 Mar 2015 // Author: Natalia ERMOLAEVA #include "ModuleBase_FilterValidated.h" #include "ModuleBase_IWorkshop.h" +#include "ModuleBase_IViewer.h" #include #include #include #include #include +#include #include +#include IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter); IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter); Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const { + bool aValid = true; ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); - if (!anOperation) - return true; - - ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); - ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast - (anActiveWidget); - ModuleBase_ViewerPrs aPrs; - myWorkshop->selection()->fillPresentation(aPrs, theOwner); - - return !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs); + if (anOperation) { + ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + Handle(AIS_InteractiveContext) aContext = aViewer->AISContext(); + + ModuleBase_Tools::selectionInfo(aContext, "ModuleBase_FilterValidated::IsOk"); + + ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget(); + if (!aCurrentWidget) + aCurrentWidget = myWorkshop->module()->activeWidget(); + if (aCurrentWidget) { + ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs()); + myWorkshop->selection()->fillPresentation(aPrs, theOwner); + ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast + (aCurrentWidget); + if (aWidgetValidated) + aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs); + else{ + ModuleBase_WidgetValidator* aWidgetValidator = aCurrentWidget->widgetValidator(); + if (aWidgetValidator) + aValid = aWidgetValidator->isValidSelection(aPrs); + } + } + } + +#ifdef DEBUG_FILTERS + qDebug(QString("ModuleBase_FilterValidated::IsOk = %1").arg(aValid).toStdString().c_str()); +#endif + return aValid; }