GPAbsoluteDate

De GENOPUS
Révision datée du 18 juillet 2017 à 10:10 par Admin (discussion | contributions) (Page créée avec « == 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: <syntax... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigation Aller à la recherche

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 vale:

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 TUC/TAI gaps.

Display

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

Several date formats are available via a mouse right click.

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

… 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:

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();
<syntaxhighlight>

== How it is stored ==

Here is the <font color=#FF8C00 title="Extensible Markup Language">XML</font> format for such a date:

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