Make settings consistent

This commit is contained in:
Victor Shcherb 2012-12-11 01:43:23 +01:00
parent b9a1b51e40
commit 5f05d02172
2 changed files with 18 additions and 17 deletions

View file

@ -375,23 +375,29 @@ public class MapUtils {
// System.out.println(buildShortOsmUrl(52.30103d, 4.862927d, 18)); // http://osm.org/go/0E4_JiVhs
// System.out.println(buildShortOsmUrl(40.59d, -115.213d, 9)); // http://osm.org/go/TelHTB--
public static String buildShortOsmUrl(double latitude, double longitude, int zoom){
long lat = (long) (((latitude + 90d)/180d)*(1l << 32));
long lon = (long) (((longitude + 180d)/360d)*(1l << 32));
long code = interleaveBits(lon, lat);
StringBuilder str = new StringBuilder(10);
str.append(BASE_SHORT_OSM_URL);
// add eight to the zoom level, which approximates an accuracy of one pixel in a tile.
for(int i=0; i< Math.ceil((zoom+8)/3d); i++){
str.append(intToBase64[(int) ((code >> (58 - 6 * i)) & 0x3f)]);
}
// append characters onto the end of the string to represent
// partial zoom levels (characters themselves have a granularity of 3 zoom levels).
for(int j=0; j< (zoom + 8) % 3 ; j++){
str.append('-');
}
long lat = (long) (((latitude + 90d)/180d)*(1l << 32));
long lon = (long) (((longitude + 180d)/360d)*(1l << 32));
str.append(createShortLocString(lat, lon, zoom));
str.append("?m");
return str.toString();
}
private static String createShortLocString(long lat, long lon, int zoom) {
long code = interleaveBits(lon, lat);
String str = "";
// add eight to the zoom level, which approximates an accuracy of one pixel in a tile.
for (int i = 0; i < Math.ceil((zoom + 8) / 3d); i++) {
str += intToBase64[(int) ((code >> (58 - 6 * i)) & 0x3f)];
}
// append characters onto the end of the string to represent
// partial zoom levels (characters themselves have a granularity of 3 zoom levels).
for (int j = 0; j < (zoom + 8) % 3; j++) {
str += '-';
}
return str;
}
/**
* interleaves the bits of two 32-bit numbers. the result is known as a Morton code.

View file

@ -167,11 +167,6 @@ public class OsmandSettings {
}
protected void switchApplicationMode(ApplicationMode oldMode){
// change some global settings/ for car
if(currentMode == ApplicationMode.CAR){
SHOW_TRANSPORT_OVER_MAP.set(false);
SHOW_OSM_BUGS.set(false);
}
// update vector renderer
RendererRegistry registry = ctx.getRendererRegistry();
RenderingRulesStorage newRenderer = registry.getRenderer(RENDERER.get());