## visad
Class ProjectionControl

    java.lang.Object
      visad.Control
          visad.ProjectionControl

All Implemented Interfaces:
  Cloneable, Serializable

Direct Known Subclasses:
  ProjectionControlJ2D, ProjectionControlJ3D

public abstract class ProjectionControl
extends Control

ProjectionControl is the VisAD interface for controlling the Projection from 3-D to 2-D.

See Also:
  Serialized Form

Field Summary
`static double` `INVSCALE2D` Inverse of SCALE2D
`protected double[]` `matrix` matrix[] shouldn't be used by non-ProjectionControl classes
`static int` `MATRIX2D_LENGTH` Length of a 2D matrix
`static int` `MATRIX2D_MAJOR` Major dimension of the 2D matrix
`static int` `MATRIX2D_MINOR` Minor dimension of the 2D matrix
`static int` `MATRIX3D_LENGTH` Length of a 2D matrix
`static int` `MATRIX3D_MAJOR` Major dimension of the 3D matrix
`static int` `MATRIX3D_MINOR` Minor dimension of the 3D matrix
`static double` `SCALE2D` Default scaling factor for 2D matrix

Fields inherited from class visad.Control
`display, displayRenderer`

Constructor Summary
`ProjectionControl(DisplayImpl d)` Construct a ProjectionControl for the display in question.

Method Summary
`void` `clearSwitches(DataRenderer re)` clear all 'pairs' in switches that involve re
`Object` `clone()` Create a clone of this ProjectionControl.
`boolean` `equals(Object o)` Check to see if the object in question is equal to this ProjectionControl.
`double[]` `getAspectCartesian()`
`double[]` `getMatrix()` Returns a copy of the graphics projection matrix.
`double[]` `getSavedProjectionMatrix()` Get the matrix that defines the saved graphics projection
`String` `getSaveString()` Get a string that can be used to reconstruct this control later
`static double[]` `matrix2DTo3D(double[] matrix)` Convert a 2D matrix to a 3D matrix, retaining the scale and aspect of the 2D matrix.
`static double[]` `matrix3DTo2D(double[] matrix)` Convert a 3D matrix to a 2D matrix, retaining the scale and aspect of the 3D matrix.
`static double[]` `matrixDConvert(double[] matrix)` Convert a 3D matrix to a 2D matrix or vice-versa, retaining the scale and aspect of the original matrix.
`void` `resetProjection()` Restores to projection matrix at time of last `saveProjection()` call -- if one was made -- or to initial projection otherwise.
`void` `saveProjection()` Saves the current display projection matrix.
`abstract void` `setAspect(double[] aspect)` Set aspect ratio of axes
`void` `setAspectCartesian(double[] aspect)` Set aspect ratio of axes, in ScalarMaps rather than matrix
`void` `setMatrix(double[] m)` Set the matrix that defines the graphics projection
`void` `setSaveString(String save)` Set the properties of this control using the specified save string
`void` `syncControl(Control rmt)` Copy the state of a remote control to this control
`String` `toString()` A string representation of this ProjectionControl.

Methods inherited from class visad.Control
`addControlListener, animation_string, changeControl, checkTicks, getDisplay, getDisplayRenderer, getIndex, getInstanceNumber, incTick, nullControl, peekTicks, removeControlListener, resetTicks, setIndex, setInstanceNumber, setTicks, subCheckTicks, subPeekTicks, subResetTicks, subSetTicks`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### matrix

    protected double[] matrix

  matrix[] shouldn't be used by non-ProjectionControl classes

### MATRIX2D_LENGTH

    public static final int MATRIX2D_LENGTH

  Length of a 2D matrix

  See Also:
    Constant Field Values

### MATRIX2D_MAJOR

    public static final int MATRIX2D_MAJOR

  Major dimension of the 2D matrix

  See Also:
    Constant Field Values

### MATRIX2D_MINOR

    public static final int MATRIX2D_MINOR

  Minor dimension of the 2D matrix

  See Also:
    Constant Field Values

### MATRIX3D_LENGTH

    public static final int MATRIX3D_LENGTH

  Length of a 2D matrix

  See Also:
    Constant Field Values

### MATRIX3D_MAJOR

    public static final int MATRIX3D_MAJOR

  Major dimension of the 3D matrix

  See Also:
    Constant Field Values

### MATRIX3D_MINOR

    public static final int MATRIX3D_MINOR

  Minor dimension of the 3D matrix

  See Also:
    Constant Field Values

### SCALE2D

    public static final double SCALE2D

  Default scaling factor for 2D matrix

  See Also:
    Constant Field Values

### INVSCALE2D

    public static final double INVSCALE2D

  Inverse of SCALE2D

  See Also:
    Constant Field Values

Constructor Detail

### ProjectionControl

    public ProjectionControl(DisplayImpl d)
                      throws VisADException

  Construct a ProjectionControl for the display in question.

Parameters:
  `d` - display to control
Throws:
  `VisADException` - d already has a ProjectionControl or some other VisAD Error

Method Detail

