private static void go() { int n1 = 101; int n2 = 101; // float[][] f = sin(rampfloat(0.0f,0.1f,0.1f,n1,n2)); float[][] f = zerofloat(n1, n2); PlotPanel.Orientation orientation = PlotPanel.Orientation.X1DOWN_X2RIGHT; PlotPanel panel = new PlotPanel(orientation); PixelsView pv = panel.addPixels(f); pv.setInterpolation(PixelsView.Interpolation.NEAREST); pv.setColorModel(ColorMap.JET); panel.addColorBar("time"); panel.setVLabel("depth (km)"); panel.setHLabel("distance (km)"); PlotFrame frame = new PlotFrame(panel); frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE); frame.setSize(800, 700); frame.setFontSize(24); frame.setVisible(true); ModeManager mm = frame.getModeManager(); ImageEditMode iem = new ImageEditMode(mm, pv, 0.0f, f); iem.setActive(true); }
/** * Constructs an image edit mode with specified manager. * * @param modeManager the mode manager for this mode. */ public ImageEditMode(ModeManager modeManager, PixelsView pixels, float vnull, float[][] v) { super(modeManager); setName("Edit"); // setIcon(loadIcon(ImageEditMode.class,"resources/ImageEdit16.gif")); // setIcon(loadIcon(MouseTrackMode.class,"resources/Track24.gif")); setMnemonicKey(KeyEvent.VK_E); setAcceleratorKey(KeyStroke.getKeyStroke(KeyEvent.VK_E, 0)); setShortDescription("Edit points"); _tile = pixels.getTile(); _pixels = pixels; fill(vnull, v); _vnull = vnull; _n1 = v[0].length; _n2 = v.length; _v = v; _is2 = new ImageSampler2(_v); _ns = 0; _x1 = new float[0][0]; _x2 = new float[0][0]; _vx = new float[0][0]; _points = new PointsView(_x1, _x2); if (pixels.getOrientation() == PixelsView.Orientation.X1RIGHT_X2UP) { _points.setOrientation(PointsView.Orientation.X1RIGHT_X2UP); } else { _points.setOrientation(PointsView.Orientation.X1DOWN_X2RIGHT); } _points.setStyle("w-o"); }
private void updatePixelsView() { _pixels.set(_v); }