1 package tim.prune.function.srtm;
3 import tim.prune.data.Coordinate;
4 import tim.prune.data.DataPoint;
7 * Class to represent a single tile of Srtm data, from a single hgt.zip file
11 /** Latitude in degrees north/south */
12 private int _latitude = 0;
13 /** Longitude in degrees east/west */
14 private int _longitude = 0;
17 * Constructor working out the tile for a single point
18 * @param inPoint data point
20 public SrtmTile(DataPoint inPoint)
22 Coordinate latitude = inPoint.getLatitude();
23 _latitude = (int) Math.floor(latitude.getDouble());
24 Coordinate longitude = inPoint.getLongitude();
25 _longitude = (int) Math.floor(longitude.getDouble());
29 * Constructor working out the tile for a single point
30 * @param inLatitude latitude in degrees
31 * @param inLongitude longitude in degrees
33 public SrtmTile(int inLatitude, int inLongitude)
35 _latitude = inLatitude;
36 _longitude = inLongitude;
42 return _latitude * 1000 + _longitude;
47 * @param inOther other tile object
48 * @return true if both represent same tile
51 public boolean equals(Object inOther)
53 if (inOther == null || inOther.getClass() != getClass()) {
56 SrtmTile otherTile = (SrtmTile) inOther;
57 return (_latitude == otherTile._latitude) && (_longitude == otherTile._longitude);
60 /** @return latitude as int */
61 public int getLatitude() {
65 /** @return longitude as int */
66 public int getLongitude() {
71 * @return filename of tile
73 public String getTileName()
75 return (_latitude >= 0?"N":"S")
76 + (Math.abs(_latitude) < 10?"0":"")
78 + (_longitude >= 0?"E":"W")
79 + (Math.abs(_longitude) < 100?"0":"")
80 + (Math.abs(_longitude) < 10?"0":"")
81 + Math.abs(_longitude)