### getMatrix

    public double[] getMatrix()

  Returns a copy of the graphics projection matrix. The matrix has 6 elements in the 2-D case and 16 elements in the 3-D case.

  Returns:
    A copy of the graphics projection matrix.

### setMatrix

    public void setMatrix(double[] m)
                   throws VisADException,
                          RemoteException

  Set the matrix that defines the graphics projection

  Parameters:
    `m` - array of the matrix values (16 elements in Java3D case, 6 elements in Java2D case)
  Throws:
    `VisADException` - invalid matrix length
    `RemoteException` - Java RMI failure.

### getSaveString

    public String getSaveString()

  Get a string that can be used to reconstruct this control later

  Specified by:
    `getSaveString` in class `Control`
  Returns:
    String representation of this object that can be used for reconstruction.

### setSaveString

    public void setSaveString(String save)
                       throws VisADException,
                              RemoteException

  Set the properties of this control using the specified save string

  Specified by:
    `setSaveString` in class `Control`
  Parameters:
    `save` - String to use for setting the properties.
  Throws:
    `VisADException` - VisAD failure.
    `RemoteException` - Java RMI failure.

### setAspect

    public abstract void setAspect(double[] aspect)
                            throws VisADException,
                                   RemoteException

  Set aspect ratio of axes

  Parameters:
    `aspect` - ratios; 3 elements for Java3D, 2 for Java2D
  Throws:
    `VisADException` - VisAD failure.
    `RemoteException` - Java RMI failure.

### setAspectCartesian

    public void setAspectCartesian(double[] aspect)
                            throws VisADException,
                                   RemoteException

  Set aspect ratio of axes, in ScalarMaps rather than matrix

  Parameters:
    `aspect` - ratios; 3 elements for Java3D, 2 for Java2D
  Throws:
    `VisADException` - VisAD failure.
    `RemoteException` - Java RMI failure.

### getAspectCartesian

    public double[] getAspectCartesian()

### saveProjection

    public void saveProjection()

  Saves the current display projection matrix. The projection may later be restored by the method `resetProjection()`.

  See Also:
    `resetProjection()`

### getSavedProjectionMatrix

    public double[] getSavedProjectionMatrix()

  Get the matrix that defines the saved graphics projection

  Returns:
    array of the matrix values (16 elements in Java3D case, 6 elements in Java2D case)

### resetProjection

    public void resetProjection()
                         throws VisADException,
                                RemoteException

  Restores to projection matrix at time of last `saveProjection()` call -- if one was made -- or to initial projection otherwise.

  Throws:
    `VisADException` - VisAD failure.
    `RemoteException` - Java RMI failure.
  See Also:
    `saveProjection()`

### matrix2DTo3D

    public static double[] matrix2DTo3D(double[] matrix)
                                 throws VisADException

  Convert a 2D matrix to a 3D matrix, retaining the scale and aspect of the 2D matrix.

  Parameters:
    `matrix` - 2D matrix to convert
  Throws:
    `VisADException` - wrong length for matrix (not MATRIX2D_LENGTH)

### matrix3DTo2D

    public static double[] matrix3DTo2D(double[] matrix)
                                 throws VisADException

  Convert a 3D matrix to a 2D matrix, retaining the scale and aspect of the 3D matrix.

  Parameters:
    `matrix` - 3D matrix to convert
  Throws:
    `VisADException` - wrong length for matrix (not MATRIX3D_LENGTH)

### matrixDConvert

    public static double[] matrixDConvert(double[] matrix)
                                   throws VisADException

  Convert a 3D matrix to a 2D matrix or vice-versa, retaining the scale and aspect of the original matrix. Helper interface to pass an unknown matrix to `matrix3DTo2D` or `matrix2DTo3D`.

  Parameters:
    `matrix` - matrix to convert
  Throws:
    `VisADException` - wrong length for matrix (not MATRIX3D_LENGTH)
  See Also:
    `matrix3DTo2D(double[])`, `matrix2DTo3D(double[])`

### clearSwitches

    public void clearSwitches(DataRenderer re)

  clear all 'pairs' in switches that involve re

### syncControl

    public void syncControl(Control rmt)
                     throws VisADException

  Copy the state of a remote control to this control

  Specified by:
    `syncControl` in class `Control`
  Parameters:
    `rmt` - remote control
  Throws:
    `VisADException` - rmt is null or not a ProjectionControl or some other VisAD error

### equals

    public boolean equals(Object o)

  Check to see if the object in question is equal to this ProjectionControl. The two are equal if they are both ProjectionControls and their projection matrices are equal.

  Overrides:
    `equals` in class `Control`
  Parameters:
    `o` - object in question.
  Returns:
    true if and only if this instance is equal to o

### clone

    public Object clone()

  Create a clone of this ProjectionControl.

  Overrides:
    `clone` in class `Control`
  Returns:
    clone

### toString

    public String toString()

  A string representation of this ProjectionControl.

  Overrides:
    `toString` in class `Control`
  Returns:
    human readable string that tells the properties of this control.