Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Orekit
Orekit
Commits
e9f8abe8
Commit
e9f8abe8
authored
Jun 07, 2022
by
Bryan Cazabonne
Browse files
Minor fixes for issue 790.
parent
ab148662
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/orekit/files/ilrs/CPF.java
View file @
e9f8abe8
...
...
@@ -145,6 +145,7 @@ public class CPF implements EphemerisFile<CPF.CPFCoordinate, CPF.CPFEphemeris> {
* Add the velocity to the last CPF coordinate entry.
* @param id satellite ILRS identifier
* @param velocity the velocity vector of the satellite
* @since 11.2
*/
public
void
addSatelliteVelocityToCPFCoordinate
(
final
String
id
,
final
Vector3D
velocity
)
{
// Get the last coordinate entry, which contains the position vector
...
...
src/main/java/org/orekit/files/ilrs/CPFWriter.java
View file @
e9f8abe8
...
...
@@ -56,8 +56,12 @@ public class CPFWriter implements EphemerisFileWriter {
/**
* Constructor.
* <p>
* Using this constructor, velocity data are not written.
* </p>
* @param header container for header data
* @param timescale time scale for dates
* @see #CPFWriter(CPFHeader, TimeScale, boolean)
*/
public
CPFWriter
(
final
CPFHeader
header
,
final
TimeScale
timescale
)
{
this
(
header
,
timescale
,
false
);
...
...
@@ -67,13 +71,13 @@ public class CPFWriter implements EphemerisFileWriter {
* Constructor.
* @param header container for header data
* @param timescale time scale for dates
* @param velocityFlag the flag for the optional velocity record
* @param velocityFlag true if velocity must be written
* @since 11.2
*/
public
CPFWriter
(
final
CPFHeader
header
,
final
TimeScale
timescale
,
final
boolean
velocityFlag
)
{
this
.
header
=
header
;
this
.
timescale
=
timescale
;
this
.
velocityFlag
=
velocityFlag
;
}
/** {@inheritDoc} */
...
...
@@ -98,7 +102,7 @@ public class CPFWriter implements EphemerisFileWriter {
// Writer
final
StreamingCpfWriter
cpfWriter
=
new
StreamingCpfWriter
(
writer
,
timescale
,
header
);
new
StreamingCpfWriter
(
writer
,
timescale
,
header
,
velocityFlag
);
// Write header
cpfWriter
.
writeHeader
();
...
...
@@ -107,7 +111,7 @@ public class CPFWriter implements EphemerisFileWriter {
final
Segment
segmentWriter
=
cpfWriter
.
newSegment
(
header
.
getRefFrame
());
// Loop on coordinates
for
(
final
TimeStampedPVCoordinates
coordinates
:
segment
.
getCoordinates
())
{
segmentWriter
.
writeEphemerisLine
(
coordinates
,
velocityFlag
);
segmentWriter
.
writeEphemerisLine
(
coordinates
);
}
}
...
...
src/main/java/org/orekit/files/ilrs/StreamingCpfWriter.java
View file @
e9f8abe8
...
...
@@ -118,20 +118,42 @@ public class StreamingCpfWriter {
/** Container for header data. */
private
final
CPFHeader
header
;
/** Flag for optional velocity record. */
private
final
boolean
velocityFlag
;
/**
* Create a CPF writer than streams data to the given output stream.
*
* <p>
* Using this constructor, velocity data are not written.
* </p>
* @param writer the output stream for the CPF file.
* @param timeScale for all times in the CPF
* @param header container for header data
* @see #StreamingCpfWriter(Appendable, TimeScale, CPFHeader, boolean)
*/
public
StreamingCpfWriter
(
final
Appendable
writer
,
final
TimeScale
timeScale
,
final
CPFHeader
header
)
{
this
(
writer
,
timeScale
,
header
,
false
);
}
this
.
writer
=
writer
;
this
.
timeScale
=
timeScale
;
this
.
header
=
header
;
/**
* Create a CPF writer than streams data to the given output stream.
*
* @param writer the output stream for the CPF file.
* @param timeScale for all times in the CPF
* @param header container for header data
* @param velocityFlag true if velocity must be written
* @since 11.2
*/
public
StreamingCpfWriter
(
final
Appendable
writer
,
final
TimeScale
timeScale
,
final
CPFHeader
header
,
final
boolean
velocityFlag
)
{
this
.
writer
=
writer
;
this
.
timeScale
=
timeScale
;
this
.
header
=
header
;
this
.
velocityFlag
=
velocityFlag
;
}
/**
...
...
@@ -281,26 +303,17 @@ public class StreamingCpfWriter {
}
/**
* Write a single ephemeris line with position record. This method does not
* write the velocity terms.
*
* Write ephemeris lines.
* <p>
* If <code>velocityFlag</code> is equals to true, both
* position and velocity records are written. Otherwise,
* only the position data are used.
* </p>
* @param pv the time, position, and velocity to write.
* @throws IOException if the output stream throws one while writing.
*/
public
void
writeEphemerisLine
(
final
TimeStampedPVCoordinates
pv
)
throws
IOException
{
writeEphemerisLine
(
pv
,
false
);
}
/**
* Write two ephemeris lines with position and velocity records.
*
* @param pv the time, position, and velocity to write.
* @param velocityFlag flag for the optional velocity record.
* @throws IOException if the output stream throws one while writing.
*/
public
void
writeEphemerisLine
(
final
TimeStampedPVCoordinates
pv
,
final
boolean
velocityFlag
)
throws
IOException
{
// Record type and direction flag
writeValue
(
writer
,
A2
,
"10"
,
true
);
...
...
@@ -339,6 +352,7 @@ public class StreamingCpfWriter {
// New line
writer
.
append
(
NEW_LINE
);
}
}
...
...
src/test/java/org/orekit/files/ilrs/CPFWriterTest.java
View file @
e9f8abe8
...
...
@@ -22,7 +22,6 @@ import static org.junit.Assert.fail;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
...
...
@@ -30,7 +29,6 @@ import java.io.InputStreamReader;
import
java.io.Reader
;
import
java.net.URISyntaxException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment