Evan Ward <evan.ward@nrl.navy.mil> a écrit :
On 10/26/2016 08:30 AM, MAISONOBE Luc wrote:
For the most part it seems that the OrekitFixedStepHandler could
be used
as the interface for an EphemerisWriter.
Do you imply that EphemerisWriter would extend
OrekitFixedStepHandler? What
would be the additional methods in this case? So do you intend
something like:
OEMWriter writer = new OEMWriter(file, metaData1, metaData2, ...);
writer.method1();
writer.method2();
propagator.setMasterMode(step, writer);
propagator.propagate();
writer.close();
For the most part, yes. To provide a couple more details of what I'm
thinking:
Appendable out = ...;
Frame frame = ...;
TimeScale scale = ...;
OEMWriter writer = new OEMWriter(out, frame, scale, metadata);
Propagator propagator = ...;
propagator.setMasterMode(step, writer);
propagator.propagate();
// close out if necessary
The EphemerisWriter interface could provide methods such as
getFrame(), and getTimeScale(), but these methods don't seem
especially necessary. I think the writer can use the isLast parameter
of handleStep(...) to figure out when to write the footer, if the
file format has one.
Very good! I did not thought about this.
Do you see a case where we would need an explicit close() or flush()
method for the EphemerisWriter? If it turns out that we don't need
any additional methods beyond those in OrekitFixedStepHandler then we
can just use that interface, with some documentation explaining the
intended usage.
No, I don't see why we should close the EphemerisWriter ourselves. If the
Appendable used also implements Closeable, the user should still close it
after the ephemeris is completed.
One piece of information that is
missing is the step size, but that could easily be added to the
init(...)
method call.
Yes, but if we use constructor for other meta-data, we could also
provide the
step size this way.
I pushed up a commit that added the step size to the init(...)
method. I think this helps reduce the duplicated information that
could become mismatched.
This is fine with me. With this change and Pascal's change about
atmosphere, I guess next version will be 9.0.