From: vsv Date: Wed, 16 May 2018 09:05:06 +0000 (+0300) Subject: Issue #2473: Fix direction of selected trihedron X-Git-Tag: V8_5_0rc2~8^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9c2ebe24ff57ce6126b240f8f2c8f58d8a94ace7;p=modules%2Fshaper.git Issue #2473: Fix direction of selected trihedron --- diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index d4a77c29b..ccb8eae4c 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -129,43 +129,35 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( } } else { if (theOwner->HasSelectable()) { - // Check Trihedron sub-objects - Handle(SelectMgr_SelectableObject) aSelObj = theOwner->Selectable(); - Handle(Standard_Type) aType = aSelObj->DynamicType(); -#ifdef BEFORE_TRIHEDRON_PATCH - 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(); - } -#else - if (aType == STANDARD_TYPE(AIS_Trihedron)) { - Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aSelObj); - Handle(AIS_TrihedronOwner) aTrOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner); - if (!aTrOwner.IsNull()) - { - const Prs3d_DatumParts& aPart = aTrOwner->DatumPart(); - if (aPart >= Prs3d_DP_XAxis && aPart <= Prs3d_DP_ZAxis) - { - gp_Ax2 anAxis = aTrihedron->Component()->Ax2(); - gp_Dir aDir = anAxis.XDirection(); - gp_Lin aLine(aTrihedron->Component()->Location(), aDir); - return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); + // Check Trihedron sub-objects + Handle(SelectMgr_SelectableObject) aSelObj = theOwner->Selectable(); + Handle(Standard_Type) aType = aSelObj->DynamicType(); + if (aType == STANDARD_TYPE(AIS_Trihedron)) { + Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aSelObj); + Handle(AIS_TrihedronOwner) aTrOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner); + if (!aTrOwner.IsNull()) { + const Prs3d_DatumParts& aPart = aTrOwner->DatumPart(); + if (aPart >= Prs3d_DP_XAxis && aPart <= Prs3d_DP_ZAxis) { + gp_Ax2 anAxis = aTrihedron->Component()->Ax2(); + gp_Dir aDir; + switch (aPart) { + case Prs3d_DP_XAxis: + aDir = anAxis.XDirection(); + break; + case Prs3d_DP_YAxis: + aDir = anAxis.YDirection(); + break; + case Prs3d_DP_ZAxis: + aDir = anAxis.Direction(); + break; + } + gp_Lin aLine(aTrihedron->Component()->Location(), aDir); + return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); + } } } - } -#endif - // This is not object controlled by the filter - aValid = Standard_True; + // This is not object controlled by the filter + aValid = Standard_True; } } }