- int idx = (tile.getLatitude() + 59)*360 + (tile.getLongitude() + 180);
- try
- {
- int dir = lookup[idx];
- if (dir > 0) {
- try {
- urls[t] = new URL(URL_PREFIX + CONTINENTS[dir] + "/" + tile.getTileName());
- } catch (MalformedURLException e) {} // ignore error, url stays null
- }
- } catch (ArrayIndexOutOfBoundsException e) {} // ignore error, url stays null
- }
- return urls;
- }
-
- /**
- * Read the dat file and get the contents
- * @return byte array containing file contents
- */
- private static byte[] readDatFile()
- {
- InputStream in = null;
- try
- {
- // Need absolute path to dat file
- in = TileFinder.class.getResourceAsStream("/tim/prune/function/srtm/srtmtiles.dat");
- if (in != null)
- {
- byte[] buffer = new byte[in.available()];
- in.read(buffer);
- in.close();
- return buffer;
- }
- }
- catch (java.io.IOException e) {
- System.err.println("Exception trying to read srtmtiles.dat : " + e.getMessage());
- }
- finally
- {