private boolean _running = false;
/** Expected size of hgt file in bytes */
- private static final long HGT_SIZE = 2884802L;
+ private static final int HGT_ROW = 3601;
+ private static final int HGT_SIZE = 2 * HGT_ROW * HGT_ROW;
/** Altitude below which is considered void */
private static final int VOID_VAL = -32768;
{
// Set progress
_progress.setValue(t);
- final int ARRLENGTH = 1201 * 1201;
+ final int ARRLENGTH = HGT_ROW * HGT_ROW;
int[] heights = new int[ARRLENGTH];
// Open zipinputstream on url and check size
ZipInputStream inStream = getStreamToHgtFile(urls[t]);
{
if (new SrtmTile(point).equals(tile))
{
- double x = (point.getLongitude().getDouble() - tile.getLongitude()) * 1200;
- double y = 1201 - (point.getLatitude().getDouble() - tile.getLatitude()) * 1200;
- int idx1 = ((int)y)*1201 + (int)x;
+ double x = (point.getLongitude().getDouble() - tile.getLongitude()) * (HGT_ROW - 1);
+ double y = HGT_ROW - (point.getLatitude().getDouble() - tile.getLatitude()) * (HGT_ROW - 1);
+ int idx1 = ((int)y)*HGT_ROW + (int)x;
try
{
- int[] fouralts = {heights[idx1], heights[idx1+1], heights[idx1-1201], heights[idx1-1200]};
+ int[] fouralts = {heights[idx1], heights[idx1+1], heights[idx1-HGT_ROW], heights[idx1-HGT_ROW+1]};
int numVoids = (fouralts[0]==VOID_VAL?1:0) + (fouralts[1]==VOID_VAL?1:0)
+ (fouralts[2]==VOID_VAL?1:0) + (fouralts[3]==VOID_VAL?1:0);
// if (numVoids > 0) System.out.println(numVoids + " voids found");
// System.out.println("Lookup: Trying online: " + inUrl.toString());
_hadToDownload = true;
// MAYBE: Only download if we're in online mode?
- return new ZipInputStream(inUrl.openStream());
+ // return new ZipInputStream(inUrl.openStream());
+ return null;
}
/**