« GPAbsoluteDate » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
== How to call it == | == How to call it == | ||
For using the | 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"> |
Version du 7 septembre 2017 à 09:30
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 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();
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>