JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class JCContourLevels

java.lang.Object
  |
  +--com.klg.jclass.chart3d.ParentTrackChange
        |
        +--com.klg.jclass.chart3d.ParentFormatter
              |
              +--com.klg.jclass.chart3d.JCContourLevels
All Implemented Interfaces:
Serializable

public class JCContourLevels
extends ParentFormatter

This object deals with contour levels(distribution table). It calculates default levels (if isDefault is true), but also allows the user to set their own levels.

See Also:
Serialized Form

Field Summary
static int DEFAULT_NUM_LEVELS
          The default number of contour levels.
protected  boolean isDefault
          Asks if linear contour levels are generated automatically (based on numLevels).
protected  double[] levels
          A strictly increasing array of contour levels.
protected  double max
          The contour minimum, calculated from the data.
protected  double min
          The contour minimum, calculated from the data.
protected  int numLevels
          The number of contour levels.
protected  int numLevelsInternal
           
 
Fields inherited from class com.klg.jclass.chart3d.ParentFormatter
decimalPadded, groupingUsed, nFrac, numberLocalization
 
Fields inherited from class com.klg.jclass.chart3d.ParentTrackChange
parents
 
Constructor Summary
JCContourLevels()
          No args constructor.
JCContourLevels(double[] levels)
          Constructor that sets the contour levels array.
JCContourLevels(int numLevels)
          Constructor that sets the number of levels.
 
Method Summary
 void addLevel(double value)
          Adds a level at the given value.
protected  void calcLevels()
          Cacluates default contour levels.
protected  void calcLimits(com.klg.jclass.chart3d.Chart3dDataView dataView, com.klg.jclass.chart3d.Chart3dGridData elevationData, com.klg.jclass.chart3d.Chart3dGridData zoneData)
          Computes the contour limits (from the data).
 int getLevelFromValue(double value)
          Calculates the contour level for this value.
 double[] getLevels()
          Returns the current contour levels array (distribution table).
 double getMax()
          Returns the contour max.
 double getMin()
          Returns the contour min.
 int getNumLevels()
          Returns the current number of levels property as specified by the user.
 int getNumLevelsInternal()
          Returns the actual number of levels used.
 boolean isDefault()
          Are default distribution levels being used? This value defaults to true, but is automatically set to false if the user sets the levels array, or calls methods addLevel() or removeLevel().
 void removeLevel(double value)
          Removes the level closest to the give value.
 void removeLevel(int level)
          Removes the level at index level.
 void setDefault(boolean isDefault)
          Sets the isDefault flag.
 void setLevels(double[] levels)
          Sets a new levels array.
 void setNumLevels(int numLevels)
          Sets the current number of levels.
 
Methods inherited from class com.klg.jclass.chart3d.ParentFormatter
getGroupingUsed, getNFrac, getNumberFormatter, getNumberLocalization, isDecimalPadded, setDecimalPadded, setGroupingUsed, setNFrac, setNumberFormatterLocale, setNumberLocalization
 
Methods inherited from class com.klg.jclass.chart3d.ParentTrackChange
addParent, clearParents, removeParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUM_LEVELS

public static final int DEFAULT_NUM_LEVELS
The default number of contour levels.

See Also:
Constant Field Values

isDefault

protected boolean isDefault
Asks if linear contour levels are generated automatically (based on numLevels).


levels

protected double[] levels
A strictly increasing array of contour levels.


numLevels

protected int numLevels
The number of contour levels. Must be non-negative.


numLevelsInternal

protected int numLevelsInternal

min

protected double min
The contour minimum, calculated from the data.


max

protected double max
The contour minimum, calculated from the data.

Constructor Detail

JCContourLevels

public JCContourLevels()
No args constructor. Values at default.


JCContourLevels

public JCContourLevels(int numLevels)
Constructor that sets the number of levels.

Parameters:
numLevels - the number of contour levels

JCContourLevels

public JCContourLevels(double[] levels)
Constructor that sets the contour levels array. The isDefault flag is set to false.

Parameters:
levels - a strictly increasing array of contour levels
Method Detail

getLevels

public double[] getLevels()
Returns the current contour levels array (distribution table).

Returns:
an array of doubles the determine the contour levels

setLevels

public void setLevels(double[] levels)
Sets a new levels array. This has a side effect of turning isDefault to false. Also, numLevels will be adjusted to be the size of the inputted array.
Note: It is assumed that the new levels array is sorted in increasing order without duplicate values.

Parameters:
levels - the new set of contour levels

getNumLevelsInternal

public int getNumLevelsInternal()
Returns the actual number of levels used. This may be different from the number of levels specified by the user if isDefault is false. In this case the actual number of levels used is the size of the specified levels array.

Returns:
the current number of levels actually used

getNumLevels

public int getNumLevels()
Returns the current number of levels property as specified by the user. This value is ignored if isDefault is false.

Returns:
the current number of levels

setNumLevels

public void setNumLevels(int numLevels)
Sets the current number of levels.
Note: numLevels is ignored if isDefault is false (with actual value used equal to the size of the levels array). Also note that numLevels must be non-negative.

Parameters:
numLevels - the new number of contour levels

isDefault

public boolean isDefault()
Are default distribution levels being used? This value defaults to true, but is automatically set to false if the user sets the levels array, or calls methods addLevel() or removeLevel().

Returns:
Are default distribution levels being used?

setDefault

public void setDefault(boolean isDefault)
Sets the isDefault flag. If set to true, JClass Chart 3D will automatically calculate a default set of levels based on the numLevels property. If set to false, the current levels array is used and numLevels becomes read-only.

Parameters:
isDefault - the new value os the isDefault flag

getMin

public double getMin()
Returns the contour min.

Returns:
the current contour min

getMax

public double getMax()
Returns the contour max.

Returns:
the current contour max

addLevel

public void addLevel(double value)
Adds a level at the given value. The value will be added into the sorted levels array. Calling this method has the side effect of setting isDefault to false.

Parameters:
value - the new contour level value

removeLevel

public void removeLevel(int level)
Removes the level at index level. Calling this method has the side effect of setting isDefault to false.

Parameters:
level - the level number to be removed

removeLevel

public void removeLevel(double value)
Removes the level closest to the give value. Calling this method has the side effect of setting isDefault to false.

Parameters:
value - the value that determines which level to remove

getLevelFromValue

public int getLevelFromValue(double value)
Calculates the contour level for this value.

Note: A value between 0 and numLevels (inclusive - there should be one more contourStyle than contour level) is returned.

Parameters:
value - the data value from which a contour level is calculated
Returns:

calcLimits

protected void calcLimits(com.klg.jclass.chart3d.Chart3dDataView dataView,
                          com.klg.jclass.chart3d.Chart3dGridData elevationData,
                          com.klg.jclass.chart3d.Chart3dGridData zoneData)
Computes the contour limits (from the data).

Parameters:
dataView - the dataView for which to calculated the contour limits
elevationData - the elevation data to use to calculate the contour limits
zoneData - the zone data to use to calculate the contour limits

calcLevels

protected void calcLevels()
Cacluates default contour levels.


Copyright © 2004 Quest Software Inc..
All rights reserved.