X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Filters.cpp;h=33308af28c456e0c83e7af465d77ed940c1fc655;hb=ae42afe3e35f7d69b26ef66323c54eb9e2fe45fe;hp=582161acee01d363bff427842edf2005bd48d2e5;hpb=d165b06723a6703ac10ca94f5800f8168379a3ad;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index 582161ace..33308af28 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,24 +36,39 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter); +PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop) + : ModuleBase_ShapeDocumentFilter(theWorkshop) +{ + addNonSelectableType(ModelAPI_ResultField::group().c_str()); + addNonSelectableType(ModelAPI_ResultGroup::group().c_str()); +} + + Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const { bool aValid = true; + std::shared_ptr aAISObj = AISObjectPtr(new GeomAPI_AISObject()); + Handle(AIS_InteractiveObject) aAisObj; + if (theOwner->HasSelectable()) { + aAisObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + if (!aAisObj.IsNull()) { + aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj)); + } + } + ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj); ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); + +#ifdef HAVE_SALOME + // Issue #3161: Do not use presentations for non-SHAPER objects + if (!anOperation && !aObj.get()) + return false; +#endif + // 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) { ResultPtr aResult = std::dynamic_pointer_cast(aObj); // result of parts belongs to PartSet document and can be selected only when PartSet @@ -63,7 +78,7 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& if (aResultGroupName == ModelAPI_ResultPart::group()) { SessionPtr aMgr = ModelAPI_Session::get(); aValid = aMgr->activeDocument() == aMgr->moduleDocument(); - } else if (aResultGroupName == ModelAPI_ResultField::group()) { + } else if (myNonSelectableTypes.contains(aResultGroupName.c_str())) { aValid = Standard_False; } else aValid = Standard_True; @@ -72,7 +87,7 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& // only and there can not be Group feature FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature) { - aValid = aFeature->getKind() != "Group"; + aValid = !myNonSelectableTypes.contains(aFeature->getKind().c_str()); } else aValid = Standard_True; } @@ -171,7 +186,9 @@ Standard_Boolean } FeaturePtr aFeature = aDocument->feature(aResult); - if(!aFeature.get() || aFeature->getKind() != "SketchCircle") { + if(!aFeature.get() || + ((aFeature->getKind() != "SketchCircle") && + (aFeature->getKind() != "SketchBSplinePeriodic"))) { return Standard_True; }