]> OCCT Git - occt-copy.git/commitdiff
0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManage...
authorkgv <kgv@opencascade.com>
Fri, 23 Sep 2016 12:33:40 +0000 (15:33 +0300)
committerkgv <kgv@opencascade.com>
Fri, 30 Sep 2016 08:17:12 +0000 (11:17 +0300)
src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/ViewerTest/ViewerTest.cxx
tests/bugs/vis/bug26344
tests/bugs/vis/bug27477

index 087efe4c0d065157bb17c01188a8b2fd556a96e4..9c140e09c9c6c423158ea93c3df2a950df5e4009 100644 (file)
@@ -380,7 +380,9 @@ Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_P
 gp_Pnt SelectMgr_SelectingVolumeManager::DetectedPoint (const Standard_Real theDepth) const
 {
   if (myActiveSelectionType != Point)
-    return gp_Pnt (RealLast(), RealLast(), RealLast());
+  {
+    Standard_ProgramError::Raise ("SelectMgr_SelectingVolumeManager::DetectedPoint() should be called only for Point selection type");
+  }
 
   return mySelectingVolumes[Frustum]->DetectedPoint (theDepth);
 }
index 427e19470064dc43c80ba44487f310ef75cd1c2c..a249f8f89488597bb0654e01fe35f6cca8ceabba 100644 (file)
@@ -154,8 +154,8 @@ public:
   //! screen point and given point theCOG
   Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
 
-  //! Calculates the point on a view ray that was detected during the run of selection algo by given depth. Is valid for point
-  //! selection only
+  //! Calculates the point on a view ray that was detected during the run of selection algo by given depth.
+  //! Throws exception if active selection type is not Point.
   Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
 
   //! Checks if the point of sensitive in which selection was detected belongs
index 84d50631da1a873a093959c21d5ed33165998b45..70c1c77a2cdc368fa943a17a0c370c4a078d0783 100644 (file)
@@ -64,6 +64,11 @@ namespace {
                              const gp_GTrsf& theInversedTrsf,
                              SelectMgr_SelectingVolumeManager& theMgr)
   {
+    if (theMgr.GetActiveSelectionType() != SelectMgr_SelectingVolumeManager::Point)
+    {
+      return;
+    }
+
     theCriterion.Point = theMgr.DetectedPoint (theCriterion.Depth);
     gp_GTrsf anInvTrsf = theInversedTrsf;
     if (theCriterion.Entity->HasInitLocation())
index f656fad1817cc7aebb0dd69b8764435bb57d00ee..c52ae150cb0fcb8ef6e0bc7a4e9f5b41093064ba 100644 (file)
@@ -4530,7 +4530,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
       aName.LeftJustify (20, ' ');
       char anInfoStr[512];
       Sprintf (anInfoStr,
-               " Depth: %+.3f Distance: %+.3f Point: %+.3f %+.3f %+.3f",
+               " Depth: %g Distance: %g Point: %g %g %g",
                aPickData.Depth,
                aPickData.MinDist,
                aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z());
index d96000a25cd7468e8a61753550f0910ebac03011..c7a0949c6378eb7d8e5fade86807f57e7f7cf1d2 100644 (file)
@@ -71,5 +71,6 @@ vselect 50 223 235 395
 if { [vreadpixel 132 300 rgb name] != "GRAY66" } { puts "Error selecting trihedron persistence object" }
 
 vselect 50 380 400 50
+vstate -entities
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
index 17ad57c703b101211a457a3221002f2d3e7e6d70..fead5ea00ada0bb18bd119c85e39b41ed26e1e5a 100644 (file)
@@ -11,7 +11,7 @@ proc check_output {theInfo} {
   for {set i 0} {$i < $aSize} {incr i} {
     if {[string equal [lindex $theInfo $i] "Depth:"]} {
       set aDepth [lindex $theInfo [expr $i + 1]]
-      if {[string equal $aDepth "+17.569"]} {
+      if {[string equal $aDepth "17.5691"]} {
         return 1
       } else {
         return $aDepth
@@ -38,7 +38,7 @@ set aResult [check_output $anInfo]
 if {$aResult == 1} {
   puts "OK"
   } else {
-    puts "ERROR: the depth value is incorrect: should be +17.569, but is equal to:"
+    puts "ERROR: the depth value is incorrect: should be 17.5691, but is equal to:"
     puts $aResult
   }