[Phission-cvs] phission/examples/java/ArmInterface/src ArmInterface.java, 1.11, 1.12 BlobDialog.jav
Brought to you by:
pthoren
From: Philip T. <pt...@us...> - 2007-06-29 18:32:58
|
Update of /cvsroot/phission/phission/examples/java/ArmInterface/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24068/src Modified Files: ArmInterface.java BlobDialog.java Log Message: Added more code for managing the mouse timer adding a larger mouse cursor Fixed some changes in the blob dialog Index: ArmInterface.java =================================================================== RCS file: /cvsroot/phission/phission/examples/java/ArmInterface/src/ArmInterface.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ArmInterface.java 29 Jun 2007 01:07:03 -0000 1.11 --- ArmInterface.java 29 Jun 2007 18:32:59 -0000 1.12 *************** *** 69,74 **** private graphSegmentation_Filter m_graphSegment = null; ! private int m_box_width = m_cap_width / 20; ! private int m_box_height = m_cap_height / 20; private int m_box_adjust = 3; private int m_box_x1 = 0; --- 69,74 ---- private graphSegmentation_Filter m_graphSegment = null; ! private int m_box_width = m_cap_width / 22; ! private int m_box_height = m_cap_height / 22; private int m_box_adjust = 3; private int m_box_x1 = 0; *************** *** 77,82 **** private int m_box_y2 = 0; ! private int m_roi_width = m_cap_width / 10; ! private int m_roi_height = m_cap_height / 10; private int m_roi_adjust = 3; private int m_roi_x1 = 0; --- 77,82 ---- private int m_box_y2 = 0; ! private int m_roi_width = m_cap_width / 14; ! private int m_roi_height = m_cap_height / 14; private int m_roi_adjust = 3; private int m_roi_x1 = 0; *************** *** 91,94 **** --- 91,95 ---- SWIGTYPE_p_phDrawing_t m_quadrant_drawing; + /* Mouse timer stuff */ Timer m_mouse_timer = null; Point m_mouse_xy = new Point(0,0); *************** *** 98,101 **** --- 99,103 ---- int m_mouse_dwell_count = 0; int m_mouse_dwell_resolution = 100; + boolean m_mouse_timer_enabled = false; /* -------------------------------------------------------------------- */ *************** *** 548,552 **** this.m_roi_y2); phission.phRectangleXY_print(0,r); ! //this.m_segment.setROI(r); } --- 550,554 ---- this.m_roi_y2); phission.phRectangleXY_print(0,r); ! this.m_segment.setROI(r); } *************** *** 704,708 **** //this.println("windowClosing"); this.m_is_running = false; - this.m_mouse_timer.stop(); this.shutdown(); } --- 706,709 ---- *************** *** 715,736 **** /* -------------------------------------------------------------------- */ ! public void windowOpened(WindowEvent e) { - //this.println("windowOpened"); - this.startup(); - /* Create a timer for dwell; when the mouse stops. * It is used to wait some time after the mouse stops and then perform * an action */ ! if (this.m_mouse_timer == null) { ! this.m_mouse_timer = new Timer( this.m_mouse_dwell_resolution, this ); ! this.m_mouse_timer.start(); } ! else if ( !this.m_mouse_timer.isRunning()) { ! this.m_mouse_timer.restart(); } } /* -------------------------------------------------------------------- */ --- 716,778 ---- /* -------------------------------------------------------------------- */ ! private void startMouseTimer() { /* Create a timer for dwell; when the mouse stops. * It is used to wait some time after the mouse stops and then perform * an action */ ! if (this.m_mouse_timer_enabled) { ! if (this.m_mouse_timer == null) ! { ! this.m_mouse_timer = new Timer( this.m_mouse_dwell_resolution, this ); ! this.m_mouse_timer.start(); ! } ! else if ( !this.m_mouse_timer.isRunning()) ! { ! this.m_mouse_timer.restart(); ! } } ! } ! ! /* -------------------------------------------------------------------- */ ! private void stopMouseTimer() ! { ! if (this.m_mouse_timer_enabled) { ! if (this.m_mouse_timer.isRunning()) ! { ! this.m_mouse_timer.stop(); ! } ! } ! this.m_mouse_xy = new Point(0,0); ! this.m_last_xy = new Point(100,100); ! } ! ! /* -------------------------------------------------------------------- */ ! private void enableMouseTimer( boolean enable ) ! { ! this.m_mouse_timer_enabled = enable; ! if (this.m_mouse_timer_enabled) ! { ! this.startMouseTimer(); ! } ! else ! { ! this.stopMouseTimer(); } } + + /* -------------------------------------------------------------------- */ + private boolean isMouseTimerEnabled() + { + return this.m_mouse_timer_enabled; + } + + /* -------------------------------------------------------------------- */ + public void windowOpened(WindowEvent e) + { + //this.println("windowOpened"); + this.startup(); + } /* -------------------------------------------------------------------- */ *************** *** 991,995 **** phRectangleXY n = phission.phRectangleXY_new( x1, y1, x2, y2 ); ! //this.m_segment.setROI(n); } --- 1033,1037 ---- phRectangleXY n = phission.phRectangleXY_new( x1, y1, x2, y2 ); ! this.m_segment.setROI(n); } *************** *** 1006,1009 **** --- 1048,1052 ---- /* Handle the key-pressed event from the text field. */ /* + * D - Enable/Disable : Start/Stop Mouse timer * O - Use the trained on color to highlight the objects * and color fill them *************** *** 1016,1021 **** * F1 - Set cursor to arrow 32x32 * F2 - Set cursor to arrow 48x48 ! * F3 - Set cursor to X 32x32 and resize mouse training rectangle to fit the cursor ! * F4 - Set cursor to X 48x48 and resize mouse training rectangle to fit the cursor * UP - Increase size of mouse training rectangle * + - Increase size of mouse training rectangle --- 1059,1065 ---- * F1 - Set cursor to arrow 32x32 * F2 - Set cursor to arrow 48x48 ! * F3 - Set cursor to arrow 64x64 ! * F4 - Set cursor to X 32x32 and resize mouse training rectangle to fit the cursor ! * F5 - Set cursor to X 48x48 and resize mouse training rectangle to fit the cursor * UP - Increase size of mouse training rectangle * + - Increase size of mouse training rectangle *************** *** 1047,1050 **** --- 1091,1099 ---- /* ------------------------------------------------------------ */ case KeyEvent.VK_F3: + this.setMouseCursor("./cursors/CursorArrow_64x64.png",64,64,0,0); + break; + + /* ------------------------------------------------------------ */ + case KeyEvent.VK_F4: this.setMouseCursor("./cursors/CursorX_32x32.png",32,32,15,15); this.m_box_width = 16; *************** *** 1054,1058 **** /* ------------------------------------------------------------ */ ! case KeyEvent.VK_F4: this.setMouseCursor("./cursors/CursorX_48x48.png",48,48,23,23); this.m_box_width = 24; --- 1103,1107 ---- /* ------------------------------------------------------------ */ ! case KeyEvent.VK_F5: this.setMouseCursor("./cursors/CursorX_48x48.png",48,48,23,23); this.m_box_width = 24; *************** *** 1071,1074 **** --- 1120,1128 ---- /* ------------------------------------------------------------ */ + case KeyEvent.VK_D: + this.enableMouseTimer(this.isMouseTimerEnabled() ? false : true ); + break; + + /* ------------------------------------------------------------ */ case KeyEvent.VK_ESCAPE: case KeyEvent.VK_Q: *************** *** 1299,1302 **** --- 1353,1357 ---- this.m_system.startup(); //this.println("m_system.startup() done."); + this.startMouseTimer(); } *************** *** 1304,1307 **** --- 1359,1363 ---- public void shutdown() { + this.stopMouseTimer(); //this.println("m_system.shutdown()..."); this.m_system.shutdown(); Index: BlobDialog.java =================================================================== RCS file: /cvsroot/phission/phission/examples/java/ArmInterface/src/BlobDialog.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BlobDialog.java 28 Jun 2007 23:37:57 -0000 1.6 --- BlobDialog.java 29 Jun 2007 18:32:59 -0000 1.7 *************** *** 317,321 **** }; ! long drawrects = this.m_draw_check.isSelected() ? 1 : 0; if (drawrects != this.m_segment.getDrawRects()) { --- 317,321 ---- }; ! int drawrects = this.m_draw_check.isSelected() ? 1 : 0; if (drawrects != this.m_segment.getDrawRects()) { *************** *** 323,327 **** } ! long colorblobs = this.m_color_check.isSelected() ? 1 : 0; if (colorblobs != this.m_segment.getColorBlobs()) { --- 323,327 ---- } ! int colorblobs = this.m_color_check.isSelected() ? 1 : 0; if (colorblobs != this.m_segment.getColorBlobs()) { |