Package ucar.unidata.util
Class ContourInfo
java.lang.Object
ucar.unidata.util.ContourInfo
A class to hold and transfer contour level settings, as to and from the
dialog box ContLevelDialog.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Dash-Dot linestatic final int
Dashed linestatic final boolean
Default contour dashing settingstatic final int
Default contour line stylestatic final boolean
Default contour color fill valuestatic final boolean
Default contour labeling settingstatic final boolean
Default contour labeling alignment settingstatic final int
Default label frequency (per qualifying contour line)static final int
Default label sizestatic final int
Default contour line widthstatic final int
Dotted line -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog using the default values.ContourInfo
(double interval, double base, double min, double max) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(double interval, double base, double min, double max, boolean labelOn, boolean dashOn) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(double interval, double base, double min, double max, boolean labelOn, boolean dashOn, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(float[] values) Create a ContourInfo from a float array.ContourInfo
(float interval, float base, float min, float max) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(float interval, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(float interval, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(String params) Create a contour info with the parameters encoded in the stringContourInfo
(String levelsString, double base, double min, double max, boolean labelOn, boolean dashOn, boolean isColorFilled, double width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle, int labelFreq, int labelLineSkip, int labelSize, Object font, boolean align) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.ContourInfo
(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle, int labelFreq, int labelSize, Object font, boolean align) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
asArray()
Return the contour parameters as an array.static String
cleanupUserLevelString
(String levelString) Clean up the user entered levels stringboolean
Get the label alignmentfloat
getBase()
Get the contour baseboolean
See if the base has been defined.float[]
Get the contour levels.float[]
getContourLevels
(String levelString) Get the contour levels from the given string.int
Get the dash styleboolean
Get the dashing flaggetFont()
Get the font.float
Get the contour intervalboolean
See if an interval has been defined.Get the interval as a string.getIntervalString
(boolean useDecimalFormat) Get the interval as a string.boolean
Get the color fill flag.boolean
Get the labelling flagint
Get the label frequency.int
int
Get the label (font) size.Get the contour interval stringint
Get the line width.float
getMax()
Get the contour maximumboolean
See if the max has been defined.float
getMin()
Get the contour minimumboolean
See if the min has been defined.boolean
See if this has been definedstatic boolean
isIrregularInterval
(String intervalString) See if a levelsString is an regular or an irregular interval.void
processParamString
(String params) Process the params string.void
set
(ContourInfo that) Set the contour parameters for this from another contour info.void
setAlignLabels
(boolean align) Set the label alignment.void
setBase
(float v) Set the contour basevoid
setDashedStyle
(int v) Set the dash stylevoid
setDashOn
(boolean v) Set the dashing flagvoid
Set the font.void
setIfDefined
(ContourInfo that) Set the parameters if they are defined in the other.void
setInterval
(float v) Set the contour intervalvoid
setIsFilled
(boolean fill) Set the color fill flagvoid
setIsLabeled
(boolean v) Set the labelling flagvoid
setLabelFreq
(int freq) Get the label frequencyvoid
setLabelLineSkip
(int labelLineSkip) void
setLabelSize
(int size) Get the label (font) sizevoid
Set the irregular contour intervals stringvoid
setLineWidth
(int width) Set the line width.void
setMax
(float v) Set the contour maximumvoid
setMin
(float v) Set the contour minimumtoString()
Return a String representation of this objectvoid
Tweak the interval for dashing.
-
Field Details
-
DEFAULT_LABEL
public static final boolean DEFAULT_LABELDefault contour labeling setting- See Also:
-
DEFAULT_LABEL_ALIGNMENT
public static final boolean DEFAULT_LABEL_ALIGNMENTDefault contour labeling alignment setting- See Also:
-
DEFAULT_DASH
public static final boolean DEFAULT_DASHDefault contour dashing setting- See Also:
-
DEFAULT_FILL
public static final boolean DEFAULT_FILLDefault contour color fill value- See Also:
-
DEFAULT_LINE_WIDTH
public static final int DEFAULT_LINE_WIDTHDefault contour line width- See Also:
-
DASH_STYLE
public static final int DASH_STYLEDashed line- See Also:
-
DOT_STYLE
public static final int DOT_STYLEDotted line- See Also:
-
DASH_DOT_STYLE
public static final int DASH_DOT_STYLEDash-Dot line- See Also:
-
DEFAULT_DASHED_STYLE
public static final int DEFAULT_DASHED_STYLEDefault contour line style- See Also:
-
DEFAULT_LABEL_SIZE
public static final int DEFAULT_LABEL_SIZEDefault label size- See Also:
-
DEFAULT_LABEL_FREQ
public static final int DEFAULT_LABEL_FREQDefault label frequency (per qualifying contour line)- See Also:
-
-
Constructor Details
-
ContourInfo
public ContourInfo(float interval, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contours
-
ContourInfo
public ContourInfo(float interval, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line width
-
ContourInfo
public ContourInfo(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
levelsString
- the contour levels as a stringbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line width
-
ContourInfo
public ContourInfo(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
levelsString
- the contour levels as a stringbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line widthdashedStyle
- dashedStyle;
-
ContourInfo
public ContourInfo(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle, int labelFreq, int labelSize, Object font, boolean align) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
levelsString
- the contour levels as a stringbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line widthdashedStyle
- dashedStylelabelFreq
- how many times to label each linelabelSize
- the label (font) sizefont
- the font - Font or HersheyFontalign
- the label alignment - true to be along contours
-
ContourInfo
public ContourInfo(String levelsString, float base, float min, float max, boolean labelOn, boolean dashOn, boolean isColorFilled, int width, int dashedStyle, int labelFreq, int labelLineSkip, int labelSize, Object font, boolean align) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
levelsString
- the contour levels as a stringbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line widthdashedStyle
- dashedStylelabelFreq
- how many times to label each linelabelLineSkip
- label every Nth linelabelSize
- the label (font) sizefont
- the font - Font or HersheyFontalign
- the label alignment - true to be along contours
-
ContourInfo
public ContourInfo()Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog using the default values. -
ContourInfo
public ContourInfo(double interval, double base, double min, double max) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of same
-
ContourInfo
public ContourInfo(double interval, double base, double min, double max, boolean labelOn, boolean dashOn) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or not
-
ContourInfo
public ContourInfo(String levelsString, double base, double min, double max, boolean labelOn, boolean dashOn, boolean isColorFilled, double width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
levelsString
- the contour levels as a stringbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notisColorFilled
- flag for color filling contourswidth
- line width
-
ContourInfo
public ContourInfo(double interval, double base, double min, double max, boolean labelOn, boolean dashOn, int width) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of samelabelOn
- whether labels aredashOn
- whether lines below base value are dashed or notwidth
- line width
-
ContourInfo
public ContourInfo(float interval, float base, float min, float max) Construct an object to hold and transfer contour level settings, such as to and from the dialog box ContLevelDialog.- Parameters:
interval
- the contour intervalbase
- the contour level below which one line must havemin
- the lower limit of plotted contour valuesmax
- the upper limit of same
-
ContourInfo
Copy constructor.- Parameters:
s
- ContourInfo to copy.
-
ContourInfo
public ContourInfo(float[] values) Create a ContourInfo from a float array.- Parameters:
values
- contour values (interval, base, min, max)
-
ContourInfo
Create a contour info with the parameters encoded in the string- Parameters:
params
- The string params
-
-
Method Details
-
processParamString
Process the params string. It can either be of the form:&interval;base;min;max;
or made up of any combination of name=value pairs. e.g.:
interval=10;min=5;max=100;base=15;dashed=true;labels=false;
- Parameters:
params
- The string params
-
isDefined
public boolean isDefined()See if this has been defined- Returns:
- true if int/max/min/base values have been set
-
getIntervalDefined
public boolean getIntervalDefined()See if an interval has been defined.- Returns:
- true if the interval is not a NaN
-
getBaseDefined
public boolean getBaseDefined()See if the base has been defined.- Returns:
- true if the base is not a NaN
-
getMinDefined
public boolean getMinDefined()See if the min has been defined.- Returns:
- true if the min is not a NaN
-
getMaxDefined
public boolean getMaxDefined()See if the max has been defined.- Returns:
- true if the max is not a NaN
-
getInterval
public float getInterval()Get the contour interval- Returns:
- the contour interval
-
getBase
public float getBase()Get the contour base- Returns:
- the contour base
-
getMin
public float getMin()Get the contour minimum- Returns:
- the contour minimum
-
getMax
public float getMax()Get the contour maximum- Returns:
- the contour maximum
-
setIsLabeled
public void setIsLabeled(boolean v) Set the labelling flag- Parameters:
v
- true to label
-
getIsLabeled
public boolean getIsLabeled()Get the labelling flag- Returns:
- true if labeled
-
setDashOn
public void setDashOn(boolean v) Set the dashing flag- Parameters:
v
- true to dash
-
getDashOn
public boolean getDashOn()Get the dashing flag- Returns:
- true to dash
-
setInterval
public void setInterval(float v) Set the contour interval- Parameters:
v
- new interval
-
setLevelsString
Set the irregular contour intervals string- Parameters:
v
- new interval string
-
getLevelsString
Get the contour interval string- Returns:
- a string representation of the levels in this
-
setBase
public void setBase(float v) Set the contour base- Parameters:
v
- new base
-
setMin
public void setMin(float v) Set the contour minimum- Parameters:
v
- new minimum
-
setMax
public void setMax(float v) Set the contour maximum- Parameters:
v
- new maximum
-
set
Set the contour parameters for this from another contour info.- Parameters:
that
- other ContourInfo
-
setIfDefined
Set the parameters if they are defined in the other.- Parameters:
that
- other to use
-
asArray
public float[] asArray()Return the contour parameters as an array.- Returns:
- contour values (interval, base, min, max)
-
tweakIntervalForDash
public void tweakIntervalForDash()Tweak the interval for dashing. -
getIntervalString
Get the interval as a string. If interval is undefined, return the levelsString.- Returns:
- interval as String in Locale format or levelsString.
-
getIntervalString
Get the interval as a string. If interval is undefined, return the levelsString.- Parameters:
useDecimalFormat
- format as decimal for XML storage- Returns:
- interval as String or levelsString.
-
toString
Return a String representation of this object -
setIsFilled
public void setIsFilled(boolean fill) Set the color fill flag- Parameters:
fill
- true to color fill
-
getIsFilled
public boolean getIsFilled()Get the color fill flag.- Returns:
- true to color fill
-
setLineWidth
public void setLineWidth(int width) Set the line width.- Parameters:
width
- line width (pixels)
-
getLineWidth
public int getLineWidth()Get the line width.- Returns:
- line width (pixels)
-
setDashedStyle
public void setDashedStyle(int v) Set the dash style- Parameters:
v
- new dash style
-
getDashedStyle
public int getDashedStyle()Get the dash style- Returns:
- dash style
-
getContourLevels
public float[] getContourLevels()Get the contour levels. If setLevels has been called with a non-null array, that array is returned, otherwise, levels are calculated from the interval, max, min and base.- Returns:
- the contour levels
-
getContourLevels
Get the contour levels from the given string.- Parameters:
levelString
- string representation of the levels- Returns:
- the contour levels
-
getLabelFreq
public int getLabelFreq()Get the label frequency.- Returns:
- the label frequency
-
setLabelFreq
public void setLabelFreq(int freq) Get the label frequency- Parameters:
freq
- the label frequency
-
getLabelLineSkip
public int getLabelLineSkip()- Returns:
- the labelLineSkip
-
setLabelLineSkip
public void setLabelLineSkip(int labelLineSkip) - Parameters:
labelLineSkip
- the labelLineSkip to set
-
getLabelSize
public int getLabelSize()Get the label (font) size.- Returns:
- the label (font) size
-
setLabelSize
public void setLabelSize(int size) Get the label (font) size- Parameters:
size
- the label (font) size
-
getFont
Get the font.- Returns:
- the font - null, Font, or HersheyFont
-
setFont
Set the font.- Parameters:
font
- the font to set - must be a Font or HersheyFont
-
getAlignLabels
public boolean getAlignLabels()Get the label alignment- Returns:
- true for along contours
-
setAlignLabels
public void setAlignLabels(boolean align) Set the label alignment.- Parameters:
align
- - true for along contours
-
cleanupUserLevelString
Clean up the user entered levels string- Parameters:
levelString
- string representation of the levels- Returns:
- The level string un-localized
-
isIrregularInterval
See if a levelsString is an regular or an irregular interval.- Parameters:
intervalString
- to check- Returns:
- true if this is not a regular interval (single value)
-