« GPAbsoluteDate » : différence entre les versions

De GENOPUS
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
 
(Une version intermédiaire par le même utilisateur non affichée)
Ligne 1 : Ligne 1 :
== How to call it ==
== How to call it ==


For using the <font color=#4169E1>GPAbsoluteDate</font> class, the developer has only to create such an object with these two possibilities:
For using the [{{PathCurrentJavaDoc}}/fr/cnes/genopus/time/GPAbsoluteDate.html GPAbsoluteDate] class, the developer has only to create such an object with these two possibilities:
 
 
[{{PathCurrentJavaDoc}}/fr/cnes/genopus/time/GPAbsoluteDate.html GPAbsoluteDate]


<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
Ligne 46 : Ligne 43 :
</syntaxhighlight>
</syntaxhighlight>


Note: it is mandatory to link with [[https://logiciels.cnes.fr/en/node/64?type=desc PATRIUS_DATASET]] data at least to take into account <font color=#FF8C00 >TUC/TAI</font> gaps.
Note: it is mandatory to link with [[https://logiciels.cnes.fr/en/node/64?type=desc PATRIUS_DATASET]] data at least to take into account <font color=#FF8C00 >UTC/TAI</font> gaps.


== Display ==
== Display ==

Dernière version du 23 septembre 2019 à 07:29

How to call it

For using the GPAbsoluteDate class, the developer has only to create such an object with these two possibilities:

gpDate = new GPAbsoluteDate("Date:");

… or, if we want to initialize the widget with a predefined date value:

final TimeScale TUC = TimeScalesFactory.getUTC();
final AbsoluteDate date0 = new AbsoluteDate(2010, 1, 1, 0, 0, 0., TUC);
gpDate = new GPAbsoluteDate("Date:", date0);

Here we have a complete example of a class allowing displaying such a widget using [GENIUS] functionalities (in the next examples, we will no more present such complete examples):

public class TestGPAbsoluteDate extends GPanel {

    private GPAbsoluteDate gpDate;
    
    public TestGPAbsoluteDate() {
        gpDate = new GPAbsoluteDate("Date:");
    }

    public void generic() throws GException { put(gpDate); }
    public void display() throws GException { generic();}

    public static void main(String[] args) throws OrekitException {

        PatriusDataset.addResourcesFromPatriusDataset();
        
        TestGPAbsoluteDate test = new TestGPAbsoluteDate();
        
        GFrame frame = new GFrame("Absolute date", test);
        frame.display();

    }

}

Note: it is mandatory to link with [PATRIUS_DATASET] data at least to take into account UTC/TAI gaps.

Display

With such an example, we will be able to display this:

GPAbsoluteDate.png

Several date formats are available via a mouse right click.

GPAbsoluteDateFormats.png

Moreover the user can select a time scale …for which the conversion will be done …

GPAbsoluteDateScales.png

… and also have the possibility to use a date offset utility (very useful when you want to add duration to a previous date) by clicking on the button:

GPAbsoluteDateOffset.png

How to use it

To get a [PATRIUS] AbsoluteDate object, we will just have to call for the getPatriusObject() method as below:

final AbsoluteDate date = date.getPatriusObject();

How it is stored

Here is the XML format for such a date:

  <AbsoluteDate name="Date:">
    <String name="date">01/01/2010 12h34m56s123ms000us000ns</String>
    <String name="scale">UTC</String>
  </AbsoluteDate>