diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx index 087efe4c0d..9c140e09c9 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx @@ -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); } diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx index 427e194700..a249f8f894 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx @@ -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 diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 84d50631da..70c1c77a2c 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -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()) diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index f656fad181..c52ae150cb 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -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()); diff --git a/tests/bugs/vis/bug26344 b/tests/bugs/vis/bug26344 index d96000a25c..c7a0949c63 100644 --- a/tests/bugs/vis/bug26344 +++ b/tests/bugs/vis/bug26344 @@ -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 diff --git a/tests/bugs/vis/bug27477 b/tests/bugs/vis/bug27477 index 17ad57c703..fead5ea00a 100644 --- a/tests/bugs/vis/bug27477 +++ b/tests/bugs/vis/bug27477 @@ -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 }