From 49e1a5c7e9e3235d7c47c0845a37d4ff3f3c4f60 Mon Sep 17 00:00:00 2001 From: osa Date: Fri, 28 Nov 2014 12:19:35 +0300 Subject: [PATCH] 0025507: Visualization - the method V3d_View::Place() is incorrect Test was updated Correction of test case for issue CR25507 --- src/V3d/V3d_View_3.cxx | 2 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 29 ++++++++++++++++++-- tests/bugs/vis/bug25507 | 25 +++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/vis/bug25507 diff --git a/src/V3d/V3d_View_3.cxx b/src/V3d/V3d_View_3.cxx index 558fe3e29d..49489db175 100644 --- a/src/V3d/V3d_View_3.cxx +++ b/src/V3d/V3d_View_3.cxx @@ -176,7 +176,7 @@ void V3d_View::Place (const Standard_Integer theXp, Standard_Integer aWinCXp = aWinWidth / 2; Standard_Integer aWinCYp = aWinHeight / 2; - Pan (aWinCXp - theXp, aWinCYp - theYp, theZoomFactor / Scale()); + Pan (aWinCXp - theXp, -(aWinCYp - theYp), theZoomFactor / Scale()); } void V3d_View::Translate(const Standard_Real theLength, const Standard_Boolean theStart) { diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 66c7c13e03..a2b4ebfbcb 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -3011,6 +3011,29 @@ static int VPan( Draw_Interpretor& di, Standard_Integer argc, const char** argv } } +//============================================================================== +//function : VPlace +//purpose : Place the point (in pixels) at the center of the window +//============================================================================== +static int VPlace (Draw_Interpretor& /*theDi*/, Standard_Integer theArgNb, const char** theArgs) +{ + Handle(V3d_View) aView = ViewerTest::CurrentView(); + if (aView.IsNull()) + { + std::cerr << theArgs[0] << "Error: no active view." << std::endl; + return 1; + } + + if (theArgNb != 3) + { + std::cerr << theArgs[0] << "Error: invalid number of arguments." << std::endl; + return 1; + } + + aView->Place (Draw::Atoi (theArgs[1]), Draw::Atoi (theArgs[2]), aView->Scale()); + + return 0; +} //============================================================================== //function : VExport @@ -7506,8 +7529,10 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "vhighlightselected [0|1] or vhighlightselected [on|off]: enables/disables highlighting of selected objects.\n" "Without arguments it shows if highlighting of selected objects is enabled now.", __FILE__,VHighlightSelected,group); - - + theCommands.Add ("vplace", + "vplace dx dy" + "\n\t\t: Places the point (in pixels) at the center of the window", + __FILE__, VPlace, group); theCommands.Add("vxrotate", "vxrotate", __FILE__,VXRotate,group); diff --git a/tests/bugs/vis/bug25507 b/tests/bugs/vis/bug25507 new file mode 100644 index 0000000000..af80389764 --- /dev/null +++ b/tests/bugs/vis/bug25507 @@ -0,0 +1,25 @@ +puts "============" +puts "CR25507" +puts "============" +puts "" +####################################################################### +# Visualization - the method V3d_View::Place() is incorrect +####################################################################### + +vinit View1 +vsetdispmode 1 + +box b1 2 1 1 +vdisplay b1 +box b2 1 1 1 +vdisplay b2 +vsetlocation b2 5 0 0 +vfit + +vselect 80 140 +vplace 80 140 + +vmoveto 200 180 +checkcolor 200 180 0.78 0.55 0.09 + +set only_screen 1