Skip to content
Snippets Groups Projects
Commit 2d0ba555 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Improved dump of min/max cell.

parent 5403bbdb
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Rotation; ...@@ -27,6 +27,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.OpenIntToDoubleHashMap; import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.errors.OrekitException; import org.orekit.errors.OrekitException;
import org.orekit.frames.FactoryManagedFrame; import org.orekit.frames.FactoryManagedFrame;
import org.orekit.frames.Frame; import org.orekit.frames.Frame;
...@@ -151,6 +152,19 @@ class Dump { ...@@ -151,6 +152,19 @@ class Dump {
lightTimeCorrection, aberrationOfLightCorrection); lightTimeCorrection, aberrationOfLightCorrection);
} }
/** Dump a direct location result.
* @param gp resulting geodetic point
* @exception RuggedException if date cannot be converted to UTC
*/
public void dumpDirectLocationResult(final GeodeticPoint gp)
throws RuggedException {
if (gp != null) {
writer.format(Locale.US,
"direct location result: latitude %22.15e longitude %22.15e elevation %22.15e%n",
gp.getLatitude(), gp.getLongitude(), gp.getAltitude());
}
}
/** Dump an observation transform transform. /** Dump an observation transform transform.
* @param scToBody provider for observation * @param scToBody provider for observation
* @param index index of the transform * @param index index of the transform
...@@ -214,6 +228,12 @@ class Dump { ...@@ -214,6 +228,12 @@ class Dump {
// it is the first time we encounter this tile, we need to dump its data // it is the first time we encounter this tile, we need to dump its data
final DumpedTileData dumpedTileData = new DumpedTileData("t" + tiles.size(), tile); final DumpedTileData dumpedTileData = new DumpedTileData("t" + tiles.size(), tile);
tiles.add(dumpedTileData); tiles.add(dumpedTileData);
dumpedTileData.setElevation(tile.getMinElevationLatitudeIndex(),
tile.getMinElevationLongitudeIndex(),
tile.getMinElevation());
dumpedTileData.setElevation(tile.getMaxElevationLatitudeIndex(),
tile.getMaxElevationLongitudeIndex(),
tile.getMaxElevation());
return dumpedTileData; return dumpedTileData;
} }
......
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.frames.Transform; import org.orekit.frames.Transform;
import org.orekit.rugged.api.AlgorithmId; import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile; import org.orekit.rugged.raster.Tile;
...@@ -60,7 +61,7 @@ public class DumpManager { ...@@ -60,7 +61,7 @@ public class DumpManager {
throw new RuggedException(RuggedMessages.DEBUG_DUMP_ALREADY_ACTIVE); throw new RuggedException(RuggedMessages.DEBUG_DUMP_ALREADY_ACTIVE);
} else { } else {
try { try {
DUMP.set(new Dump(new PrintWriter(file))); DUMP.set(new Dump(new PrintWriter(file, "UTF-8")));
} catch (IOException ioe) { } catch (IOException ioe) {
throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR, throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR,
file.getAbsolutePath(), ioe.getLocalizedMessage()); file.getAbsolutePath(), ioe.getLocalizedMessage());
...@@ -145,6 +146,17 @@ public class DumpManager { ...@@ -145,6 +146,17 @@ public class DumpManager {
} }
} }
/** Dump a direct location result.
* @param gp resulting geodetic point
* @exception RuggedException if date cannot be converted to UTC
*/
public static void dumpDirectLocationResult(final GeodeticPoint gp)
throws RuggedException {
if (isActive()) {
DUMP.get().dumpDirectLocationResult(gp);
}
}
/** Dump an observation transform transform. /** Dump an observation transform transform.
* @param scToBody provider for observation * @param scToBody provider for observation
* @param index index of the transform * @param index index of the transform
......
...@@ -189,17 +189,39 @@ public class SimpleTile implements Tile { ...@@ -189,17 +189,39 @@ public class SimpleTile implements Tile {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getMinElevation() { public double getMinElevation() {
DumpManager.dumpTileCell(this, minElevationLatitudeIndex, minElevationLongitudeIndex, minElevation);
return minElevation; return minElevation;
} }
/** {@inheritDoc} */
@Override
public int getMinElevationLatitudeIndex() {
return minElevationLatitudeIndex;
}
/** {@inheritDoc} */
@Override
public int getMinElevationLongitudeIndex() {
return minElevationLongitudeIndex;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double getMaxElevation() { public double getMaxElevation() {
DumpManager.dumpTileCell(this, maxElevationLatitudeIndex, maxElevationLongitudeIndex, maxElevation);
return maxElevation; return maxElevation;
} }
/** {@inheritDoc} */
@Override
public int getMaxElevationLatitudeIndex() {
return maxElevationLatitudeIndex;
}
/** {@inheritDoc} */
@Override
public int getMaxElevationLongitudeIndex() {
return maxElevationLongitudeIndex;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void setElevation(final int latitudeIndex, final int longitudeIndex, public void setElevation(final int latitudeIndex, final int longitudeIndex,
......
...@@ -215,11 +215,27 @@ public interface Tile extends UpdatableTile { ...@@ -215,11 +215,27 @@ public interface Tile extends UpdatableTile {
*/ */
double getMinElevation(); double getMinElevation();
/** Get the maximum elevation in the tile. /** Get the latitude index of min elevation.
* @return latitude index of min elevation*/
int getMinElevationLatitudeIndex();
/** Get the longitude index of min elevation.
* @return longitude index of min elevation*/
int getMinElevationLongitudeIndex();
/** Get the maximum elevation in the tile.
* @return maximum elevation in the tile * @return maximum elevation in the tile
*/ */
double getMaxElevation(); double getMaxElevation();
/** Get the latitude index of max elevation.
* @return latitude index of max elevation*/
int getMaxElevationLatitudeIndex();
/** Get the longitude index of max elevation.
* @return longitude index of max elevation*/
int getMaxElevationLongitudeIndex();
/** Get the elevation of an exact grid point. /** Get the elevation of an exact grid point.
* @param latitudeIndex grid point index along latitude * @param latitudeIndex grid point index along latitude
* @param longitudeIndex grid point index along longitude * @param longitudeIndex grid point index along longitude
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment