1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_Filters.cpp
4 // Created: 08 Nov 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "PartSet_Filters.h"
9 #include <ModuleBase_IWorkshop.h>
10 #include "ModuleBase_IModule.h"
12 #include <ModelAPI_Feature.h>
13 #include <FeaturesPlugin_Group.h>
15 #include <AIS_InteractiveObject.hxx>
16 #include <AIS_Shape.hxx>
19 IMPLEMENT_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
20 IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
22 Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
25 ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
26 // the shapes from different documents should be provided if there is no started operation
27 // in order to show/hide results
30 if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
31 std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
32 if (theOwner->HasSelectable()) {
33 Handle(AIS_InteractiveObject) aAisObj =
34 Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
35 if (!aAisObj.IsNull()) {
36 aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
39 ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
41 FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
43 aValid = aFeature->getKind() != FeaturesPlugin_Group::ID();
45 aValid = Standard_True;
47 // This is not object controlled by the filter
48 aValid = Standard_True;
52 qDebug(QString("PartSet_GlobalFilter::IsOk = %1").arg(aValid).toStdString().c_str());