visad
Class ProjectionControl
- java.lang.Object
-
- visad.Control
-
- visad.ProjectionControl
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
- 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
Fields Modifier and Type Field and Description static doubleINVSCALE2DInverse of SCALE2Dstatic intMATRIX2D_LENGTHLength of a 2D matrixstatic intMATRIX2D_MAJORMajor dimension of the 2D matrixstatic intMATRIX2D_MINORMinor dimension of the 2D matrixstatic intMATRIX3D_LENGTHLength of a 2D matrixstatic intMATRIX3D_MAJORMajor dimension of the 3D matrixstatic intMATRIX3D_MINORMinor dimension of the 3D matrixstatic doubleSCALE2DDefault scaling factor for 2D matrix
-
Constructor Summary
Constructors Constructor and Description ProjectionControl(DisplayImpl d)Construct a ProjectionControl for the display in question.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidclearSwitches(DataRenderer re)clear all 'pairs' in switches that involve rejava.lang.Objectclone()Create a clone of this ProjectionControl.booleanequals(java.lang.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 projectionjava.lang.StringgetSaveString()Get a string that can be used to reconstruct this control laterstatic 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.voidresetProjection()Restores to projection matrix at time of lastsaveProjection()call -- if one was made -- or to initial projection otherwise.voidsaveProjection()Saves the current display projection matrix.abstract voidsetAspect(double[] aspect)Set aspect ratio of axesvoidsetAspectCartesian(double[] aspect)Set aspect ratio of axes, in ScalarMaps rather than matrixvoidsetMatrix(double[] m)Set the matrix that defines the graphics projectionvoidsetSaveString(java.lang.String save)Set the properties of this control using the specified save stringvoidsyncControl(Control rmt)Copy the state of a remote control to this controljava.lang.StringtoString()A string representation of this ProjectionControl.-
Methods inherited from class visad.Control
addControlListener, animation_string, changeControl, checkTicks, getDisplay, getDisplayRenderer, getInstanceNumber, incTick, nullControl, peekTicks, removeControlListener, resetTicks, setTicks, subCheckTicks, subPeekTicks, subResetTicks, subSetTicks
-
-
-
-
Field Detail
-
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, java.rmi.RemoteExceptionSet 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 lengthjava.rmi.RemoteException- Java RMI failure.
-
getSaveString
public java.lang.String getSaveString()
Get a string that can be used to reconstruct this control later- Specified by:
getSaveStringin classControl- Returns:
- String representation of this object that can be used for reconstruction.
-
setSaveString
public void setSaveString(java.lang.String save) throws VisADException, java.rmi.RemoteExceptionSet the properties of this control using the specified save string- Specified by:
setSaveStringin classControl- Parameters:
save- String to use for setting the properties.- Throws:
VisADException- VisAD failure.java.rmi.RemoteException- Java RMI failure.
-
setAspect
public abstract void setAspect(double[] aspect) throws VisADException, java.rmi.RemoteExceptionSet aspect ratio of axes- Parameters:
aspect- ratios; 3 elements for Java3D, 2 for Java2D- Throws:
VisADException- VisAD failure.java.rmi.RemoteException- Java RMI failure.
-
setAspectCartesian
public void setAspectCartesian(double[] aspect) throws VisADException, java.rmi.RemoteExceptionSet aspect ratio of axes, in ScalarMaps rather than matrix- Parameters:
aspect- ratios; 3 elements for Java3D, 2 for Java2D- Throws:
VisADException- VisAD failure.java.rmi.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 methodresetProjection().- 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, java.rmi.RemoteExceptionRestores to projection matrix at time of lastsaveProjection()call -- if one was made -- or to initial projection otherwise.- Throws:
VisADException- VisAD failure.java.rmi.RemoteException- Java RMI failure.- See Also:
saveProjection()
-
matrix2DTo3D
public static double[] matrix2DTo3D(double[] matrix) throws VisADExceptionConvert 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 VisADExceptionConvert 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 VisADExceptionConvert 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 tomatrix3DTo2Dormatrix2DTo3D.- 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:
syncControlin classControl- Parameters:
rmt- remote control- Throws:
VisADException- rmt is null or not a ProjectionControl or some other VisAD error
-
equals
public boolean equals(java.lang.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.
-
clone
public java.lang.Object clone()
Create a clone of this ProjectionControl.
-
-
DMelt 3.0 © DataMelt by jWork.ORG