Class GridEdit
- java.lang.Object
-
- visad.bom.GridEdit
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener
public class GridEdit extends java.lang.Object implements java.awt.event.ActionListenerGridEdit 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
Constructors Constructor and Description GridEdit(Field gs, DisplayImplJ3D d)gs has MathType (t -> ((x, y) -> v)) or ((x, y) -> v) conditions on gs and display: 1.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactionPerformed(java.awt.event.ActionEvent e)static voidmain(java.lang.String[] args)voidstart()enable user to draw move vectors with optional deltasvoidstop()warp grid according to move vectors drawn by user also interpolate user defined delta values at move pointsvoidundo()undo action of last call to stop()static FlatFieldwarpGrid(FlatField ff, float[][][] set_samples, float[][] deltas)warpGrid is the workhorse of GridEdit and can be used independently of any instances of the class
-
-
-
Constructor Detail
-
GridEdit
public GridEdit(Field gs, DisplayImplJ3D d) throws VisADException, java.rmi.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:
VisADExceptionjava.rmi.RemoteException
-
-
Method Detail
-
start
public void start() throws VisADException, java.rmi.RemoteExceptionenable user to draw move vectors with optional deltas- Throws:
VisADExceptionjava.rmi.RemoteException
-
stop
public void stop() throws VisADException, java.rmi.RemoteExceptionwarp grid according to move vectors drawn by user also interpolate user defined delta values at move points- Throws:
VisADExceptionjava.rmi.RemoteException
-
warpGrid
public static FlatField warpGrid(FlatField ff, float[][][] set_samples, float[][] deltas) throws VisADException, java.rmi.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 valuesdeltas- 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 parametersjava.rmi.RemoteException
-
undo
public void undo() throws VisADException, java.rmi.RemoteExceptionundo action of last call to stop()- Throws:
VisADExceptionjava.rmi.RemoteException
-
main
public static void main(java.lang.String[] args) throws VisADException, java.rmi.RemoteException- Throws:
VisADExceptionjava.rmi.RemoteException
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
-
DMelt 3.0 © DataMelt by jWork.ORG