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;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.errors.OrekitException;
import org.orekit.frames.FactoryManagedFrame;
import org.orekit.frames.Frame;
......@@ -151,6 +152,19 @@ class Dump {
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.
* @param scToBody provider for observation
* @param index index of the transform
......@@ -214,6 +228,12 @@ class Dump {
// it is the first time we encounter this tile, we need to dump its data
final DumpedTileData dumpedTileData = new DumpedTileData("t" + tiles.size(), tile);
tiles.add(dumpedTileData);
dumpedTileData.setElevation(tile.getMinElevationLatitudeIndex(),
tile.getMinElevationLongitudeIndex(),
tile.getMinElevation());
dumpedTileData.setElevation(tile.getMaxElevationLatitudeIndex(),
tile.getMaxElevationLongitudeIndex(),
tile.getMaxElevation());
return dumpedTileData;
}
......
......@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.frames.Transform;
import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile;
......@@ -60,7 +61,7 @@ public class DumpManager {
throw new RuggedException(RuggedMessages.DEBUG_DUMP_ALREADY_ACTIVE);
} else {
try {
DUMP.set(new Dump(new PrintWriter(file)));
DUMP.set(new Dump(new PrintWriter(file, "UTF-8")));
} catch (IOException ioe) {
throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR,
file.getAbsolutePath(), ioe.getLocalizedMessage());
......@@ -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.
* @param scToBody provider for observation
* @param index index of the transform
......
......@@ -189,17 +189,39 @@ public class SimpleTile implements Tile {
/** {@inheritDoc} */
@Override
public double getMinElevation() {
DumpManager.dumpTileCell(this, minElevationLatitudeIndex, minElevationLongitudeIndex, minElevation);
return minElevation;
}
/** {@inheritDoc} */
@Override
public int getMinElevationLatitudeIndex() {
return minElevationLatitudeIndex;
}
/** {@inheritDoc} */
@Override
public int getMinElevationLongitudeIndex() {
return minElevationLongitudeIndex;
}
/** {@inheritDoc} */
@Override
public double getMaxElevation() {
DumpManager.dumpTileCell(this, maxElevationLatitudeIndex, maxElevationLongitudeIndex, maxElevation);
return maxElevation;
}
/** {@inheritDoc} */
@Override
public int getMaxElevationLatitudeIndex() {
return maxElevationLatitudeIndex;
}
/** {@inheritDoc} */
@Override
public int getMaxElevationLongitudeIndex() {
return maxElevationLongitudeIndex;
}
/** {@inheritDoc} */
@Override
public void setElevation(final int latitudeIndex, final int longitudeIndex,
......
......@@ -215,11 +215,27 @@ public interface Tile extends UpdatableTile {
*/
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
*/
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.
* @param latitudeIndex grid point index along latitude
* @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