* @param inOther other tile object
* @return true if both represent same tile
*/
- public boolean equals(SrtmTile inOther)
+ public boolean equals(Object inOther)
{
- return (_latitude == inOther._latitude) && (_longitude == inOther._longitude);
+ if (! (inOther instanceof SrtmTile))
+ {
+ return false;
+ }
+ SrtmTile otherTile = (SrtmTile) inOther;
+ return (_latitude == otherTile._latitude) &&
+ (_longitude == otherTile._longitude);
+ }
+
+ public int hashCode()
+ {
+ return 360 * _latitude + _longitude;
}
/** @return latitude as int */
+ (_longitude >= 0?"E":"W")
+ (Math.abs(_longitude) < 100?"0":"")
+ (Math.abs(_longitude) < 10?"0":"")
- + Math.abs(_longitude)
- + ".hgt.zip";
+ + Math.abs(_longitude);
+ }
+
+ public SrtmSource findBestCachedSource()
+ {
+ SrtmSource[] sources = {
+ new SrtmGl1Source(),
+ new SrtmViewfinderSource(),
+ new Srtm3Source(),
+ };
+ for (int i = 0; i < sources.length; i++)
+ {
+ if (sources[i].isCached(this))
+ {
+ return sources[i];
+ }
+ }
+ return null;
}
}