Class ContourInfo

java.lang.Object
ucar.unidata.util.ContourInfo

public class ContourInfo extends Object
A class to hold and transfer contour level settings, as to and from the dialog box ContLevelDialog.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Dash-Dot line
    static final int
    Dashed line
    static final boolean
    Default contour dashing setting
    static final int
    Default contour line style
    static final boolean
    Default contour color fill value
    static final boolean
    Default contour labeling setting
    static final boolean
    Default contour labeling alignment setting
    static final int
    Default label frequency (per qualifying contour line)
    static final int
    Default label size
    static final int
    Default contour line width
    static final int
    Dotted line
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct 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.
    Create a contour info with the parameters encoded in the string
    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.
    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 Type
    Method
    Description
    float[]
    Return the contour parameters as an array.
    static String
    Clean up the user entered levels string
    boolean
    Get the label alignment
    float
    Get the contour base
    boolean
    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 style
    boolean
    Get the dashing flag
    Get the font.
    float
    Get the contour interval
    boolean
    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 flag
    int
    Get the label frequency.
    int
     
    int
    Get the label (font) size.
    Get the contour interval string
    int
    Get the line width.
    float
    Get the contour maximum
    boolean
    See if the max has been defined.
    float
    Get the contour minimum
    boolean
    See if the min has been defined.
    boolean
    See if this has been defined
    static boolean
    isIrregularInterval(String intervalString)
    See if a levelsString is an regular or an irregular interval.
    void
    Process the params string.
    void
    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 base
    void
    Set the dash style
    void
    setDashOn(boolean v)
    Set the dashing flag
    void
    Set the font.
    void
    Set the parameters if they are defined in the other.
    void
    setInterval(float v)
    Set the contour interval
    void
    setIsFilled(boolean fill)
    Set the color fill flag
    void
    setIsLabeled(boolean v)
    Set the labelling flag
    void
    setLabelFreq(int freq)
    Get the label frequency
    void
    setLabelLineSkip(int labelLineSkip)
     
    void
    setLabelSize(int size)
    Get the label (font) size
    void
    Set the irregular contour intervals string
    void
    setLineWidth(int width)
    Set the line width.
    void
    setMax(float v)
    Set the contour maximum
    void
    setMin(float v)
    Set the contour minimum
    Return a String representation of this object
    void
    Tweak the interval for dashing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_LABEL

      public static final boolean DEFAULT_LABEL
      Default contour labeling setting
      See Also:
    • DEFAULT_LABEL_ALIGNMENT

      public static final boolean DEFAULT_LABEL_ALIGNMENT
      Default contour labeling alignment setting
      See Also:
    • DEFAULT_DASH

      public static final boolean DEFAULT_DASH
      Default contour dashing setting
      See Also:
    • DEFAULT_FILL

      public static final boolean DEFAULT_FILL
      Default contour color fill value
      See Also:
    • DEFAULT_LINE_WIDTH

      public static final int DEFAULT_LINE_WIDTH
      Default contour line width
      See Also:
    • DASH_STYLE

      public static final int DASH_STYLE
      Dashed line
      See Also:
    • DOT_STYLE

      public static final int DOT_STYLE
      Dotted line
      See Also:
    • DASH_DOT_STYLE

      public static final int DASH_DOT_STYLE
      Dash-Dot line
      See Also:
    • DEFAULT_DASHED_STYLE

      public static final int DEFAULT_DASHED_STYLE
      Default contour line style
      See Also:
    • DEFAULT_LABEL_SIZE

      public static final int DEFAULT_LABEL_SIZE
      Default label size
      See Also:
    • DEFAULT_LABEL_FREQ

      public static final int DEFAULT_LABEL_FREQ
      Default 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - 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 string
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - 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 string
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - line width
      dashedStyle - 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 string
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - line width
      dashedStyle - dashedStyle
      labelFreq - how many times to label each line
      labelSize - the label (font) size
      font - the font - Font or HersheyFont
      align - 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 string
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - line width
      dashedStyle - dashedStyle
      labelFreq - how many times to label each line
      labelLineSkip - label every Nth line
      labelSize - the label (font) size
      font - the font - Font or HersheyFont
      align - 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - 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 string
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      isColorFilled - flag for color filling contours
      width - 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
      labelOn - whether labels are
      dashOn - whether lines below base value are dashed or not
      width - 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 interval
      base - the contour level below which one line must have
      min - the lower limit of plotted contour values
      max - the upper limit of same
    • ContourInfo

      public ContourInfo(ContourInfo s)
      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

      public ContourInfo(String params)
      Create a contour info with the parameters encoded in the string
      Parameters:
      params - The string params
  • Method Details

    • processParamString

      public void processParamString(String params)
      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

      public void setLevelsString(String v)
      Set the irregular contour intervals string
      Parameters:
      v - new interval string
    • getLevelsString

      public 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

      public void set(ContourInfo that)
      Set the contour parameters for this from another contour info.
      Parameters:
      that - other ContourInfo
    • setIfDefined

      public void setIfDefined(ContourInfo that)
      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

      public String getIntervalString()
      Get the interval as a string. If interval is undefined, return the levelsString.
      Returns:
      interval as String in Locale format or levelsString.
    • getIntervalString

      public String getIntervalString(boolean useDecimalFormat)
      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

      public String toString()
      Return a String representation of this object
      Overrides:
      toString in class Object
      Returns:
      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

      public float[] getContourLevels(String levelString)
      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

      public Object getFont()
      Get the font.
      Returns:
      the font - null, Font, or HersheyFont
    • setFont

      public void setFont(Object font)
      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

      public static String cleanupUserLevelString(String levelString)
      Clean up the user entered levels string
      Parameters:
      levelString - string representation of the levels
      Returns:
      The level string un-localized
    • isIrregularInterval

      public static boolean isIrregularInterval(String intervalString)
      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)