visad.util
Class CursorUtil

java.lang.Object
  extended by visad.util.CursorUtil

public class CursorUtil
extends Object

Utility methods for cursor-related functions, including converting between pixel, cursor and domain coordinates, and evaluating functions at a given cursor location.


Constructor Summary
CursorUtil()
           
 
Method Summary
static double[] cursorToDomain(DisplayImpl d, double[] cursor)
          Converts the given cursor coordinates to domain coordinates.
static double[] cursorToDomain(DisplayImpl d, RealType[] types, double[] cursor)
          Converts the given cursor coordinates to domain coordinates.
static int[] cursorToPixel(DisplayImpl d, double[] cursor)
          Converts the given cursor coordinates to pixel coordinates.
static double[] domainToCursor(DisplayImpl d, double[] domain)
          Converts the given domain coordinates to cursor coordinates.
static double[] domainToCursor(DisplayImpl d, RealType[] types, double[] domain)
          Converts the given domain coordinates to cursor coordinates.
static int[] domainToPixel(DisplayImpl d, double[] domain)
          Converts the given domain coordinates to pixel coordinates.
static double[] evaluate(FunctionImpl data, double[] domain)
          Evaluates the given function at the specified domain coordinates.
static double[][] getScaleValues(DisplayImpl d, RealType[] types)
          Gets scale values (multiplier and offset) for the X, Y and Z maps corresponding to the given RealTypes (or the first ScalarMaps to X, Y and Z if types is null).
static ScalarMap[] getXYZMaps(DisplayImpl d, RealType[] types)
          Gets X, Y and Z maps for the given display, corresponding to the specified RealTypes, or the first ScalarMaps to X, Y and Z if types is null.
static double[] pixelToCursor(DisplayImpl d, int x, int y)
          Converts the given pixel coordinates to cursor coordinates.
static double[] pixelToDomain(DisplayImpl d, int x, int y)
          Converts the given pixel coordinates to domain coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CursorUtil

public CursorUtil()
Method Detail

cursorToDomain

public static double[] cursorToDomain(DisplayImpl d,
                                      RealType[] types,
                                      double[] cursor)
Converts the given cursor coordinates to domain coordinates.


domainToCursor

public static double[] domainToCursor(DisplayImpl d,
                                      RealType[] types,
                                      double[] domain)
Converts the given domain coordinates to cursor coordinates.


cursorToDomain

public static double[] cursorToDomain(DisplayImpl d,
                                      double[] cursor)
Converts the given cursor coordinates to domain coordinates.


domainToCursor

public static double[] domainToCursor(DisplayImpl d,
                                      double[] domain)
Converts the given domain coordinates to cursor coordinates.


pixelToCursor

public static double[] pixelToCursor(DisplayImpl d,
                                     int x,
                                     int y)
Converts the given pixel coordinates to cursor coordinates.


cursorToPixel

public static int[] cursorToPixel(DisplayImpl d,
                                  double[] cursor)
Converts the given cursor coordinates to pixel coordinates.


pixelToDomain

public static double[] pixelToDomain(DisplayImpl d,
                                     int x,
                                     int y)
Converts the given pixel coordinates to domain coordinates.


domainToPixel

public static int[] domainToPixel(DisplayImpl d,
                                  double[] domain)
Converts the given domain coordinates to pixel coordinates.


evaluate

public static double[] evaluate(FunctionImpl data,
                                double[] domain)
                         throws VisADException,
                                RemoteException
Evaluates the given function at the specified domain coordinates.

Throws:
VisADException
RemoteException

getScaleValues

public static double[][] getScaleValues(DisplayImpl d,
                                        RealType[] types)
Gets scale values (multiplier and offset) for the X, Y and Z maps corresponding to the given RealTypes (or the first ScalarMaps to X, Y and Z if types is null). If no mapping to a spatial axis is found, that component of the array will be null.

Returns:
Scale array of size [3][2], with the first dimension corresponding to X, Y or Z, and the second giving multiplier and offset. For example, cursor_x = scale[0][0] * domain_x + scale[0][1].

getXYZMaps

public static ScalarMap[] getXYZMaps(DisplayImpl d,
                                     RealType[] types)
Gets X, Y and Z maps for the given display, corresponding to the specified RealTypes, or the first ScalarMaps to X, Y and Z if types is null.

Returns:
RealType array of size [3], for X, Y and Z map, respectively.