Class to build a time axis. More...
#include <MeshViz/graph/PoTimeAxis.h>
Classes | |
struct | Tdate_axis_level_rep |
struct | Tdate_axis_rep |
struct | Tdate_elem |
struct | Tdate_interv |
struct | Tdate_list |
struct | TimeAxisAttr |
Public Types | |
enum | Language { ENGLISH, FRANCAIS, DEUTSCH, ESPANOL } |
enum | GradFit { GRAD_FIT, GRAD_UNFIT } |
enum | Type { X, Y } |
Public Member Functions | |
virtual SoType | getTypeId () const |
virtual const SoNodekitCatalog * | getNodekitCatalog () const |
PoTimeAxis () | |
PoTimeAxis (const char *_startDate, const char *_endDate, float _coord, Type _type=X) | |
virtual void | rebuild () |
void | setDateFormatMapping (PbDateFormatMapping *formatMapping) |
const PbDateFormatMapping * | getDateFormatMapping () const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
static const SoNodekitCatalog * | getClassNodekitCatalog () |
Public Attributes | |
SoSFString | startDate |
SoSFString | endDate |
SoSFFloat | coord |
SoSFEnum | type |
SoSFEnum | language |
SoSFEnum | gradFit |
SoMFString | gradRep |
SoSFString | timesPeriod |
Friends | |
int | tpdlparse (void) |
int | tpdllex (void) |
int | tpaxparse (void) |
int | tpaxlex (void) |
This class builds a time axis in the plane XY. A time axis is an axis with date graduations.
The abscissa or ordinate (following "type" field) of the start point of the axis is startDate. The abscissa or ordinate (following "type" field) of the end point of the axis is endDate. Both these abscissas and ordinates are computed according to the association between a dates range and a coordinates range defined by the the current date mapping.
Both startDate and endDate are described by character strings. The syntax must fit the current date format, otherwise the axis is not built.
The current date format and the current date mapping are defined as follows : If the method setDateFormatMapping(formatMapping) is called, the current date format and the current date mapping are defined by "formatMapping". Otherwise the current date format and the current date mapping are specified in the current inherited state (cf property node PoDateFormatMapping).
Axis graduations are displayed depending on date representation given by the fields gradRep and timesPeriod. gradRep is a list of representations and timesPeriod is a list of possible duration.
Let D be the duration between startDate and endDate (date at the start and the end of the axis), and let Di (0 <= i < gradRep.getNum()) be the set of duration defined by the parameter timesPeriod. The choice of a representation is done as follows:
if D < D0 the axis is built using representation gradRep[0] if Di <= D < Di+1 the axis is built using representation gradRep[i+1] if DgradRep.getNum()-2 < D the axis is built using representation gradRep[gradRep.getNum() -1]
If the duration list is not provided (empty string), the representation is not chosen depending on D. It is chosen depending on calendar threads given with each representation.
Syntax of the string timesPeriod which defines the set of duration. This is a rational language defined as follows:
timesPeriod = ([r]U)* where (U) is the time units selected from SEC, MIN, HOU, DAY, YEA where ([r]) optional positive real value defining the number of units (=1 id r is not defined) ([r]U)* means that [r]U sequence may be repeated 0 or several times The 'space' characters are ignored examples: timesPeriod = "10SEC 20MIN HOU" defines 3 duration: 10 seconds, 20 minutes et 1 hour timesPeriod = "0.2SEC 30MIN 10DAY 2YEA" defines 4 duration: 0.2 seconds, 30 minutes, 10 day et 2 years
remark: For all units but SEC, only the integer part of (r) is used. Specifying a decimal part is then useless.
A date graduation representation allows the application:
A graduation representation is defined by:
All levels of graduation are displayed underneath each other for horizontal axes and side by side for vertical axes. The first level is the closest to the main line of the axis, the last one is the furthest. Date components are seconds, minutes, hours, days, months and years.
Syntax of the string gradRep[i] which defines the date representation number i. This is a rational language defined as follows:
gradRep[i] = R(/R)* where (/) stands for the current new line character (attribute of the current miscellaneous attributes - cf PoAxis description) (it appears before definition of new level) where (R) is the representation of dates for one level. This rational language is also defined by: R = [[r]U] ['string'] ([n]C['string'])* where [[r]U] (optional) defines the thread between 2 following calendar graduations of a level where ['string'] (optional) is any character strings between quotes where [n]C defines the appearance of one of the date calendar components [n]C = (s) to display the number of seconds (0 to 59.999...) = (m) to display the number of minutes (0 to 59) = (H) to display the number of hours (0 to 23) = (D) to display the day number in the month (1 to 31) = (nD) to display n first characters of the name of the day of the week = (M) to display number of the month (1 to 12) = (nM) to display n first characters of the name of the month of the year = (Y) or (2Y)to display 2 last digits of the year = (4Y)to display all digits of the year
Characters for the day of the month or month of the year are displayed using current language defined by the field language. n is an integer value greater than 0.
Warning: To insert the quote (') character in the string ['string'], it must be repeated twice. If the string must only contain (') character then the string must be defined as ''''. To insert a (") in the string a back-slash character (\) must be added before it.
Example 1:
gradRep[i] = "20 SEC 'at'm''''s'sec' / 1MIN D 3M Y' ' H'h' m'''' "
defines two levels of graduations:
Possible appearance of graduation may be for instance:
at11'50sec at12'10sec at12'30sec at12'50sec at13'10sec at13'30sec 3MAR94 18h12' 3MAR94 18h13'
Example 2:
gradRep[i] = "5 MIN H'h'm'''' / DAY D'-'3M / YEA 4Y"
defines three levels of graduation:
Possible appearance of graduation may be for instance:
11h15' 11h20' 11h25' 11h30' 11h35' 11h40' 3-MAR 1995
gradVisibility | VISILITY_DEPEND |
gradPosition | GRAD_DEPEND |
gradPath | PATH_DEPEND |
gradFontName | "" |
gradFontSize | 0 |
gradDistAxis | 0 |
gradAddStringVisibility | FALSE |
gradAddString | "" |
marginType | REL_MARGIN |
marginStart | 0 |
marginEnd | 0 |
titleVisibility | VISILITY_DEPEND |
titlePosition | TITLE_DEPEND |
titlePath | PATH_DEPEND |
titleFontName | "" |
titleFontSize | 0 |
titleDistAxis | 0 |
titleString | "" |
gridVisibility | VISILITY_DEPEND |
gridLengthGradSide | 0 |
gridLengthGradOtherSide | 1 |
arrowVisibility | VISIBILITY_DEPEND |
arrowHeight | 0.03 |
arrowLength | 0.05 |
tickVisibility | VISIBILITY_DEPEND |
tickPosition | TICK_GRAD_SIDE |
tickMainLength | 0 |
tickSubLength | 0 |
tickSubDef | PERIOD_MAIN_TICK |
tickNumOrPeriod | 1 |
tickFirstGrad | 1 |
tickLastGrad | 1 |
reverseFlag | AXIS_REVERSE_DEPEND |
startDate | "1-01-70" |
endDate | "2-01-70" |
coord | 0 |
type | X |
language | ENGLISH |
gradFit | GRAD_UNFIT |
gradRep | "" |
timesPeriod | "" |
enum PoTimeAxis::GradFit |
enum PoTimeAxis::Language |
enum PoTimeAxis::Type |
PoTimeAxis::PoTimeAxis | ( | ) | [inline] |
Constructor.
PoTimeAxis::PoTimeAxis | ( | const char * | _startDate, | |
const char * | _endDate, | |||
float | _coord, | |||
Type | _type = X | |||
) | [inline] |
Constructor.
static const SoNodekitCatalog* PoTimeAxis::getClassNodekitCatalog | ( | ) | [static] |
Returns the SoNodekitCatalog for this class.
Reimplemented from PoAxis.
static SoType PoTimeAxis::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from PoAxis.
const PbDateFormatMapping* PoTimeAxis::getDateFormatMapping | ( | ) | const |
Gets a reference to a PbDateFormatMapping object for the input date format and for the association dates, coordinates.
virtual const SoNodekitCatalog* PoTimeAxis::getNodekitCatalog | ( | ) | const [virtual] |
Returns the SoNodekitCatalog for this instance.
Reimplemented from PoAxis.
virtual SoType PoTimeAxis::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from PoAxis.
virtual void PoTimeAxis::rebuild | ( | ) | [virtual] |
void PoTimeAxis::setDateFormatMapping | ( | PbDateFormatMapping * | formatMapping | ) |
Sets a reference to a PbDateFormatMapping object for the input date format and for the association dates, coordinates.
If this method is not called (or called passing NULL as argument), this is the date format and date mapping defined in the current inherited state (defined with the property node PoDateFormatMapping) which are used.
int tpaxlex | ( | void | ) | [friend] |
int tpaxparse | ( | void | ) | [friend] |
int tpdllex | ( | void | ) | [friend] |
int tpdlparse | ( | void | ) | [friend] |
Abscissa or ordinate of the axis according to the axis type.
End date of the axis.
Make sure that this date is in the same format as defined by the current date format.
This flag indicates if the first graduation is in round figures or not.
List of date representation.
If the list is empty, the representation is automatically computed.
Language of date graduations.
Start date of the axis.
Make sure that this date is in the same format as defined by the current date format.
String containing gradRep.getNum() -1 sub-strings.
Each sub-string specifies a time period used to choose the date representation. If this string is empty, this choice is automatically made.
Axis type.
(X or Y).