« GPAbsoluteDate » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 49 : | Ligne 49 : | ||
With such an example, we will be able to display this: | With such an example, we will be able to display this: | ||
[[File:GPAbsoluteDate. | [[File:GPAbsoluteDate.png]] | ||
Several date formats are available via a mouse right click. | Several date formats are available via a mouse right click. | ||
[[File:GPAbsoluteDateFormats.png]] | |||
Moreover the user can select a time scale …for which the conversion will be done … | Moreover the user can select a time scale …for which the conversion will be done … | ||
[[File: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 | … 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: | ||
[[File:GPAbsoluteDateOffset.png]] | |||
== How to use it == | == How to use it == |
Version du 26 juillet 2017 à 13:21
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();
<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>