Commit 985c2d5b authored by Luc Maisonobe's avatar Luc Maisonobe

Merge branch 'issue-474' into develop

parents c8e32e8e f788358b
Pipeline #1027 passed with stages
in 31 minutes and 17 seconds
......@@ -41,6 +41,9 @@ import org.orekit.utils.TimeStampedAngularCoordinates;
public class AemFile extends NdmFile<Header, AemSegment>
implements AttitudeEphemerisFile<TimeStampedAngularCoordinates, AemSegment> {
/** Root element for XML files. */
public static final String ROOT = "aem";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_AEM_VERS";
......
......@@ -56,9 +56,6 @@ import org.orekit.utils.IERSConventions;
*/
public class AemParser extends AdmParser<AemFile, AemParser> implements AttitudeEphemerisFileParser<AemFile> {
/** Root element for XML files. */
private static final String ROOT = "aem";
/** Pattern for splitting strings at blanks. */
private static final Pattern SPLIT_AT_BLANKS = Pattern.compile("\\s+");
......@@ -102,7 +99,7 @@ public class AemParser extends AdmParser<AemFile, AemParser> implements Attitude
public AemParser(final IERSConventions conventions, final boolean simpleEOP,
final DataContext dataContext,
final AbsoluteDate missionReferenceDate, final int defaultInterpolationDegree) {
super(ROOT, AemFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate);
super(AemFile.ROOT, AemFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate);
this.defaultInterpolationDegree = defaultInterpolationDegree;
}
......@@ -126,7 +123,7 @@ public class AemParser extends AdmParser<AemFile, AemParser> implements Attitude
metadata = null;
context = null;
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(AemFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new KvnStructureProcessingState(this);
......
......@@ -257,7 +257,7 @@ public class AemWriter extends AbstractMessageWriter<Header, AemSegment, AemFile
*/
public AemWriter(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(AemFile.FORMAT_VERSION_KEY, CCSDS_AEM_VERS,
super(AemFile.ROOT, AemFile.FORMAT_VERSION_KEY, CCSDS_AEM_VERS,
new ContextBinding(
() -> conventions, () -> true, () -> dataContext,
() -> missionReferenceDate, () -> TimeSystem.UTC,
......@@ -266,7 +266,7 @@ public class AemWriter extends AbstractMessageWriter<Header, AemSegment, AemFile
/** {@inheritDoc} */
@Override
public void writeSegment(final Generator generator, final AemSegment segment) throws IOException {
public void writeSegmentContent(final Generator generator, final AemSegment segment) throws IOException {
final AemMetadata metadata = segment.getMetadata();
writeMetadata(generator, metadata);
......
......@@ -138,12 +138,16 @@ public class AttitudeWriter implements AttitudeEphemerisFileWriter {
try (Generator generator = fileFormat == FileFormat.KVN ?
new KvnGenerator(appendable, AemWriter.KVN_PADDING_WIDTH, outputName) :
new XmlGenerator(appendable, XmlGenerator.DEFAULT_INDENT, outputName)) {
writer.writeHeader(generator, header);
// Loop on segments
for (final S segment : segments) {
writeSegment(generator, segment);
}
writer.writeFooter(generator);
}
}
......
......@@ -41,6 +41,9 @@ import org.orekit.utils.TimeStampedAngularCoordinates;
*/
public class ApmFile extends NdmFile<Header, Segment<AdmMetadata, ApmData>> {
/** Root element for XML files. */
public static final String ROOT = "apm";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_APM_VERS";
......
......@@ -54,9 +54,6 @@ import org.orekit.utils.IERSConventions;
*/
public class ApmParser extends AdmParser<ApmFile, ApmParser> {
/** Root element for XML files. */
private static final String ROOT = "apm";
/** File header. */
private Header header;
......@@ -108,7 +105,7 @@ public class ApmParser extends AdmParser<ApmFile, ApmParser> {
public ApmParser(final IERSConventions conventions, final boolean simpleEOP,
final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(ROOT, ApmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate);
super(ApmFile.ROOT, ApmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate);
}
/** {@inheritDoc} */
......@@ -131,7 +128,7 @@ public class ApmParser extends AdmParser<ApmFile, ApmParser> {
currentManeuver = null;
maneuvers = new ArrayList<>();
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(ApmFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new ErrorState(); // should never be called
......@@ -268,7 +265,7 @@ public class ApmParser extends AdmParser<ApmFile, ApmParser> {
* @return always return true
*/
boolean manageEulerElementsSpinSection(final boolean starting) {
setFallback(starting ? this::processEulerToken : structureProcessor);
setFallback(starting ? this::processSpinStabilizedToken : structureProcessor);
return true;
}
......
......@@ -59,7 +59,7 @@ public class ApmWriter extends AbstractMessageWriter<Header, Segment<AdmMetadata
*/
public ApmWriter(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(ApmFile.FORMAT_VERSION_KEY, CCSDS_APM_VERS,
super(ApmFile.ROOT, ApmFile.FORMAT_VERSION_KEY, CCSDS_APM_VERS,
new ContextBinding(
() -> conventions, () -> false, () -> dataContext,
() -> missionReferenceDate, () -> TimeSystem.UTC,
......@@ -68,7 +68,7 @@ public class ApmWriter extends AbstractMessageWriter<Header, Segment<AdmMetadata
/** {@inheritDoc} */
@Override
public void writeSegment(final Generator generator, final Segment<AdmMetadata, ApmData> segment)
public void writeSegmentContent(final Generator generator, final Segment<AdmMetadata, ApmData> segment)
throws IOException {
// write the metadata
......
......@@ -73,9 +73,13 @@ class EulerWriter extends AbstractWriter {
generator.writeEntry(EulerKey.RATE_FRAME.name(),
euler.rateFrameIsA() ? EulerKey.EULER_FRAME_A.name() : EulerKey.EULER_FRAME_B.name(),
true);
generator.writeEntry(seq.charAt(0) + ANGLE, Unit.DEGREE.fromSI(angles[0]), true);
generator.writeEntry(seq.charAt(1) + ANGLE, Unit.DEGREE.fromSI(angles[1]), true);
generator.writeEntry(seq.charAt(2) + ANGLE, Unit.DEGREE.fromSI(angles[2]), true);
// if we don't have rates, at least we need angles
// (we may have only rates, as orientation is already given by mandatory quaternion)
final boolean needsAngles = !euler.hasRates();
generator.writeEntry(seq.charAt(0) + ANGLE, Unit.DEGREE.fromSI(angles[0]), needsAngles);
generator.writeEntry(seq.charAt(1) + ANGLE, Unit.DEGREE.fromSI(angles[1]), needsAngles);
generator.writeEntry(seq.charAt(2) + ANGLE, Unit.DEGREE.fromSI(angles[2]), needsAngles);
// rates
if (euler.hasRates()) {
......
......@@ -29,6 +29,12 @@ import org.orekit.files.ccsds.section.CommentsContainer;
*/
public class UserDefined extends CommentsContainer {
/** Tag name for user defined parameters keys. */
public static final String USER_DEFINED_XML_TAG = "USER_DEFINED";
/** Attribute name for user defined parameters keys. */
public static final String USER_DEFINED_XML_ATTRIBUTE = "parameter";
/** Prefix for user defined parameters keys. */
public static final String USER_DEFINED_PREFIX = "USER_DEFINED_";
......
......@@ -20,9 +20,7 @@ package org.orekit.files.ccsds.ndm.odm;
import java.io.IOException;
import java.util.Map;
import org.orekit.errors.OrekitInternalError;
import org.orekit.files.ccsds.section.AbstractWriter;
import org.orekit.files.ccsds.utils.FileFormat;
import org.orekit.files.ccsds.utils.generation.Generator;
/** Writer for user defined parameters data.
......@@ -48,12 +46,7 @@ public class UserDefinedWriter extends AbstractWriter {
@Override
protected void writeContent(final Generator generator) throws IOException {
for (Map.Entry<String, String> entry : userDefined.getParameters().entrySet()) {
if (generator.getFormat() == FileFormat.XML) {
// TODO
throw new OrekitInternalError(null);
} else {
generator.writeEntry(UserDefined.USER_DEFINED_PREFIX + entry.getKey(), entry.getValue(), false);
}
generator.writeUserDefined(entry.getKey(), entry.getValue());
}
}
......
......@@ -36,6 +36,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
public class OcmFile extends NdmFile<Header, Segment<OcmMetadata, OcmData>>
implements EphemerisFile<TimeStampedPVCoordinates, OrbitStateHistory> {
/** Root element for XML messages. */
public static final String ROOT = "ocm";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_OCM_VERS";
......
......@@ -63,9 +63,6 @@ import org.orekit.utils.units.Unit;
*/
public class OcmParser extends CommonParser<OcmFile, OcmParser> implements EphemerisFileParser<OcmFile> {
/** Root element for XML messages. */
private static final String ROOT = "ocm";
/** Orbit line element for XML messages. */
private static final String ORB_LINE = "orbLine";
......@@ -140,7 +137,7 @@ public class OcmParser extends CommonParser<OcmFile, OcmParser> implements Ephem
*/
public OcmParser(final IERSConventions conventions, final boolean simpleEOP,
final DataContext dataContext, final double mu) {
super(ROOT, OcmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, null, mu);
super(OcmFile.ROOT, OcmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, null, mu);
}
/** {@inheritDoc} */
......@@ -182,7 +179,7 @@ public class OcmParser extends CommonParser<OcmFile, OcmParser> implements Ephem
orbitDeterminationBlock = null;
userDefinedBlock = null;
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(OcmFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new KvnStructureProcessingState(this);
......
......@@ -55,7 +55,7 @@ public class OcmWriter extends AbstractMessageWriter<Header, Segment<OcmMetadata
* @param dataContext used to retrieve frames, time scales, etc.
*/
public OcmWriter(final IERSConventions conventions, final DataContext dataContext) {
super(OcmFile.FORMAT_VERSION_KEY, CCSDS_OCM_VERS,
super(OcmFile.ROOT, OcmFile.FORMAT_VERSION_KEY, CCSDS_OCM_VERS,
new ContextBinding(
() -> conventions, () -> false, () -> dataContext,
() -> null, () -> TimeSystem.UTC,
......@@ -67,7 +67,7 @@ public class OcmWriter extends AbstractMessageWriter<Header, Segment<OcmMetadata
* @param segment segment to write
* @throws IOException if any buffer writing operations fails
*/
public void writeSegment(final Generator generator, final Segment<OcmMetadata, OcmData> segment)
public void writeSegmentContent(final Generator generator, final Segment<OcmMetadata, OcmData> segment)
throws IOException {
// write the metadata
......
......@@ -141,12 +141,16 @@ public class EphemerisWriter implements EphemerisFileWriter {
try (Generator generator = fileFormat == FileFormat.KVN ?
new KvnGenerator(appendable, OemWriter.KVN_PADDING_WIDTH, outputName) :
new XmlGenerator(appendable, XmlGenerator.DEFAULT_INDENT, outputName)) {
writer.writeHeader(generator, header);
// Loop on segments
for (final S segment : segments) {
writeSegment(generator, segment);
}
writer.writeFooter(generator);
}
}
......
......@@ -45,6 +45,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
public class OemFile extends NdmFile<Header, OemSegment>
implements EphemerisFile<TimeStampedPVCoordinates, OemSegment> {
/** Root element for XML files. */
public static final String ROOT = "oem";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_OEM_VERS";
......
......@@ -63,9 +63,6 @@ import org.orekit.utils.units.Unit;
*/
public class OemParser extends CommonParser<OemFile, OemParser> implements EphemerisFileParser<OemFile> {
/** Root element for XML files. */
private static final String ROOT = "oem";
/** Comment marker. */
private static final String COMMENT = "COMMENT";
......@@ -124,7 +121,7 @@ public class OemParser extends CommonParser<OemFile, OemParser> implements Ephem
final DataContext dataContext,
final AbsoluteDate missionReferenceDate, final double mu,
final int defaultInterpolationDegree) {
super(ROOT, OemFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext,
super(OemFile.ROOT, OemFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext,
missionReferenceDate, mu);
this.defaultInterpolationDegree = defaultInterpolationDegree;
}
......@@ -153,7 +150,7 @@ public class OemParser extends CommonParser<OemFile, OemParser> implements Ephem
currentCovariance = null;
currentRow = -1;
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(OemFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new KvnStructureProcessingState(this);
......
......@@ -235,7 +235,7 @@ public class OemWriter extends AbstractMessageWriter<Header, OemSegment, OemFile
*/
public OemWriter(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(OemFile.FORMAT_VERSION_KEY, CCSDS_OEM_VERS,
super(OemFile.ROOT, OemFile.FORMAT_VERSION_KEY, CCSDS_OEM_VERS,
new ContextBinding(
() -> conventions, () -> true, () -> dataContext,
() -> missionReferenceDate, () -> TimeSystem.UTC, () -> 0.0, () -> 1.0));
......@@ -243,7 +243,7 @@ public class OemWriter extends AbstractMessageWriter<Header, OemSegment, OemFile
/** {@inheritDoc} */
@Override
public void writeSegment(final Generator generator, final OemSegment segment) throws IOException {
public void writeSegmentContent(final Generator generator, final OemSegment segment) throws IOException {
final OemMetadata metadata = segment.getMetadata();
writeMetadata(generator, metadata);
......
......@@ -40,6 +40,9 @@ import org.orekit.utils.IERSConventions;
*/
public class OmmFile extends NdmFile<Header, Segment<OmmMetadata, OmmData>> implements TimeStamped {
/** Root element for XML files. */
public static final String ROOT = "omm";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_OMM_VERS";
......
......@@ -66,9 +66,6 @@ import org.orekit.utils.IERSConventions;
*/
public class OmmParser extends CommonParser<OmmFile, OmmParser> {
/** Root element for XML files. */
private static final String ROOT = "omm";
/** User-defined element. */
private static final String USER_DEFINED = "USER_DEFINED";
......@@ -121,7 +118,7 @@ public class OmmParser extends CommonParser<OmmFile, OmmParser> {
public OmmParser(final IERSConventions conventions, final boolean simpleEOP,
final DataContext dataContext, final AbsoluteDate missionReferenceDate,
final double mu, final double defaultMass) {
super(ROOT, OmmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate, mu);
super(OmmFile.ROOT, OmmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate, mu);
this.defaultMass = defaultMass;
}
......@@ -157,7 +154,7 @@ public class OmmParser extends CommonParser<OmmFile, OmmParser> {
covarianceBlock = null;
userDefinedBlock = null;
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(OmmFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new ErrorState(); // should never be called
......
......@@ -60,7 +60,7 @@ public class OmmWriter extends AbstractMessageWriter<Header, Segment<OmmMetadata
*/
public OmmWriter(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(OmmFile.FORMAT_VERSION_KEY, CCSDS_OMM_VERS,
super(OmmFile.ROOT, OmmFile.FORMAT_VERSION_KEY, CCSDS_OMM_VERS,
new ContextBinding(
() -> conventions, () -> false, () -> dataContext,
() -> missionReferenceDate, () -> TimeSystem.UTC,
......@@ -72,7 +72,7 @@ public class OmmWriter extends AbstractMessageWriter<Header, Segment<OmmMetadata
* @param segment segment to write
* @throws IOException if any buffer writing operations fails
*/
public void writeSegment(final Generator generator, final Segment<OmmMetadata, OmmData> segment)
public void writeSegmentContent(final Generator generator, final Segment<OmmMetadata, OmmData> segment)
throws IOException {
// write the metadata
......
......@@ -39,6 +39,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class OpmFile extends NdmFile<Header, Segment<CommonMetadata, OpmData>> implements TimeStamped {
/** Root element for XML files. */
public static final String ROOT = "opm";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_OPM_VERS";
......
......@@ -67,9 +67,6 @@ import org.orekit.utils.IERSConventions;
*/
public class OpmParser extends CommonParser<OpmFile, OpmParser> {
/** Root element for XML files. */
private static final String ROOT = "opm";
/** User-defined element. */
private static final String USER_DEFINED = "USER_DEFINED";
......@@ -129,7 +126,7 @@ public class OpmParser extends CommonParser<OpmFile, OpmParser> {
final DataContext dataContext,
final AbsoluteDate missionReferenceDate, final double mu,
final double defaultMass) {
super(ROOT, OpmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate, mu);
super(OpmFile.ROOT, OpmFile.FORMAT_VERSION_KEY, conventions, simpleEOP, dataContext, missionReferenceDate, mu);
this.defaultMass = defaultMass;
}
......@@ -167,7 +164,7 @@ public class OpmParser extends CommonParser<OpmFile, OpmParser> {
maneuverBlocks = new ArrayList<>();
userDefinedBlock = null;
if (fileFormat == FileFormat.XML) {
structureProcessor = new XmlStructureProcessingState(ROOT, this);
structureProcessor = new XmlStructureProcessingState(OpmFile.ROOT, this);
reset(fileFormat, structureProcessor);
} else {
structureProcessor = new ErrorState(); // should never be called
......
......@@ -63,7 +63,7 @@ public class OpmWriter extends AbstractMessageWriter<Header, Segment<CommonMetad
*/
public OpmWriter(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate) {
super(OpmFile.FORMAT_VERSION_KEY, CCSDS_OPM_VERS,
super(OpmFile.ROOT, OpmFile.FORMAT_VERSION_KEY, CCSDS_OPM_VERS,
new ContextBinding(
() -> conventions, () -> false, () -> dataContext,
() -> missionReferenceDate, () -> TimeSystem.UTC,
......@@ -75,7 +75,7 @@ public class OpmWriter extends AbstractMessageWriter<Header, Segment<CommonMetad
* @param segment segment to write
* @throws IOException if any buffer writing operations fails
*/
public void writeSegment(final Generator generator, final Segment<CommonMetadata, OpmData> segment)
public void writeSegmentContent(final Generator generator, final Segment<CommonMetadata, OpmData> segment)
throws IOException {
// write the metadata
......
......@@ -18,7 +18,6 @@ package org.orekit.files.ccsds.ndm.tdm;
import java.io.IOException;
import org.orekit.errors.OrekitInternalError;
import org.orekit.files.ccsds.definitions.TimeConverter;
import org.orekit.files.ccsds.section.AbstractWriter;
import org.orekit.files.ccsds.section.KvnStructureKey;
......@@ -74,17 +73,19 @@ class ObservationsBlockWriter extends AbstractWriter {
for (final Observation observation : observationsBlock.getObservations()) {
final Observationtype type = observation.getType();
final AbsoluteDate date = observation.getEpoch();
final double rawValue = observation.getMeasurement();
final double siValue = type.siToRaw(converter, metadata, date, rawValue);
final double siValue = observation.getMeasurement();
final double rawValue = type.siToRaw(converter, metadata, date, siValue);
if (generator.getFormat() == FileFormat.KVN) {
final StringBuilder builder = new StringBuilder();
builder.append(generator.dateToString(timeConverter, date));
builder.append(' ');
builder.append(generator.doubleToString(siValue));
builder.append(generator.doubleToString(rawValue));
generator.writeEntry(observation.getType().name(), builder.toString(), false);
} else {
// TODO
throw new OrekitInternalError(null);
generator.enterSection(TdmDataKey.observation.name());
generator.writeEntry(TdmDataKey.EPOCH.name(), timeConverter, date, true);
generator.writeEntry(type.name(), rawValue, true);
generator.exitSection();
}
}
......
......@@ -38,6 +38,9 @@ import org.orekit.utils.IERSConventions;
*/
public class TdmFile extends NdmFile<Header, Segment<TdmMetadata, ObservationsBlock>> {
/** Root element for XML files. */
public static final String ROOT = "tdm";
/** Key for format version. */
public static final String FORMAT_VERSION_KEY = "CCSDS_TDM_VERS";
......
......@@ -81,14 +81,18 @@ class TdmMetadataWriter extends AbstractWriter {
generator.writeEntry(TdmMetadataKey.TRANSMIT_BAND.name(), metadata.getTransmitBand(), false);
generator.writeEntry(TdmMetadataKey.RECEIVE_BAND.name(), metadata.getReceiveBand(), false);
generator.writeEntry(TdmMetadataKey.TURNAROUND_NUMERATOR.name(), metadata.getTurnaroundNumerator(), false);
generator.writeEntry(TdmMetadataKey.TURNAROUND_DENOMINATOR.name(), metadata.getTurnaroundDenominator(), false);
if (metadata.getTurnaroundNumerator() != 0 || metadata.getTurnaroundDenominator() != 0) {
generator.writeEntry(TdmMetadataKey.TURNAROUND_NUMERATOR.name(), metadata.getTurnaroundNumerator(), false);
generator.writeEntry(TdmMetadataKey.TURNAROUND_DENOMINATOR.name(), metadata.getTurnaroundDenominator(), false);
}
generator.writeEntry(TdmMetadataKey.TIMETAG_REF.name(), metadata.getTimetagRef(), false);
generator.writeEntry(TdmMetadataKey.INTEGRATION_INTERVAL.name(), metadata.getIntegrationInterval(), false);
generator.writeEntry(TdmMetadataKey.INTEGRATION_REF.name(), metadata.getIntegrationRef(), false);
generator.writeEntry(TdmMetadataKey.FREQ_OFFSET.name(), metadata.getFreqOffset(), false);
generator.writeEntry(TdmMetadataKey.RANGE_MODE.name(), metadata.getRangeMode(), false);
generator.writeEntry(TdmMetadataKey.RANGE_MODULUS.name(), metadata.getRawRangeModulus(), false);
if (metadata.getRawRangeModulus() != 0) {
generator.writeEntry(TdmMetadataKey.RANGE_MODULUS.name(), metadata.getRawRangeModulus(), false);
}
generator.writeEntry(TdmMetadataKey.RANGE_UNITS.name(), metadata.getRangeUnits(), false);
generator.writeEntry(TdmMetadataKey.ANGLE_TYPE.name(), metadata.getAngleType(), false);
if (metadata.getReferenceFrame() != null) {
......@@ -105,12 +109,24 @@ class TdmMetadataWriter extends AbstractWriter {
generator.writeEntry(TdmMetadataKey.RECEIVE_DELAY_4.name(), Unit.SECOND.fromSI(metadata.getReceiveDelays().get(4)), false);
generator.writeEntry(TdmMetadataKey.RECEIVE_DELAY_5.name(), Unit.SECOND.fromSI(metadata.getReceiveDelays().get(5)), false);
generator.writeEntry(TdmMetadataKey.DATA_QUALITY.name(), metadata.getDataQuality(), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_ANGLE_1.name(), Unit.DEGREE.fromSI(metadata.getCorrectionAngle1()), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_ANGLE_2.name(), Unit.DEGREE.fromSI(metadata.getCorrectionAngle2()), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_DOPPLER.name(), Units.KM_PER_S.fromSI(metadata.getCorrectionDoppler()), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_RANGE.name(), Unit.ONE.fromSI(metadata.getRawCorrectionRange()), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_RECEIVE.name(), Unit.HERTZ.fromSI(metadata.getCorrectionReceive()), false);
generator.writeEntry(TdmMetadataKey.CORRECTION_TRANSMIT.name(), Unit.HERTZ.fromSI(metadata.getCorrectionTransmit()), false);
if (metadata.getCorrectionAngle1() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_ANGLE_1.name(), Unit.DEGREE.fromSI(metadata.getCorrectionAngle1()), false);
}
if (metadata.getCorrectionAngle2() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_ANGLE_2.name(), Unit.DEGREE.fromSI(metadata.getCorrectionAngle2()), false);
}
if (metadata.getCorrectionDoppler() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_DOPPLER.name(), Units.KM_PER_S.fromSI(metadata.getCorrectionDoppler()), false);
}
if (metadata.getRawCorrectionRange() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_RANGE.name(), Unit.ONE.fromSI(metadata.getRawCorrectionRange()), false);
}
if (metadata.getCorrectionReceive() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_RECEIVE.name(), Unit.HERTZ.fromSI(metadata.getCorrectionReceive()), false);
}
if (metadata.getCorrectionTransmit() != 0) {
generator.writeEntry(TdmMetadataKey.CORRECTION_TRANSMIT.name(), Unit.HERTZ.fromSI(metadata.getCorrectionTransmit()), false);
}
generator.writeEntry(TdmMetadataKey.CORRECTIONS_APPLIED.name(), metadata.getCorrectionsApplied(), false);
}
......
......@@ -55,9 +55,6 @@ import org.orekit.utils.IERSConventions;
*/
public class TdmParser extends AbstractMessageParser<TdmFile, TdmParser> {
/** Root element for XML files. */
private static final String ROOT = "tdm";
/** Converter for {@link RangeUnits#RU Range Units} (may be null). */
private final RangeUnitsConverter converter;
......@@ -93,7 +90,7 @@ public class TdmParser extends AbstractMessageParser<TdmFile, TdmParser> {