@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() ); final double[] l = hooks.get( targetIndex ).getW(); l[ 0 ] = xm; l[ 1 ] = ym; updateRoi(); if ( showMesh || showSprings ) synchronized ( ill ) { pleaseIllustrate = true; ill.notify(); } synchronized ( opt ) { pleaseOptimize = true; opt.notify(); } } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() ); final double[] l = hooks.get( targetIndex ).getW(); l[ 0 ] = xm; l[ 1 ] = ym; updateRoi(); if ( showMesh || showSprings ) synchronized ( ill ) { pleaseIllustrate = true; ill.notify(); } synchronized ( opt ) { pleaseOptimize = true; opt.notify(); } } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); updateIllustration(); updateRoi(); try { updateMapping(); if ( showPreview ) { synchronized ( painter ) { //if ( !pleaseRepaint.getAndSet( true ) ) pleaseRepaint.set( true ); painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ){} catch ( final IllDefinedDataPointsException ex ){} } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); updateIllustration(); updateRoi(); try { updateMapping(); if ( showPreview ) { synchronized ( painter ) { //if ( !pleaseRepaint.getAndSet( true ) ) pleaseRepaint.set( true ); painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ){} catch ( final IllDefinedDataPointsException ex ){} } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); try { myModel().fit( m ); for ( final Tuple tuple : tuples ) { synchronized ( tuple.painter ) { tuple.pleaseRepaint.set( true ); tuple.painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ) { ex.printStackTrace(); } catch ( final IllDefinedDataPointsException ex ) { ex.printStackTrace(); } } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); try { myModel().fit( m ); for ( final Tuple tuple : tuples ) { synchronized ( tuple.painter ) { tuple.pleaseRepaint.set( true ); tuple.painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ) { ex.printStackTrace(); } catch ( final IllDefinedDataPointsException ex ) { ex.printStackTrace(); } } }
@Override public void mousePressed( final MouseEvent e ) { targetIndex = -1; final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() ); double target_d = Double.MAX_VALUE; for ( int i = 0; i < hooks.size(); ++i ) { final double[] l = hooks.get( i ).getW(); final double dx = win.getCanvas().getMagnification() * ( l[ 0 ] - xm ); final double dy = win.getCanvas().getMagnification() * ( l[ 1 ] - ym ); final double d = dx * dx + dy * dy; if ( d < 64.0 && d < target_d ) { targetIndex = i; target_d = d; } } if ( e.getButton() == MouseEvent.BUTTON1 ) { if ( targetIndex == -1 ) { addHandle( xm, ym ); updateRoi(); } } } @Override
@Override public void mousePressed( final MouseEvent e ) { targetIndex = -1; final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() ); double target_d = Double.MAX_VALUE; for ( int i = 0; i < hooks.size(); ++i ) { final double[] l = hooks.get( i ).getW(); final double dx = win.getCanvas().getMagnification() * ( l[ 0 ] - xm ); final double dy = win.getCanvas().getMagnification() * ( l[ 1 ] - ym ); final double d = dx * dx + dy * dy; if ( d < 64.0 && d < target_d ) { targetIndex = i; target_d = d; } } if ( e.getButton() == MouseEvent.BUTTON1 ) { if ( targetIndex == -1 ) { addHandle( xm, ym ); updateRoi(); } } } @Override
@Override public void mousePressed( final MouseEvent e ) { targetIndex = -1; if ( e.getButton() == MouseEvent.BUTTON1 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); double target_d = Double.MAX_VALUE; for ( int i = 0; i < q.length; ++i ) { final double dx = win.getCanvas().getMagnification() * ( q[ i ].getW()[ 0 ] - x ); final double dy = win.getCanvas().getMagnification() * ( q[ i ].getW()[ 1 ] - y ); final double d = dx * dx + dy * dy; if ( d < 64.0 && d < target_d ) { targetIndex = i; target_d = d; } } } }
@Override public void mousePressed( final MouseEvent e ) { targetIndex = -1; if ( e.getButton() == MouseEvent.BUTTON1 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); double target_d = Double.MAX_VALUE; for ( int i = 0; i < q.length; ++i ) { final double dx = win.getCanvas().getMagnification() * ( q[ i ].getW()[ 0 ] - x ); final double dy = win.getCanvas().getMagnification() * ( q[ i ].getW()[ 1 ] - y ); final double d = dx * dx + dy * dy; if ( d < 64.0 && d < target_d ) { targetIndex = i; target_d = d; } } } }
public static void setKeyUp(int key) { if (debugMode) IJ.log("setKeyUp: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1,-1); break; case ALL_KEYS: shiftDown=controlDown=altDown=spaceDown=false; break; } }
if ( e.getButton() == MouseEvent.BUTTON1 ) final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() );
if ( e.getButton() == MouseEvent.BUTTON1 ) final ImageWindow win = WindowManager.getCurrentWindow(); final int xm = win.getCanvas().offScreenX( e.getX() ); final int ym = win.getCanvas().offScreenY( e.getY() );
public static void setKeyUp(int key) { if (debugMode) IJ.log("setKeyUp: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=false; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=false; break; case KeyEvent.VK_ALT: altDown=false; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=false; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: spaceDown=false; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1,-1); break; case ALL_KEYS: shiftDown=controlDown=altDown=spaceDown=false; break; } }
public static void setKeyDown(int key) { if (debugMode) IJ.log("setKeyDown: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=true; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=true; break; case KeyEvent.VK_ALT: altDown=true; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=true; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: { spaceDown=true; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1, -1); break; } case KeyEvent.VK_ESCAPE: { escapePressed = true; break; } } }
public static void setKeyDown(int key) { if (debugMode) IJ.log("setKeyDown: "+key); switch (key) { case KeyEvent.VK_CONTROL: controlDown=true; break; case KeyEvent.VK_META: if (isMacintosh()) controlDown=true; break; case KeyEvent.VK_ALT: altDown=true; updateStatus(); break; case KeyEvent.VK_SHIFT: shiftDown=true; if (debugMode) beep(); break; case KeyEvent.VK_SPACE: { spaceDown=true; ImageWindow win = WindowManager.getCurrentWindow(); if (win!=null) win.getCanvas().setCursor(-1,-1,-1, -1); break; } case KeyEvent.VK_ESCAPE: { escapePressed = true; break; } } }
final ImageWindow win = WindowManager.getCurrentWindow(); final double x = win.getCanvas().offScreenXD( e.getX() ); final double y = win.getCanvas().offScreenYD( e.getY() );
final ImageWindow win = WindowManager.getCurrentWindow(); final double x = win.getCanvas().offScreenXD( e.getX() ); final double y = win.getCanvas().offScreenYD( e.getY() );
toolbar.setColor(Color.black); toolbar.setTool(Toolbar.LINE); ImageWindow win = WindowManager.getCurrentWindow(); ImageCanvas canvas = win.getCanvas(); if (canvas instanceof PlotsCanvas)
toolbar.setColor(Color.black); toolbar.setTool(Toolbar.LINE); ImageWindow win = WindowManager.getCurrentWindow(); ImageCanvas canvas = win.getCanvas(); if (canvas instanceof PlotsCanvas)