visad.bom
Class GridEdit

java.lang.Object
  extended by visad.bom.GridEdit
All Implemented Interfaces:
ActionListener, EventListener

public class GridEdit
extends Object
implements ActionListener

GridEdit is the VisAD class for warping and modifying fields.

Construct a GridEdit object linked to a 2-D grid [a FlatField with MathType ((x, y) -> range)]) or a sequence of 2-D grids [a FieldImpl with MathType (t -> ((x, y) -> range))], and a DisplayImpl. The grid or grids must all have the same domain Set, which must be a Gridded2DSet or a GriddedSet with domain dimension = 2. The domain must be mapped to two spatial DisplayRealTypes. If a sequence of grids, the sequence domain must be mapped to Animation. The grid may have any number of range RealTypes. The GridEdit object operates in a sequence: 1. Invokes its start() method to start. 2. User drags grid warp motion lines with the right mouse button. These lines must lie inside the grid. 3. If user presses SHIFT while dragging a grid warp motion line, the program prompts for increments for values at the dragged location. 4. User can delete lines by clicking the right button on their end points, with CTRL pressed. 5. At any point after start(), the application can invoke stop() to stop the dragging process, and warp the grid. 6. After the grid has been warped, the application can invoke undo() to undo the paste and stop the process. 7. The process can be restarted by invoking start(), any number of times. The main() method illustrates a simple GUI and test case with a sequnece of grids. Run 'java visad.bom.GridEdit' to test with contour values, and run 'java visad.bom.GridEdit 1' to test with color values.


Constructor Summary
GridEdit(Field gs, DisplayImplJ3D d)
           gs has MathType (t -> ((x, y) -> v)) or ((x, y) -> v) conditions on gs and display: 1. x and y mapped to XAxis, YAxis, ZAxis 2.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
static void main(String[] args)
           
 void start()
          enable user to draw move vectors with optional deltas
 void stop()
          warp grid according to move vectors drawn by user also interpolate user defined delta values at move points
 void undo()
          undo action of last call to stop()
static FlatField warpGrid(FlatField ff, float[][][] set_samples, float[][] deltas)
          warpGrid is the workhorse of GridEdit and can be used independently of any instances of the class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridEdit

public GridEdit(Field gs,
                DisplayImplJ3D d)
         throws VisADException,
                RemoteException
     gs has MathType (t -> ((x, y) -> v)) or ((x, y) -> v)
     conditions on gs and display:
     1. x and y mapped to XAxis, YAxis, ZAxis
     2. (x, y) domain GriddedSet
     3. if (t -> ...), then t is mapped to Animation

Throws:
VisADException
RemoteException
Method Detail

start

public void start()
           throws VisADException,
                  RemoteException
enable user to draw move vectors with optional deltas

Throws:
VisADException
RemoteException

stop

public void stop()
          throws VisADException,
                 RemoteException
warp grid according to move vectors drawn by user also interpolate user defined delta values at move points

Throws:
VisADException
RemoteException

warpGrid

public static FlatField warpGrid(FlatField ff,
                                 float[][][] set_samples,
                                 float[][] deltas)
                          throws VisADException,
                                 RemoteException
warpGrid is the workhorse of GridEdit and can be used independently of any instances of the class

Parameters:
ff - A FlatField containing the 2-D grid to be warped.
set_samples - The move vectors, dimensioned [number_of_moves][2][2] where the second index enumerates x and y and the third index enumerates the "from" and "to" ends of the move. These values are x and y data values
deltas - Increments for moved values, to be interpolated over the grid, dimensioned [number_of_grid_range_values][number_of_moves]. May be null.
Returns:
Warped grid, with motion vectors and deltas applied.
Throws:
VisADException - bad parameters
RemoteException

undo

public void undo()
          throws VisADException,
                 RemoteException
undo action of last call to stop()

Throws:
VisADException
RemoteException

main

public static void main(String[] args)
                 throws VisADException,
                        RemoteException
Throws:
VisADException
RemoteException

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener