« Quick Start » : différence entre les versions

De GENOPUS
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
 
(15 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
In this Quick Start page, we assume that the user has already used the [http://genius.cnes.fr GENIUS] library. Thus, he can refer to its own [http://genius.cnes.fr/index.php/Quick_Start Quick start] page. Of course, we also assume that he is familiar with the <font color=#FF8C00>Java</font> language as well as the [http://www.eclipse.org/ Eclipse] environment.
In this Quick Start page, we will see how (very easily) we will create an application to display and convert orbit data. Nevertheless, we assume that the user has already used the [http://genius.cnes.fr GENIUS] library. Thus, he can refer to its own [http://genius.cnes.fr/index.php/Quick_Start Quick start] page. Of course, we also assume that he is familiar with the <font color=#FF8C00>Java</font> language as well as the [http://www.eclipse.org/ Eclipse] environment.
 
== Create the test class ==


So, first, we have to create a class extending from the [http://genius.cnes.fr/index.php/GFrame_and_GPanel GPanel] one with a main method ...
So, first, we have to create a class extending from the [http://genius.cnes.fr/index.php/GFrame_and_GPanel GPanel] one with a main method ...


[[File:QuickStart1.png]]
[[File:QuickStart1.png]]
== Adding display() and generic() methods ==
Then, you will have to add unimplemented methods <font color=#4169E1>display()</font> and <font color=#4169E1>generic()</font>...


[[File:QuickStart2.png]]
[[File:QuickStart2.png]]
[http://www.eclipse.org/ Eclipse] helps you to do it very quickly by clicking on the error sign:


[[File:QuickStart3.png]]
[[File:QuickStart3.png]]
You will obtain this:


[[File:QuickStart4.png]]
[[File:QuickStart4.png]]
== Create a GPOrbit object ==
Then, create a [{{PathCurrentJavaDoc}}/fr/cnes/genopus/orbits/GPOrbit.html GPOrbit] object and decide to display it using the <font color=#4169E1>put()</font> method:


[[File:QuickStart5.png]]
[[File:QuickStart5.png]]


Create a frame using the [http://genius.cnes.fr/index.php/GFrame_and_GPanel GFrame] class ...
== Create a Frame ==
 
In the main method, create a frame using the [http://genius.cnes.fr/index.php/GFrame_and_GPanel GFrame] class to put our OrbitTest panel inside ...


[[File:QuickStart6.png]]
[[File:QuickStart6.png]]


Do not forget to call to the PATRIUS_DATASET (to get for example information about time scales)
== Link with PATRIUS_DATASET  ==
 
Do not forget to refer to the [https://logiciels.cnes.fr/en/content/patriusdataset PATRIUS_DATASET] (to get for example information about time scales) else you will get error messages.


[[File:QuickStart7.png]]
[[File:QuickStart7.png]]
== See your widget ! ==


And when you will execute, you will obtain this:
And when you will execute, you will obtain this:
[[File:QuickStart8.png]]
[[File:QuickStart8.png]]
== Code ==
Here is the code of this example (to copy it, if you want). Simple is'nt it ?
<syntaxhighlight lang="java">
import fr.cnes.genius.exception.GException;
import fr.cnes.genius.lowLevel.GFrame;
import fr.cnes.genius.lowLevel.GPanel;
import fr.cnes.genopus.orbits.GPOrbit;
import fr.cnes.sirius.addons.patriusdataset.PatriusDataset;
import fr.cnes.sirius.patrius.utils.exception.PatriusException;
public class OrbitTest extends GPanel {
   
    private final GPOrbit orbit;
   
    public OrbitTest () {
        orbit = new GPOrbit("MyOrbit");
    }
    public static void main(String[] args) throws PatriusException {
        PatriusDataset.addResourcesFromPatriusDataset();
        final GFrame frame = new GFrame("OrbitTest", new OrbitTest());
        frame.display();
    }
    @Override
    public void display() throws GException {
        put(orbit);
    }
    @Override
    public void generic() throws GException {
    }
}
</syntaxhighlight>

Dernière version du 10 novembre 2018 à 18:38

In this Quick Start page, we will see how (very easily) we will create an application to display and convert orbit data. Nevertheless, we assume that the user has already used the GENIUS library. Thus, he can refer to its own Quick start page. Of course, we also assume that he is familiar with the Java language as well as the Eclipse environment.

Create the test class

So, first, we have to create a class extending from the GPanel one with a main method ...

QuickStart1.png

Adding display() and generic() methods

Then, you will have to add unimplemented methods display() and generic()...

QuickStart2.png


Eclipse helps you to do it very quickly by clicking on the error sign:

QuickStart3.png


You will obtain this:

QuickStart4.png

Create a GPOrbit object

Then, create a GPOrbit object and decide to display it using the put() method:

QuickStart5.png

Create a Frame

In the main method, create a frame using the GFrame class to put our OrbitTest panel inside ...

QuickStart6.png

Link with PATRIUS_DATASET

Do not forget to refer to the PATRIUS_DATASET (to get for example information about time scales) else you will get error messages.

QuickStart7.png

See your widget !

And when you will execute, you will obtain this:

QuickStart8.png

Code

Here is the code of this example (to copy it, if you want). Simple is'nt it ?

import fr.cnes.genius.exception.GException;
import fr.cnes.genius.lowLevel.GFrame;
import fr.cnes.genius.lowLevel.GPanel;
import fr.cnes.genopus.orbits.GPOrbit;
import fr.cnes.sirius.addons.patriusdataset.PatriusDataset;
import fr.cnes.sirius.patrius.utils.exception.PatriusException;

public class OrbitTest extends GPanel {
    
    private final GPOrbit orbit;
    
    public OrbitTest () {
        orbit = new GPOrbit("MyOrbit");
    }

    public static void main(String[] args) throws PatriusException {
        PatriusDataset.addResourcesFromPatriusDataset();
        final GFrame frame = new GFrame("OrbitTest", new OrbitTest());
        frame.display();
    }

    @Override
    public void display() throws GException {
        put(orbit);
    }

    @Override
    public void generic() throws GException {
    }

}