Package hec.geometry
Class Axis
java.lang.Object
java.util.Observable
hec.geometry.Axis
- All Implemented Interfaces:
AdjustmentListener
,Serializable
,EventListener
- Direct Known Subclasses:
CategoryAxis
,LogAxis
,ProbabilityAxis
,TSAxis
A single coordinate axis.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AxisProp
axis properties used during construction and initializationstatic final int
static final String
protected static final boolean
static final double
static final double
static final String
static final int
linar axis typestatic final int
Logarithmic axis typeprotected Vector
Meant to be a copy of the observer list, because we need to be able to transfer an observer list from on axis to another and there is now way to get at the list because it is privatestatic final String
static final int
static final int
modified time axis type.static final int
time axis typestatic final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
protected void
void
Find a nice tic intervalvoid
void
computeScaling
(double min, double max) computes the scaling based on the min and max values in world coordinatesvoid
computeScaling
(int iview) int
Computes an integer value based on the max/min and the current view max/min that represents a position on a scroll barvoid
Find a nice tic intervalvoid
void
double
double
double
Returns the maximum data value for the axis.double
Returns the minimum data value for the axis.int
getDisplayUnitsString
(int system) int
getLabel()
double
double
getMax()
Returns the maximum value for this axis.double
getMin()
double
getName()
int
int
double
int
protected double
getRatedValue
(double baseValue) boolean
double
double
int
double
double
get the color of the ticsget the color of the tics as a Stringget the tic text colorget the tic text color as a Stringint
getType()
protected double
getUnRatedValue
(double ratedValue) double
double
double
double
getZoom()
void
growToGlyphBounds
(double min, double max) void
growWorldExtents
(double min, double max) void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
get whether this Axis is using it's default limitsdouble
l2w
(int l) returns the world value for the given local valuedouble
l2wE
(double l) returns the world value for the given local valuevoid
popLabel()
void
boolean
rateAxis()
void
setActualMaximumValue
(double value) set the actual maximum value for this Axis to valuevoid
setActualMinimumValue
(double value) set the actual minimum value for this Axis to valuevoid
set the Axis to use the user supplied maximum valuevoid
set the Axis to use the maximum value from it's DataSetsvoid
set the Axis to use the user supplied minimum valuevoid
set the Axis to use the minimum value from it's DataSetsvoid
void
void
void
void
setAxisProp
(AxisProp prop) void
setComputeMajorTics
(boolean state) void
Deprecated.void
Deprecated.void
setComputeMinorTics
(boolean state) void
Deprecated.void
Deprecated.void
setDataUnitSystem
(int system) protected void
setDefaultExtents
(double min, double max) void
setDisplayScaleFactor
(int paramId, double scale) void
setDisplayUnitSystem
(int system) void
void
setMajorTicInterval
(double interval) set the major tic interval for this Axis to intervalvoid
setMaximumFactionDigits
(int numDigits) void
setMaximumLimit
(double max) set the maximum limit for this Axis to maxvoid
setMinimumLimit
(double min) set the minimum limit for this Axis to minvoid
setMinMax
(double min, double max) void
setMinorTicInterval
(double interval) set the minor tic interval for this Axis to intervalvoid
void
setNumberOfTicLabelLayers
(int layers) set the numver of tic label layers to layers max number of tic label layers.void
setNumTicLabelLevels
(int r) void
setOrigin
(double origin) void
setParameterId
(int id) void
Sets a rating function for the axis.void
setRatingFunction
(RatingFunction f, boolean axisObjectRating) Sets a rating function for the axis.void
setReversed
(boolean r) void
Deprecated.void
Deprecated.void
setScaleLimits
(double min, double max) void
setTicColor
(Color c) set the tic colorvoid
setTicColor
(String colorString) set the tic color to the color represented by colorStringvoid
set the tic text color to cvoid
setTicTextColor
(String colorString) set the tic text color to the color represented by colorStringvoid
void
set this Axis not to use defaults limitsvoid
set this Axis to use defaults limitsvoid
setViewLimits
(double min, double max) void
setWorldExtents
(double min, double max) void
setWorldMinExtent
(double min) void
unZoom()
void
updateRatedFunctionScroll
(Axis baseAxis, AdjustmentEvent e) int
w2l
(double w) returns the local value for the given world valuedouble
w2lE
(double w) returns the local value for the given world valuevoid
zoomByFactor
(double factor) Change the zoom scaling by the given factorvoid
zoomIn
(double wmin, double wmax) Zooms based on world coordinatesvoid
zoomIn
(int imin, int imax) Zooms in based on local coordinatesvoid
zoomInUnMod
(double wmin, double wmax) Zooms based on world coordinatesMethods inherited from class java.util.Observable
clearChanged, countObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Field Details
-
DEFAULT_AXIS_MAX
public static final double DEFAULT_AXIS_MAX- See Also:
-
DEFAULT_AXIS_MIN
public static final double DEFAULT_AXIS_MIN- See Also:
-
m_observerList
Meant to be a copy of the observer list, because we need to be able to transfer an observer list from on axis to another and there is now way to get at the list because it is private -
DEBUG
protected static final boolean DEBUG -
XAXIS
public static final int XAXIS- See Also:
-
YAXIS
public static final int YAXIS- See Also:
-
LINEAR
public static final int LINEARlinar axis type- See Also:
-
TIME
public static final int TIMEtime axis type- See Also:
-
SEASONAL
public static final int SEASONALmodified time axis type. HecTime.year()-1900- See Also:
-
LOGARITHMIC
public static final int LOGARITHMICLogarithmic axis type- See Also:
-
PROBABILITY
public static final int PROBABILITY- See Also:
-
CATEGORY
public static final int CATEGORY- See Also:
-
_axisProp
axis properties used during construction and initialization -
COMPUTED_SCALE
- See Also:
-
NEW_ZOOM
- See Also:
-
LABEL_CHANGE
- See Also:
-
-
Constructor Details
-
Axis
Default Constructor- Parameters:
n
-
-
-
Method Details
-
getType
public int getType() -
setMinMax
public void setMinMax(double min, double max) -
setScaleLimits
public void setScaleLimits(double min, double max) -
getOrigin
public double getOrigin() -
getScaleMin
public double getScaleMin() -
getScaleMax
public double getScaleMax() -
setViewLimits
public void setViewLimits(double min, double max) -
getViewMin
public double getViewMin() -
getViewMax
public double getViewMax() -
unZoom
public void unZoom() -
setRatingFunction
Sets a rating function for the axis. This value can be null to turn off axis rating.- Parameters:
f
- the function to set.
-
setRatingFunction
Sets a rating function for the axis. This value can be null to turn off axis rating.- Parameters:
f
- the function to set.axisObjectRating
- true if this rating function is based on exsiting data or false if it was user entered or another type of rating. Needed when saving properties because the next time around the rating be generated by the existing objects
-
getRatingFunction
-
rateAxis
public boolean rateAxis() -
getRatedValue
protected double getRatedValue(double baseValue) -
getUnRatedValue
protected double getUnRatedValue(double ratedValue) -
getObserverList
-
addObserver
- Overrides:
addObserver
in classObservable
-
deleteObserver
- Overrides:
deleteObserver
in classObservable
-
deleteObservers
public void deleteObservers()- Overrides:
deleteObservers
in classObservable
-
getOldDisplayUnitSystem
public int getOldDisplayUnitSystem() -
setDisplayUnitSystem
public void setDisplayUnitSystem(int system) -
setDataUnitSystem
public void setDataUnitSystem(int system) -
setParameterId
public void setParameterId(int id) -
setDisplayScaleFactor
public void setDisplayScaleFactor(int paramId, double scale) -
getDisplayUnitSystem
public int getDisplayUnitSystem() -
getDataUnitSystem
public int getDataUnitSystem() -
getParameterId
public int getParameterId() -
isReversed
public boolean isReversed() -
getDisplayUnitsString
-
setAxisProp
-
setDefaultExtents
protected void setDefaultExtents(double min, double max) -
getThousScale
public double getThousScale() -
getThousPow
public double getThousPow() -
getSigFig
public int getSigFig() -
setMaximumFactionDigits
public void setMaximumFactionDigits(int numDigits) -
computeScrollPosition
public int computeScrollPosition()Computes an integer value based on the max/min and the current view max/min that represents a position on a scroll bar- Returns:
-
adjustmentValueChanged
- Specified by:
adjustmentValueChanged
in interfaceAdjustmentListener
-
updateRatedFunctionScroll
-
zoomInUnMod
public void zoomInUnMod(double wmin, double wmax) Zooms based on world coordinates- Parameters:
wmin
-wmax
-
-
zoomIn
public void zoomIn(double wmin, double wmax) Zooms based on world coordinates- Parameters:
wmin
-wmax
-
-
zoomIn
public void zoomIn(int imin, int imax) Zooms in based on local coordinates- Parameters:
imin
-imax
-
-
zoomByFactor
public void zoomByFactor(double factor) Change the zoom scaling by the given factor- Parameters:
factor
-
-
computeAutoViewValues
protected void computeAutoViewValues() -
setReversedOn
Deprecated. -
setReversedOff
Deprecated. -
setReversed
public void setReversed(boolean r) -
getReversed
public boolean getReversed()- Returns:
- * @deprecated
-
setNumTicLabelLevels
public void setNumTicLabelLevels(int r) -
getNumTicLabelLevels
public int getNumTicLabelLevels() -
setLabel
-
getLabel
-
pushLabel
public void pushLabel() -
popLabel
public void popLabel() -
getName
-
setName
-
getScaledLabel
-
getZoom
public double getZoom() -
getWorldRange
public double getWorldRange() -
invalidateWorldExtents
public void invalidateWorldExtents() -
setWorldExtents
public void setWorldExtents(double min, double max) -
setWorldMinExtent
public void setWorldMinExtent(double min) -
growWorldExtents
public void growWorldExtents(double min, double max) -
getWorldExtents
-
getMin
public double getMin() -
getMax
public double getMax()Returns the maximum value for this axis. This differes from the data max because the data max may be 9.75 and the Axis displays a max value of 10.- Returns:
-
getDataMax
public double getDataMax()Returns the maximum data value for the axis.- Returns:
-
getDataMin
public double getDataMin()Returns the minimum data value for the axis.- Returns:
-
getActMin
public double getActMin() -
getActMax
public double getActMax() -
getMajorTic
public double getMajorTic() -
getMinorTic
public double getMinorTic() -
getAxisProp
-
computeScaling
public void computeScaling(double min, double max) computes the scaling based on the min and max values in world coordinates- Parameters:
min
-max
-
-
computeScaling
public void computeScaling() -
computeScaling
public void computeScaling(int iview) -
w2l
public int w2l(double w) returns the local value for the given world value- Parameters:
w
-- Returns:
-
w2lE
public double w2lE(double w) returns the local value for the given world value- Parameters:
w
-- Returns:
-
l2w
public double l2w(int l) returns the world value for the given local value- Parameters:
l
-- Returns:
-
l2wE
public double l2wE(double l) returns the world value for the given local value- Parameters:
l
-- Returns:
-
computeNiceMinMax
public void computeNiceMinMax()Find a nice tic interval -
computeTicInterval
public void computeTicInterval()Find a nice tic interval -
getTicColor
get the color of the tics- Returns:
- the tic color
-
getTicColorString
get the color of the tics as a String- Returns:
- the tic color string
-
setTicColor
set the tic color to the color represented by colorString- Parameters:
colorString
- the color to set the tics to
-
setTicColor
set the tic color- Parameters:
c
- the new tic color
-
getTicTextColor
get the tic text color- Returns:
- the tic text color
-
getTicTextColorString
get the tic text color as a String- Returns:
- the tic text color String
-
setTicTextColor
set the tic text color to the color represented by colorString- Parameters:
colorString
- the color to set the tic text to
-
setTicTextColor
set the tic text color to c- Parameters:
c
- the new tic text color
-
setUseDefaultLimitsOn
public void setUseDefaultLimitsOn()set this Axis to use defaults limits -
setUseDefaultLimitsOff
public void setUseDefaultLimitsOff()set this Axis not to use defaults limits -
isUsingDefaultLimits
public boolean isUsingDefaultLimits()get whether this Axis is using it's default limits- Returns:
-
setMinimumLimit
public void setMinimumLimit(double min) set the minimum limit for this Axis to min- Parameters:
min
- the new minimum limit
-
setMaximumLimit
public void setMaximumLimit(double max) set the maximum limit for this Axis to max- Parameters:
max
- the new maximum limit- See Also:
-
setMajorTicInterval
public void setMajorTicInterval(double interval) set the major tic interval for this Axis to interval- Parameters:
interval
- the new major tic interval- See Also:
-
setMinorTicInterval
public void setMinorTicInterval(double interval) set the minor tic interval for this Axis to interval- Parameters:
interval
- the new minor tic interval- See Also:
-
setNumberOfTicLabelLayers
public void setNumberOfTicLabelLayers(int layers) set the numver of tic label layers to layers max number of tic label layers. -1 is unrestricted. Most important for time series axis.- Parameters:
layers
- the number of tic label layers- See Also:
-
setActualMaximumValue
public void setActualMaximumValue(double value) set the actual maximum value for this Axis to value- Parameters:
value
- the new maximum value- See Also:
-
setOrigin
public void setOrigin(double origin) -
setActualMinimumValue
public void setActualMinimumValue(double value) set the actual minimum value for this Axis to value- Parameters:
value
- the new minimum value- See Also:
-
setAutomaticMaximumOn
public void setAutomaticMaximumOn()set the Axis to use the maximum value from it's DataSets- See Also:
-
setAutomaticMaximumOff
public void setAutomaticMaximumOff()set the Axis to use the user supplied maximum value- See Also:
-
setAutomaticMinimumOn
public void setAutomaticMinimumOn()set the Axis to use the minimum value from it's DataSets- See Also:
-
isUsingAutomaticMinimum
public boolean isUsingAutomaticMinimum() -
setAutomaticMinimumOff
public void setAutomaticMinimumOff()set the Axis to use the user supplied minimum value- See Also:
-
setAutomaticViewMaximumOn
public void setAutomaticViewMaximumOn() -
isUsingAutomaticMaximum
public boolean isUsingAutomaticMaximum() -
setAutomaticViewMaximumOff
public void setAutomaticViewMaximumOff() -
isUsingAutomaticViewMaximum
public boolean isUsingAutomaticViewMaximum() -
setAutomaticViewMinimumOn
public void setAutomaticViewMinimumOn() -
setAutomaticViewMinimumOff
public void setAutomaticViewMinimumOff() -
isUsingAutomaticViewMinimum
public boolean isUsingAutomaticViewMinimum() -
setComputeMajorTics
public void setComputeMajorTics(boolean state) - Parameters:
state
- true to autocompute tics- See Also:
-
setComputeMajorTicsOn
Deprecated. -
setComputeMajorTicsOff
Deprecated. -
isComputingMajorTics
public boolean isComputingMajorTics() -
setComputeMinorTics
public void setComputeMinorTics(boolean state) - Parameters:
state
-- See Also:
-
setComputeMinorTicsOn
Deprecated. -
setComputeMinorTicsOff
Deprecated. -
isComputingMinorTics
public boolean isComputingMinorTics() -
growToGlyphBounds
public void growToGlyphBounds(double min, double max) -
setUnit
-