]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2473: Fix direction of selected trihedron
authorvsv <vsv@opencascade.com>
Wed, 16 May 2018 09:05:06 +0000 (12:05 +0300)
committervsv <vsv@opencascade.com>
Wed, 16 May 2018 09:05:06 +0000 (12:05 +0300)
src/ModuleBase/ModuleBase_ViewerFilters.cpp

index d4a77c29bf677065a64811a68f862fc44eaeccea..ccb8eae4cc447bde125151e06e6a552a8defd67a 100644 (file)
@@ -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;
         }
       }
     }