LATITUDE and LONGITUDE constants

This commit is contained in:
Roman Inflianskas 2016-05-28 00:27:07 +03:00
parent a2984f5c7c
commit 9ac6faec25
3 changed files with 24 additions and 18 deletions

View file

@ -35,7 +35,6 @@ import net.osmand.binary.BinaryMapIndexReader.MapIndex;
import net.osmand.binary.BinaryMapIndexReader.MapObjectStat;
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
import net.osmand.binary.BinaryMapIndexReader.SearchFilter;
import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
@ -120,12 +119,12 @@ public class BinaryInspector {
boolean vstats;
boolean osm;
FileOutputStream osmOut = null;
double lattop = 85;
double latbottom = -85;
double lonleft = -180;
double lonright = 180;
double lattop = MapUtils.LATITUDE_MIN;
double latbottom = MapUtils.LATITUDE_MAX;
double lonleft = MapUtils.LONGITUDE_MIN;
double lonright = MapUtils.LONGITUDE_MAX;
String lang = null;
int zoom = -1;
int zoom = MapUtils.NO_ZOOM;
public boolean isVaddress() {
return vaddress;

View file

@ -208,7 +208,7 @@ public abstract class MapObject implements Comparable<MapObject> {
return false;
return true;
}
public static class MapObjectComparator implements Comparator<MapObject> {
private final String l;
Collator collator = OsmAndCollator.primaryCollator();
@ -220,7 +220,7 @@ public abstract class MapObject implements Comparable<MapObject> {
public MapObjectComparator(String lang) {
this.l = lang;
}
@Override
public int compare(MapObject o1, MapObject o2) {
if (o1 == null ^ o2 == null) {

View file

@ -19,12 +19,19 @@ import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
*/
public class MapUtils {
public static final double MIN_LATITUDE = -85.0511;
public static final double MAX_LATITUDE = 85.0511;
public static final double LATITUDE_MIN = -85.0511;
public static final double LATITUDE_MAX = 85.0511;
public static final double LATITUDE_TURN = 180.0;
public static final double MIN_LONGITUDE = -180.0;
public static final double MAX_LONGITUDE = 180.0;
public static final double LONGITUDE_MIN = -180.0;
public static final double LONGITUDE_MAX = 180.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
// https://github.com/openstreetmap/operations/issues/2
@ -120,10 +127,10 @@ public class MapUtils {
}
public static double checkLongitude(double longitude) {
if (longitude > MIN_LONGITUDE && longitude <= MAX_LONGITUDE) {
if (longitude > LONGITUDE_MIN && longitude <= LONGITUDE_MAX) {
return longitude;
}
while (longitude <= MIN_LONGITUDE || longitude > MAX_LONGITUDE) {
while (longitude < LONGITUDE_MIN || longitude > LONGITUDE_MAX) {
if (longitude < 0) {
longitude += LONGITUDE_TURN;
} else {
@ -144,10 +151,10 @@ public class MapUtils {
latitude -= LATITUDE_TURN;
}
}
if (latitude < MIN_LATITUDE) {
return MIN_LATITUDE;
} else if (latitude > MAX_LATITUDE) {
return MAX_LATITUDE;
if (latitude < LATITUDE_MIN) {
return LATITUDE_MIN;
} else if (latitude > LATITUDE_MAX) {
return LATITUDE_MAX;
}
return latitude;
}