0030477: Visualization - crash in AIS_Manipulator::ObjectTransformation after using...
[occt.git] / src / AIS / AIS_Manipulator.cxx
index 9da4a17..e47a6c3 100644 (file)
@@ -271,6 +271,18 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
   }
 }
 
+//=======================================================================
+//function : SetPart
+//purpose  : 
+//=======================================================================
+void AIS_Manipulator::SetPart (const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled)
+{
+  for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
+  {
+    SetPart (anIt, theMode, theIsEnabled);
+  }
+}
+
 //=======================================================================
 //function : EnableMode
 //purpose  : 
@@ -481,6 +493,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
       const gp_Lin aLine (myStartPosition.Location(), myAxes[myCurrentIndex].Position().Direction());
       Extrema_ExtElC anExtrema (anInputLine, aLine, Precision::Angular());
       if (!anExtrema.IsDone()
+        || anExtrema.IsParallel()
         || anExtrema.NbExt() != 1)
       {
         // translation cannot be done co-directed with camera
@@ -526,7 +539,9 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
       const gp_Pnt aPosLoc   = myStartPosition.Location();
       const gp_Ax1 aCurrAxis = getAx1FromAx2Dir (myStartPosition, myCurrentIndex);
       IntAna_IntConicQuad aIntersector (anInputLine, gp_Pln (aPosLoc, aCurrAxis.Direction()), Precision::Angular(), Precision::Intersection());
-      if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
+      if (!aIntersector.IsDone()
+        || aIntersector.IsParallel()
+        || aIntersector.NbPoints() < 1)
       {
         return Standard_False;
       }
@@ -995,10 +1010,14 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
   {
     for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
     {
+      if (!myAxes[anIt].HasTranslation())
+      {
+        continue;
+      }
       const Axis& anAxis = myAxes[anIt];
       if (aMode != AIS_MM_None)
       {
-        anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Translation, 9);
+        anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
       }
       // define sensitivity by line
       Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
@@ -1016,6 +1035,10 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
   {
     for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
     {
+      if (!myAxes[anIt].HasRotation())
+      {
+        continue;
+      }
       const Axis& anAxis = myAxes[anIt];
       if (aMode != AIS_MM_None)
       {
@@ -1036,6 +1059,10 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
   {
     for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
     {
+      if (!myAxes[anIt].HasScaling())
+      {
+        continue;
+      }
       if (aMode != AIS_MM_None)
       {
         anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);