+#ifdef DEBUG_FILTERS
+ qDebug(QString("PartSet_GlobalFilter::IsOk = %1").arg(aValid).toStdString().c_str());
+#endif
+ return aValid;
+}
+
+IMPLEMENT_STANDARD_RTTIEXT(PartSet_ResultGroupNameFilter, SelectMgr_Filter);
+
+void PartSet_ResultGroupNameFilter::setGroupNames(const std::set<std::string>& theGroupNames)
+{
+ myGroupNames = theGroupNames;
+}
+
+Standard_Boolean PartSet_ResultGroupNameFilter::IsOk(
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+ std::shared_ptr<GeomAPI_AISObject> 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 anObject = myWorkshop->findPresentedObject(aAISObj);
+ if (!anObject.get())
+ return true;
+
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+ // 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())
+ return true;
+
+ std::string aGroupName = aResult->groupName();// == ModelAPI_ResultPart::group()) {
+ if (myGroupNames.find(aGroupName) != myGroupNames.end())
+ return false; // the object of the filtered type is found
+
+ return true;
+}
+
+
+IMPLEMENT_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter);
+
+Standard_Boolean
+ PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+ ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+ if(!anOperation) {
+ return Standard_True;
+ }
+
+ if(theOwner->HasSelectable() == Standard_False) {
+ return Standard_True;
+ }
+
+ Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if(aBrepOwner.IsNull()) {
+ return Standard_True;
+ }
+
+ const TopoDS_Shape& aShape = aBrepOwner->Shape();
+ if(aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
+ return Standard_True;
+ }
+
+ Handle(ModuleBase_ResultPrs) aResultPrs =
+ Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable());
+ if(aResultPrs.IsNull()) {
+ return Standard_True;
+ }
+
+ std::shared_ptr<GeomAPI_AISObject> aGeomAISObj(new GeomAPI_AISObject());
+ aGeomAISObj->setImpl(new Handle(AIS_InteractiveObject)(aResultPrs));
+ ObjectPtr anObj = myWorkshop->findPresentedObject(aGeomAISObj);
+ if(!anObj.get()) {
+ return Standard_True;
+ }
+
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+ if(!aResult.get()) {
+ return Standard_True;
+ }
+
+ DocumentPtr aDocument = aResult->document();
+ if(!aDocument.get()) {
+ return Standard_True;
+ }
+
+ FeaturePtr aFeature = aDocument->feature(aResult);
+ if(!aFeature.get() || aFeature->getKind() != "SketchCircle") {
+ return Standard_True;
+ }
+
+ const TopoDS_Shape anOwnerShape = aResultPrs->Shape();
+ if(anOwnerShape.ShapeType() == TopAbs_EDGE) {
+ return Standard_False;
+ }
+
+#ifdef DEBUG_FILTERS
+ qDebug(QString("PartSet_ShapeDocumentFilter::IsOk = %1").arg(aValid).toStdString().c_str());
+#endif
+
+ return Standard_True;