Commit b45bdee4 authored by GC's avatar GC
Browse files

First commit for issue-790.

Added optional velocity vector to both CPF parser and writer.
parent 8cce4593
......@@ -141,6 +141,25 @@ public class CPF implements EphemerisFile<CPF.CPFCoordinate, CPF.CPFEphemeris> {
ephemeris.get(id).coordinates.add(coord);
}
/**
* Add the velocity to the last CPF coordinate entry.
* @param id satellite ILRS identifier
* @param velocity the velocity vector of the satellite
*/
public void addSatelliteVelocityToCPFCoordinate(final String id, final Vector3D velocity) {
// Get the last coordinate entry, which contains the position vector
final CPFCoordinate lastCoordinate = ephemeris.get(id).coordinates.get(ephemeris.get(id).coordinates.size() - 1);
// Create a new CPFCoordinate object with both position and velocity information
final CPFCoordinate CPFCoordUpdated = new CPFCoordinate(lastCoordinate.getDate(),
lastCoordinate.getPosition(),
velocity,
lastCoordinate.getLeap());
// Patch the last record
ephemeris.get(id).coordinates.set(ephemeris.get(id).coordinates.size() - 1, CPFCoordUpdated);
}
/**
* Set the interpolation sample.
* @param interpolationSample interpolation sample
......
......@@ -496,7 +496,18 @@ public class CPFParser implements EphemerisFileParser<CPF> {
/** {@inheritDoc} */
@Override
public void parse(final String line, final ParseInfo pi) {
// Not implemented yet
// Data contained in the line
final String[] values = SEPARATOR.split(line);
// Coordinates
final double x = Double.parseDouble(values[2]);
final double y = Double.parseDouble(values[3]);
final double z = Double.parseDouble(values[4]);
final Vector3D velocity = new Vector3D(x, y, z);
// CPF coordinate
pi.file.addSatelliteVelocityToCPFCoordinate(pi.file.getHeader().getIlrsSatelliteId(), velocity);
}
/** {@inheritDoc} */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment