add non-nls strings
git-svn-id: https://osmand.googlecode.com/svn/trunk@177 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
fd1b905978
commit
f23475ad1b
10 changed files with 97 additions and 95 deletions
|
@ -122,60 +122,60 @@ public class TileSourceManager {
|
||||||
|
|
||||||
|
|
||||||
public static TileSourceTemplate getMapnikSource(){
|
public static TileSourceTemplate getMapnikSource(){
|
||||||
return new TileSourceTemplate("Mapnik", "http://tile.openstreetmap.org/{0}/{1}/{2}.png", ".png", 18, 1, 256, 18000);
|
return new TileSourceTemplate("Mapnik", "http://tile.openstreetmap.org/{0}/{1}/{2}.png", ".png", 18, 1, 256, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getOsmaRenderSource(){
|
public static TileSourceTemplate getOsmaRenderSource(){
|
||||||
return new TileSourceTemplate("OsmaRender", "http://tah.openstreetmap.org/Tiles/tile/{0}/{1}/{2}.png", ".png", 17, 1, 256, 18000);
|
return new TileSourceTemplate("OsmaRender", "http://tah.openstreetmap.org/Tiles/tile/{0}/{1}/{2}.png", ".png", 17, 1, 256, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getCycleMapSource(){
|
public static TileSourceTemplate getCycleMapSource(){
|
||||||
return new TileSourceTemplate("CycleMap", "http://b.andy.sandbox.cloudmade.com/tiles/cycle/{0}/{1}/{2}.png", ".png", 17, 0, 256, 18000);
|
return new TileSourceTemplate("CycleMap", "http://b.andy.sandbox.cloudmade.com/tiles/cycle/{0}/{1}/{2}.png", ".png", 17, 0, 256, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getAerialMapSource(){
|
public static TileSourceTemplate getAerialMapSource(){
|
||||||
return new TileSourceTemplate("OpenAerialMap", "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/{0}/{1}/{2}.jpg", ".jpg", 13, 0, 256, 18000);
|
return new TileSourceTemplate("OpenAerialMap", "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/{0}/{1}/{2}.jpg", ".jpg", 13, 0, 256, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getCloudMadeSource(){
|
public static TileSourceTemplate getCloudMadeSource(){
|
||||||
return new TileSourceTemplate("Cloudmade", "http://tile.cloudmade.com/7ded028e030c5929b28bf823486ce84f/1/256/{0}/{1}/{2}.png", ".png", 18, 0, 256, 18000);
|
return new TileSourceTemplate("Cloudmade", "http://tile.cloudmade.com/7ded028e030c5929b28bf823486ce84f/1/256/{0}/{1}/{2}.png", ".png", 18, 0, 256, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getMapSurferSource(){
|
public static TileSourceTemplate getMapSurferSource(){
|
||||||
return new TileSourceTemplate("MapSurfer", "http://tiles1.mapsurfer.net/tms_r.ashx?z={0}&x={1}&y={2}", ".png", 19, 0, 256, 18000);
|
return new TileSourceTemplate("MapSurfer", "http://tiles1.mapsurfer.net/tms_r.ashx?z={0}&x={1}&y={2}", ".png", 19, 0, 256, 18000);//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getNavigationDebugSource(){
|
public static TileSourceTemplate getNavigationDebugSource(){
|
||||||
return new TileSourceTemplate("NavigationDebug", "http://ec2-184-73-15-218.compute-1.amazonaws.com/6700/256/{0}/{1}/{2}.png", ".png", 18, 0, 256, 18000);
|
return new TileSourceTemplate("NavigationDebug", "http://ec2-184-73-15-218.compute-1.amazonaws.com/6700/256/{0}/{1}/{2}.png", ".png", 18, 0, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static TileSourceTemplate getOpenPisteMapSource(){
|
public static TileSourceTemplate getOpenPisteMapSource(){
|
||||||
return new TileSourceTemplate("OpenPisteMap", "http://openpistemap.org/tiles/contours/{0}/{1}/{2}.png", ".png", 17, 0, 256, 18000);
|
return new TileSourceTemplate("OpenPisteMap", "http://openpistemap.org/tiles/contours/{0}/{1}/{2}.png", ".png", 17, 0, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getGoogleMapsSource(){
|
public static TileSourceTemplate getGoogleMapsSource(){
|
||||||
return new TileSourceTemplate("GoogleMaps", "http://mt3.google.com/vt/v=w2.97&x={1}&y={2}&z={0}", ".png", 19, 0, 256, 18000);
|
return new TileSourceTemplate("GoogleMaps", "http://mt3.google.com/vt/v=w2.97&x={1}&y={2}&z={0}", ".png", 19, 0, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getGoogleMapsSatelliteSource(){
|
public static TileSourceTemplate getGoogleMapsSatelliteSource(){
|
||||||
return new TileSourceTemplate("GoogleMaps Satellite", "http://khm1.google.com/kh/v=59&x={1}&y={2}&z={0}", ".jpg", 20, 0, 256, 18000);
|
return new TileSourceTemplate("GoogleMaps Satellite", "http://khm1.google.com/kh/v=59&x={1}&y={2}&z={0}", ".jpg", 20, 0, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getGoogleMapsTerrainSource(){
|
public static TileSourceTemplate getGoogleMapsTerrainSource(){
|
||||||
return new TileSourceTemplate("GoogleMaps Terrain", "http://mt3.google.com/vt/v=w2p.111&hl=en&x={1}&y={2}&z={0}", ".jpg", 15, 0, 256, 18000);
|
return new TileSourceTemplate("GoogleMaps Terrain", "http://mt3.google.com/vt/v=w2p.111&hl=en&x={1}&y={2}&z={0}", ".jpg", 15, 0, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getMicrosoftMapsSource(){
|
public static TileSourceTemplate getMicrosoftMapsSource(){
|
||||||
return new MicrosoftTileSourceTemplate("Microsoft Maps", 'r', "png", ".png", 19, 1, 256, 18000);
|
return new MicrosoftTileSourceTemplate("Microsoft Maps", 'r', "png", ".png", 19, 1, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getMicrosoftEarthSource(){
|
public static TileSourceTemplate getMicrosoftEarthSource(){
|
||||||
return new MicrosoftTileSourceTemplate("Microsoft Earth", 'a', "jpg", ".jpg", 19, 1, 256, 18000);
|
return new MicrosoftTileSourceTemplate("Microsoft Earth", 'a', "jpg", ".jpg", 19, 1, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileSourceTemplate getMicrosoftHybridSource(){
|
public static TileSourceTemplate getMicrosoftHybridSource(){
|
||||||
return new MicrosoftTileSourceTemplate("Microsoft Hybrid", 'h', "jpg", ".jpg", 19, 1, 256, 18000);
|
return new MicrosoftTileSourceTemplate("Microsoft Hybrid", 'h', "jpg", ".jpg", 19, 1, 256, 18000); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,8 +206,8 @@ public class TileSourceManager {
|
||||||
|
|
||||||
private final char mapTypeChar;
|
private final char mapTypeChar;
|
||||||
int serverNum = 0; // 0..3
|
int serverNum = 0; // 0..3
|
||||||
protected String urlBase = ".ortho.tiles.virtualearth.net/tiles/";
|
protected String urlBase = ".ortho.tiles.virtualearth.net/tiles/"; //$NON-NLS-1$
|
||||||
protected String urlAppend = "?g=45";
|
protected String urlAppend = "?g=45"; //$NON-NLS-1$
|
||||||
private final String tileType;
|
private final String tileType;
|
||||||
|
|
||||||
public MicrosoftTileSourceTemplate(String name, char mapTypeChar , String type,
|
public MicrosoftTileSourceTemplate(String name, char mapTypeChar , String type,
|
||||||
|
@ -222,7 +222,7 @@ public class TileSourceManager {
|
||||||
public String getUrlToLoad(int x, int y, int zoom) {
|
public String getUrlToLoad(int x, int y, int zoom) {
|
||||||
String tileNum = encodeQuadTree(zoom, x, y);
|
String tileNum = encodeQuadTree(zoom, x, y);
|
||||||
// serverNum = (serverNum + 1) % serverNumMax;
|
// serverNum = (serverNum + 1) % serverNumMax;
|
||||||
return "http://" + mapTypeChar + serverNum + urlBase + mapTypeChar + tileNum + "."
|
return "http://" + mapTypeChar + serverNum + urlBase + mapTypeChar + tileNum + "." //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
+ tileType + urlAppend;
|
+ tileType + urlAppend;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class LatLon {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Lat " + latitude +" Lon "+ longitude;
|
return "Lat " + latitude +" Lon "+ longitude; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getLatitude() {
|
public double getLatitude() {
|
||||||
|
|
|
@ -210,9 +210,9 @@ public class MapUtils {
|
||||||
if(meters >= 100000){
|
if(meters >= 100000){
|
||||||
return meters / 1000 + " km";
|
return meters / 1000 + " km";
|
||||||
} else if(meters >= 10000){
|
} else if(meters >= 10000){
|
||||||
return MessageFormat.format("{0, number, #.#} km", ((float) meters) / 1000);
|
return MessageFormat.format("{0, number, #.#}"+" km", ((float) meters) / 1000); //$NON-NLS-1$
|
||||||
} else if(meters > 1500){
|
} else if(meters > 1500){
|
||||||
return MessageFormat.format("{0, number, #.##} km", ((float) meters) / 1000);
|
return MessageFormat.format("{0, number, #.##}"+" km", ((float) meters) / 1000); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
return meters + " m";
|
return meters + " m";
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,33 +3,33 @@ package com.osmand.osm;
|
||||||
public class OSMSettings {
|
public class OSMSettings {
|
||||||
|
|
||||||
public enum OSMTagKey {
|
public enum OSMTagKey {
|
||||||
NAME("name"),
|
NAME("name"), //$NON-NLS-1$
|
||||||
NAME_EN("name:en"),
|
NAME_EN("name:en"), //$NON-NLS-1$
|
||||||
// ways
|
// ways
|
||||||
HIGHWAY("highway"),
|
HIGHWAY("highway"), //$NON-NLS-1$
|
||||||
BUILDING("building"),
|
BUILDING("building"), //$NON-NLS-1$
|
||||||
// transport
|
// transport
|
||||||
ROUTE("route"),
|
ROUTE("route"), //$NON-NLS-1$
|
||||||
OPERATOR("operator"),
|
OPERATOR("operator"), //$NON-NLS-1$
|
||||||
REF("ref"),
|
REF("ref"), //$NON-NLS-1$
|
||||||
|
|
||||||
// address
|
// address
|
||||||
PLACE("place"),
|
PLACE("place"), //$NON-NLS-1$
|
||||||
ADDR_HOUSE_NUMBER("addr:housenumber"),
|
ADDR_HOUSE_NUMBER("addr:housenumber"), //$NON-NLS-1$
|
||||||
ADDR_STREET("addr:street"),
|
ADDR_STREET("addr:street"), //$NON-NLS-1$
|
||||||
ADDR_POSTCODE("addr:postcode"),
|
ADDR_POSTCODE("addr:postcode"), //$NON-NLS-1$
|
||||||
|
|
||||||
// POI
|
// POI
|
||||||
AMENITY("amenity"),
|
AMENITY("amenity"), //$NON-NLS-1$
|
||||||
SHOP("shop"),
|
SHOP("shop"), //$NON-NLS-1$
|
||||||
LEISURE("leisure"),
|
LEISURE("leisure"), //$NON-NLS-1$
|
||||||
TOURISM("tourism"),
|
TOURISM("tourism"), //$NON-NLS-1$
|
||||||
SPORT("sport"),
|
SPORT("sport"), //$NON-NLS-1$
|
||||||
HISTORIC("historic"),
|
HISTORIC("historic"), //$NON-NLS-1$
|
||||||
NATURAL("natural"),
|
NATURAL("natural"), //$NON-NLS-1$
|
||||||
INTERNET_ACCESS("internet_access"),
|
INTERNET_ACCESS("internet_access"), //$NON-NLS-1$
|
||||||
|
|
||||||
OPENING_HOURS("opening_hours"),
|
OPENING_HOURS("opening_hours"), //$NON-NLS-1$
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
@ -53,9 +53,9 @@ public class OSMSettings {
|
||||||
|
|
||||||
public static boolean wayForCar(String tagHighway){
|
public static boolean wayForCar(String tagHighway){
|
||||||
if(tagHighway != null){
|
if(tagHighway != null){
|
||||||
String[] cars = new String[]{"trunk", "motorway", "primary", "secondary", "tertiary", "service", "residential",
|
String[] cars = new String[]{"trunk", "motorway", "primary", "secondary", "tertiary", "service", "residential", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||||
"trunk_link", "motorway_link", "primary_link", "secondary_link", "residential_link",
|
"trunk_link", "motorway_link", "primary_link", "secondary_link", "residential_link", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
"tertiary_link", "track" };
|
"tertiary_link", "track" }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
for(String c : cars){
|
for(String c : cars){
|
||||||
if(c.equals(tagHighway)){
|
if(c.equals(tagHighway)){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,30 +26,30 @@ import com.osmand.osm.Way;
|
||||||
|
|
||||||
public class OsmBaseStorage extends DefaultHandler {
|
public class OsmBaseStorage extends DefaultHandler {
|
||||||
|
|
||||||
protected static final String ELEM_OSM = "osm";
|
protected static final String ELEM_OSM = "osm"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_NODE = "node";
|
protected static final String ELEM_NODE = "node"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_TAG = "tag";
|
protected static final String ELEM_TAG = "tag"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_WAY = "way";
|
protected static final String ELEM_WAY = "way"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_ND = "nd";
|
protected static final String ELEM_ND = "nd"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_RELATION = "relation";
|
protected static final String ELEM_RELATION = "relation"; //$NON-NLS-1$
|
||||||
protected static final String ELEM_MEMBER = "member";
|
protected static final String ELEM_MEMBER = "member"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
protected static final String ATTR_VERSION = "version";
|
protected static final String ATTR_VERSION = "version"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_ID = "id";
|
protected static final String ATTR_ID = "id"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_LAT = "lat";
|
protected static final String ATTR_LAT = "lat"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_LON = "lon";
|
protected static final String ATTR_LON = "lon"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_TIMESTAMP = "timestamp";
|
protected static final String ATTR_TIMESTAMP = "timestamp"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_UID = "uid";
|
protected static final String ATTR_UID = "uid"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_USER = "user";
|
protected static final String ATTR_USER = "user"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_VISIBLE = "visible";
|
protected static final String ATTR_VISIBLE = "visible"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_CHANGESET = "changeset";
|
protected static final String ATTR_CHANGESET = "changeset"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_K = "k";
|
protected static final String ATTR_K = "k"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_V = "v";
|
protected static final String ATTR_V = "v"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected static final String ATTR_TYPE = "type";
|
protected static final String ATTR_TYPE = "type"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_REF = "ref";
|
protected static final String ATTR_REF = "ref"; //$NON-NLS-1$
|
||||||
protected static final String ATTR_ROLE = "role";
|
protected static final String ATTR_ROLE = "role"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected Entity currentParsedEntity = null;
|
protected Entity currentParsedEntity = null;
|
||||||
protected EntityInfo currentParsedEntityInfo = null;
|
protected EntityInfo currentParsedEntityInfo = null;
|
||||||
|
@ -123,7 +123,7 @@ public class OsmBaseStorage extends DefaultHandler {
|
||||||
}
|
}
|
||||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
try {
|
try {
|
||||||
factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false); //$NON-NLS-1$
|
||||||
return saxParser = factory.newSAXParser();
|
return saxParser = factory.newSAXParser();
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
|
@ -154,8 +154,8 @@ public class OsmBaseStorage extends DefaultHandler {
|
||||||
|
|
||||||
protected static final Set<String> supportedVersions = new HashSet<String>();
|
protected static final Set<String> supportedVersions = new HashSet<String>();
|
||||||
static {
|
static {
|
||||||
supportedVersions.add("0.6");
|
supportedVersions.add("0.6"); //$NON-NLS-1$
|
||||||
supportedVersions.add("0.5");
|
supportedVersions.add("0.5"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initRootElement(String uri, String localName, String name, Attributes attributes) throws OsmVersionNotSupported{
|
protected void initRootElement(String uri, String localName, String name, Attributes attributes) throws OsmVersionNotSupported{
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.osmand;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -187,7 +188,7 @@ public class ResourceManager {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
amenityRepositories.add(repository);
|
amenityRepositories.add(repository);
|
||||||
}else {
|
}else {
|
||||||
warnings.add("The version of index '" + f.getName() +"'is not supported");
|
warnings.add(MessageFormat.format("The version of index ''{0}''is not supported", f.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +210,7 @@ public class ResourceManager {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
addressMap.put(repository.getName(), repository);
|
addressMap.put(repository.getName(), repository);
|
||||||
} else {
|
} else {
|
||||||
warnings.add("The version of index '" + f.getName() +"'is not supported");
|
warnings.add(MessageFormat.format("The version of index ''{0}''is not supported", f.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class EditingPOIActivity {
|
||||||
public void showCreateDialog(double latitude, double longitude){
|
public void showCreateDialog(double latitude, double longitude){
|
||||||
dlg = new Dialog(ctx);
|
dlg = new Dialog(ctx);
|
||||||
Node n = new Node(latitude, longitude, -1);
|
Node n = new Node(latitude, longitude, -1);
|
||||||
n.putTag(OSMTagKey.AMENITY.getValue(), "");
|
n.putTag(OSMTagKey.AMENITY.getValue(), ""); //$NON-NLS-1$
|
||||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00"); //$NON-NLS-1$
|
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00"); //$NON-NLS-1$
|
||||||
dlg.setTitle(R.string.poi_create_title);
|
dlg.setTitle(R.string.poi_create_title);
|
||||||
showDialog(n);
|
showDialog(n);
|
||||||
|
@ -341,7 +341,7 @@ public class EditingPOIActivity {
|
||||||
boolean f = true;
|
boolean f = true;
|
||||||
while ((s = in.readLine()) != null) {
|
while ((s = in.readLine()) != null) {
|
||||||
if(!f){
|
if(!f){
|
||||||
responseBody.append("\n");
|
responseBody.append("\n"); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
f = false;
|
f = false;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ public class EditingPOIActivity {
|
||||||
String res = sendRequest(SITE_API+"api/0.6/node/"+id, "GET", null, "Loading poi " + id, false); //$NON-NLS-1$ //$NON-NLS-2$
|
String res = sendRequest(SITE_API+"api/0.6/node/"+id, "GET", null, "Loading poi " + id, false); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if(res != null){
|
if(res != null){
|
||||||
OsmBaseStorage st = new OsmBaseStorage();
|
OsmBaseStorage st = new OsmBaseStorage();
|
||||||
st.parseOSM(new ByteArrayInputStream(res.getBytes("UTF-8")), null, null, true);
|
st.parseOSM(new ByteArrayInputStream(res.getBytes("UTF-8")), null, null, true); //$NON-NLS-1$
|
||||||
Entity entity = st.getRegisteredEntities().get(id);
|
Entity entity = st.getRegisteredEntities().get(id);
|
||||||
entityInfo = st.getRegisteredEntityInfo().get(id);
|
entityInfo = st.getRegisteredEntityInfo().get(id);
|
||||||
if(entity instanceof Node){
|
if(entity instanceof Node){
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
import java.lang.Thread.UncaughtExceptionHandler;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -84,8 +85,8 @@ public class MainMenuActivity extends Activity {
|
||||||
File file = new File(Environment.getExternalStorageDirectory(), EXCEPTION_PATH);
|
File file = new File(Environment.getExternalStorageDirectory(), EXCEPTION_PATH);
|
||||||
if(file.exists() && file.length() > 0){
|
if(file.exists() && file.length() > 0){
|
||||||
if(size != file.length()){
|
if(size != file.length()){
|
||||||
String msg = "Previous application run was crashed. Log file is in " + EXCEPTION_PATH +". ";
|
String msg = MessageFormat.format("Previous application run was crashed. Log file is at {0}. Please raise the issue and attach log file.",
|
||||||
msg += "Please raise the issue and attach log file.";
|
EXCEPTION_PATH);
|
||||||
Builder builder = new AlertDialog.Builder(MainMenuActivity.this);
|
Builder builder = new AlertDialog.Builder(MainMenuActivity.this);
|
||||||
builder.setMessage(msg).setNeutralButton("Close", null).show();
|
builder.setMessage(msg).setNeutralButton("Close", null).show();
|
||||||
getPreferences(MODE_WORLD_READABLE).edit().putLong(EXCEPTION_FILE_SIZE, file.length()).commit();
|
getPreferences(MODE_WORLD_READABLE).edit().putLong(EXCEPTION_FILE_SIZE, file.length()).commit();
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class RoutingHelper {
|
||||||
float bearingMovement = currentLocation.bearingTo(routeNodes.get(currentRoute));
|
float bearingMovement = currentLocation.bearingTo(routeNodes.get(currentRoute));
|
||||||
float d = Math.abs(currentLocation.distanceTo(routeNodes.get(currentRoute)) * FloatMath.sin((bearingMovement - bearing)*3.14f/180f));
|
float d = Math.abs(currentLocation.distanceTo(routeNodes.get(currentRoute)) * FloatMath.sin((bearingMovement - bearing)*3.14f/180f));
|
||||||
if(d > 50) {
|
if(d > 50) {
|
||||||
log.info("Recalculate route, because correlation : " + d);
|
log.info("Recalculate route, because correlation : " + d); //$NON-NLS-1$
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,12 +197,12 @@ public class RoutingHelper {
|
||||||
float f1 = currentLocation.distanceTo(routeNodes.get(currentRoute - 1)) + d;
|
float f1 = currentLocation.distanceTo(routeNodes.get(currentRoute - 1)) + d;
|
||||||
float c = routeNodes.get(currentRoute - 1).distanceTo(routeNodes.get(currentRoute));
|
float c = routeNodes.get(currentRoute - 1).distanceTo(routeNodes.get(currentRoute));
|
||||||
if (c * 2 < d + f1) {
|
if (c * 2 < d + f1) {
|
||||||
log.info("Recalculate route, because too far from points : " + d + " " + f1 + " >> " + c);
|
log.info("Recalculate route, because too far from points : " + d + " " + f1 + " >> " + c); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// that case is needed
|
// that case is needed
|
||||||
log.info("Recalculate route, because too far from start : " + d);
|
log.info("Recalculate route, because too far from start : " + d); //$NON-NLS-1$
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
lastTimeEvaluatedRoute = System.currentTimeMillis();
|
lastTimeEvaluatedRoute = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}, "Calculating route");
|
}, "Calculating route"); //$NON-NLS-1$
|
||||||
currentRunningJob.start();
|
currentRunningJob.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,29 +372,29 @@ public class RoutingHelper {
|
||||||
if (start != null && end != null) {
|
if (start != null && end != null) {
|
||||||
List<Location> res = new ArrayList<Location>();
|
List<Location> res = new ArrayList<Location>();
|
||||||
if(log.isInfoEnabled()){
|
if(log.isInfoEnabled()){
|
||||||
log.info("Start finding route from " + start + " to " + end);
|
log.info("Start finding route from " + start + " to " + end); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
StringBuilder uri = new StringBuilder();
|
StringBuilder uri = new StringBuilder();
|
||||||
uri.append("http://www.yournavigation.org/api/1.0/gosmore.php?format=kml");
|
uri.append("http://www.yournavigation.org/api/1.0/gosmore.php?format=kml"); //$NON-NLS-1$
|
||||||
uri.append("&flat=").append(start.getLatitude());
|
uri.append("&flat=").append(start.getLatitude()); //$NON-NLS-1$
|
||||||
uri.append("&flon=").append(start.getLongitude());
|
uri.append("&flon=").append(start.getLongitude()); //$NON-NLS-1$
|
||||||
uri.append("&tlat=").append(end.getLatitude());
|
uri.append("&tlat=").append(end.getLatitude()); //$NON-NLS-1$
|
||||||
uri.append("&tlon=").append(end.getLongitude());
|
uri.append("&tlon=").append(end.getLongitude()); //$NON-NLS-1$
|
||||||
if(ApplicationMode.PEDESTRIAN== mode){
|
if(ApplicationMode.PEDESTRIAN== mode){
|
||||||
uri.append("&v=foot") ;
|
uri.append("&v=foot") ; //$NON-NLS-1$
|
||||||
} else if(ApplicationMode.BICYCLE == mode){
|
} else if(ApplicationMode.BICYCLE == mode){
|
||||||
uri.append("&v=bicycle") ;
|
uri.append("&v=bicycle") ; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
uri.append("&v=motorcar");
|
uri.append("&v=motorcar"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
uri.append("&fast=1").append("&layer=mapnik");
|
uri.append("&fast=1").append("&layer=mapnik"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
URL url = new URL(uri.toString());
|
URL url = new URL(uri.toString());
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream())));
|
Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream())));
|
||||||
NodeList list = doc.getElementsByTagName("coordinates");
|
NodeList list = doc.getElementsByTagName("coordinates"); //$NON-NLS-1$
|
||||||
for(int i=0; i<list.getLength(); i++){
|
for(int i=0; i<list.getLength(); i++){
|
||||||
Node item = list.item(i);
|
Node item = list.item(i);
|
||||||
String str = item.getFirstChild().getNodeValue();
|
String str = item.getFirstChild().getNodeValue();
|
||||||
|
@ -410,7 +410,7 @@ public class RoutingHelper {
|
||||||
try {
|
try {
|
||||||
double lon = Double.parseDouble(coordinate.substring(0, s));
|
double lon = Double.parseDouble(coordinate.substring(0, s));
|
||||||
double lat = Double.parseDouble(coordinate.substring(s + 1));
|
double lat = Double.parseDouble(coordinate.substring(s + 1));
|
||||||
Location l = new Location("router");
|
Location l = new Location("router"); //$NON-NLS-1$
|
||||||
l.setLatitude(lat);
|
l.setLatitude(lat);
|
||||||
l.setLongitude(lon);
|
l.setLongitude(lon);
|
||||||
res.add(l);
|
res.add(l);
|
||||||
|
@ -428,16 +428,16 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(log.isInfoEnabled()){
|
if(log.isInfoEnabled()){
|
||||||
log.info("Finding route contained " + res.size() + " points for " + (System.currentTimeMillis() - time) + " ms");
|
log.info("Finding route contained " + res.size() + " points for " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RouteCalculationResult(res, null);
|
return new RouteCalculationResult(res, null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Failed to find route ", e);
|
log.error("Failed to find route ", e); //$NON-NLS-1$
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
log.error("Failed to find route ", e);
|
log.error("Failed to find route ", e); //$NON-NLS-1$
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.error("Failed to find route ", e);
|
log.error("Failed to find route ", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new RouteCalculationResult(null, null);
|
return new RouteCalculationResult(null, null);
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
int x = view.getRotatedMapXForPoint(n.getLatitude(), n.getLongitude());
|
int x = view.getRotatedMapXForPoint(n.getLatitude(), n.getLongitude());
|
||||||
int y = view.getRotatedMapYForPoint(n.getLatitude(), n.getLongitude());
|
int y = view.getRotatedMapYForPoint(n.getLatitude(), n.getLongitude());
|
||||||
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
|
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
|
||||||
String format = "Bug : " + n.getName();
|
String format = "Bug : " + n.getName(); //$NON-NLS-1$
|
||||||
Toast.makeText(view.getContext(), format, Toast.LENGTH_SHORT).show();
|
Toast.makeText(view.getContext(), format, Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue