0025507: Visualization - the method V3d_View::Place() is incorrect
authorosa <osa@opencascade.com>
Fri, 28 Nov 2014 09:19:35 +0000 (12:19 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 28 Nov 2014 09:21:10 +0000 (12:21 +0300)
Test was updated

Correction of test case for issue CR25507

src/V3d/V3d_View_3.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
tests/bugs/vis/bug25507 [new file with mode: 0644]

index 558fe3e..49489db 100644 (file)
@@ -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) {
index 66c7c13..a2b4ebf 100644 (file)
@@ -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 (file)
index 0000000..af80389
--- /dev/null
@@ -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