Salome HOME
Added a method to disable waiting cursor in the preview operation
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IMeasureOperations.cxx
index 4a24fd2c452f5c622f3010aa91ee01ff12687e8e..1d04c284491ae45b4be72dfa59ec4684c25a418f 100644 (file)
 #include <NMTDS_Tools.hxx>
 #include <NMTDS_InterfPool.hxx>
 #include <NMTDS_PInterfPool.hxx>
-#include <NMTDS_PassKeyBoolean.hxx>
+//#include <NMTDS_PassKeyBoolean.hxx>
+#include <NMTDS_PairBoolean.hxx>
 #include <NMTDS_ShapesDataStructure.hxx>
-#include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
+//#include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
+#include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
 
 #include <Basics_OCCTVersion.hxx>
 
@@ -786,6 +788,15 @@ gp_Ax3 GEOMImpl_IMeasureOperations::GetPosition (const TopoDS_Shape& theShape)
       Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
       gp_Pln aPln = aGPlane->Pln();
       aResult = aPln.Position();
+      // In case of reverse orinetation of the face invert the plane normal
+      // (the face's normal does not mathc the plane's normal in this case)
+      if(theShape.Orientation() == TopAbs_REVERSED)
+      {
+        gp_Dir Vx =  aResult.XDirection();
+        gp_Dir N  =  aResult.Direction().Mirrored(Vx); 
+        gp_Pnt P  =  aResult.Location();
+        aResult = gp_Ax3(P, N, Vx);
+      }       
     }
   }
 
@@ -1376,14 +1387,17 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
 
   // 3. Get the pairs of interfered shapes 
   NMTDS_PInterfPool pIP = aCSI.IP();
-  const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get();
+  //const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get();
+  const NMTDS_ListOfPairBoolean& aLPKB = pIP->Get();
 
   Standard_Integer n1, n2;
-  NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
+  //NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
+  NMTDS_ListIteratorOfListOfPairBoolean aIt;
 
   aIt.Initialize(aLPKB);
   for (; aIt.More(); aIt.Next()) {
-    const NMTDS_PassKeyBoolean& aPKB = aIt.Value();
+    //const NMTDS_PassKeyBoolean& aPKB = aIt.Value();
+    const NMTDS_PairBoolean& aPKB = aIt.Value();
     aPKB.Ids(n1, n2);
 
     if (n1 > aNbS || n2 > aNbS)
@@ -2012,6 +2026,10 @@ void GEOMImpl_IMeasureOperations::PointCoordinates (Handle(GEOM_Object) theShape
 Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine1,
                                                      Handle(GEOM_Object) theLine2)
 {
+  if (theLine1->GetType() == GEOM_VECTOR &&
+      theLine2->GetType() == GEOM_VECTOR)
+    return GetAngleBtwVectors(theLine1, theLine2);
+
   SetErrorCode(KO);
 
   Standard_Real anAngle = -1.0;
@@ -2060,7 +2078,7 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine
     gp_Lin aLin2 = L2->Lin();
 
     anAngle = aLin1.Angle(aLin2);
-    anAngle /= PI180; // convert radians into degrees
+    anAngle *= 180. / M_PI; // convert radians into degrees
 
     if (anAngle > 90.0) {
       anAngle = 180.0 - anAngle;
@@ -2126,7 +2144,7 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngleBtwVectors (Handle(GEOM_Objec
     gp_Vec aV2 (BRep_Tool::Pnt(aP21), BRep_Tool::Pnt(aP22)) ;
 
     anAngle = aV1.Angle(aV2);
-    anAngle /= PI180; // convert radians into degrees
+    anAngle *= 180. / M_PI; // convert radians into degrees
 
     SetErrorCode(OK);
   }
@@ -2620,7 +2638,7 @@ void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theA
   }
   count = NbProblems->Value((Standard_Integer)BRepCheck_SubshapeNotInShape);
   if (count > 0) {
-    theDump += "  Subshape not in Shape .................... ";
+    theDump += "  Sub-shape not in Shape .................... ";
     theDump += TCollection_AsciiString(count) + "\n";
   }
   count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientation);
@@ -2630,7 +2648,7 @@ void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theA
   }
   count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientationOfSubshape);
   if (count > 0) {
-    theDump += "  Bad Orientation of Subshape .............. ";
+    theDump += "  Bad Orientation of Sub-shape .............. ";
     theDump += TCollection_AsciiString(count) + "\n";
   }
   count = NbProblems->Value((Standard_Integer)BRepCheck_CheckFail);