X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Filters.cpp;h=d82447430e3757d240e7dacbef36fce48ec17ca5;hb=1181dff91b7a5673d8238a3be0e2ef9ec441aab3;hp=d5df8871ceed90efe5702c36f73a1641c7ee58f1;hpb=f1cd93fd02a54259f72e3191d037323a496b2bef;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index d5df8871c..d82447430 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -7,6 +7,7 @@ #include "PartSet_Filters.h" #include +#include "ModuleBase_IModule.h" #include #include @@ -20,25 +21,35 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter) Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const { - if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) { - if (theOwner->HasSelectable()) { - Handle(AIS_InteractiveObject) aAisObj = - Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); - if (!aAisObj.IsNull()) { - std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); - aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj)); - ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj); - if (aObj) { - FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); - if (aFeature) { - return aFeature->getKind() != FeaturesPlugin_Group::ID(); - } else - return Standard_True; - } else - // This is not object controlled by the filter - return Standard_True; + bool aValid = true; + ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); + // the shapes from different documents should be provided if there is no started operation + // in order to show/hide results + if (anOperation) { + aValid = false; + if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) { + std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); + if (theOwner->HasSelectable()) { + Handle(AIS_InteractiveObject) aAisObj = + Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + if (!aAisObj.IsNull()) { + aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj)); + } } + ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj); + if (aObj) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); + if (aFeature) { + aValid = aFeature->getKind() != FeaturesPlugin_Group::ID(); + } else + aValid = Standard_True; + } else + // This is not object controlled by the filter + aValid = Standard_True; } } - return Standard_False; +#ifdef DEBUG_FILTERS + qDebug(QString("PartSet_GlobalFilter::IsOk = %1").arg(aValid).toStdString().c_str()); +#endif + return aValid; }