- case TopAbs_EDGE:
- {
- TopoDS_Edge aEdge = TopoDS::Edge(aShape);
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aEdge, aFirst, aLast);
- gp_Pnt aFirstPnt = aCurve->Value(aFirst);
- gp_Pnt aMidPnt = aCurve->Value((aFirst + aLast) / 2.);
- gp_Pnt aLastPnt = aCurve->Value(aLast);
- bool aD1 = myPlane.Distance(aFirstPnt) < Precision::Confusion();
- bool aD2 = myPlane.Distance(aMidPnt) < Precision::Confusion();
- bool aD3 = myPlane.Distance(aLastPnt) < Precision::Confusion();
- return aD1 && aD2 && aD3;
- }
- }
- } else {
- // This is not object controlled by the filter
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-
-
-//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
-Standard_Boolean ModuleBase_ObjectTypesFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- Standard_Boolean isOk = ModuleBase_ShapeDocumentFilter::IsOk(theOwner);
- if (isOk && theOwner->HasSelectable()) {
- Handle(AIS_InteractiveObject) aAisObj =
- Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
- if (!aAisObj.IsNull()) {
- boost::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
- aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
- ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
-
- foreach (QString aType, myTypes) {
- if (aType.toLower() == "construction") {
- ResultConstructionPtr aConstr =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
- return (aConstr != NULL);
- } // ToDo: Process other types of objects