X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ViewerFilters.cpp;h=8ee95af0c03c8527e8b0081bc25bb9111ec29659;hb=29dfb8a802f61cacf5f57fb79c62badee00ebcdf;hp=a3d20fce7aeb15047c49690a8c2880b4c2420616;hpb=3a9418e989aabf61341c20e01628e43ca030c491;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index a3d20fce7..8ee95af0c 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -15,6 +15,12 @@ #include #include +#include +#include +#include +#include +#include +#include #include @@ -74,11 +80,11 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti if (myPlane.get()) { aValid = Standard_False; if (theOwner->HasSelectable()) { + gp_Pln aPlane = myPlane->impl(); Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (!aShapeOwner.IsNull() && aShapeOwner->HasShape()) { TopoDS_Shape aShape = aShapeOwner->Shape(); TopAbs_ShapeEnum aType = aShape.ShapeType(); - gp_Pln aPlane = myPlane->impl(); switch (aType) { case TopAbs_VERTEX: { @@ -105,6 +111,23 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti break; } } else { + // Check Trihedron sub-objects + Handle(SelectMgr_SelectableObject) aSelObj = theOwner->Selectable(); + Handle(Standard_Type) aType = aSelObj->DynamicType(); + if (aType == STANDARD_TYPE(AIS_Axis)) { + Handle(AIS_Axis) aAxis = Handle(AIS_Axis)::DownCast(aSelObj); + gp_Lin aLine = aAxis->Component()->Lin(); + return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); + + } else if (aType == STANDARD_TYPE(AIS_Point)) { + Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast(aSelObj); + return aPlane.Distance(aPoint->Component()->Pnt()) < Precision::Confusion(); + + } else if (aType == STANDARD_TYPE(AIS_Plane)) { + Handle(AIS_Plane) aAisPlane = Handle(AIS_Plane)::DownCast(aSelObj); + gp_Pln aPln = aAisPlane->Component()->Pln(); + return aPlane.Distance(aPln) < Precision::Confusion(); + } // This is not object controlled by the filter aValid = Standard_True; }