gov.noaa.pmel.sgt
Interface TimeAxisStyle


public interface TimeAxisStyle

TimeAxisStyle defines an interface to create a specific time axis style. Currently there are five time axes styles, MINUTE_HOUR, HOUR_DAY, DAY_MONTH, MONTH_YEAR, and YEAR_DECADE. All time axes have two labeling levels, minor and major. For example, DAY_MONTH style has a minor level of days and a major level of months.

Since:
1.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
TimeAxis

Method Summary
 void computeDefaults(GeoDate delta)
          Determine the minor label interval from the time extent of the axis.
 double computeLocation(double prev, double now)
          Determines the location of the minor time label.
 java.lang.String getDefaultMajorLabelFormat()
          Get the default major label format.
 int getDefaultMajorLabelInterval()
          Get the default major label interval.
 java.lang.String getDefaultMinorLabelFormat()
          Get the default minor label format.
 int getDefaultMinorLabelInterval()
          Get the default minor label interval.
 int getDefaultNumSmallTics()
          Get the default number of small tics between each minor tic.
 int getIncrementUnits()
          Get the increment units for the minor labeling.
 double getIncrementValue()
          Get the increment value for the minor labeling.
 int getMajorValue(GeoDate time)
          Get the major time value for labeling.
 int getMinorValue(GeoDate time)
          Get the minor time value for labeling.
 GeoDate getStartTime(TimeRange trange)
          Returns a beginning time rounded to the nearest minor increment.
 boolean isRoomForMajorLabel(GeoDate delta)
          Determines if there is enough room in delta time for another major label.
 boolean isStartOfMinor(GeoDate time)
          Determines if time is the start of a minor interval.
 java.lang.String toString()
           
 

Method Detail

getMinorValue

int getMinorValue(GeoDate time)
Get the minor time value for labeling.

Parameters:
time - current date
Returns:
minor time value

getMajorValue

int getMajorValue(GeoDate time)
Get the major time value for labeling.

Parameters:
time - current date
Returns:
major time value

isRoomForMajorLabel

boolean isRoomForMajorLabel(GeoDate delta)
Determines if there is enough room in delta time for another major label.

Returns:
true if enough room exists

isStartOfMinor

boolean isStartOfMinor(GeoDate time)
Determines if time is the start of a minor interval.

Returns:
true if start of minor interval

getDefaultMinorLabelFormat

java.lang.String getDefaultMinorLabelFormat()
Get the default minor label format. The default minor labels are "mm", "HH", "dd", "MMM", and "yy" for MINUTE_HOUR, HOUR_DAY, DAY_MONTH, MONTH_YEAR, and YEAR_DECADE, respectively.

Returns:
minor label format

getDefaultMajorLabelFormat

java.lang.String getDefaultMajorLabelFormat()
Get the default major label format. The default major labels are "yyyy-MM-dd HH", "yyyy-MM-dd", "yyyy-MM", "yyyy", and "yyyy" for MINUTE_HOUR, HOUR_DAY, DAY_MONTH, MONTH_YEAR, and YEAR_DECADE, respectively.

Returns:
major label format

getDefaultMinorLabelInterval

int getDefaultMinorLabelInterval()
Get the default minor label interval.

Returns:
minor label interval

getDefaultMajorLabelInterval

int getDefaultMajorLabelInterval()
Get the default major label interval.

Returns:
major label interval

getDefaultNumSmallTics

int getDefaultNumSmallTics()
Get the default number of small tics between each minor tic.

Returns:
number of small tics

getStartTime

GeoDate getStartTime(TimeRange trange)
Returns a beginning time rounded to the nearest minor increment. For example, for DAY_MONTH if time is increasing then round to the day before tRange.start otherwise the nearest day after tRange.end.

Parameters:
tRange - time range of the axis

getIncrementValue

double getIncrementValue()
Get the increment value for the minor labeling. The value is 1.0 for all styles.

Returns:
increment value

getIncrementUnits

int getIncrementUnits()
Get the increment units for the minor labeling. The value is GeoDate.MINUTES, GeoDate.HOURS, GeoDate.DAYS, GeoDate.MONTHS, and GoeDate.YEARS for MINUTE_HOUR, HOUR_DAY, DAY_MONTH, MONTH_YEAR, and YEAR_DECADE, respectively.

Returns:
increment units
See Also:
GeoDate

computeDefaults

void computeDefaults(GeoDate delta)
Determine the minor label interval from the time extent of the axis. For example, if delta is greater than 30 days, greater than 10 and less that 30 days, or less than 10 days, the interval is 5, 2, or 1, respectively, for DAY_MONTH style.

Parameters:
delta - time extent

computeLocation

double computeLocation(double prev,
                       double now)
Determines the location of the minor time label. Positions the label between the tic marks for DAY_MONTH, MONTH_YEAR, and YEAR_DECADE, or at the tic mark for MINUTES_HOURS and HOURS_DAYS.

Parameters:
prev - previous tic location
now - current tic location

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object