X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_Filters.cpp;h=31f1872c778acce3053fce118629971a8dbbdcb2;hb=020e7187ee88afbd18286f149536cdef61d9f61e;hp=0921844d6456fbb13161d1b1e255052c935dd598;hpb=dfb689721a73f8b65b0f61b593ef6421409bbf7b;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index 0921844d6..31f1872c7 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -10,6 +10,8 @@ #include "ModuleBase_IModule.h" #include +#include +#include #include #include @@ -21,31 +23,44 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter) Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const { + 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) - return true; - - 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)); + 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) { + ResultPtr aResult = std::dynamic_pointer_cast(aObj); + // result of parts belongs to PartSet document and can be selected only when PartSet is active + // in order to do not select the result of the active part. + if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) { + SessionPtr aMgr = ModelAPI_Session::get(); + aValid = aMgr->activeDocument() == aMgr->moduleDocument(); + } + else { + 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; } - 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; } - return Standard_False; +#ifdef DEBUG_FILTERS + qDebug(QString("PartSet_GlobalFilter::IsOk = %1").arg(aValid).toStdString().c_str()); +#endif + return aValid; }