Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Terminology and variable tweaks.
  • Loading branch information
markpet49 committed Mar 22, 2024
commit 8d0525c962a499b92f466314cb9c98b9bb521787
18 changes: 9 additions & 9 deletions src/gov/nasa/worldwind/util/EGM2008.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@

public class EGM2008
{
protected static final int N_ROW_MARKERS = 2; // The beginning and end of each row of latitude data is a flag of some sort
protected static final int LONGITUDE_COLS = 8640 + N_ROW_MARKERS; // Number of float32s in a row of data in the data file.
protected static final int LATITUDE_ROWS = 4321; // Number of rows.
public static final int N_ROW_MARKERS = 2; // The beginning and end of each row of latitude data is a flag of some sort
public static final int N_LONGITUDE_COLS = 8640 + N_ROW_MARKERS; // Number of float32s in a row of data in the data file.
public static final int N_LATITUDE_ROWS = 4321; // Number of rows.
public static final double GRID_RESOLUTION = 2.5d / 60d; // 2.5 minute grid
protected static final double CELL_AREA = GRID_RESOLUTION * GRID_RESOLUTION;
protected static final long CACHE_SIZE = EGM2008.LONGITUDE_COLS * 4 * 45 * 15; // Cache 15 degrees worth of offsets.
protected static final int N_LAT_ROW_BYTES = LONGITUDE_COLS * 4; // Offsets are float32
public static final double CELL_AREA = GRID_RESOLUTION * GRID_RESOLUTION;
protected static final long CACHE_SIZE = EGM2008.N_LONGITUDE_COLS * 4 * 45 * 15; // Cache 15 degrees worth of offsets.
public static final int N_LAT_ROW_BYTES = N_LONGITUDE_COLS * 4; // Offsets are float32

protected String offsetsFilePath;
protected BufferWrapper deltas;
Expand Down Expand Up @@ -171,7 +171,7 @@ public float[][] getLatRows(int latRow) throws IOException
boolean retrievalRequired = false;
for (int i = 0; i < interpRowIndices.length; i++)
{
if (interpRowIndices[i] < EGM2008.LATITUDE_ROWS)
if (interpRowIndices[i] < EGM2008.N_LATITUDE_ROWS)
{
float[] latData = (float[]) this.offsetCache.getObject(interpRowIndices[i]);
latDataArray[i] = latData;
Expand All @@ -187,14 +187,14 @@ public float[][] getLatRows(int latRow) throws IOException
{
for (int i = 0; i < interpRowIndices.length; i++)
{
if (interpRowIndices[i] < EGM2008.LATITUDE_ROWS && latDataArray[i] == null)
if (interpRowIndices[i] < EGM2008.N_LATITUDE_ROWS && latDataArray[i] == null)
{
offsetFile.seek(interpRowIndices[i] * EGM2008.N_LAT_ROW_BYTES);
byte[] latByteData = new byte[EGM2008.N_LAT_ROW_BYTES];
offsetFile.read(latByteData);
ByteBuffer latByteBuffer = ByteBuffer.wrap(latByteData).order(ByteOrder.LITTLE_ENDIAN);
FloatBuffer latFloatBuffer = latByteBuffer.asFloatBuffer();
float[] latData = new float[EGM2008.LONGITUDE_COLS];
float[] latData = new float[EGM2008.N_LONGITUDE_COLS];
latFloatBuffer.get(latData);
this.offsetCache.add(interpRowIndices[i], latData, EGM2008.N_LAT_ROW_BYTES);
latDataArray[i] = latData;
Expand Down
8 changes: 4 additions & 4 deletions src/gov/nasa/worldwindx/examples/EGM2008Offsets.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import javax.swing.SwingUtilities;

/**
* Shows how to apply EGM2008 offsets to the Earth.
* Shows how to apply EGM2008 offsets to Earth elevations.
*
* This EGM2008 data file is not included in the SDK due to its size. The data may be downloaded here:
* https://builds.worldwind.arc.nasa.gov/artifactory/EGM2008-Data/egm2008_25.dat
Expand Down Expand Up @@ -156,12 +156,12 @@ public AppFrame()
double elevation = earth.getElevation(pos.latitude, pos.longitude);
if (egmAvailable)
{
placemark.setValue(AVKey.DISPLAY_NAME, String.format("EGM2008 Offset: %7.4f\nEllipse elevation:%7.4f\nEGM2008 Adjusted elevation: %7.4f",
egmOffset, elevation, elevation + egmOffset));
placemark.setValue(AVKey.DISPLAY_NAME, String.format("EGM2008 Offset: %7.4f\nEllipsoid elevation:%7.4f\nEGM2008 Adjusted elevation: %7.4f",
egmOffset, elevation, elevation - egmOffset));
}
else
{
placemark.setValue(AVKey.DISPLAY_NAME, String.format("EGM2008 Offset: N/A\nEllipse elevation:%7.4f\nEGM2008 Adjusted elevation: N/A",
placemark.setValue(AVKey.DISPLAY_NAME, String.format("EGM2008 Offset: N/A\nEllipsoid elevation:%7.4f\nEGM2008 Adjusted elevation: N/A",
elevation));
}
placemark.setLabelText(label);
Expand Down