LATITUDE and LONGITUDE constants
This commit is contained in:
parent
a2984f5c7c
commit
9ac6faec25
3 changed files with 24 additions and 18 deletions
|
@ -35,7 +35,6 @@ import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.MapObjectStat;
|
import net.osmand.binary.BinaryMapIndexReader.MapObjectStat;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
|
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchFilter;
|
import net.osmand.binary.BinaryMapIndexReader.SearchFilter;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter;
|
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||||
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
|
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
|
||||||
|
@ -120,12 +119,12 @@ public class BinaryInspector {
|
||||||
boolean vstats;
|
boolean vstats;
|
||||||
boolean osm;
|
boolean osm;
|
||||||
FileOutputStream osmOut = null;
|
FileOutputStream osmOut = null;
|
||||||
double lattop = 85;
|
double lattop = MapUtils.LATITUDE_MIN;
|
||||||
double latbottom = -85;
|
double latbottom = MapUtils.LATITUDE_MAX;
|
||||||
double lonleft = -180;
|
double lonleft = MapUtils.LONGITUDE_MIN;
|
||||||
double lonright = 180;
|
double lonright = MapUtils.LONGITUDE_MAX;
|
||||||
String lang = null;
|
String lang = null;
|
||||||
int zoom = -1;
|
int zoom = MapUtils.NO_ZOOM;
|
||||||
|
|
||||||
public boolean isVaddress() {
|
public boolean isVaddress() {
|
||||||
return vaddress;
|
return vaddress;
|
||||||
|
|
|
@ -19,12 +19,19 @@ import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
|
||||||
*/
|
*/
|
||||||
public class MapUtils {
|
public class MapUtils {
|
||||||
|
|
||||||
public static final double MIN_LATITUDE = -85.0511;
|
public static final double LATITUDE_MIN = -85.0511;
|
||||||
public static final double MAX_LATITUDE = 85.0511;
|
public static final double LATITUDE_MAX = 85.0511;
|
||||||
public static final double LATITUDE_TURN = 180.0;
|
public static final double LATITUDE_TURN = 180.0;
|
||||||
public static final double MIN_LONGITUDE = -180.0;
|
public static final double LONGITUDE_MIN = -180.0;
|
||||||
public static final double MAX_LONGITUDE = 180.0;
|
public static final double LONGITUDE_MAX = 180.0;
|
||||||
public static final double LONGITUDE_TURN = 360.0;
|
public static final double LONGITUDE_TURN = 360.0;
|
||||||
|
public static final int[] MAP_BOUNDING_BOX_31_TILE_NUMBER = {
|
||||||
|
MapUtils.get31TileNumberX(LONGITUDE_MIN),
|
||||||
|
MapUtils.get31TileNumberX(LONGITUDE_MAX),
|
||||||
|
MapUtils.get31TileNumberY(LATITUDE_MAX),
|
||||||
|
MapUtils.get31TileNumberY(LATITUDE_MIN),
|
||||||
|
};
|
||||||
|
public static final int NO_ZOOM = -1;
|
||||||
|
|
||||||
// TODO change the hostname back to osm.org once HTTPS works for it
|
// TODO change the hostname back to osm.org once HTTPS works for it
|
||||||
// https://github.com/openstreetmap/operations/issues/2
|
// https://github.com/openstreetmap/operations/issues/2
|
||||||
|
@ -120,10 +127,10 @@ public class MapUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double checkLongitude(double longitude) {
|
public static double checkLongitude(double longitude) {
|
||||||
if (longitude > MIN_LONGITUDE && longitude <= MAX_LONGITUDE) {
|
if (longitude > LONGITUDE_MIN && longitude <= LONGITUDE_MAX) {
|
||||||
return longitude;
|
return longitude;
|
||||||
}
|
}
|
||||||
while (longitude <= MIN_LONGITUDE || longitude > MAX_LONGITUDE) {
|
while (longitude < LONGITUDE_MIN || longitude > LONGITUDE_MAX) {
|
||||||
if (longitude < 0) {
|
if (longitude < 0) {
|
||||||
longitude += LONGITUDE_TURN;
|
longitude += LONGITUDE_TURN;
|
||||||
} else {
|
} else {
|
||||||
|
@ -144,10 +151,10 @@ public class MapUtils {
|
||||||
latitude -= LATITUDE_TURN;
|
latitude -= LATITUDE_TURN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (latitude < MIN_LATITUDE) {
|
if (latitude < LATITUDE_MIN) {
|
||||||
return MIN_LATITUDE;
|
return LATITUDE_MIN;
|
||||||
} else if (latitude > MAX_LATITUDE) {
|
} else if (latitude > LATITUDE_MAX) {
|
||||||
return MAX_LATITUDE;
|
return LATITUDE_MAX;
|
||||||
}
|
}
|
||||||
return latitude;
|
return latitude;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue