visad
Class AxisScale
- java.lang.Object
-
- visad.AxisScale
-
- All Implemented Interfaces:
- java.io.Serializable
public class AxisScale extends java.lang.Object implements java.io.SerializableClass which defines the scales displayed along the spatial axes of a display. Each ScalarMap that has a DisplayScalar of the X, Y, or Z axis will have a non-null AxisScale.- See Also:
ScalarMap.getAxisScale(), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intPRIMARYidentifier for primary label side of axisstatic intQUATERNARYidentifier for quaternary label side of axisstatic intSECONDARYidentifier for secondary label side of axisstatic intTERTIARYidentifier for tertiary label side of axisstatic intX_AXISX_AXIS identifierstatic intY_AXISY_AXIS identifierstatic intZ_AXISZ_AXIS identifier
-
Constructor Summary
Constructors Constructor and Description AxisScale(ScalarMap map)Construct a new AxisScale for the given ScalarMap
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidcreateStandardLabels(double max, double min, double base, double increment)Creates a hashtable that will draw text labels starting at the starting point specified using the increment field.intgetAxis()Get axis that the scale will be displayed on.intgetAxisOrdinal()Get the position of this AxisScale on the Axis (first, second, third).booleangetBaseLineVisible()Determine whether the base line for the scale should be visiblejava.awt.ColorgetColor()Get the color of this axis scale.java.awt.FontgetFont()Get the font used for rendering the labelsbooleangetGridLinesVisible()Get the visibility of the grid linesjava.lang.StringgetLabel()Deprecated.Get the label of the AxisScale.booleangetLabelAllTicks()Return whether all major ticks are to be labeled.VisADTriangleArraygetLabelArray()Get the labels rendered with a font to pass to the renderer.booleangetLabelBothSides()See if both sides are labeledintgetLabelSize()Gets the size of the labels.java.util.HashtablegetLabelTable()Get the Hashtable used for labelsdoublegetMajorTickSpacing()This method returns the major tick spacing.doublegetMinorTickSpacing()This method returns the minor tick spacing.java.text.NumberFormatgetNumberFormat()Get the formatting for labels.VisADLineArraygetScaleArray()Get the Scale to pass to the renderer.booleangetScreenBased()return screenBased modeintgetSide()Get the alignment for the axisbooleangetSnapToBox()Determine whether this property is set.intgetTickOrientation()Get the orientation for the ticks along the axisbooleangetTicksVisible()See if ticks are visiblejava.lang.StringgetTitle()Get the title of the AxisScale.booleanisLabelRelief()Checks if is label has relief.booleanisVisible()Get the visibility of the AxisScalebooleanmakeScale()Create the scale.booleanmakeScale(boolean twoD, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, double scale, double offset, double line, double[] dataRange)inner logic of makeScale with no references to display, displayRenderer or scalarMap, allwoing more flexible placement of scalesbooleanmakeScreenBasedScale(double xmin, double ymin, double xmax, double ymax, double XTMIN, double YTMIN, double XTMAX, double YTMAX)Create the scale for screen based.voidsetAutoComputeTicks(boolean b)Allow the AxisScale to automatically compute the desired majorTickSpacing based on the range of the ScalarMap.voidsetBaseLineVisible(boolean visible)Set visibility of base line.voidsetColor(java.awt.Color color)Set the color of this axis scale.voidsetColor(float[] color)Set the color of this axis scale.voidsetFont(java.awt.Font font)Set the font used for rendering the labelsvoidsetFont(HersheyFont font)Set the font used for rendering the labelsvoidsetGridLinesVisible(boolean show)Set the visibility of the grid lines; Grid lines are placed at major tick marks.voidsetLabel(java.lang.String label)Deprecated.Set the label to be used for this axis. The default is the ScalarName of the ScalarMap.voidsetLabelAllTicks(boolean labelAll)Set whether all major ticks should be labeled.voidsetLabelBothSides(boolean both)Set whether both sides are labeled.voidsetLabelRelief(boolean labelRelief)Sets the label relief.voidsetLabelSize(int size)Sets the size of the labels.voidsetLabelTable(java.util.Hashtable labels)Used to specify what label will be drawn at any given value.voidsetMajorTicks(double[] majorTicks)Set major tick marks.voidsetMajorTickSpacing(double spacing)Set major tick mark spacing.voidsetMinorTicks(double[] minorTicks)Set minor tick marks.voidsetMinorTickSpacing(double spacing)Set minor tick mark spacing.voidsetNumberFormat(java.text.NumberFormat format)Set the formatting for all labelsvoidsetScreenBased(boolean sb)set screenBased mode true indicates axis is stationary relative to screenvoidsetSide(int side)Set side for axis (PRIMARY, SECONDARY)voidsetSnapToBox(boolean b)Toggle whether the scale is along the box edge or notvoidsetTickBase(double base)Sets the base value for tick marks.voidsetTickOrientation(int orient)Set orientation of tick marks along the axis line.voidsetTicksVisible(boolean visible)Set whether ticks are visiblevoidsetTitle(java.lang.String title)Set the title to be used for this axis.voidsetVisible(boolean visible)Set the visibility of the AxisScale
-
-
-
Field Detail
-
X_AXIS
public static final int X_AXIS
X_AXIS identifier- See Also:
- Constant Field Values
-
Y_AXIS
public static final int Y_AXIS
Y_AXIS identifier- See Also:
- Constant Field Values
-
Z_AXIS
public static final int Z_AXIS
Z_AXIS identifier- See Also:
- Constant Field Values
-
PRIMARY
public static final int PRIMARY
identifier for primary label side of axis- See Also:
- Constant Field Values
-
SECONDARY
public static final int SECONDARY
identifier for secondary label side of axis- See Also:
- Constant Field Values
-
TERTIARY
public static final int TERTIARY
identifier for tertiary label side of axis- See Also:
- Constant Field Values
-
QUATERNARY
public static final int QUATERNARY
identifier for quaternary label side of axis- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AxisScale
public AxisScale(ScalarMap map) throws VisADException
Construct a new AxisScale for the given ScalarMap- Parameters:
map- ScalarMap to monitor. Must be mapped to one of Display.XAxis, Display.YAxis, Display.ZAxis- Throws:
VisADException- bad ScalarMap or other VisAD problem
-
-
Method Detail
-
getAxisOrdinal
public int getAxisOrdinal()
Get the position of this AxisScale on the Axis (first, second, third).- Returns:
- position from the axis (first = 0, second = 1, etc)
-
setLabel
public void setLabel(java.lang.String label)
Deprecated. Set the label to be used for this axis. The default is the ScalarName of the ScalarMap.- Parameters:
label- label to be used- See Also:
setTitle(String)
-
getLabel
public java.lang.String getLabel()
Deprecated. Get the label of the AxisScale.- Returns:
- label
- See Also:
getTitle()
-
setTitle
public void setTitle(java.lang.String title)
Set the title to be used for this axis. The default is the ScalarName of the ScalarMap.- Parameters:
title- title to be used
-
getTitle
public java.lang.String getTitle()
Get the title of the AxisScale.- Returns:
- title
-
getAxis
public int getAxis()
Get axis that the scale will be displayed on.- Returns:
- axis (X_AXIS, Y_AXIS or Z_AXIS)
-
getScaleArray
public VisADLineArray getScaleArray()
Get the Scale to pass to the renderer.- Returns:
- VisADLineArray representing the scale
-
getLabelArray
public VisADTriangleArray getLabelArray()
Get the labels rendered with a font to pass to the renderer.- Returns:
- VisADTriangleArray representing the labels
-
setScreenBased
public void setScreenBased(boolean sb)
set screenBased mode true indicates axis is stationary relative to screen
-
getScreenBased
public boolean getScreenBased()
return screenBased mode- Returns:
- true if axis is stationary relative to screen
-
makeScreenBasedScale
public boolean makeScreenBasedScale(double xmin, double ymin, double xmax, double ymax, double XTMIN, double YTMIN, double XTMAX, double YTMAX) throws VisADExceptionCreate the scale for screen based.- Returns:
- true if scale was successfully created, otherwise false
- Throws:
VisADException
-
makeScale
public boolean makeScale() throws VisADExceptionCreate the scale.- Returns:
- true if scale was successfully created, otherwise false
- Throws:
VisADException
-
makeScale
public boolean makeScale(boolean twoD, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, double scale, double offset, double line, double[] dataRange) throws VisADExceptioninner logic of makeScale with no references to display, displayRenderer or scalarMap, allwoing more flexible placement of scales- Throws:
VisADException
-
getColor
public java.awt.Color getColor()
Get the color of this axis scale.- Returns:
- Color of the scale.
-
setColor
public void setColor(java.awt.Color color)
Set the color of this axis scale.- Parameters:
color- Color to use
-
setColor
public void setColor(float[] color)
Set the color of this axis scale.- Parameters:
color- array of red, green, and blue values in the range (0.0 - 1.0). color must be float[3].
-
setMajorTickSpacing
public void setMajorTickSpacing(double spacing)
Set major tick mark spacing. The number that is passed-in represents the distance, measured in values, between each major tick mark. If you have a ScalarMap with a range from 0 to 50 and the major tick spacing is set to 10, you will get major ticks next to the following values: 0, 10, 20, 30, 40, 50. This value will always be used unless you callsetAutoComputeTickswith atruevalue.- Parameters:
spacing- spacing between major tick marks (must be > 0)- See Also:
getMajorTickSpacing(),setAutoComputeTicks(boolean)
-
setMajorTicks
public void setMajorTicks(double[] majorTicks)
Set major tick marks. Tick marks will be placed at the values on the axis.- Parameters:
majorTicks- the tick values
-
setMinorTicks
public void setMinorTicks(double[] minorTicks)
Set minor tick marks. Tick marks will be placed at the values on the axis.- Parameters:
minorTicks- the tick values
-
getMajorTickSpacing
public double getMajorTickSpacing()
This method returns the major tick spacing. The number that is returned represents the distance, measured in values, between each major tick mark.- Returns:
- the number of values between major ticks
- See Also:
setMajorTickSpacing(double)
-
setMinorTickSpacing
public void setMinorTickSpacing(double spacing)
Set minor tick mark spacing. The number that is passed-in represents the distance, measured in values, between each minor tick mark. If you have a ScalarMap with a range from 0 to 50 and the minor tick spacing is set to 10, you will get minor ticks next to the following values: 0, 10, 20, 30, 40, 50. This value will always be used unless you callsetAutoComputeTickswith atruevalue.- Parameters:
spacing- spacing between minor tick marks (must be > 0)- See Also:
getMinorTickSpacing(),setAutoComputeTicks(boolean)
-
getMinorTickSpacing
public double getMinorTickSpacing()
This method returns the minor tick spacing. The number that is returned represents the distance, measured in values, between each minor tick mark.- Returns:
- the number of values between minor ticks
- See Also:
setMinorTickSpacing(double)
-
setAutoComputeTicks
public void setAutoComputeTicks(boolean b)
Allow the AxisScale to automatically compute the desired majorTickSpacing based on the range of the ScalarMap.- Parameters:
b- if true, have majorTickSpacing automatically computed.
-
createStandardLabels
public void createStandardLabels(double max, double min, double base, double increment)Creates a hashtable that will draw text labels starting at the starting point specified using the increment field. If you call createStandardLabels(100, 0, 2.0, 10.0), then it will make labels for the values 2, 12, 22, 32, etc.- Throws:
java.lang.IllegalArgumentException- if min > max, or increment is greater than max-min- See Also:
setLabelTable(java.util.Hashtable)
-
setLabelTable
public void setLabelTable(java.util.Hashtable labels) throws VisADExceptionUsed to specify what label will be drawn at any given value. The key-value pairs are of this format: { Double value, java.lang.String}- Parameters:
labels- map of value/label pairs- Throws:
VisADException- invalid hashtable- See Also:
getLabelTable()
-
getLabelTable
public java.util.Hashtable getLabelTable()
Get the Hashtable used for labels
-
setFont
public void setFont(java.awt.Font font)
Set the font used for rendering the labels- Parameters:
font- new font to use
-
setFont
public void setFont(HersheyFont font)
Set the font used for rendering the labels- Parameters:
font- new font to use
-
getFont
public java.awt.Font getFont()
Get the font used for rendering the labels- Returns:
- font use or null if using default text plot
-
setBaseLineVisible
public void setBaseLineVisible(boolean visible)
Set visibility of base line.- Parameters:
visible- true to display (default), false to turn off
-
getBaseLineVisible
public boolean getBaseLineVisible()
Determine whether the base line for the scale should be visible- Returns:
- true if line is visible, otherwise false;
-
setSnapToBox
public void setSnapToBox(boolean b)
Toggle whether the scale is along the box edge or not- Parameters:
b- true to snap to the box
-
getSnapToBox
public boolean getSnapToBox()
Determine whether this property is set.- Returns:
- true if property is set, otherwise false;
-
setLabelSize
public void setLabelSize(int size)
Sets the size of the labels. You can use this to change the label size when aFontis not being used. If aFontis being used and you call setLabelSize(), a newFontis created using the oldFontname and style, but with the new size.- Parameters:
size- font size to use- See Also:
setFont(java.awt.Font)
-
getLabelSize
public int getLabelSize()
Gets the size of the labels.- Returns:
- relative size of labels
-
setTickBase
public void setTickBase(double base)
Sets the base value for tick marks. This only applies whensetMajorTickSpacingorsetMinorTickSpacinghave been called.- Parameters:
base- base value for drawing tick marks. For example, if your scale ranges from -4 to 18 and you set the major tick spacing to 5, you will get ticks at -4, 1, 6, 11, and 16 by default. If you set the tick base value to 0, you will get ticks at 0, 5, 10, 15.
-
setSide
public void setSide(int side)
Set side for axis (PRIMARY, SECONDARY)- Parameters:
side- side for axis to appear on
-
getSide
public int getSide()
Get the alignment for the axis- Returns:
- axis alignment (PRIMARY or SECONDARY)
-
setTickOrientation
public void setTickOrientation(int orient)
Set orientation of tick marks along the axis line.- Parameters:
orient- (PRIMARY or SECONDARY)
-
getTickOrientation
public int getTickOrientation()
Get the orientation for the ticks along the axis- Returns:
- tick orientation (PRIMARY or SECONDARY)
-
setNumberFormat
public void setNumberFormat(java.text.NumberFormat format)
Set the formatting for all labels- Parameters:
format- format string
-
getNumberFormat
public java.text.NumberFormat getNumberFormat()
Get the formatting for labels. May be null (if not set)- Returns:
- format used for labeling
-
setVisible
public void setVisible(boolean visible)
Set the visibility of the AxisScale- Parameters:
visible- true to display the AxisScale
-
isVisible
public boolean isVisible()
Get the visibility of the AxisScale- Returns:
- true if AxisScale is being rendered
-
setGridLinesVisible
public void setGridLinesVisible(boolean show)
Set the visibility of the grid lines; Grid lines are placed at major tick marks.- Parameters:
show- true to display the grid lines
-
getGridLinesVisible
public boolean getGridLinesVisible()
Get the visibility of the grid lines- Returns:
- true if grid lines are being rendered
-
setLabelBothSides
public void setLabelBothSides(boolean both)
Set whether both sides are labeled.- Parameters:
both- true to label both sides
-
getLabelBothSides
public boolean getLabelBothSides()
See if both sides are labeled- Returns:
- true if labelling is on both sides
-
setTicksVisible
public void setTicksVisible(boolean visible)
Set whether ticks are visible- Parameters:
visible- true to show ticks
-
getTicksVisible
public boolean getTicksVisible()
See if ticks are visible- Returns:
- true if labeling is on both sides
-
setLabelAllTicks
public void setLabelAllTicks(boolean labelAll)
Set whether all major ticks should be labeled. The default is to only label the first and last major tick. This setting is ignored if user labels are being used or if user manually callscreateStandardLabelsorsetLabelTable- Parameters:
labelAll- true to label all (major) ticks. Overridden- See Also:
getLabelAllTicks(),createStandardLabels(double, double, double, double),setLabelTable(Hashtable)
-
getLabelAllTicks
public boolean getLabelAllTicks()
Return whether all major ticks are to be labeled.- Returns:
- true if ticks are to be labeled.
-
isLabelRelief
public boolean isLabelRelief()
Checks if is label has relief.- Returns:
- true, if is label has relief
-
setLabelRelief
public void setLabelRelief(boolean labelRelief)
Sets the label relief.- Parameters:
labelRelief- the new label relief
-
-
DMelt 3.0 © DataMelt by jWork.ORG