Class PoTimeAxis

  • All Implemented Interfaces:
    SafeDisposable

    public class PoTimeAxis
    extends PoAxis
    Class to build a time axis. 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:

    • to draw it using different levels,
    • to define a date thread between each graduation of a level,
    • to display for each graduation of a level, one or several components of the date,
    • to display any character strings for each graduation.

    A graduation representation is defined by:

    • the number of graduation level,
    • for each level
      • the graduation thread (number of seconds, minutes, hours, days, months or years)
      • an optional character string before the first indicator
      • a set of appearance indicators of one of the date components, followed by an optional character string.

    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:
    • at the first level:
      • graduations are displayed every 20 seconds.
      • each of the graduations begins with the character string (at) followed by the number of minutes, the date relating to the graduation, then a (') character, then the number of seconds, and finally the character string (sec). For instance: at 12'50sec
    • at the second level:
      • graduation are displayed for every minutes.
      • each of the graduations begins with the number of the day in the month, then the first three characters for the month of the year, then the 2 last digits of the year, then ( ), then the number of hours, then (h),then the number of minutes and finally ('). For instance: 3MAR94 18h13'

    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:
    • at the first level:
      • graduations are displayed every 5 minutes.
      • each graduation begins with the number of hours of the date relating to the graduation, then (h), then the number of minutes followed by (').
    • at the second level:
      • graduations are displayed for each day.
      • each graduation begins with the number of the day, then (-), then the first three characters of the month.
    • at the third level:
      • graduations are displayed using 4 digits for each year.

    Possible appearance of graduation may be for instance:

        11h15'   11h20'   11h25'   11h30'   11h35'   11h40'
                                  3-MAR
                                    1995

    • Note 1: With a thread in minutes, each graduation is displayed starting at 0 second. With a thread in hour, each graduation is displayed starting at 0 minute, 0 second. With a thread in day, each graduation is displayed starting at 0 hour, 0 minute, 0 second. With a thread in month, each graduation is displayed starting 1st of the month, 0 hour, 0 minute, 0 second. With a thread in year, each graduation is displayed starting 1st of January, 0 hour, 0 minute, 0 second. When for a specific level, all graduations are out of bounds, then a graduation is displayed at the middle of the axis. The previous sample shows this with level 2 graduation (3-MARS) and level 3 one (1995).
    • Note 2: If gradRep.getNum=0 or gradRep[0] = "", Graph Master does its best to display date graduation using the best possible number of levels and best possible thread. This choice is only relating to duration between the bounding dates of the axis. The field timesPeriod is not used.
    • Note 3: If a representation does not specify the thread type for the first level (i.e. the field [[r]U] is not defined), then Graph Master computes the thread relating to D duration between the boundary dates of the axis. A calendar component (type [n]C) is automatically chosen by Graph Master and the components defined in the representation with a lower unit are ignored. For instance, if the representation is "3D'-'D':'H'h'm''''s / 3M 4Y", and if Graph Master chooses an hour thread, the minutes and seconds components of the first level won't be displayed, only "3D'- 'D':'H'h'" will be used. If a representation specifies the thread unit, but not the number of units (only [r] is given), then Graph Master also computes this number of units relating to D, but all calendar components of the representation will be used.
    • Note 4: If a representation does not specify the thread type for the level 2, 3,... (i.e. the field [[r]U] is not defined), then Graph Master chooses the current thread unit depending on previous thread unit. If at level 1, the thread unit is minutes, then thread units at level 2 will be hours,... Note 3 applies when choosing calendar components. For instance if the representation is "5MIN 3D'-'D':'H'h'm'''' / m'min'H'h '3D'-'D", then Graph Master chooses hours as the thread unit for level 2 and only components "'H'h '3D'-'D" will be used at this level.

    File format/default:

    PoTimeAxis {

      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 ""
    }

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <link REL="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <title></title> </head> <BODY> <h1></h1> <h4> <A NAME="Heading607">CATALOG PARTS</A></h4> <ul><b>PoTimeAxis</b> {</ul> <ul><ul><b>Separator</b> <tt>alternateRep</tt> (from PoBase) {<br> </ul></ul> <ul><ul><ul><b>AppearanceKit</b> <tt>appearance</tt> (from PoBase)</ul></ul></ul> <ul><ul><ul><i>Specifies the appearance of all the kit. By default lightModel.model=BASE_COLOR.</i></ul></ul></ul> <ul><ul><ul><b>MatrixTransform</b> <tt>domainTransform</tt> (from PoBase)</ul></ul></ul> <ul><ul><ul><i>Corresponds to the domain transformation.</i></ul></ul></ul> <ul><ul><ul><b>MatrixTransform</b> <tt>transform</tt> (from PoAxis)</ul></ul></ul> <ul><ul><ul><i>Corresponds to the axis plane orientation matrix.</i></ul></ul></ul> <ul><ul><ul><ul></ul></ul></ul></ul> <ul><ul><ul><b>Separator</b> <tt>bodySep</tt> (from PoAxis) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw the body of the axis.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>bodyApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of the body of the axis.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>body </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw the body of the axis.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>arrowSep</tt> (from PoAxis) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw the arrow.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>arrowApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of the arrow.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>arrow </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoFaceSet shape to draw the arrow.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>subGradTickSep</tt> (from PoAxis) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw sub-graduation tick.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>subGradTickApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of sub-graduation tick.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>subGradTick </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw sub-graduation tick.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>subGradGridSep</tt> (from PoAxis){</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw sub-graduation grid.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>subGradGridApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of sub-graduation grid.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>subGradGrid </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw sub-graduation grid.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>mainGradTickSep</tt> (from PoAxis){</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw main-graduation tick.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>mainGradTickApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of main-graduation tick.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>mainGradTick </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw main-graduation tick.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>mainGradGridSep</tt> (from PoAxis){</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw main-graduation grid.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>mainGradGridApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of main-graduation grid.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>mainGradGrid </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw main-graduation grid.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>mainGradTextSep</tt> (from PoAxis) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw main-graduation text.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>mainGradTextApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of main-graduation text. By default drawStyle.style=LINES. font.size and font.name are set when the kit is rebuilt.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>mainGradText </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a list of SoAnnoText3 shapes to draw main-graduation text.</i></ul></ul></ul></ul> <ul><ul><ul>}<br> <br> <b>Separator</b> <tt>titleSep</tt> (from PoAxis) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw title text.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>titleApp </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of title text. By default drawStyle.style=LINES. font.size and font.name are set when the kit is rebuilt.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>title </tt>(from PoAxis)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoAnnoText3 shape to draw title.</i></ul></ul></ul></ul> <ul><ul><ul>}</ul></ul></ul> <ul><ul>}</ul></ul> <ul>}</ul> <ul><ul><br> </ul></ul> </body> </html>

    • Field Detail

      • startDate

        public final SoSFString startDate
        Start date of the axis. Make sure that this date is in the same format as defined by the current date format.
      • endDate

        public final SoSFString endDate
        End date of the axis. Make sure that this date is in the same format as defined by the current date format.
      • coord

        public final SoSFFloat coord
        Abscissa or ordinate of the axis according to the axis type.
      • gradRep

        public final SoMFString gradRep
        List of date representation. If the list is empty, the representation is automatically computed.
      • timesPeriod

        public final SoSFString timesPeriod
        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.
    • Constructor Detail

      • PoTimeAxis

        public PoTimeAxis​(java.lang.String _startDate,
                          java.lang.String _endDate,
                          float _coord)
        Calls PoTimeAxis(_startDate, _endDate, _coord, PoTimeAxis.Types.valueOf( PoTimeAxis.Types.X.getValue() )).
      • PoTimeAxis

        public PoTimeAxis​(java.lang.String _startDate,
                          java.lang.String _endDate,
                          float _coord,
                          PoTimeAxis.Types _type)
        Constructor.
      • PoTimeAxis

        public PoTimeAxis()
        Constructor.
    • Method Detail

      • getDateFormatMapping

        public PbDateFormatMapping getDateFormatMapping()
        Gets a reference to a PbDateFormatMapping object for the input date format and for the association dates, coordinates.
      • setDateFormatMapping

        public void 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.