Class StreamingOcmWriter
- java.lang.Object
-
- org.orekit.files.ccsds.ndm.odm.ocm.StreamingOcmWriter
-
- All Implemented Interfaces:
AutoCloseable
public class StreamingOcmWriter extends Object implements AutoCloseable
A writer for OCM files.Each instance corresponds to a single Orbit Comprehensive Message. A new OCM ephemeris trajectory state history block is started by calling
newBlock()
.This writer is intended to write only trajectory state history blocks. It does not writes physical properties, covariance data, maneuver data, perturbations parameters, orbit determination or user-defined parameters. If these blocks are needed, then
OcmWriter
must be used as it handles all OCM data blocks.The trajectory blocks metadata identifiers (
TRAJ_ID
,TRAJ_PREV_ID
,TRAJ_NEXT_ID
) are updated automatically usingTrajectoryStateHistoryMetadata.incrementTrajID(String)
, so users should generally only setTrajectoryStateHistoryMetadata.setTrajID(String)
in the template.The blocks returned by this class can be used as step handlers for a
Propagator
.Propagator propagator = ...; // pre-configured propagator OCMWriter ocmWriter = ...; // pre-configured writer try (Generator out = ...; // set-up output stream StreamingOcmWriter sw = new StreamingOcmWriter(out, ocmWriter, header, metadata, template)) { // set-up streaming writer // write block 1 propagator.getMultiplexer().add(step, sw.newBlock()); propagator.propagate(startDate1, stopDate1); ... // write block n propagator.getMultiplexer().clear(); propagator.getMultiplexer().add(step, sw.newBlock()); propagator.propagate(startDateN, stopDateN); }
- Since:
- 12.0
- Author:
- Luc Maisonobe
- See Also:
OcmWriter
,EphemerisOcmWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StreamingOcmWriter.BlockWriter
A writer for a trajectory state history block of an OCM.
-
Constructor Summary
Constructors Constructor Description StreamingOcmWriter(Generator generator, OcmWriter writer, OdmHeader header, OcmMetadata metadata, TrajectoryStateHistoryMetadata template)
Construct a writer that for each segment uses the reference frame of the first state's attitude.StreamingOcmWriter(Generator generator, OcmWriter writer, OdmHeader header, OcmMetadata metadata, TrajectoryStateHistoryMetadata template, boolean useAttitudeFrame)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
StreamingOcmWriter.BlockWriter
newBlock()
Create a writer for a new OCM trajectory state history block.
-
-
-
Constructor Detail
-
StreamingOcmWriter
public StreamingOcmWriter(Generator generator, OcmWriter writer, OdmHeader header, OcmMetadata metadata, TrajectoryStateHistoryMetadata template)
Construct a writer that for each segment uses the reference frame of the first state's attitude.- Parameters:
generator
- generator for OCM outputwriter
- writer for the OCM message formatheader
- file header (may be null)metadata
- file metadatatemplate
- template for trajectory metadata- See Also:
StreamingOcmWriter(Generator, OcmWriter, OdmHeader, OcmMetadata, TrajectoryStateHistoryMetadata, boolean)
-
StreamingOcmWriter
public StreamingOcmWriter(Generator generator, OcmWriter writer, OdmHeader header, OcmMetadata metadata, TrajectoryStateHistoryMetadata template, boolean useAttitudeFrame)
Simple constructor.- Parameters:
generator
- generator for OCM outputwriter
- writer for the OCM message formatheader
- file header (may be null)metadata
- file metadatatemplate
- template for trajectory metadatauseAttitudeFrame
- iftrue
then the reference frame for each segment is taken from the first state's attitude. Otherwise thetemplate
's reference frame is used,TrajectoryStateHistoryMetadata.getTrajReferenceFrame()
.
-
-
Method Detail
-
newBlock
public StreamingOcmWriter.BlockWriter newBlock()
Create a writer for a new OCM trajectory state history block.The returned writer can only write a single trajectory state history block in an OCM. This method must be called to create a writer for each trajectory state history block.
- Returns:
- a new OCM trajectory state history block writer, ready for use.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
-