visad
Class ContourControl
- java.lang.Object
-
- visad.Control
-
- visad.ContourControl
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class ContourControl extends Control
ContourControl is the VisAD class for controlling IsoContour display scalars.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intEVERY_NTH_DEFAULTstatic intEVERY_NTH_MAXstatic intEVERY_NTH_MINstatic intLABEL_FREQ_HIstatic intLABEL_FREQ_LOstatic intLABEL_FREQ_MED
-
Constructor Summary
Constructors Constructor and Description ContourControl(DisplayImpl d)Construct a new ContourControl for the display
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddProjectionControlListener(ControlListener cl, ProjectionControl pcntrl)remove previous projListener from pcntrl, and save cl as new projListenerjava.lang.Objectclone()booleancontourFilled()voidenableContours(boolean on)set contour enablevoidenableLabels(boolean on)set label enablebooleanequals(java.lang.Object o)Indicates whether or not this instance equals an ObjectbooleangetAlignLabels()booleangetAutoSizeLabels()intgetDashedStyle()Get the line style for lines that are styled.intgetEveryNth()static doublegetInitScale()byte[]getLabelColor()Gets the label color.java.lang.ObjectgetLabelFont()Get contour label fontintgetLabelFreq()doublegetLabelSize()float[]getLevels(float[] lowhibase, boolean[] dashes)get 'new' descriptors for 2-D contour linesvoidgetMainContours(boolean[] bvalues, float[] fvalues)get parameters for IsoContour depictionsbooleangetPublicSet()java.lang.StringgetSaveString()voidnullControl()End this control (called by ScalarMap.nullDisplay()).voidreLabel()If zoom scale has changed sufficiently, re-transform in order to recompute labels.voidsetAlignLabels(boolean flag)Set the contour label alignment policyvoidsetAutoScaleLabels(boolean flag)set enable for label auto-sizevoidsetContourFill(boolean flag)voidsetContourInterval(float interval, float low, float hi, float ba)Sets the parameters for contour iso-lines.voidsetContourLimits(float low, float hi)Set low and high iso-line levelsvoidsetDashedStyle(int style)Set the line style to apply to dashed lines.voidsetEveryNth(int lineCount)Set how often we label linesvoidsetLabelColor(byte[] color)Sets the color for label.voidsetLabelColor(byte[] color, boolean change)Sets the label color.voidsetLabelFont(java.lang.Object font)Set the contour label FontvoidsetLabelFreq(int freq)set label frequencyvoidsetLabelSize(double factor)set size for label auto-sizevoidsetLevels(float[] levels, float base, boolean dash)Set arbitrary levels for 2-D contour lines; levels below base are dashed if dash == truevoidsetSaveString(java.lang.String save)reconstruct this ContourControl using the specified save stringvoidsetSurfaceValue(float value)Set level for iso-surfacesvoidsetSurfaceValue(float value, boolean setLevels)Set level for iso-surfacesvoidsyncControl(Control rmt)copy the state of a remote control to this control-
Methods inherited from class visad.Control
addControlListener, animation_string, changeControl, checkTicks, getDisplay, getDisplayRenderer, getInstanceNumber, incTick, peekTicks, removeControlListener, resetTicks, setTicks, subCheckTicks, subPeekTicks, subResetTicks, subSetTicks, toString
-
-
-
-
Field Detail
-
LABEL_FREQ_LO
public static final int LABEL_FREQ_LO
- See Also:
- Constant Field Values
-
LABEL_FREQ_MED
public static final int LABEL_FREQ_MED
- See Also:
- Constant Field Values
-
LABEL_FREQ_HI
public static final int LABEL_FREQ_HI
- See Also:
- Constant Field Values
-
EVERY_NTH_MIN
public static final int EVERY_NTH_MIN
- See Also:
- Constant Field Values
-
EVERY_NTH_DEFAULT
public static final int EVERY_NTH_DEFAULT
- See Also:
- Constant Field Values
-
EVERY_NTH_MAX
public static final int EVERY_NTH_MAX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContourControl
public ContourControl(DisplayImpl d)
Construct a new ContourControl for the display- Parameters:
d- Display to associate with this
-
-
Method Detail
-
setSurfaceValue
public void setSurfaceValue(float value) throws VisADException, java.rmi.RemoteExceptionSet level for iso-surfaces- Parameters:
value- value of the iso-surface to display- Throws:
VisADException- VisAD errorjava.rmi.RemoteException- Java RMI failure.
-
setSurfaceValue
public void setSurfaceValue(float value, boolean setLevels) throws VisADException, java.rmi.RemoteExceptionSet level for iso-surfaces- Parameters:
value- value of the iso-surface to displaysetLevels- true if this should be used for contour levels- Throws:
VisADException- VisAD errorjava.rmi.RemoteException- Java RMI failure.
-
setContourInterval
public void setContourInterval(float interval, float low, float hi, float ba) throws VisADException, java.rmi.RemoteExceptionSets the parameters for contour iso-lines. This method invokes theControlListener.controlChanged(ControlEvent)method of all registered listeners;- Parameters:
interval- The contour interval. Must be non-zero. If negative, then contour lines below the base will be dashed. Must not be NaN.low- The minimum contour value. No contour line less than this value will be drawn. Must not be NaN.hi- The maximum contour value. No contour line greater than this value will be drawn. Must not be NaN.ba- The base contour value. The contour lines will be integer multiples of the interval away from this value. Must not be NaN.- Throws:
VisADException- The interval is zero or too small.java.rmi.RemoteException- Java RMI failure.
-
setContourLimits
public void setContourLimits(float low, float hi) throws VisADException, java.rmi.RemoteExceptionSet low and high iso-line levels- Parameters:
low- The minimum contour value. No contour line less than this value will be drawn. Must not be NaN.hi- The maximum contour value. No contour line greater than this value will be drawn. Must not be NaN.- Throws:
VisADException- VisAD errorjava.rmi.RemoteException- Java RMI failure.
-
getPublicSet
public boolean getPublicSet()
- Returns:
- boolean indicating whether levels have been set by other than auto-scale
-
setLevels
public void setLevels(float[] levels, float base, boolean dash) throws VisADException, java.rmi.RemoteExceptionSet arbitrary levels for 2-D contour lines; levels below base are dashed if dash == true- Parameters:
levels- An array of contour values to display.base- The base contour value for dashing. Levels below base are dashed if dash is truedash- flag for making dashed contours below the base contour value.- Throws:
VisADException- VisAD errorjava.rmi.RemoteException- Java RMI failure.
-
getLevels
public float[] getLevels(float[] lowhibase, boolean[] dashes)get 'new' descriptors for 2-D contour lines- Parameters:
lowhibase- must be dimensioned float[3], where lowhibase[0] used to return low limit lowhibase[1] used to return high limit lowhibase[2] used to return basedashes- must be dimensioned boolean[1], where dashed[0] used to return dash enable- Returns:
- float[] array of levels for contour curves
-
enableLabels
public void enableLabels(boolean on) throws VisADException, java.rmi.RemoteExceptionset label enable- Parameters:
on- new value for label enable- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
enableContours
public void enableContours(boolean on) throws VisADException, java.rmi.RemoteExceptionset contour enable- Parameters:
on- new value for contour enable- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
getMainContours
public void getMainContours(boolean[] bvalues, float[] fvalues) throws VisADExceptionget parameters for IsoContour depictions- Parameters:
bvalues- must be dimensioned boolean[2], where bvalues[0] used to return contour enable bvalues[1] used to return label enablefvalues- must be dimensioned float[5], where fvalues[0] used to return level for iso-surface fvalues[1] used to return interval for iso-lines fvalues[2] used to return low limit for iso-lines fvalues[3] used to return high limit for iso-lines fvalues[4] used to return base for iso-lines- Throws:
VisADException- a VisAD error occurred
-
setContourFill
public void setContourFill(boolean flag) throws VisADException, java.rmi.RemoteException- Throws:
VisADExceptionjava.rmi.RemoteException
-
contourFilled
public boolean contourFilled()
- Returns:
- contourFill enable
-
getInitScale
public static double getInitScale()
- Returns:
- initial scale for label auto-size
-
setAutoScaleLabels
public void setAutoScaleLabels(boolean flag)
set enable for label auto-size- Parameters:
flag- new value for label auto-size enable
-
getAutoSizeLabels
public boolean getAutoSizeLabels()
- Returns:
- label auto-size enable
-
setAlignLabels
public void setAlignLabels(boolean flag) throws java.rmi.RemoteException, VisADExceptionSet the contour label alignment policy- Parameters:
flag- true: labels follow the contour line, false: labels are horizontal, default: true- Throws:
VisADExceptionjava.rmi.RemoteException
-
getAlignLabels
public boolean getAlignLabels()
-
setLabelColor
public void setLabelColor(byte[] color) throws java.rmi.RemoteException, VisADExceptionSets the color for label.- Parameters:
color- RGB color array, if null label takes contour color- Throws:
VisADExceptionjava.rmi.RemoteException
-
setLabelColor
public void setLabelColor(byte[] color, boolean change) throws java.rmi.RemoteException, VisADExceptionSets the label color.- Parameters:
color- RGB color array, if null label takes contour colorchange- If false, noControlEventis fired.- Throws:
java.rmi.RemoteExceptionVisADException
-
getLabelColor
public byte[] getLabelColor()
Gets the label color.- Returns:
- label color as RGB array, null if not set
-
setLabelFont
public void setLabelFont(java.lang.Object font) throws java.rmi.RemoteException, VisADExceptionSet the contour label Font- Parameters:
font- can be java.awt.Font or visad.util.HersheyFont. The former are rendered as filled polygons which can exhibit co-planar artifacts, the latter as lines which will always be visible, front or back, on co-planar surfaces. Can benull, the default, which results in the Times Roman HersheyFont.- Throws:
VisADExceptionjava.rmi.RemoteException
-
getLabelFont
public java.lang.Object getLabelFont()
Get contour label font- Returns:
- label font
-
setLabelFreq
public void setLabelFreq(int freq) throws VisADException, java.rmi.RemoteExceptionset label frequency- Parameters:
freq- how many labels to attempt per line- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
getLabelFreq
public int getLabelFreq()
- Returns:
- label frequency (number per line)
-
getEveryNth
public int getEveryNth()
- Returns:
- the everyNth
-
setEveryNth
public void setEveryNth(int lineCount) throws VisADException, java.rmi.RemoteExceptionSet how often we label lines- Parameters:
lineCount- how many lines to skip before next labeled line- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
setLabelSize
public void setLabelSize(double factor) throws VisADException, java.rmi.RemoteExceptionset size for label auto-size- Parameters:
factor- new size for label auto-size- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
getLabelSize
public double getLabelSize()
- Returns:
- size for label auto-size
-
getDashedStyle
public int getDashedStyle()
Get the line style for lines that are styled.- Returns:
- One of the line style constants from
GraphicsModeControl.
-
setDashedStyle
public void setDashedStyle(int style) throws java.rmi.RemoteException, VisADExceptionSet the line style to apply to dashed lines.- Parameters:
style- One of the line style constants fromGraphicsModeControl.- Throws:
java.rmi.RemoteExceptionVisADException
-
getSaveString
public java.lang.String getSaveString()
- Specified by:
getSaveStringin classControl- Returns:
- String representation of this ContourControl
-
setSaveString
public void setSaveString(java.lang.String save) throws VisADException, java.rmi.RemoteExceptionreconstruct this ContourControl using the specified save string- Specified by:
setSaveStringin classControl- Parameters:
save- - String representation for reconstruction- Throws:
VisADException- if a VisAD error occursjava.rmi.RemoteException- if an RMI error occurs
-
addProjectionControlListener
public void addProjectionControlListener(ControlListener cl, ProjectionControl pcntrl)
remove previous projListener from pcntrl, and save cl as new projListener- Parameters:
cl- new ControlListener for projListenerpcntrl- ProjectionControl
-
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 whose state is copied- Throws:
VisADException- if a VisAD error occurs
-
equals
public boolean equals(java.lang.Object o)
Indicates whether or not this instance equals an Object
-
clone
public java.lang.Object clone()
-
reLabel
public void reLabel() throws VisADException, java.rmi.RemoteExceptionIf zoom scale has changed sufficiently, re-transform in order to recompute labels. No action is taken ifsetContourFill(boolean)has been set.- Throws:
VisADException- if a VisAD error occursjava.rmi.RemoteException- if an RMI error occurs
-
nullControl
public void nullControl()
End this control (called by ScalarMap.nullDisplay()). Override to remove zoom control listener.- Overrides:
nullControlin classControl
-
-
DMelt 3.0 © DataMelt by jWork.ORG