Mise à jour de Get Started authored by Julien LEBLOND's avatar Julien LEBLOND
......@@ -2,113 +2,60 @@
## Prerequisities
- [Java](https://www.java.com/fr/) 8 or more
* [Java](https://www.java.com/fr/) 8 or more
* [Orekit](https://gitlab.orekit.org/orekit/orekit) >= V 1.12
* [junit-jupiter](https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter) >= V 5.10.2
* [czml-writer](https://github.com/AnalyticalGraphicsInc/czml-writer) >= V 3.0.0
* A directory and a path of the inputs if there are some.
* A directory and a path of the output.
In order to generate a CZML file, we will first describe the intern architecture of a CZML file :
## Installation
## CZML Structure
A CZML file is a subset of [JSON files](https://en.wikipedia.org/wiki/JSON). Hence, a CZML file contains only one array of a JSON file. Objects inside the CZML are nammed **[packet]()**, all the objects we will use are in fact packets.
### The Header
[Doc here](Header)
The header describes the entire scene and the time the simulation will lasts. It is absolutly mandatory that the header is the first object created while writing in the CZML file.
### Objects that can be added :
#### Satellite
[Doc here](Satellite)
The satellite object will create a satellite and its path. The path will be computed with a propagation for the duration of the scene. (**A propagator can create the header in order to setup the propagation parameters before**).
#### Ground Station
[Doc here](CZMLGroundStation)
The ground station object will create and display a ground station at the surface of the earth.
#### Visibility Cone
[Doc here](VisibilityCone)
The visibility cone is an object that can be build in order to create a [Line Of Visibility](LineOfVisibility) of to display what the station sees. It can be created only with a station then it will not be bounded to a specific satellite. Or it can be created with a satellite and the visiblity cone will have the height of the satellite.
#### Line of visibility
[Doc here](LineOfVisibility)
### With maven
The line of visibility is a line that will be displayed only when a satellite is visible in the local sky of a ground station.
Orekit and junit can be installed with maven using a pom.xml with dependencies :
* [Orekit](https://mvnrepository.com/artifact/org.orekit/orekit)
* [junit-jupiter](https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter)
#### Constellation
[Doc here](Constellation)
For the czml writer you will need to install it differently, because no maven repository exists, two methos can be used :
The constellation object creates several [Satellites](Satellite) at the same time in order to build a constellation with the number of satellites given and orbital planes given.
## Functions to use
After each object is created, the function `.generateCZML()` is callable to write the object into the CZML file. When the last object is written, the function `.endFile()` will need to be called in order to finish the CZML file (Be careful to use `endFile()` only on the last object of the file).
Here is an example of what a classic OreCZML call can look like :
```java
// String intput and for Output
final String root = System.getProperty("user.dir").replace("\\", "/");
final String outputPath = root + "/" + "Output";
final String outputName = "Output_CZML.txt";
final String output = outputPath + "/" + outputName;
final String oemFile = "intputOem.kvn";
final String inputOemFile = root + "/" + oemFile;
// Setup of the time scale and the frame
final Frame EME2000 = FramesFactory.getEME2000();
final TimeScale UTC = TimeScalesFactory.getUTC();
// Setup of the start and end date
final AbsoluteDate startDate = new AbsoluteDate(2022, 1, 17, 12, 0, 0.0, UTC);
final AbsoluteDate finalDate = new AbsoluteDate(2022, 1, 17, 13, 0, 0.0, UTC);
// Input : An LEO orbit of 550 km of altitude, with an inclination of 60°, a perigee argument of 90° and a //right ascension of the ascending node of 90°
final KeplerianOrbit initialOrbit = new KeplerianOrbit(6928000, 0, FastMath.toRadians(60), 0, FastMath.toRadians(90), FastMath.toRadians(90), PositionAngleType.MEAN, EME2000, startDate, Constants.WGS84_EARTH_MU);
* You download the .jar and you install it directly. Let name the groupId `com.custom`, the artifactId `cesium` and the version iwll be `1.0`. You will need to add in the pom.xml the following lines to do so :
```xml
<dependency>
<groupId>com.custom</groupId>
<artifactId>cesium</artifactId>
<version>1.0</version>
</dependency>
```
Now that the dependency is added you can now use the following command in maven to install it :
`mvn install:install-file -Dfile=[path]\cesiumlanguagewriter-3.0.0.jar -DgroupId=com.custom -DartifactId=cesium -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true`
// Topocentric frame of Toulouse
// Setup ITRF
final IERSConventions IERS = IERSConventions.IERS_2010;
final Frame ITRF = FramesFactory.getITRF(IERS, true);
// Definition of the earth
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ITRF);
// Position of Toulouse
final GeodeticPoint toulouseFrame = new GeodeticPoint(FastMath.toRadians(43.6047), FastMath.toRadians(1.4442), 10);
final TopocentricFrame topocentricToulouse = new TopocentricFrame(earth, toulouseFrame, "Toulouse Frame");
* You can directly add the file locally in your IDE, here are some methods for the most used IDE :
[Eclipse](https://stackoverflow.com/questions/3280353/how-to-import-a-jar-in-eclipse)
[IntelliJ](https://www.geeksforgeeks.org/how-to-add-external-jar-file-to-an-intellij-idea-project/)
[VS Code](https://www.codeproject.com/Questions/5281024/How-to-import-jar-file-in-vs-code)
[Net Beans](https://stackoverflow.com/questions/17693040/adding-external-jar-to-maven-project-in-netbeans)
// Header
// Clock
Clock clock = new Clock(inputOemFile);
Header header = new Header("document", "Header Principal", clock);
## CZML Structure
// Satellite
Satellite satellite = new Satellite(inputOemFile, header);
In order to understand how a CZML file is organized, please check the [tutorial](Tutorial)
// Ground Station
CZMLGroundStation toulouse = new CZMLGroundStation(topocentricToulouse, header);
## Usage
// Line of visibility
LineOfVisibility lineOfVisu = new LineOfVisibility(topocentricToulouse, satellite, header);
### Use with Cesium Sandbox
// Writing into the CZML
header.generateCZML();
satellite.generateCZML();
toulouse.generateCZML();
lineOfVisu.generateCZML();
lineofVisu.endFile()
The [cesium sandbox](https://sandcastle.cesium.com) is a web interface that allows the user to display online [CesiumJS](https://cesium.com/platform/cesiumjs/) code for visualisation. CesiumJS is a javascript library that can displays 3D scenes around central bodies. CesiumJS understands CZML file and can load them into the scene.
// Writing into the file
final CZMLFile CZMLfile = new CZMLFile(outputPath, output);
CZMLfile.write(header);
CZMLfile.write(satellite);
CZMLfile.write(toulouse);
CZMLfile.write(lineOfVisu);
Here is a basic load of a CZML file in cesiumJS :
```javascript
const viewer = new Viewer("cesiumContainer");
const czmlDataSource = Cesium.CzmlDataSource.load("PATH);
viewer.dataSources.add(czmlDataSource);
viewer.scene.globe.enableLighting = true;
```
### Use Cesium locally
The cesium sandcastle is good to display small czml files, but when file are quite bigger, it is advised to load cesium locally in order to compute bigger simulations. To do so a [repository]() has been created to work with OreCZML. You will find there all instructions to launch cesium locally.
\ No newline at end of file