add non-nls, start to change postal-code as city
git-svn-id: https://osmand.googlecode.com/svn/trunk@176 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
12c977b0ba
commit
fd1b905978
44 changed files with 753 additions and 731 deletions
|
@ -65,7 +65,7 @@ public class Algoritms {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
} catch(IOException e){
|
} catch(IOException e){
|
||||||
log.warn("Closing stream warn", e);
|
log.warn("Closing stream warn", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class Algoritms {
|
||||||
for(File c : f.listFiles()){
|
for(File c : f.listFiles()){
|
||||||
updateAllExistingImgTilesToOsmandFormat(c);
|
updateAllExistingImgTilesToOsmandFormat(c);
|
||||||
}
|
}
|
||||||
} else if(f.getName().endsWith(".png") || f.getName().endsWith(".jpg")){
|
} else if(f.getName().endsWith(".png") || f.getName().endsWith(".jpg")){ //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
f.renameTo(new File(f.getAbsolutePath() + ".tile"));
|
f.renameTo(new File(f.getAbsolutePath() + ".tile")); //$NON-NLS-1$
|
||||||
} else if(f.getName().endsWith(".andnav2")) {
|
} else if(f.getName().endsWith(".andnav2")) { //$NON-NLS-1$
|
||||||
f.renameTo(new File(f.getAbsolutePath().substring(0, f.getAbsolutePath().length() - ".andnav2".length()) + ".tile"));
|
f.renameTo(new File(f.getAbsolutePath().substring(0, f.getAbsolutePath().length() - ".andnav2".length()) + ".tile")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class Messages {
|
public class Messages {
|
||||||
|
|
||||||
|
private static ResourceBundle bundle = ResourceBundle.getBundle("messages"); //$NON-NLS-1$
|
||||||
private static ResourceBundle bundle = ResourceBundle.getBundle("messages");
|
|
||||||
|
|
||||||
|
|
||||||
public static String getMessage(String key){
|
public static String getMessage(String key){
|
||||||
|
|
|
@ -23,13 +23,15 @@ public class ToDoConstants {
|
||||||
|
|
||||||
// TODO ANDROID
|
// TODO ANDROID
|
||||||
// 31. Translation.
|
// 31. Translation.
|
||||||
// GOT : olga
|
// DONE : partially olga
|
||||||
|
// TODO : everywhere put non-nls, check all translated into russian [swing could not be translated]
|
||||||
|
|
||||||
// 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions.
|
// 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions.
|
||||||
|
// Some icons are not fine (as back menu from map - it is blured).
|
||||||
|
|
||||||
// 37. Get rid of exit button (!). Think about when notification should go & how clear resources if it is necessary
|
// 37. Get rid of exit button (!). Think about when notification should go & how clear resources if it is necessary
|
||||||
// DONE :
|
// DONE :
|
||||||
// TODO : add to app settings preference (Refresh indexes).
|
// TODO : add to app settings preference (Refresh indexes).
|
||||||
|
|
||||||
// 32. Introduce POI predefined filters (car filter(other-fuel, transportation-car_wash, show-car) and others)
|
// 32. Introduce POI predefined filters (car filter(other-fuel, transportation-car_wash, show-car) and others)
|
||||||
// DONE : back end (POI filter object, save, delete, read)
|
// DONE : back end (POI filter object, save, delete, read)
|
||||||
|
@ -53,15 +55,16 @@ public class ToDoConstants {
|
||||||
// That setting should rule all activities that use internet. It should ask whenever internet is used
|
// That setting should rule all activities that use internet. It should ask whenever internet is used
|
||||||
// (would you like to use internet for that operation - if using internet is not checked).
|
// (would you like to use internet for that operation - if using internet is not checked).
|
||||||
// Internet using now for : edit POI osm, show osm bugs layer, download tiles.
|
// Internet using now for : edit POI osm, show osm bugs layer, download tiles.
|
||||||
|
// 47. Internet connectivity could be checked before trying to use
|
||||||
|
// 46. Implement downloading strategy for tiles (do not load 17 zoom, load only 16 for example) - try to scale 15 zoom for 17 (?)
|
||||||
// 40. Support simple vector road rendering (require new index file) (?)
|
// 40. Support simple vector road rendering (require new index file) (?)
|
||||||
// 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?)
|
// 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?)
|
||||||
// 46. Implement downloading strategy for tiles (do not load 17 zoom, load only 16 for example) - try to scale 15 zoom for 17 (?)
|
|
||||||
// 47. Internet connectivity could be checked before trying to use
|
|
||||||
|
|
||||||
// BUGS Android
|
// BUGS Android
|
||||||
|
// 6. Improvement postal_code search : replace search city <-> postal_code (show streets for postal_code)
|
||||||
// 5. Improvement : Implement caching files existing on FS, implement specific method in RM
|
// 5. Improvement : Implement caching files existing on FS, implement specific method in RM
|
||||||
// Introducing cache of file names that are on disk (creating new File() consumes a lot of memory)
|
// Introducing cache of file names that are on disk (creating new File() consumes a lot of memory)
|
||||||
// 6. Improvement postal_code search : replace search city <-> postal_code (show streets for postal_code)
|
|
||||||
// 7. Update map is duplicated in target & in update menu (context menu)
|
// 7. Update map is duplicated in target & in update menu (context menu)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ package com.osmand;
|
||||||
|
|
||||||
public class Version {
|
public class Version {
|
||||||
|
|
||||||
public static final String APP_VERSION = "0.2";
|
public static final String APP_VERSION = "0.2"; //$NON-NLS-1$
|
||||||
public static final String APP_NAME = "OsmAnd";
|
public static final String APP_NAME = "OsmAnd"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION;
|
public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION; //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,11 @@ public class Amenity extends MapObject {
|
||||||
} else if (node.getTag(OSMTagKey.HISTORIC) != null) {
|
} else if (node.getTag(OSMTagKey.HISTORIC) != null) {
|
||||||
return node.getTag(OSMTagKey.HISTORIC);
|
return node.getTag(OSMTagKey.HISTORIC);
|
||||||
} else if (node.getTag(OSMTagKey.INTERNET_ACCESS) != null) {
|
} else if (node.getTag(OSMTagKey.INTERNET_ACCESS) != null) {
|
||||||
return "internet_access";
|
return "internet_access"; //$NON-NLS-1$
|
||||||
} else if (node.getTag(OSMTagKey.AMENITY) != null) {
|
} else if (node.getTag(OSMTagKey.AMENITY) != null) {
|
||||||
return node.getTag(OSMTagKey.AMENITY);
|
return node.getTag(OSMTagKey.AMENITY);
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AmenityType getType(Entity node){
|
protected AmenityType getType(Entity node){
|
||||||
|
@ -118,7 +118,7 @@ public class Amenity extends MapObject {
|
||||||
|
|
||||||
|
|
||||||
public String getSimpleFormat(boolean en){
|
public String getSimpleFormat(boolean en){
|
||||||
return AmenityType.toPublicString(type) + " : " + getStringWithoutType(en);
|
return AmenityType.toPublicString(type) + " : " + getStringWithoutType(en); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStringWithoutType(boolean en){
|
public String getStringWithoutType(boolean en){
|
||||||
|
@ -126,7 +126,7 @@ public class Amenity extends MapObject {
|
||||||
if(n.length() == 0){
|
if(n.length() == 0){
|
||||||
return getSubType();
|
return getSubType();
|
||||||
}
|
}
|
||||||
return getSubType() + " " + n;
|
return getSubType() + " " + n; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,14 +15,14 @@ public enum AmenityType {
|
||||||
EDUCATION("amenity_type_education"), // school, ... //$NON-NLS-1$
|
EDUCATION("amenity_type_education"), // school, ... //$NON-NLS-1$
|
||||||
TRANSPORTATION("amenity_type_transportation"), // car_wash, parking, ... //$NON-NLS-1$
|
TRANSPORTATION("amenity_type_transportation"), // car_wash, parking, ... //$NON-NLS-1$
|
||||||
FINANCE("amenity_type_finance"), // bank, atm, ... //$NON-NLS-1$
|
FINANCE("amenity_type_finance"), // bank, atm, ... //$NON-NLS-1$
|
||||||
HEALTHCARE("amenity_type_healthcare"), // hospital ...
|
HEALTHCARE("amenity_type_healthcare"), // hospital ... //$NON-NLS-1$
|
||||||
ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel)
|
ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel) //$NON-NLS-1$
|
||||||
TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum ..
|
TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum .. //$NON-NLS-1$
|
||||||
HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic)
|
HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic) //$NON-NLS-1$
|
||||||
SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes...
|
SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes... //$NON-NLS-1$
|
||||||
LEISURE("amenity_type_leisure"), // [TAG] leisure
|
LEISURE("amenity_type_leisure"), // [TAG] leisure //$NON-NLS-1$
|
||||||
SPORT("amenity_type_sport"), // [TAG] sport
|
SPORT("amenity_type_sport"), // [TAG] sport //$NON-NLS-1$
|
||||||
OTHER("amenity_type_other"), // grave-yard, police, post-office [+Internet_access]
|
OTHER("amenity_type_other"), // grave-yard, police, post-office [+Internet_access] //$NON-NLS-1$
|
||||||
;
|
;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -67,247 +67,247 @@ public enum AmenityType {
|
||||||
protected static Map<String, AmenityType> amenityMap = new LinkedHashMap<String, AmenityType>();
|
protected static Map<String, AmenityType> amenityMap = new LinkedHashMap<String, AmenityType>();
|
||||||
static {
|
static {
|
||||||
|
|
||||||
amenityMap.put("alpine_hut", AmenityType.TOURISM);
|
amenityMap.put("alpine_hut", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("attraction", AmenityType.TOURISM);
|
amenityMap.put("attraction", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("artwork", AmenityType.TOURISM);
|
amenityMap.put("artwork", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("camp_site", AmenityType.TOURISM);
|
amenityMap.put("camp_site", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("caravan_site", AmenityType.TOURISM);
|
amenityMap.put("caravan_site", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("chalet", AmenityType.TOURISM);
|
amenityMap.put("chalet", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("guest_house", AmenityType.TOURISM);
|
amenityMap.put("guest_house", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("hostel", AmenityType.TOURISM);
|
amenityMap.put("hostel", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("hotel", AmenityType.TOURISM);
|
amenityMap.put("hotel", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("information", AmenityType.TOURISM);
|
amenityMap.put("information", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("motel", AmenityType.TOURISM);
|
amenityMap.put("motel", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("museum", AmenityType.TOURISM);
|
amenityMap.put("museum", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("picnic_site", AmenityType.TOURISM);
|
amenityMap.put("picnic_site", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("theme_park", AmenityType.TOURISM);
|
amenityMap.put("theme_park", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("viewpoint", AmenityType.TOURISM);
|
amenityMap.put("viewpoint", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
amenityMap.put("zoo", AmenityType.TOURISM);
|
amenityMap.put("zoo", AmenityType.TOURISM); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("archaeological_site", AmenityType.HISTORIC);
|
amenityMap.put("archaeological_site", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("battlefield", AmenityType.HISTORIC);
|
amenityMap.put("battlefield", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("boundary_stone", AmenityType.HISTORIC);
|
amenityMap.put("boundary_stone", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("castle", AmenityType.HISTORIC);
|
amenityMap.put("castle", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("fort", AmenityType.HISTORIC);
|
amenityMap.put("fort", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("memorial", AmenityType.HISTORIC);
|
amenityMap.put("memorial", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("pa", AmenityType.HISTORIC);
|
amenityMap.put("pa", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("monument", AmenityType.HISTORIC);
|
amenityMap.put("monument", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("ruins", AmenityType.HISTORIC);
|
amenityMap.put("ruins", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("wayside_cross", AmenityType.HISTORIC);
|
amenityMap.put("wayside_cross", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("wayside_shrine", AmenityType.HISTORIC);
|
amenityMap.put("wayside_shrine", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
amenityMap.put("wreck", AmenityType.HISTORIC);
|
amenityMap.put("wreck", AmenityType.HISTORIC); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("alcohol", AmenityType.SHOP);
|
amenityMap.put("alcohol", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("bakery", AmenityType.SHOP);
|
amenityMap.put("bakery", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("beauty", AmenityType.SHOP);
|
amenityMap.put("beauty", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("beverages", AmenityType.SHOP);
|
amenityMap.put("beverages", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("bicycle", AmenityType.SHOP);
|
amenityMap.put("bicycle", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("books", AmenityType.SHOP); //$NON-NLS-1$
|
amenityMap.put("books", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("boutique", AmenityType.SHOP);
|
amenityMap.put("boutique", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("butcher", AmenityType.SHOP);
|
amenityMap.put("butcher", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("car", AmenityType.SHOP);
|
amenityMap.put("car", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("car_repair", AmenityType.SHOP);
|
amenityMap.put("car_repair", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("charity", AmenityType.SHOP);
|
amenityMap.put("charity", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("chemist", AmenityType.SHOP);
|
amenityMap.put("chemist", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("clothes", AmenityType.SHOP);
|
amenityMap.put("clothes", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("computer", AmenityType.SHOP);
|
amenityMap.put("computer", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("confectionery", AmenityType.SHOP);
|
amenityMap.put("confectionery", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("convenience", AmenityType.SHOP);
|
amenityMap.put("convenience", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("department_store", AmenityType.SHOP);
|
amenityMap.put("department_store", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("dry_cleaning", AmenityType.SHOP);
|
amenityMap.put("dry_cleaning", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("doityourself", AmenityType.SHOP);
|
amenityMap.put("doityourself", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("electronics", AmenityType.SHOP);
|
amenityMap.put("electronics", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("fabrics", AmenityType.SHOP);
|
amenityMap.put("fabrics", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("farm", AmenityType.SHOP);
|
amenityMap.put("farm", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("florist", AmenityType.SHOP);
|
amenityMap.put("florist", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("funeral_directors", AmenityType.SHOP);
|
amenityMap.put("funeral_directors", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("furniture", AmenityType.SHOP);
|
amenityMap.put("furniture", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("garden_centre", AmenityType.SHOP);
|
amenityMap.put("garden_centre", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("general", AmenityType.SHOP);
|
amenityMap.put("general", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("gift", AmenityType.SHOP);
|
amenityMap.put("gift", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("glaziery", AmenityType.SHOP);
|
amenityMap.put("glaziery", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("greengrocer", AmenityType.SHOP);
|
amenityMap.put("greengrocer", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hairdresser", AmenityType.SHOP);
|
amenityMap.put("hairdresser", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$
|
amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$
|
amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$
|
amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$
|
amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hardware", AmenityType.SHOP);
|
amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hearing_aids", AmenityType.SHOP);
|
amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("hifi", AmenityType.SHOP);
|
amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("ice_cream", AmenityType.SHOP);
|
amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("jewelry", AmenityType.SHOP);
|
amenityMap.put("jewelry", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("kiosk", AmenityType.SHOP);
|
amenityMap.put("kiosk", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("laundry", AmenityType.SHOP);
|
amenityMap.put("laundry", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("mall", AmenityType.SHOP);
|
amenityMap.put("mall", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("massage", AmenityType.SHOP);
|
amenityMap.put("massage", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("money_lender", AmenityType.SHOP);
|
amenityMap.put("money_lender", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("motorcycle", AmenityType.SHOP);
|
amenityMap.put("motorcycle", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("newsagent", AmenityType.SHOP);
|
amenityMap.put("newsagent", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("optician", AmenityType.SHOP);
|
amenityMap.put("optician", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("organic", AmenityType.SHOP);
|
amenityMap.put("organic", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("outdoor", AmenityType.SHOP);
|
amenityMap.put("outdoor", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("pawnbroker", AmenityType.SHOP);
|
amenityMap.put("pawnbroker", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("second_hand", AmenityType.SHOP);
|
amenityMap.put("second_hand", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("sports", AmenityType.SHOP);
|
amenityMap.put("sports", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("stationery", AmenityType.SHOP);
|
amenityMap.put("stationery", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("supermarket", AmenityType.SHOP);
|
amenityMap.put("supermarket", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("shoes", AmenityType.SHOP);
|
amenityMap.put("shoes", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("tattoo", AmenityType.SHOP);
|
amenityMap.put("tattoo", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("toys", AmenityType.SHOP);
|
amenityMap.put("toys", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("travel_agency", AmenityType.SHOP);
|
amenityMap.put("travel_agency", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("variety_store", AmenityType.SHOP);
|
amenityMap.put("variety_store", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
amenityMap.put("video", AmenityType.SHOP);
|
amenityMap.put("video", AmenityType.SHOP); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
amenityMap.put("dog_park", AmenityType.LEISURE);
|
amenityMap.put("dog_park", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("sports_centre", AmenityType.LEISURE);
|
amenityMap.put("sports_centre", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("golf_course", AmenityType.LEISURE);
|
amenityMap.put("golf_course", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("stadium", AmenityType.LEISURE);
|
amenityMap.put("stadium", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("track", AmenityType.LEISURE);
|
amenityMap.put("track", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("pitch", AmenityType.LEISURE);
|
amenityMap.put("pitch", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("water_park", AmenityType.LEISURE);
|
amenityMap.put("water_park", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("marina", AmenityType.LEISURE);
|
amenityMap.put("marina", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("slipway", AmenityType.LEISURE);
|
amenityMap.put("slipway", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("fishing", AmenityType.LEISURE);
|
amenityMap.put("fishing", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("nature_reserve", AmenityType.LEISURE);
|
amenityMap.put("nature_reserve", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("park", AmenityType.LEISURE);
|
amenityMap.put("park", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("playground", AmenityType.LEISURE);
|
amenityMap.put("playground", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("garden", AmenityType.LEISURE);
|
amenityMap.put("garden", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("common", AmenityType.LEISURE);
|
amenityMap.put("common", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("ice_rink", AmenityType.LEISURE);
|
amenityMap.put("ice_rink", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("miniature_golf", AmenityType.LEISURE);
|
amenityMap.put("miniature_golf", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
amenityMap.put("dance", AmenityType.LEISURE);
|
amenityMap.put("dance", AmenityType.LEISURE); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
amenityMap.put("9pin", AmenityType.SPORT);
|
amenityMap.put("9pin", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("10pin", AmenityType.SPORT);
|
amenityMap.put("10pin", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("archery", AmenityType.SPORT);
|
amenityMap.put("archery", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("athletics", AmenityType.SPORT);
|
amenityMap.put("athletics", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("australian_football", AmenityType.SPORT);
|
amenityMap.put("australian_football", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("baseball", AmenityType.SPORT);
|
amenityMap.put("baseball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("basketball", AmenityType.SPORT);
|
amenityMap.put("basketball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("beachvolleyball", AmenityType.SPORT);
|
amenityMap.put("beachvolleyball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("boules", AmenityType.SPORT);
|
amenityMap.put("boules", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("bowls", AmenityType.SPORT);
|
amenityMap.put("bowls", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("canoe", AmenityType.SPORT);
|
amenityMap.put("canoe", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("chess", AmenityType.SPORT);
|
amenityMap.put("chess", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("climbing", AmenityType.SPORT);
|
amenityMap.put("climbing", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("cricket", AmenityType.SPORT);
|
amenityMap.put("cricket", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("cricket_nets", AmenityType.SPORT);
|
amenityMap.put("cricket_nets", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("croquet", AmenityType.SPORT);
|
amenityMap.put("croquet", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("cycling", AmenityType.SPORT);
|
amenityMap.put("cycling", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("diving", AmenityType.SPORT);
|
amenityMap.put("diving", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("dog_racing", AmenityType.SPORT);
|
amenityMap.put("dog_racing", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("equestrian", AmenityType.SPORT);
|
amenityMap.put("equestrian", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("football", AmenityType.SPORT);
|
amenityMap.put("football", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("golf", AmenityType.SPORT);
|
amenityMap.put("golf", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("gymnastics", AmenityType.SPORT);
|
amenityMap.put("gymnastics", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("hockey", AmenityType.SPORT);
|
amenityMap.put("hockey", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("horse_racing", AmenityType.SPORT);
|
amenityMap.put("horse_racing", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("ice_stock", AmenityType.SPORT);
|
amenityMap.put("ice_stock", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("korfball", AmenityType.SPORT);
|
amenityMap.put("korfball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("motor", AmenityType.SPORT);
|
amenityMap.put("motor", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("multi", AmenityType.SPORT);
|
amenityMap.put("multi", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("orienteering", AmenityType.SPORT);
|
amenityMap.put("orienteering", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("paddle_tennis", AmenityType.SPORT);
|
amenityMap.put("paddle_tennis", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("paragliding", AmenityType.SPORT);
|
amenityMap.put("paragliding", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("pelota", AmenityType.SPORT);
|
amenityMap.put("pelota", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("racquet", AmenityType.SPORT);
|
amenityMap.put("racquet", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("rowing", AmenityType.SPORT);
|
amenityMap.put("rowing", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("rugby", AmenityType.SPORT);
|
amenityMap.put("rugby", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("shooting", AmenityType.SPORT);
|
amenityMap.put("shooting", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("skating", AmenityType.SPORT);
|
amenityMap.put("skating", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("skateboard", AmenityType.SPORT);
|
amenityMap.put("skateboard", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("skiing", AmenityType.SPORT);
|
amenityMap.put("skiing", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("soccer", AmenityType.SPORT);
|
amenityMap.put("soccer", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("swimming", AmenityType.SPORT);
|
amenityMap.put("swimming", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("table_tennis", AmenityType.SPORT);
|
amenityMap.put("table_tennis", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("team_handball", AmenityType.SPORT);
|
amenityMap.put("team_handball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("tennis", AmenityType.SPORT);
|
amenityMap.put("tennis", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("toboggan", AmenityType.SPORT);
|
amenityMap.put("toboggan", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
amenityMap.put("volleyball", AmenityType.SPORT);
|
amenityMap.put("volleyball", AmenityType.SPORT); //$NON-NLS-1$
|
||||||
|
|
||||||
// amenity sub type
|
// amenity sub type
|
||||||
amenityMap.put("place_of_worship", AmenityType.OTHER);
|
amenityMap.put("place_of_worship", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("restaurant", AmenityType.SUSTENANCE);
|
amenityMap.put("restaurant", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("food_court", AmenityType.SUSTENANCE);
|
amenityMap.put("food_court", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("fast_food", AmenityType.SUSTENANCE);
|
amenityMap.put("fast_food", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("drinking_water", AmenityType.SUSTENANCE);
|
amenityMap.put("drinking_water", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("bbq", AmenityType.SUSTENANCE);
|
amenityMap.put("bbq", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("pub", AmenityType.SUSTENANCE);
|
amenityMap.put("pub", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("bar", AmenityType.SUSTENANCE);
|
amenityMap.put("bar", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("cafe", AmenityType.SUSTENANCE);
|
amenityMap.put("cafe", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("biergarten", AmenityType.SUSTENANCE);
|
amenityMap.put("biergarten", AmenityType.SUSTENANCE); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("kindergarten", AmenityType.EDUCATION);
|
amenityMap.put("kindergarten", AmenityType.EDUCATION); //$NON-NLS-1$
|
||||||
amenityMap.put("school", AmenityType.EDUCATION);
|
amenityMap.put("school", AmenityType.EDUCATION); //$NON-NLS-1$
|
||||||
amenityMap.put("college", AmenityType.EDUCATION);
|
amenityMap.put("college", AmenityType.EDUCATION); //$NON-NLS-1$
|
||||||
amenityMap.put("library", AmenityType.EDUCATION);
|
amenityMap.put("library", AmenityType.EDUCATION); //$NON-NLS-1$
|
||||||
amenityMap.put("university", AmenityType.EDUCATION);
|
amenityMap.put("university", AmenityType.EDUCATION); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("ferry_terminal", AmenityType.TRANSPORTATION);
|
amenityMap.put("ferry_terminal", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("bicycle_parking", AmenityType.TRANSPORTATION);
|
amenityMap.put("bicycle_parking", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("bicycle_rental", AmenityType.TRANSPORTATION);
|
amenityMap.put("bicycle_rental", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("bus_station", AmenityType.TRANSPORTATION);
|
amenityMap.put("bus_station", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("car_rental", AmenityType.TRANSPORTATION);
|
amenityMap.put("car_rental", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("car_sharing", AmenityType.TRANSPORTATION);
|
amenityMap.put("car_sharing", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("fuel", AmenityType.TRANSPORTATION);
|
amenityMap.put("fuel", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("car_wash", AmenityType.TRANSPORTATION);
|
amenityMap.put("car_wash", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("grit_bin", AmenityType.TRANSPORTATION);
|
amenityMap.put("grit_bin", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("parking", AmenityType.TRANSPORTATION);
|
amenityMap.put("parking", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
amenityMap.put("taxi", AmenityType.TRANSPORTATION);
|
amenityMap.put("taxi", AmenityType.TRANSPORTATION); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("atm", AmenityType.FINANCE);
|
amenityMap.put("atm", AmenityType.FINANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("bank", AmenityType.FINANCE);
|
amenityMap.put("bank", AmenityType.FINANCE); //$NON-NLS-1$
|
||||||
amenityMap.put("bureau_de_change", AmenityType.FINANCE);
|
amenityMap.put("bureau_de_change", AmenityType.FINANCE); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("pharmacy", AmenityType.HEALTHCARE);
|
amenityMap.put("pharmacy", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("hospital", AmenityType.HEALTHCARE);
|
amenityMap.put("hospital", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("baby_hatch", AmenityType.HEALTHCARE);
|
amenityMap.put("baby_hatch", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("dentist", AmenityType.HEALTHCARE);
|
amenityMap.put("dentist", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("doctors", AmenityType.HEALTHCARE);
|
amenityMap.put("doctors", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("veterinary", AmenityType.HEALTHCARE);
|
amenityMap.put("veterinary", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
amenityMap.put("first_aid", AmenityType.HEALTHCARE);
|
amenityMap.put("first_aid", AmenityType.HEALTHCARE); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("architect_office", AmenityType.ENTERTAINMENT);
|
amenityMap.put("architect_office", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("arts_centre", AmenityType.ENTERTAINMENT);
|
amenityMap.put("arts_centre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("cinema", AmenityType.ENTERTAINMENT);
|
amenityMap.put("cinema", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("community_centre", AmenityType.ENTERTAINMENT);
|
amenityMap.put("community_centre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("fountain", AmenityType.ENTERTAINMENT);
|
amenityMap.put("fountain", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("nightclub", AmenityType.ENTERTAINMENT);
|
amenityMap.put("nightclub", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("stripclub", AmenityType.ENTERTAINMENT);
|
amenityMap.put("stripclub", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("studio", AmenityType.ENTERTAINMENT);
|
amenityMap.put("studio", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("theatre", AmenityType.ENTERTAINMENT);
|
amenityMap.put("theatre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("sauna", AmenityType.ENTERTAINMENT);
|
amenityMap.put("sauna", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
amenityMap.put("brothel", AmenityType.ENTERTAINMENT);
|
amenityMap.put("brothel", AmenityType.ENTERTAINMENT); //$NON-NLS-1$
|
||||||
|
|
||||||
amenityMap.put("internet_access", AmenityType.OTHER);
|
amenityMap.put("internet_access", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("bench", AmenityType.OTHER);
|
amenityMap.put("bench", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("clock", AmenityType.OTHER);
|
amenityMap.put("clock", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("courthouse", AmenityType.OTHER);
|
amenityMap.put("courthouse", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("crematorium", AmenityType.OTHER);
|
amenityMap.put("crematorium", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("embassy", AmenityType.OTHER);
|
amenityMap.put("embassy", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("emergency_phone", AmenityType.OTHER);
|
amenityMap.put("emergency_phone", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("fire_hydrant", AmenityType.OTHER);
|
amenityMap.put("fire_hydrant", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("fire_station", AmenityType.OTHER);
|
amenityMap.put("fire_station", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("grave_yard", AmenityType.OTHER);
|
amenityMap.put("grave_yard", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("hunting_stand", AmenityType.OTHER);
|
amenityMap.put("hunting_stand", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("marketplace", AmenityType.OTHER);
|
amenityMap.put("marketplace", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("police", AmenityType.OTHER);
|
amenityMap.put("police", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("post_box", AmenityType.OTHER);
|
amenityMap.put("post_box", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("post_office", AmenityType.OTHER);
|
amenityMap.put("post_office", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("prison", AmenityType.OTHER);
|
amenityMap.put("prison", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("public_building", AmenityType.OTHER);
|
amenityMap.put("public_building", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("recycling", AmenityType.OTHER);
|
amenityMap.put("recycling", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("shelter", AmenityType.OTHER);
|
amenityMap.put("shelter", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("telephone", AmenityType.OTHER);
|
amenityMap.put("telephone", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("toilets", AmenityType.OTHER);
|
amenityMap.put("toilets", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("townhall", AmenityType.OTHER);
|
amenityMap.put("townhall", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("vending_machine", AmenityType.OTHER);
|
amenityMap.put("vending_machine", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("waste_basket", AmenityType.OTHER);
|
amenityMap.put("waste_basket", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
amenityMap.put("waste_disposal", AmenityType.OTHER);
|
amenityMap.put("waste_disposal", AmenityType.OTHER); //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,6 @@ public class City extends MapObject {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<String> getPostcodes() {
|
|
||||||
return postcodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Street> getStreets(){
|
public Collection<Street> getStreets(){
|
||||||
return streets.values();
|
return streets.values();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +126,7 @@ public class City extends MapObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "City [" +type+"] " + getName();
|
return "City [" +type+"] " + getName(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doDataPreparation(){
|
public void doDataPreparation(){
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class DataTileManager<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String evTile(int tileX, int tileY){
|
private String evTile(int tileX, int tileY){
|
||||||
return tileX +"_"+tileY;
|
return tileX +"_"+tileY; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
if (this.name != null) {
|
if (this.name != null) {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
@ -68,7 +68,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
if(this.enName != null){
|
if(this.enName != null){
|
||||||
return this.enName;
|
return this.enName;
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnName(String enName) {
|
public void setEnName(String enName) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Region extends MapObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Region(){
|
public Region(){
|
||||||
name = "Region";
|
name = "Region"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsmBaseStorage getStorage() {
|
public OsmBaseStorage getStorage() {
|
||||||
|
|
|
@ -25,12 +25,12 @@ public class DataIndexReader {
|
||||||
|
|
||||||
public Connection getConnection(File file) throws SQLException{
|
public Connection getConnection(File file) throws SQLException{
|
||||||
try {
|
try {
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error("Illegal configuration", e);
|
log.error("Illegal configuration", e); //$NON-NLS-1$
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
return DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath());
|
return DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class DataIndexReader {
|
||||||
List<Street> streets = new ArrayList<Street>();
|
List<Street> streets = new ArrayList<Street>();
|
||||||
Statement stat = c.createStatement();
|
Statement stat = c.createStatement();
|
||||||
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexStreetTable.values(),
|
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexStreetTable.values(),
|
||||||
IndexStreetTable.CITY.toString() +" = " + city.getId()));
|
IndexStreetTable.CITY.toString() +" = " + city.getId())); //$NON-NLS-1$
|
||||||
while(set.next()){
|
while(set.next()){
|
||||||
Street street = new Street(city);
|
Street street = new Street(city);
|
||||||
street.setName(set.getString(IndexStreetTable.NAME.ordinal() + 1));
|
street.setName(set.getString(IndexStreetTable.NAME.ordinal() + 1));
|
||||||
|
@ -76,7 +76,7 @@ public class DataIndexReader {
|
||||||
List<Building> buildings = new ArrayList<Building>();
|
List<Building> buildings = new ArrayList<Building>();
|
||||||
Statement stat = c.createStatement();
|
Statement stat = c.createStatement();
|
||||||
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexBuildingTable.values(),
|
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexBuildingTable.values(),
|
||||||
IndexBuildingTable.STREET.toString() +" = " + street.getId()));
|
IndexBuildingTable.STREET.toString() +" = " + street.getId())); //$NON-NLS-1$
|
||||||
while(set.next()){
|
while(set.next()){
|
||||||
Building building = new Building();
|
Building building = new Building();
|
||||||
building.setName(set.getString(IndexBuildingTable.NAME.ordinal() + 1));
|
building.setName(set.getString(IndexBuildingTable.NAME.ordinal() + 1));
|
||||||
|
@ -95,11 +95,11 @@ public class DataIndexReader {
|
||||||
Connection c = getConnection(f);
|
Connection c = getConnection(f);
|
||||||
try {
|
try {
|
||||||
for (City city : readCities(c)) {
|
for (City city : readCities(c)) {
|
||||||
System.out.println("CITY " + city.getName());
|
System.out.println("CITY " + city.getName()); //$NON-NLS-1$
|
||||||
for (Street s : readStreets(c, city)) {
|
for (Street s : readStreets(c, city)) {
|
||||||
System.out.println("\tSTREET " + s.getName());
|
System.out.println("\tSTREET " + s.getName()); //$NON-NLS-1$
|
||||||
for (Building b : readBuildings(c, s)) {
|
for (Building b : readBuildings(c, s)) {
|
||||||
System.out.println("\t\tBULDING " + b.getName());
|
System.out.println("\t\tBULDING " + b.getName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class DataIndexWriter {
|
||||||
f.mkdirs();
|
f.mkdirs();
|
||||||
// remove existing file
|
// remove existing file
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
log.warn("Remove existing index : " + f.getAbsolutePath());
|
log.warn("Remove existing index : " + f.getAbsolutePath()); //$NON-NLS-1$
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
|
@ -61,18 +61,18 @@ public class DataIndexWriter {
|
||||||
File file = checkFile(IndexConstants.POI_INDEX_DIR+region.getName()+IndexConstants.POI_INDEX_EXT);
|
File file = checkFile(IndexConstants.POI_INDEX_DIR+region.getName()+IndexConstants.POI_INDEX_EXT);
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error("Illegal configuration", e);
|
log.error("Illegal configuration", e); //$NON-NLS-1$
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath());
|
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
Statement stat = conn.createStatement();
|
Statement stat = conn.createStatement();
|
||||||
assert IndexPoiTable.values().length == 8;
|
assert IndexPoiTable.values().length == 8;
|
||||||
stat.executeUpdate(IndexConstants.generateCreateSQL(IndexPoiTable.values()));
|
stat.executeUpdate(IndexConstants.generateCreateSQL(IndexPoiTable.values()));
|
||||||
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexPoiTable.values()));
|
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexPoiTable.values()));
|
||||||
stat.execute("PRAGMA user_version = " + IndexConstants.POI_TABLE_VERSION);
|
stat.execute("PRAGMA user_version = " + IndexConstants.POI_TABLE_VERSION); //$NON-NLS-1$
|
||||||
stat.close();
|
stat.close();
|
||||||
|
|
||||||
PreparedStatement prep = conn.prepareStatement(
|
PreparedStatement prep = conn.prepareStatement(
|
||||||
|
@ -102,7 +102,7 @@ public class DataIndexWriter {
|
||||||
conn.setAutoCommit(true);
|
conn.setAutoCommit(true);
|
||||||
} finally {
|
} finally {
|
||||||
conn.close();
|
conn.close();
|
||||||
log.info(String.format("Indexing poi done in %s ms.", System.currentTimeMillis() - now));
|
log.info(String.format("Indexing poi done in %s ms.", System.currentTimeMillis() - now)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,12 @@ public class DataIndexWriter {
|
||||||
File file = checkFile(IndexConstants.ADDRESS_INDEX_DIR+region.getName()+IndexConstants.ADDRESS_INDEX_EXT);
|
File file = checkFile(IndexConstants.ADDRESS_INDEX_DIR+region.getName()+IndexConstants.ADDRESS_INDEX_EXT);
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error("Illegal configuration", e);
|
log.error("Illegal configuration", e); //$NON-NLS-1$
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath());
|
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
Statement stat = conn.createStatement();
|
Statement stat = conn.createStatement();
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public class DataIndexWriter {
|
||||||
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetNodeTable.values()));
|
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetNodeTable.values()));
|
||||||
stat.executeUpdate(IndexConstants.generateCreateSQL(IndexStreetTable.values()));
|
stat.executeUpdate(IndexConstants.generateCreateSQL(IndexStreetTable.values()));
|
||||||
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetTable.values()));
|
stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetTable.values()));
|
||||||
stat.execute("PRAGMA user_version = " + IndexConstants.ADDRESS_TABLE_VERSION);
|
stat.execute("PRAGMA user_version = " + IndexConstants.ADDRESS_TABLE_VERSION); //$NON-NLS-1$
|
||||||
stat.close();
|
stat.close();
|
||||||
|
|
||||||
PreparedStatement prepCity = conn.prepareStatement(
|
PreparedStatement prepCity = conn.prepareStatement(
|
||||||
|
@ -220,7 +220,7 @@ public class DataIndexWriter {
|
||||||
conn.setAutoCommit(true);
|
conn.setAutoCommit(true);
|
||||||
} finally {
|
} finally {
|
||||||
conn.close();
|
conn.close();
|
||||||
log.info(String.format("Indexing address done in %s ms.", System.currentTimeMillis() - now));
|
log.info(String.format("Indexing address done in %s ms.", System.currentTimeMillis() - now)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@ public class IndexConstants {
|
||||||
public final static int POI_TABLE_VERSION = 0;
|
public final static int POI_TABLE_VERSION = 0;
|
||||||
public final static int ADDRESS_TABLE_VERSION = 1;
|
public final static int ADDRESS_TABLE_VERSION = 1;
|
||||||
|
|
||||||
public static final String POI_INDEX_DIR = "POI/";
|
public static final String POI_INDEX_DIR = "POI/"; //$NON-NLS-1$
|
||||||
public static final String ADDRESS_INDEX_DIR = "Address/";
|
public static final String ADDRESS_INDEX_DIR = "Address/"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String POI_INDEX_EXT = ".poi.odb";
|
public static final String POI_INDEX_EXT = ".poi.odb"; //$NON-NLS-1$
|
||||||
public static final String ADDRESS_INDEX_EXT = ".addr.odb";
|
public static final String ADDRESS_INDEX_EXT = ".addr.odb"; //$NON-NLS-1$
|
||||||
|
|
||||||
public interface IndexColumn {
|
public interface IndexColumn {
|
||||||
public boolean isIndex();
|
public boolean isIndex();
|
||||||
|
@ -31,20 +31,20 @@ public class IndexConstants {
|
||||||
|
|
||||||
public static String generateCreateSQL(IndexColumn[] columns){
|
public static String generateCreateSQL(IndexColumn[] columns){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("create table ").append(columns[0].getTableName()).append(" (");
|
b.append("create table ").append(columns[0].getTableName()).append(" ("); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for(IndexColumn c : columns){
|
for(IndexColumn c : columns){
|
||||||
if(first) {
|
if(first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
b.append(", ");
|
b.append(", "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(c.toString());
|
b.append(c.toString());
|
||||||
if(c.getType() != null){
|
if(c.getType() != null){
|
||||||
b.append(" ").append(c.getType());
|
b.append(" ").append(c.getType()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.append(" ); ");
|
b.append(" ); "); //$NON-NLS-1$
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,41 +54,41 @@ public class IndexConstants {
|
||||||
|
|
||||||
public static String generateSelectSQL(IndexColumn[] select, String where){
|
public static String generateSelectSQL(IndexColumn[] select, String where){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("select ");
|
b.append("select "); //$NON-NLS-1$
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for(IndexColumn c : select){
|
for(IndexColumn c : select){
|
||||||
if(first) {
|
if(first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
b.append(", ");
|
b.append(", "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(c.toString());
|
b.append(c.toString());
|
||||||
}
|
}
|
||||||
b.append(" FROM ").append(select[0].getTableName());
|
b.append(" FROM ").append(select[0].getTableName()); //$NON-NLS-1$
|
||||||
if(where != null){
|
if(where != null){
|
||||||
b.append(" WHERE " ).append(where);
|
b.append(" WHERE " ).append(where); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(" ; ");
|
b.append(" ; "); //$NON-NLS-1$
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generatePrepareStatementToInsert(String tableName, int numColumns){
|
public static String generatePrepareStatementToInsert(String tableName, int numColumns){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("insert into ").append(tableName).append(" values (");
|
b.append("insert into ").append(tableName).append(" values ("); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
for(int i=0; i< numColumns; i++){
|
for(int i=0; i< numColumns; i++){
|
||||||
if(i > 0){
|
if(i > 0){
|
||||||
b.append(", ");
|
b.append(", "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append("?");
|
b.append("?"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(");");
|
b.append(");"); //$NON-NLS-1$
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generateCreateIndexSQL(IndexColumn[] columns){
|
public static String generateCreateIndexSQL(IndexColumn[] columns){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
String tableName = columns[0].getTableName();
|
String tableName = columns[0].getTableName();
|
||||||
b.append("create index ").append(tableName).append("_index ON ").append(tableName).append(" (");
|
b.append("create index ").append(tableName).append("_index ON ").append(tableName).append(" ("); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for(IndexColumn c : columns){
|
for(IndexColumn c : columns){
|
||||||
if(!c.isIndex()){
|
if(!c.isIndex()){
|
||||||
|
@ -97,11 +97,11 @@ public class IndexConstants {
|
||||||
if(first) {
|
if(first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
b.append(", ");
|
b.append(", "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(c.toString());
|
b.append(c.toString());
|
||||||
}
|
}
|
||||||
b.append(" ); ");
|
b.append(" ); "); //$NON-NLS-1$
|
||||||
if(first){
|
if(first){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class IndexConstants {
|
||||||
|
|
||||||
|
|
||||||
public enum IndexPoiTable implements IndexColumn {
|
public enum IndexPoiTable implements IndexColumn {
|
||||||
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), OPENING_HOURS, NAME, NAME_EN, TYPE, SUBTYPE;
|
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), OPENING_HOURS, NAME, NAME_EN, TYPE, SUBTYPE; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
boolean index = false;
|
boolean index = false;
|
||||||
String type = null;
|
String type = null;
|
||||||
private IndexPoiTable(){}
|
private IndexPoiTable(){}
|
||||||
|
@ -120,7 +120,7 @@ public class IndexConstants {
|
||||||
private IndexPoiTable(String type, boolean index){ this(type); this.index = index;}
|
private IndexPoiTable(String type, boolean index){ this(type); this.index = index;}
|
||||||
|
|
||||||
public static String getTable(){
|
public static String getTable(){
|
||||||
return "poi";
|
return "poi"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName(){
|
public String getTableName(){
|
||||||
|
@ -140,7 +140,7 @@ public class IndexConstants {
|
||||||
|
|
||||||
|
|
||||||
public enum IndexCityTable implements IndexColumn {
|
public enum IndexCityTable implements IndexColumn {
|
||||||
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY_TYPE;
|
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY_TYPE; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
boolean index = false;
|
boolean index = false;
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTable() {
|
public static String getTable() {
|
||||||
return "city";
|
return "city"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
|
@ -176,7 +176,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IndexStreetTable implements IndexColumn {
|
public enum IndexStreetTable implements IndexColumn {
|
||||||
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY("long", true);
|
ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY("long", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
boolean index = false;
|
boolean index = false;
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTable() {
|
public static String getTable() {
|
||||||
return "street";
|
return "street"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
|
@ -212,7 +212,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IndexStreetNodeTable implements IndexColumn {
|
public enum IndexStreetNodeTable implements IndexColumn {
|
||||||
ID("long", true), LATITUDE("double"), LONGITUDE("double"), STREET("long", true), WAY("long", true);
|
ID("long", true), LATITUDE("double"), LONGITUDE("double"), STREET("long", true), WAY("long", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
boolean index = false;
|
boolean index = false;
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTable() {
|
public static String getTable() {
|
||||||
return "street_node";
|
return "street_node"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
|
@ -248,7 +248,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IndexBuildingTable implements IndexColumn {
|
public enum IndexBuildingTable implements IndexColumn {
|
||||||
ID("long"), LATITUDE("double"), LONGITUDE("double"), NAME, NAME_EN, STREET("long", true), POSTCODE(null, true);
|
ID("long"), LATITUDE("double"), LONGITUDE("double"), NAME, NAME_EN, STREET("long", true), POSTCODE(null, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
boolean index = false;
|
boolean index = false;
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class IndexConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTable() {
|
public static String getTable() {
|
||||||
return "building";
|
return "building"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
|
|
|
@ -175,14 +175,14 @@ public class MapTileDownloader {
|
||||||
|
|
||||||
currentlyDownloaded.add(request.fileToSave);
|
currentlyDownloaded.add(request.fileToSave);
|
||||||
if(log.isDebugEnabled()){
|
if(log.isDebugEnabled()){
|
||||||
log.debug("Start downloading tile : " + request.url);
|
log.debug("Start downloading tile : " + request.url); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
request.fileToSave.getParentFile().mkdirs();
|
request.fileToSave.getParentFile().mkdirs();
|
||||||
URL url = new URL(request.url);
|
URL url = new URL(request.url);
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
connection.setRequestProperty("User-Agent", Version.APP_NAME_VERSION);
|
connection.setRequestProperty("User-Agent", Version.APP_NAME_VERSION); //$NON-NLS-1$
|
||||||
BufferedInputStream inputStream = new BufferedInputStream(connection.getInputStream(), 8 * 1024);
|
BufferedInputStream inputStream = new BufferedInputStream(connection.getInputStream(), 8 * 1024);
|
||||||
FileOutputStream stream = null;
|
FileOutputStream stream = null;
|
||||||
try {
|
try {
|
||||||
|
@ -194,16 +194,16 @@ public class MapTileDownloader {
|
||||||
Algoritms.closeStream(stream);
|
Algoritms.closeStream(stream);
|
||||||
}
|
}
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Downloading tile : " + request.url + " successfull " + (System.currentTimeMillis() - time) + " ms");
|
log.debug("Downloading tile : " + request.url + " successfull " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
currentErrors++;
|
currentErrors++;
|
||||||
request.setError(true);
|
request.setError(true);
|
||||||
log.error("UnknownHostException, cannot download tile " + request.url + " " + e.getMessage());
|
log.error("UnknownHostException, cannot download tile " + request.url + " " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
currentErrors++;
|
currentErrors++;
|
||||||
request.setError(true);
|
request.setError(true);
|
||||||
log.warn("Cannot download tile : " + request.url, e);
|
log.warn("Cannot download tile : " + request.url, e); //$NON-NLS-1$
|
||||||
} finally {
|
} finally {
|
||||||
currentlyDownloaded.remove(request.fileToSave);
|
currentlyDownloaded.remove(request.fileToSave);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ConsoleProgressImplementation implements IProgress {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishTask() {
|
public void finishTask() {
|
||||||
System.out.println("Task " + currentTask + " is finished ");
|
System.out.println("Task " + currentTask + " is finished "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
this.currentTask = null;
|
this.currentTask = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class ConsoleProgressImplementation implements IProgress {
|
||||||
|
|
||||||
private void printIfNeeded() {
|
private void printIfNeeded() {
|
||||||
if(getCurrentPercent() - lastPercentPrint >= deltaPercentsToPrint){
|
if(getCurrentPercent() - lastPercentPrint >= deltaPercentsToPrint){
|
||||||
System.out.println(MessageFormat.format("Done {0} %.", getCurrentPercent()));
|
System.out.println(MessageFormat.format("Done {0} %.", getCurrentPercent())); //$NON-NLS-1$
|
||||||
this.lastPercentPrint = getCurrentPercent();
|
this.lastPercentPrint = getCurrentPercent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class ConsoleProgressImplementation implements IProgress {
|
||||||
public void startTask(String taskName, int work) {
|
public void startTask(String taskName, int work) {
|
||||||
if(!Algoritms.objectEquals(currentTask, taskName)){
|
if(!Algoritms.objectEquals(currentTask, taskName)){
|
||||||
this.currentTask = taskName;
|
this.currentTask = taskName;
|
||||||
System.out.println("Started new task : " + currentTask + " - " + work);
|
System.out.println("Started new task : " + currentTask + " - " + work); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
startWork(work);
|
startWork(work);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class ConsoleProgressImplementation implements IProgress {
|
||||||
public void startWork(int work) {
|
public void startWork(int work) {
|
||||||
if(this.work != work){
|
if(this.work != work){
|
||||||
this.work = work;
|
this.work = work;
|
||||||
System.out.println("Amount of work was changed to " + work);
|
System.out.println("Amount of work was changed to " + work); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
this.currentDone = 0;
|
this.currentDone = 0;
|
||||||
this.lastPercentPrint = 0;
|
this.lastPercentPrint = 0;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TileSourceManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUrlToLoad(int x, int y, int zoom) {
|
public String getUrlToLoad(int x, int y, int zoom) {
|
||||||
return MessageFormat.format(urlToLoad, zoom+"", x+"", y+"");
|
return MessageFormat.format(urlToLoad, zoom, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,7 @@ public class OsmExtractionUI implements IMapLocationListener {
|
||||||
buildTransportIndex = new JCheckBox();
|
buildTransportIndex = new JCheckBox();
|
||||||
buildTransportIndex.setText("Build transport index");
|
buildTransportIndex.setText("Build transport index");
|
||||||
panel.add(buildTransportIndex);
|
panel.add(buildTransportIndex);
|
||||||
buildTransportIndex.setSelected(true);
|
buildTransportIndex.setSelected(false);
|
||||||
|
|
||||||
loadingAllData = new JCheckBox();
|
loadingAllData = new JCheckBox();
|
||||||
loadingAllData.setText("Loading all osm data");
|
loadingAllData.setText("Loading all osm data");
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class AmenityIndexRepository {
|
||||||
private final String[] columns = IndexConstants.generateColumnNames(IndexPoiTable.values());
|
private final String[] columns = IndexConstants.generateColumnNames(IndexPoiTable.values());
|
||||||
public List<Amenity> searchAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int limit, PoiFilter filter, List<Amenity> amenities){
|
public List<Amenity> searchAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int limit, PoiFilter filter, List<Amenity> amenities){
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
String squery = "? < latitude AND latitude < ? AND ? < longitude AND longitude < ?";
|
String squery = "? < latitude AND latitude < ? AND ? < longitude AND longitude < ?"; //$NON-NLS-1$
|
||||||
|
|
||||||
if(filter != null){
|
if(filter != null){
|
||||||
String sql = filter.buildSqlWhereFilter();
|
String sql = filter.buildSqlWhereFilter();
|
||||||
if(sql != null){
|
if(sql != null){
|
||||||
squery += " AND " + sql;
|
squery += " AND " + sql; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cursor query = db.query(IndexPoiTable.getTable(), columns, squery,
|
Cursor query = db.query(IndexPoiTable.getTable(), columns, squery,
|
||||||
|
@ -73,30 +73,30 @@ public class AmenityIndexRepository {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug(String.format("Search for %s done in %s ms found %s.",
|
log.debug(String.format("Search for %s done in %s ms found %s.", //$NON-NLS-1$
|
||||||
topLatitude + " " + leftLongitude, System.currentTimeMillis() - now, amenities.size()));
|
topLatitude + " " + leftLongitude, System.currentTimeMillis() - now, amenities.size())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return amenities;
|
return amenities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){
|
public boolean addAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){
|
||||||
assert IndexPoiTable.values().length == 8;
|
assert IndexPoiTable.values().length == 8;
|
||||||
db.execSQL("INSERT INTO " + IndexPoiTable.getTable() + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
db.execSQL("INSERT INTO " + IndexPoiTable.getTable() + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Object[]{id, latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType});
|
new Object[]{id, latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){
|
public boolean updateAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("UPDATE " + IndexPoiTable.getTable() + " SET ");
|
b.append("UPDATE " + IndexPoiTable.getTable() + " SET "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
b.append(IndexPoiTable.LATITUDE.name()).append(" = ?").append(", ").
|
b.append(IndexPoiTable.LATITUDE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.LONGITUDE.name()).append(" = ?").append(", ").
|
append(IndexPoiTable.LONGITUDE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.OPENING_HOURS.name()).append(" = ?").append(", ").
|
append(IndexPoiTable.OPENING_HOURS.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.NAME.name()).append(" = ?").append(", ").
|
append(IndexPoiTable.NAME.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.NAME_EN.name()).append(" = ?").append(", ").
|
append(IndexPoiTable.NAME_EN.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.TYPE.name()).append(" = ?").append(", ").
|
append(IndexPoiTable.TYPE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(IndexPoiTable.SUBTYPE.name()).append(" = ?").append(" ").
|
append(IndexPoiTable.SUBTYPE.name()).append(" = ?").append(" "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(" WHERE ").append(IndexPoiTable.ID.name()).append(" = ?");
|
append(" WHERE ").append(IndexPoiTable.ID.name()).append(" = ?"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
db.execSQL(b.toString(),
|
db.execSQL(b.toString(),
|
||||||
new Object[]{latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType, id});
|
new Object[]{latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType, id});
|
||||||
|
@ -104,7 +104,7 @@ public class AmenityIndexRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteAmenity(long id){
|
public boolean deleteAmenity(long id){
|
||||||
db.execSQL("DELETE FROM " + IndexPoiTable.getTable()+ " WHERE id="+id);
|
db.execSQL("DELETE FROM " + IndexPoiTable.getTable()+ " WHERE id="+id); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public class AmenityIndexRepository {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor query = db.query(IndexPoiTable.getTable(), new String[]{"MAX(latitude)", "MAX(longitude)", "MIN(latitude)", "MIN(longitude)"}, null, null,null, null, null);
|
Cursor query = db.query(IndexPoiTable.getTable(), new String[]{"MAX(latitude)", "MAX(longitude)", "MIN(latitude)", "MIN(longitude)"}, null, null,null, null, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
if(query.moveToFirst()){
|
if(query.moveToFirst()){
|
||||||
dataTopLatitude = query.getDouble(0);
|
dataTopLatitude = query.getDouble(0);
|
||||||
dataRightLongitude = query.getDouble(1);
|
dataRightLongitude = query.getDouble(1);
|
||||||
|
@ -181,7 +181,7 @@ public class AmenityIndexRepository {
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Initializing db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms");
|
log.debug("Initializing db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.commons.logging.Log;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LogUtil {
|
public class LogUtil {
|
||||||
public static String TAG = "com.osmand";
|
public static String TAG = "com.osmand"; //$NON-NLS-1$
|
||||||
private static class OsmandLogImplementation implements Log {
|
private static class OsmandLogImplementation implements Log {
|
||||||
|
|
||||||
private final String fullName;
|
private final String fullName;
|
||||||
|
@ -29,35 +29,35 @@ public class LogUtil {
|
||||||
@Override
|
@Override
|
||||||
public void debug(Object message) {
|
public void debug(Object message) {
|
||||||
if(isDebugEnabled()){
|
if(isDebugEnabled()){
|
||||||
android.util.Log.d(TAG, name + " " + message);
|
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(Object message, Throwable t) {
|
public void debug(Object message, Throwable t) {
|
||||||
if(isDebugEnabled()){
|
if(isDebugEnabled()){
|
||||||
android.util.Log.d(TAG, name + " " + message, t);
|
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(Object message) {
|
public void error(Object message) {
|
||||||
if(isErrorEnabled()){
|
if(isErrorEnabled()){
|
||||||
android.util.Log.e(TAG, name + " " + message);
|
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(Object message, Throwable t) {
|
public void error(Object message, Throwable t) {
|
||||||
if(isErrorEnabled()){
|
if(isErrorEnabled()){
|
||||||
android.util.Log.e(TAG, name + " " + message, t);
|
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fatal(Object message) {
|
public void fatal(Object message) {
|
||||||
if(isFatalEnabled()){
|
if(isFatalEnabled()){
|
||||||
android.util.Log.e(TAG, name + " " + message);
|
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,21 +65,21 @@ public class LogUtil {
|
||||||
@Override
|
@Override
|
||||||
public void fatal(Object message, Throwable t) {
|
public void fatal(Object message, Throwable t) {
|
||||||
if(isFatalEnabled()){
|
if(isFatalEnabled()){
|
||||||
android.util.Log.e(TAG, name + " " + message, t);
|
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void info(Object message) {
|
public void info(Object message) {
|
||||||
if(isInfoEnabled()){
|
if(isInfoEnabled()){
|
||||||
android.util.Log.i(TAG, name + " " + message);
|
android.util.Log.i(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void info(Object message, Throwable t) {
|
public void info(Object message, Throwable t) {
|
||||||
if(isInfoEnabled()){
|
if(isInfoEnabled()){
|
||||||
android.util.Log.i(TAG, name + " " + message, t);
|
android.util.Log.i(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,28 +118,28 @@ public class LogUtil {
|
||||||
@Override
|
@Override
|
||||||
public void trace(Object message) {
|
public void trace(Object message) {
|
||||||
if(isTraceEnabled()){
|
if(isTraceEnabled()){
|
||||||
android.util.Log.d(TAG, name + " " + message);
|
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trace(Object message, Throwable t) {
|
public void trace(Object message, Throwable t) {
|
||||||
if(isTraceEnabled()){
|
if(isTraceEnabled()){
|
||||||
android.util.Log.d(TAG, name + " " + message, t);
|
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(Object message) {
|
public void warn(Object message) {
|
||||||
if(isWarnEnabled()){
|
if(isWarnEnabled()){
|
||||||
android.util.Log.w(TAG, name + " " + message);
|
android.util.Log.w(TAG, name + " " + message); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warn(Object message, Throwable t) {
|
public void warn(Object message, Throwable t) {
|
||||||
if(isWarnEnabled()){
|
if(isWarnEnabled()){
|
||||||
android.util.Log.w(TAG, name + " " + message, t);
|
android.util.Log.w(TAG, name + " " + message, t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// These settings are stored in SharedPreferences
|
// These settings are stored in SharedPreferences
|
||||||
public static final String SHARED_PREFERENCES_NAME = "com.osmand.settings";
|
public static final String SHARED_PREFERENCES_NAME = "com.osmand.settings"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final int CENTER_CONSTANT = 0;
|
public static final int CENTER_CONSTANT = 0;
|
||||||
public static final int BOTTOM_CONSTANT = 1;
|
public static final int BOTTOM_CONSTANT = 1;
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles";
|
public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isUsingInternetToDownloadTiles(Context ctx) {
|
public static boolean isUsingInternetToDownloadTiles(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -49,7 +49,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String USE_INTERNET_TO_CALCULATE_ROUTE = "use_internet_to_calculate_route";
|
public static final String USE_INTERNET_TO_CALCULATE_ROUTE = "use_internet_to_calculate_route"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isUsingInternetToCalculateRoute(Context ctx) {
|
public static boolean isUsingInternetToCalculateRoute(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -57,7 +57,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SHOW_POI_OVER_MAP = "show_poi_over_map";
|
public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isShowingPoiOverMap(Context ctx) {
|
public static boolean isShowingPoiOverMap(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -65,11 +65,11 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String USER_NAME = "user_name";
|
public static final String USER_NAME = "user_name"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getUserName(Context ctx) {
|
public static String getUserName(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
return prefs.getString(USER_NAME, "NoName");
|
return prefs.getString(USER_NAME, "NoName"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setUserName(Context ctx, String name) {
|
public static boolean setUserName(Context ctx, String name) {
|
||||||
|
@ -77,10 +77,10 @@ public class OsmandSettings {
|
||||||
return prefs.edit().putString(USER_NAME, name).commit();
|
return prefs.edit().putString(USER_NAME, name).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String USER_PASSWORD = "user_password";
|
public static final String USER_PASSWORD = "user_password"; //$NON-NLS-1$
|
||||||
public static String getUserPassword(Context ctx){
|
public static String getUserPassword(Context ctx){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
return prefs.getString(USER_PASSWORD, "");
|
return prefs.getString(USER_PASSWORD, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setUserPassword(Context ctx, String name){
|
public static boolean setUserPassword(Context ctx, String name){
|
||||||
|
@ -89,7 +89,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String APPLICATION_MODE = "application_mode";
|
public static final String APPLICATION_MODE = "application_mode"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static ApplicationMode getApplicationMode(Context ctx) {
|
public static ApplicationMode getApplicationMode(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -107,10 +107,10 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SAVE_CURRENT_TRACK = "save_current_track";
|
public static final String SAVE_CURRENT_TRACK = "save_current_track"; //$NON-NLS-1$
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx";
|
public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isSavingTrackToGpx(Context ctx) {
|
public static boolean isSavingTrackToGpx(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -118,7 +118,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SAVE_TRACK_INTERVAL = "save_track_interval";
|
public static final String SAVE_TRACK_INTERVAL = "save_track_interval"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getSavingTrackInterval(Context ctx) {
|
public static int getSavingTrackInterval(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -126,7 +126,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SHOW_OSM_BUGS = "show_osm_bugs";
|
public static final String SHOW_OSM_BUGS = "show_osm_bugs"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isShowingOsmBugs(Context ctx) {
|
public static boolean isShowingOsmBugs(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -134,7 +134,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String SHOW_VIEW_ANGLE = "show_view_angle";
|
public static final String SHOW_VIEW_ANGLE = "show_view_angle"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isShowingViewAngle(Context ctx) {
|
public static boolean isShowingViewAngle(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -142,7 +142,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String AUTO_ZOOM_MAP = "auto_zoom_map";
|
public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isAutoZoomEnabled(Context ctx) {
|
public static boolean isAutoZoomEnabled(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -150,7 +150,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing";
|
public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isRotateMapToBearing(Context ctx) {
|
public static boolean isRotateMapToBearing(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -158,7 +158,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String POSITION_ON_MAP = "position_on_map";
|
public static final String POSITION_ON_MAP = "position_on_map"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getPositionOnMap(Context ctx) {
|
public static int getPositionOnMap(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -166,7 +166,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String MAP_VIEW_3D = "map_view_3d";
|
public static final String MAP_VIEW_3D = "map_view_3d"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isMapView3D(Context ctx) {
|
public static boolean isMapView3D(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -174,7 +174,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String USE_ENGLISH_NAMES = "use_english_names";
|
public static final String USE_ENGLISH_NAMES = "use_english_names"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean usingEnglishNames(Context ctx) {
|
public static boolean usingEnglishNames(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -187,7 +187,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public static final String MAP_TILE_SOURCES = "map_tile_sources";
|
public static final String MAP_TILE_SOURCES = "map_tile_sources"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static ITileSource getMapTileSource(Context ctx) {
|
public static ITileSource getMapTileSource(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -213,10 +213,10 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This value is a key for saving last known location shown on the map
|
// This value is a key for saving last known location shown on the map
|
||||||
public static final String LAST_KNOWN_MAP_LAT = "last_known_map_lat";
|
public static final String LAST_KNOWN_MAP_LAT = "last_known_map_lat"; //$NON-NLS-1$
|
||||||
public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon";
|
public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon"; //$NON-NLS-1$
|
||||||
public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location";
|
public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location"; //$NON-NLS-1$
|
||||||
public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom";
|
public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static LatLon getLastKnownMapLocation(Context ctx) {
|
public static LatLon getLastKnownMapLocation(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -265,8 +265,8 @@ public class OsmandSettings {
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String POINT_NAVIGATE_LAT = "point_navigate_lat";
|
public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; //$NON-NLS-1$
|
||||||
public final static String POINT_NAVIGATE_LON = "point_navigate_lon";
|
public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static LatLon getPointToNavigate(Context ctx) {
|
public static LatLon getPointToNavigate(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
@ -288,23 +288,23 @@ public class OsmandSettings {
|
||||||
return prefs.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
|
return prefs.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String LAST_SEARCHED_REGION = "last_searched_region";
|
public static final String LAST_SEARCHED_REGION = "last_searched_region"; //$NON-NLS-1$
|
||||||
public static final String LAST_SEARCHED_CITY = "last_searched_city";
|
public static final String LAST_SEARCHED_CITY = "last_searched_city"; //$NON-NLS-1$
|
||||||
public static final String LAST_SEARCHED_STREET = "last_searched_street";
|
public static final String LAST_SEARCHED_STREET = "last_searched_street"; //$NON-NLS-1$
|
||||||
public static final String LAST_SEARCHED_BUILDING = "last_searched_building";
|
public static final String LAST_SEARCHED_BUILDING = "last_searched_building"; //$NON-NLS-1$
|
||||||
public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street";
|
public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getLastSearchedRegion(Context ctx) {
|
public static String getLastSearchedRegion(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
return prefs.getString(LAST_SEARCHED_REGION, "");
|
return prefs.getString(LAST_SEARCHED_REGION, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setLastSearchedRegion(Context ctx, String region) {
|
public static boolean setLastSearchedRegion(Context ctx, String region) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1).putString(LAST_SEARCHED_STREET,
|
Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1).putString(LAST_SEARCHED_STREET,
|
||||||
"").putString(LAST_SEARCHED_BUILDING, "");
|
"").putString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
||||||
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
|
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
@ -316,31 +316,31 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public static boolean setLastSearchedCity(Context ctx, Long cityId) {
|
public static boolean setLastSearchedCity(Context ctx, Long cityId) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString(
|
Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString( //$NON-NLS-1$
|
||||||
LAST_SEARCHED_BUILDING, "");
|
LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$
|
||||||
if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){
|
if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){
|
||||||
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
|
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastSearchedStreet(Context ctx) {
|
public static String getLastSearchedStreet(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
return prefs.getString(LAST_SEARCHED_STREET, "");
|
return prefs.getString(LAST_SEARCHED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setLastSearchedStreet(Context ctx, String street) {
|
public static boolean setLastSearchedStreet(Context ctx, String street) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, "");
|
Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$
|
||||||
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
||||||
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
|
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastSearchedBuilding(Context ctx) {
|
public static String getLastSearchedBuilding(Context ctx) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
return prefs.getString(LAST_SEARCHED_BUILDING, "");
|
return prefs.getString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setLastSearchedBuilding(Context ctx, String building) {
|
public static boolean setLastSearchedBuilding(Context ctx, String building) {
|
||||||
|
@ -353,7 +353,7 @@ public class OsmandSettings {
|
||||||
if (!prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
if (!prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, "");
|
return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setLastSearchedIntersectedStreet(Context ctx, String street) {
|
public static boolean setLastSearchedIntersectedStreet(Context ctx, String street) {
|
||||||
|
@ -366,7 +366,7 @@ public class OsmandSettings {
|
||||||
return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
|
return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map";
|
public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean setPoiFilterForMap(Context ctx, String filterId) {
|
public static boolean setPoiFilterForMap(Context ctx, String filterId) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
|
|
@ -12,9 +12,9 @@ import com.osmand.osm.MapUtils;
|
||||||
|
|
||||||
public class PoiFilter {
|
public class PoiFilter {
|
||||||
|
|
||||||
public final static String STD_PREFIX = "std_";
|
public final static String STD_PREFIX = "std_"; //$NON-NLS-1$
|
||||||
public final static String USER_PREFIX = "user_";
|
public final static String USER_PREFIX = "user_"; //$NON-NLS-1$
|
||||||
public final static String CUSTOM_FILTER_ID = USER_PREFIX + "custom_id";
|
public final static String CUSTOM_FILTER_ID = USER_PREFIX + "custom_id"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Map<AmenityType, List<String>> acceptedTypes = new LinkedHashMap<AmenityType, List<String>>();
|
private Map<AmenityType, List<String>> acceptedTypes = new LinkedHashMap<AmenityType, List<String>>();
|
||||||
private String filterByName = null;
|
private String filterByName = null;
|
||||||
|
@ -33,7 +33,7 @@ public class PoiFilter {
|
||||||
public PoiFilter(AmenityType type){
|
public PoiFilter(AmenityType type){
|
||||||
isStandardFilter = true;
|
isStandardFilter = true;
|
||||||
filterId = STD_PREFIX + type;
|
filterId = STD_PREFIX + type;
|
||||||
name = type == null ? Messages.getMessage("poi_filter_closest_poi") : AmenityType.toPublicString(type);
|
name = type == null ? Messages.getMessage("poi_filter_closest_poi") : AmenityType.toPublicString(type); //$NON-NLS-1$
|
||||||
if(type == null){
|
if(type == null){
|
||||||
initSearchAll();
|
initSearchAll();
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,38 +147,38 @@ public class PoiFilter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if(acceptedTypes.size() == 0){
|
if(acceptedTypes.size() == 0){
|
||||||
return "1 > 1";
|
return "1 > 1"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("(");
|
b.append("("); //$NON-NLS-1$
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for(AmenityType a : acceptedTypes.keySet()){
|
for(AmenityType a : acceptedTypes.keySet()){
|
||||||
if(first){
|
if(first){
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
b.append(" OR ");
|
b.append(" OR "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append("(");
|
b.append("("); //$NON-NLS-1$
|
||||||
b.append(IndexPoiTable.TYPE.name().toLowerCase()).append(" = '").append(AmenityType.valueToString(a)).append("'");
|
b.append(IndexPoiTable.TYPE.name().toLowerCase()).append(" = '").append(AmenityType.valueToString(a)).append("'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if(acceptedTypes.get(a) != null){
|
if(acceptedTypes.get(a) != null){
|
||||||
List<String> list = acceptedTypes.get(a);
|
List<String> list = acceptedTypes.get(a);
|
||||||
b.append(" AND ");
|
b.append(" AND "); //$NON-NLS-1$
|
||||||
b.append(IndexPoiTable.SUBTYPE.name().toLowerCase()).append(" IN (");
|
b.append(IndexPoiTable.SUBTYPE.name().toLowerCase()).append(" IN ("); //$NON-NLS-1$
|
||||||
boolean bfirst = true;
|
boolean bfirst = true;
|
||||||
for(String s : list){
|
for(String s : list){
|
||||||
if(bfirst){
|
if(bfirst){
|
||||||
bfirst = false;
|
bfirst = false;
|
||||||
} else {
|
} else {
|
||||||
b.append(", ");
|
b.append(", "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append("'").append(s).append("'");
|
b.append("'").append(s).append("'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
b.append(")");
|
b.append(")"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
b.append(")");
|
b.append(")"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
b.append(")");
|
b.append(")"); //$NON-NLS-1$
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,59 +42,59 @@ public class PoiFiltersHelper {
|
||||||
Map<AmenityType, List<String>> types = new LinkedHashMap<AmenityType, List<String>>();
|
Map<AmenityType, List<String>> types = new LinkedHashMap<AmenityType, List<String>>();
|
||||||
|
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<String>();
|
||||||
list.add("fuel");
|
list.add("fuel"); //$NON-NLS-1$
|
||||||
list.add("car_wash");
|
list.add("car_wash"); //$NON-NLS-1$
|
||||||
list.add("car_repair");
|
list.add("car_repair"); //$NON-NLS-1$
|
||||||
types.put(AmenityType.TRANSPORTATION, list);
|
types.put(AmenityType.TRANSPORTATION, list);
|
||||||
list = new ArrayList<String>();
|
list = new ArrayList<String>();
|
||||||
list.add("car");
|
list.add("car"); //$NON-NLS-1$
|
||||||
list.add("car_repair");
|
list.add("car_repair"); //$NON-NLS-1$
|
||||||
types.put(AmenityType.SHOP, list);
|
types.put(AmenityType.SHOP, list);
|
||||||
filters.add(new PoiFilter(Messages.getMessage("poi_filter_car_aid"), null, types));
|
filters.add(new PoiFilter(Messages.getMessage("poi_filter_car_aid"), null, types)); //$NON-NLS-1$
|
||||||
types.clear();
|
types.clear();
|
||||||
|
|
||||||
|
|
||||||
types.put(AmenityType.HISTORIC, null);
|
types.put(AmenityType.HISTORIC, null);
|
||||||
types.put(AmenityType.TOURISM, null);
|
types.put(AmenityType.TOURISM, null);
|
||||||
list = new ArrayList<String>();
|
list = new ArrayList<String>();
|
||||||
list.add("place_of_worship");
|
list.add("place_of_worship"); //$NON-NLS-1$
|
||||||
list.add("internet_access");
|
list.add("internet_access"); //$NON-NLS-1$
|
||||||
list.add("bench");
|
list.add("bench"); //$NON-NLS-1$
|
||||||
list.add("embassy");
|
list.add("embassy"); //$NON-NLS-1$
|
||||||
list.add("emergency_phone");
|
list.add("emergency_phone"); //$NON-NLS-1$
|
||||||
list.add("marketplace");
|
list.add("marketplace"); //$NON-NLS-1$
|
||||||
list.add("post_office");
|
list.add("post_office"); //$NON-NLS-1$
|
||||||
list.add("recycling");
|
list.add("recycling"); //$NON-NLS-1$
|
||||||
list.add("telephone");
|
list.add("telephone"); //$NON-NLS-1$
|
||||||
list.add("toilets");
|
list.add("toilets"); //$NON-NLS-1$
|
||||||
list.add("waste_basket");
|
list.add("waste_basket"); //$NON-NLS-1$
|
||||||
list.add("waste_disposal");
|
list.add("waste_disposal"); //$NON-NLS-1$
|
||||||
types.put(AmenityType.OTHER, list);
|
types.put(AmenityType.OTHER, list);
|
||||||
filters.add(new PoiFilter(Messages.getMessage("poi_filter_for_tourists"), null, types));
|
filters.add(new PoiFilter(Messages.getMessage("poi_filter_for_tourists"), null, types)); //$NON-NLS-1$
|
||||||
types.clear();
|
types.clear();
|
||||||
|
|
||||||
list = new ArrayList<String>();
|
list = new ArrayList<String>();
|
||||||
list.add("fuel");
|
list.add("fuel"); //$NON-NLS-1$
|
||||||
types.put(AmenityType.TRANSPORTATION, list);
|
types.put(AmenityType.TRANSPORTATION, list);
|
||||||
filters.add(new PoiFilter(Messages.getMessage("poi_filter_fuel"), null, types));
|
filters.add(new PoiFilter(Messages.getMessage("poi_filter_fuel"), null, types)); //$NON-NLS-1$
|
||||||
types.clear();
|
types.clear();
|
||||||
|
|
||||||
list = new ArrayList<String>();
|
list = new ArrayList<String>();
|
||||||
list.add("alcohol");
|
list.add("alcohol"); //$NON-NLS-1$
|
||||||
list.add("bakery");
|
list.add("bakery"); //$NON-NLS-1$
|
||||||
list.add("beverages");
|
list.add("beverages"); //$NON-NLS-1$
|
||||||
list.add("butcher");
|
list.add("butcher"); //$NON-NLS-1$
|
||||||
list.add("convenience");
|
list.add("convenience"); //$NON-NLS-1$
|
||||||
list.add("department_store");
|
list.add("department_store"); //$NON-NLS-1$
|
||||||
list.add("convenience");
|
list.add("convenience"); //$NON-NLS-1$
|
||||||
list.add("farm");
|
list.add("farm"); //$NON-NLS-1$
|
||||||
list.add("general");
|
list.add("general"); //$NON-NLS-1$
|
||||||
list.add("ice_cream");
|
list.add("ice_cream"); //$NON-NLS-1$
|
||||||
list.add("kiosk");
|
list.add("kiosk"); //$NON-NLS-1$
|
||||||
list.add("supermarket");
|
list.add("supermarket"); //$NON-NLS-1$
|
||||||
list.add("variety_store");
|
list.add("variety_store"); //$NON-NLS-1$
|
||||||
types.put(AmenityType.SHOP, list);
|
types.put(AmenityType.SHOP, list);
|
||||||
filters.add(new PoiFilter(Messages.getMessage("poi_filter_food_shop"), null, types));
|
filters.add(new PoiFilter(Messages.getMessage("poi_filter_food_shop"), null, types)); //$NON-NLS-1$
|
||||||
types.clear();
|
types.clear();
|
||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
|
@ -106,7 +106,7 @@ public class PoiFiltersHelper {
|
||||||
////ctx.deleteDatabase(PoiFilterDbHelper.DATABASE_NAME);
|
////ctx.deleteDatabase(PoiFilterDbHelper.DATABASE_NAME);
|
||||||
|
|
||||||
cacheUserDefinedFilters = new ArrayList<PoiFilter>();
|
cacheUserDefinedFilters = new ArrayList<PoiFilter>();
|
||||||
PoiFilter filter = new PoiFilter(Messages.getMessage("poi_filter_custom_filter"), PoiFilter.CUSTOM_FILTER_ID, null);
|
PoiFilter filter = new PoiFilter(Messages.getMessage("poi_filter_custom_filter"), PoiFilter.CUSTOM_FILTER_ID, null); //$NON-NLS-1$
|
||||||
cacheUserDefinedFilters.add(filter);
|
cacheUserDefinedFilters.add(filter);
|
||||||
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
||||||
cacheUserDefinedFilters.addAll(helper.getFilters());
|
cacheUserDefinedFilters.addAll(helper.getFilters());
|
||||||
|
@ -157,22 +157,22 @@ public class PoiFiltersHelper {
|
||||||
|
|
||||||
protected static class PoiFilterDbHelper extends SQLiteOpenHelper {
|
protected static class PoiFilterDbHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public static final String DATABASE_NAME = "poi_filters";
|
public static final String DATABASE_NAME = "poi_filters"; //$NON-NLS-1$
|
||||||
private static final int DATABASE_VERSION = 1;
|
private static final int DATABASE_VERSION = 1;
|
||||||
private static final String FILTER_NAME = "poi_filters";
|
private static final String FILTER_NAME = "poi_filters"; //$NON-NLS-1$
|
||||||
private static final String FILTER_COL_NAME = "name";
|
private static final String FILTER_COL_NAME = "name"; //$NON-NLS-1$
|
||||||
private static final String FILTER_COL_ID = "id";
|
private static final String FILTER_COL_ID = "id"; //$NON-NLS-1$
|
||||||
private static final String FILTER_COL_FILTERBYNAME = "filterbyname";
|
private static final String FILTER_COL_FILTERBYNAME = "filterbyname"; //$NON-NLS-1$
|
||||||
private static final String FILTER_TABLE_CREATE = "CREATE TABLE " + FILTER_NAME + " (" +
|
private static final String FILTER_TABLE_CREATE = "CREATE TABLE " + FILTER_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
FILTER_COL_NAME + ", " + FILTER_COL_ID + ", " + FILTER_COL_FILTERBYNAME + ");";
|
FILTER_COL_NAME + ", " + FILTER_COL_ID + ", " + FILTER_COL_FILTERBYNAME + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
|
||||||
|
|
||||||
private static final String CATEGORIES_NAME = "categories";
|
private static final String CATEGORIES_NAME = "categories"; //$NON-NLS-1$
|
||||||
private static final String CATEGORIES_FILTER_ID = "filter_id";
|
private static final String CATEGORIES_FILTER_ID = "filter_id"; //$NON-NLS-1$
|
||||||
private static final String CATEGORIES_COL_CATEGORY = "category";
|
private static final String CATEGORIES_COL_CATEGORY = "category"; //$NON-NLS-1$
|
||||||
private static final String CATEGORIES_COL_SUBCATEGORY = "subcategory";
|
private static final String CATEGORIES_COL_SUBCATEGORY = "subcategory"; //$NON-NLS-1$
|
||||||
private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE " + CATEGORIES_NAME + " (" +
|
private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE " + CATEGORIES_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
CATEGORIES_FILTER_ID + ", " + CATEGORIES_COL_CATEGORY + ", " + CATEGORIES_COL_SUBCATEGORY + ");";
|
CATEGORIES_FILTER_ID + ", " + CATEGORIES_COL_CATEGORY + ", " + CATEGORIES_COL_SUBCATEGORY + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
|
||||||
PoiFilterDbHelper(Context context) {
|
PoiFilterDbHelper(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
@ -195,16 +195,16 @@ public class PoiFiltersHelper {
|
||||||
public boolean addFilter(PoiFilter p, SQLiteDatabase db, boolean addOnlyCategories){
|
public boolean addFilter(PoiFilter p, SQLiteDatabase db, boolean addOnlyCategories){
|
||||||
if(db != null){
|
if(db != null){
|
||||||
if(!addOnlyCategories){
|
if(!addOnlyCategories){
|
||||||
db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()});
|
db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
Map<AmenityType, List<String>> types = p.getAcceptedTypes();
|
Map<AmenityType, List<String>> types = p.getAcceptedTypes();
|
||||||
for(AmenityType a : types.keySet()){
|
for(AmenityType a : types.keySet()){
|
||||||
if(types.get(a) == null){
|
if(types.get(a) == null){
|
||||||
db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)",
|
db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Object[]{p.getFilterId(), AmenityType.valueToString(a), null});
|
new Object[]{p.getFilterId(), AmenityType.valueToString(a), null});
|
||||||
} else {
|
} else {
|
||||||
for(String s : types.get(a)){
|
for(String s : types.get(a)){
|
||||||
db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)",
|
db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
new Object[]{p.getFilterId(), AmenityType.valueToString(a), s});
|
new Object[]{p.getFilterId(), AmenityType.valueToString(a), s});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ public class PoiFiltersHelper {
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
ArrayList<PoiFilter> list = new ArrayList<PoiFilter>();
|
ArrayList<PoiFilter> list = new ArrayList<PoiFilter>();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
Cursor query = db.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " +
|
Cursor query = db.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
CATEGORIES_NAME, null);
|
CATEGORIES_NAME, null);
|
||||||
Map<String, Map<AmenityType, List<String>>> map = new LinkedHashMap<String, Map<AmenityType,List<String>>>();
|
Map<String, Map<AmenityType, List<String>>> map = new LinkedHashMap<String, Map<AmenityType,List<String>>>();
|
||||||
if(query.moveToFirst()){
|
if(query.moveToFirst()){
|
||||||
|
@ -242,7 +242,7 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
|
|
||||||
query = db.rawQuery("SELECT " + FILTER_COL_ID +", " + FILTER_COL_NAME +"," + FILTER_COL_FILTERBYNAME +" FROM " +
|
query = db.rawQuery("SELECT " + FILTER_COL_ID +", " + FILTER_COL_NAME +"," + FILTER_COL_FILTERBYNAME +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
FILTER_NAME, null);
|
FILTER_NAME, null);
|
||||||
if(query.moveToFirst()){
|
if(query.moveToFirst()){
|
||||||
do {
|
do {
|
||||||
|
@ -262,11 +262,11 @@ public class PoiFiltersHelper {
|
||||||
public boolean editFilter(PoiFilter filter) {
|
public boolean editFilter(PoiFilter filter) {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?",
|
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
new Object[] { filter.getFilterId() });
|
new Object[] { filter.getFilterId() });
|
||||||
addFilter(filter, db, true);
|
addFilter(filter, db, true);
|
||||||
db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE "
|
db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||||
+ FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() });
|
+ FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); //$NON-NLS-1$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -275,8 +275,8 @@ public class PoiFiltersHelper {
|
||||||
public boolean deleteFilter(PoiFilter p){
|
public boolean deleteFilter(PoiFilter p){
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()});
|
db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()});
|
db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class ProgressDialogImplementation implements IProgress {
|
||||||
private int progress;
|
private int progress;
|
||||||
private int work;
|
private int work;
|
||||||
private int deltaWork;
|
private int deltaWork;
|
||||||
private String message = "";
|
private String message = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private Handler mViewUpdateHandler;
|
private Handler mViewUpdateHandler;
|
||||||
private Thread run;
|
private Thread run;
|
||||||
|
@ -47,7 +47,7 @@ public class ProgressDialogImplementation implements IProgress {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMessage() {
|
private void updateMessage() {
|
||||||
message = taskName + String.format(" %.1f %%", this.progress * 100f / ((float) this.work));
|
message = taskName + String.format(" %.1f %%", this.progress * 100f / ((float) this.work)); //$NON-NLS-1$
|
||||||
mViewUpdateHandler.sendEmptyMessage(0);
|
mViewUpdateHandler.sendEmptyMessage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class ProgressDialogImplementation implements IProgress {
|
||||||
@Override
|
@Override
|
||||||
public void startTask(String taskName, int work) {
|
public void startTask(String taskName, int work) {
|
||||||
if(taskName == null){
|
if(taskName == null){
|
||||||
taskName = "";
|
taskName = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
message = taskName;
|
message = taskName;
|
||||||
mViewUpdateHandler.sendEmptyMessage(0);
|
mViewUpdateHandler.sendEmptyMessage(0);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.osmand;
|
package com.osmand;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -10,6 +11,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -39,6 +41,7 @@ public class RegionAddressRepository {
|
||||||
private LinkedHashMap<Long, City> cities = new LinkedHashMap<Long, City>();
|
private LinkedHashMap<Long, City> cities = new LinkedHashMap<Long, City>();
|
||||||
|
|
||||||
private Map<CityType, List<City>> cityTypes = new HashMap<CityType, List<City>>();
|
private Map<CityType, List<City>> cityTypes = new HashMap<CityType, List<City>>();
|
||||||
|
private SortedSet<String> postCodes = new TreeSet<String>(Collator.getInstance());
|
||||||
|
|
||||||
private boolean useEnglishNames = false;
|
private boolean useEnglishNames = false;
|
||||||
|
|
||||||
|
@ -57,7 +60,7 @@ public class RegionAddressRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Initializing address db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms");
|
log.debug("Initializing address db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +79,7 @@ public class RegionAddressRepository {
|
||||||
public void clearCities(){
|
public void clearCities(){
|
||||||
cities.clear();
|
cities.clear();
|
||||||
cityTypes.clear();
|
cityTypes.clear();
|
||||||
|
postCodes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean areCitiesPreloaded(){
|
public boolean areCitiesPreloaded(){
|
||||||
|
@ -95,12 +99,12 @@ public class RegionAddressRepository {
|
||||||
if(city.isEmptyWithStreets()){
|
if(city.isEmptyWithStreets()){
|
||||||
preloadStreets(city);
|
preloadStreets(city);
|
||||||
}
|
}
|
||||||
if (city.getPostcodes().isEmpty()) {
|
if (postCodes.isEmpty()) {
|
||||||
preloadPostcodes(city);
|
preloadPostcodes();
|
||||||
}
|
}
|
||||||
Street street = city.getStreet(name);
|
Street street = city.getStreet(name);
|
||||||
if (street == null) {
|
if (street == null) {
|
||||||
street = city.getPostcodes().contains(name.toUpperCase()) ? new PostcodeBasedStreet(city, name) : null;
|
street = postCodes.contains(name.toUpperCase()) ? new PostcodeBasedStreet(city, name) : null;
|
||||||
}
|
}
|
||||||
return street;
|
return street;
|
||||||
}
|
}
|
||||||
|
@ -167,9 +171,9 @@ public class RegionAddressRepository {
|
||||||
public void fillWithSuggestedStreetsIntersectStreets(City city, Street st, List<Street> streetsToFill) {
|
public void fillWithSuggestedStreetsIntersectStreets(City city, Street st, List<Street> streetsToFill) {
|
||||||
if (st != null) {
|
if (st != null) {
|
||||||
Set<Long> strIds = new TreeSet<Long>();
|
Set<Long> strIds = new TreeSet<Long>();
|
||||||
log.debug("Start loading instersection streets for " + city.getName());
|
log.debug("Start loading instersection streets for " + city.getName()); //$NON-NLS-1$
|
||||||
Cursor query = db.rawQuery("SELECT B.STREET FROM street_node A JOIN street_node B ON A.ID = B.ID WHERE A.STREET = ?",
|
Cursor query = db.rawQuery("SELECT B.STREET FROM street_node A JOIN street_node B ON A.ID = B.ID WHERE A.STREET = ?", //$NON-NLS-1$
|
||||||
new String[] { st.getId() + "" });
|
new String[] { st.getId() + "" }); //$NON-NLS-1$
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
if (st.getId() != query.getLong(0)) {
|
if (st.getId() != query.getLong(0)) {
|
||||||
|
@ -183,7 +187,7 @@ public class RegionAddressRepository {
|
||||||
streetsToFill.add(s);
|
streetsToFill.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Loaded " + strIds.size() + " streets");
|
log.debug("Loaded " + strIds.size() + " streets"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
preloadWayNodes(st);
|
preloadWayNodes(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +195,7 @@ public class RegionAddressRepository {
|
||||||
|
|
||||||
public void fillWithSuggestedStreets(City c, String name, List<Street> streetsToFill){
|
public void fillWithSuggestedStreets(City c, String name, List<Street> streetsToFill){
|
||||||
preloadStreets(c);
|
preloadStreets(c);
|
||||||
preloadPostcodes(c);
|
preloadPostcodes();
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
|
|
||||||
int ind = 0;
|
int ind = 0;
|
||||||
|
@ -202,7 +206,7 @@ public class RegionAddressRepository {
|
||||||
Character.isDigit(name.charAt(0)) &&
|
Character.isDigit(name.charAt(0)) &&
|
||||||
Character.isDigit(name.charAt(1))) {
|
Character.isDigit(name.charAt(1))) {
|
||||||
// also try to identify postcodes
|
// also try to identify postcodes
|
||||||
for (String code : c.getPostcodes()) {
|
for (String code : postCodes) {
|
||||||
code = code.toLowerCase();
|
code = code.toLowerCase();
|
||||||
if (code.startsWith(name)) {
|
if (code.startsWith(name)) {
|
||||||
streetsToFill.add(ind++,new PostcodeBasedStreet(c, code));
|
streetsToFill.add(ind++,new PostcodeBasedStreet(c, code));
|
||||||
|
@ -226,17 +230,40 @@ public class RegionAddressRepository {
|
||||||
|
|
||||||
public void fillWithSuggestedCities(String name, List<City> citiesToFill){
|
public void fillWithSuggestedCities(String name, List<City> citiesToFill){
|
||||||
preloadCities();
|
preloadCities();
|
||||||
|
// essentially index is created that cities towns are first in cities map
|
||||||
|
int ind = 0;
|
||||||
|
if (name.length() >= 2 &&
|
||||||
|
Character.isDigit(name.charAt(0)) &&
|
||||||
|
Character.isDigit(name.charAt(1))) {
|
||||||
|
preloadPostcodes();
|
||||||
|
name = name.toLowerCase();
|
||||||
|
// also try to identify postcodes
|
||||||
|
for (String code : postCodes) {
|
||||||
|
String lcode = code.toLowerCase();
|
||||||
|
// TODO postcode
|
||||||
|
City c = new City(CityType.CITY);
|
||||||
|
c.setName(code);
|
||||||
|
c.setEnName(code);
|
||||||
|
if (lcode.startsWith(name)) {
|
||||||
|
citiesToFill.add(ind++,c);
|
||||||
|
} else if(lcode.contains(name)){
|
||||||
|
citiesToFill.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if(name.length() < 3){
|
if(name.length() < 3){
|
||||||
EnumSet<CityType> set = EnumSet.of(CityType.CITY, CityType.TOWN);
|
EnumSet<CityType> set = EnumSet.of(CityType.CITY, CityType.TOWN);
|
||||||
for(CityType t : set){
|
for(CityType t : set){
|
||||||
|
List<City> list = cityTypes.get(t);
|
||||||
|
if(list == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(name.length() == 0){
|
if(name.length() == 0){
|
||||||
List<City> list = cityTypes.get(t);
|
citiesToFill.addAll(list);
|
||||||
if (list != null) {
|
|
||||||
citiesToFill.addAll(list);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
for (City c : cityTypes.get(t)) {
|
for (City c : list) {
|
||||||
String cName = useEnglishNames ? c.getEnName() : c.getName();
|
String cName = useEnglishNames ? c.getEnName() : c.getName();
|
||||||
String lowerCase = cName.toLowerCase();
|
String lowerCase = cName.toLowerCase();
|
||||||
if(lowerCase.startsWith(name)){
|
if(lowerCase.startsWith(name)){
|
||||||
|
@ -246,8 +273,6 @@ public class RegionAddressRepository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// essentially index is created that cities towns are first in cities map
|
|
||||||
int ind = 0;
|
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
Collection<City> src = cities.values();
|
Collection<City> src = cities.values();
|
||||||
for (City c : src) {
|
for (City c : src) {
|
||||||
|
@ -261,15 +286,15 @@ public class RegionAddressRepository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int initialsize = citiesToFill.size();
|
int initialsize = citiesToFill.size();
|
||||||
log.debug("Start loading cities for " +getName() + " filter " + name);
|
log.debug("Start loading cities for " +getName() + " filter " + name); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// lower function in SQLite requires ICU extension
|
// lower function in SQLite requires ICU extension
|
||||||
name = Algoritms.capitalizeFirstLetterAndLowercase(name);
|
name = Algoritms.capitalizeFirstLetterAndLowercase(name);
|
||||||
StringBuilder where = new StringBuilder(80);
|
StringBuilder where = new StringBuilder(80);
|
||||||
where.
|
where.
|
||||||
append(IndexCityTable.CITY_TYPE.toString()).append(" not in (").
|
append(IndexCityTable.CITY_TYPE.toString()).append(" not in ("). //$NON-NLS-1$
|
||||||
append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(", ").
|
append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(", "). //$NON-NLS-1$
|
||||||
append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'').append(") and ").
|
append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'').append(") and "). //$NON-NLS-1$
|
||||||
append(useEnglishNames ? IndexCityTable.NAME_EN.toString() : IndexCityTable.NAME.toString()).append(" LIKE '"+name+"%'");
|
append(useEnglishNames ? IndexCityTable.NAME_EN.toString() : IndexCityTable.NAME.toString()).append(" LIKE '"+name+"%'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()),
|
Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()),
|
||||||
where.toString(), null, null, null, null);
|
where.toString(), null, null, null, null);
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
|
@ -280,15 +305,15 @@ public class RegionAddressRepository {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
||||||
|
|
||||||
log.debug("Loaded citites " + (citiesToFill.size() - initialsize));
|
log.debug("Loaded citites " + (citiesToFill.size() - initialsize)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preloadWayNodes(Street street){
|
public void preloadWayNodes(Street street){
|
||||||
if(street.getWayNodes().isEmpty()){
|
if(street.getWayNodes().isEmpty()){
|
||||||
Cursor query = db.query(IndexStreetNodeTable.getTable(), IndexConstants.generateColumnNames(IndexStreetNodeTable.values()), "? = street",
|
Cursor query = db.query(IndexStreetNodeTable.getTable(), IndexConstants.generateColumnNames(IndexStreetNodeTable.values()), "? = street", //$NON-NLS-1$
|
||||||
new String[] { street.getId() + "" }, null, null, null);
|
new String[] { street.getId() + "" }, null, null, null); //$NON-NLS-1$
|
||||||
log.debug("Start loading waynodes for " + street.getName());
|
log.debug("Start loading waynodes for " + street.getName()); //$NON-NLS-1$
|
||||||
Map<Long, Way> ways = new LinkedHashMap<Long, Way>();
|
Map<Long, Way> ways = new LinkedHashMap<Long, Way>();
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
@ -306,27 +331,27 @@ public class RegionAddressRepository {
|
||||||
for(Way w : ways.values()){
|
for(Way w : ways.values()){
|
||||||
street.getWayNodes().add(w);
|
street.getWayNodes().add(w);
|
||||||
}
|
}
|
||||||
log.debug("Loaded " + ways.size() + " ways");
|
log.debug("Loaded " + ways.size() + " ways"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preloadPostcodes(City city) {
|
public void preloadPostcodes() {
|
||||||
if (city.getPostcodes().isEmpty()) {
|
if (postCodes.isEmpty()) {
|
||||||
// check if it possible to load postcodes
|
// check if it possible to load postcodes
|
||||||
Cursor query = db.query(true, IndexBuildingTable.getTable(), new String[] { IndexBuildingTable.POSTCODE.toString() }, null,
|
Cursor query = db.query(true, IndexBuildingTable.getTable(), new String[] { IndexBuildingTable.POSTCODE.toString() }, null,
|
||||||
null, null, null, null, null);
|
null, null, null, null, null);
|
||||||
log.debug("Start loading postcodes for " + city.getName());
|
log.debug("Start loading postcodes for "); //$NON-NLS-1$
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
String postcode = query.getString(0);
|
String postcode = query.getString(0);
|
||||||
if (postcode != null) {
|
if (postcode != null) {
|
||||||
city.getPostcodes().add(postcode);
|
postCodes.add(postcode);
|
||||||
}
|
}
|
||||||
} while (query.moveToNext());
|
} while (query.moveToNext());
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
log.debug("Loaded " + city.getPostcodes().size() + " postcodes ");
|
log.debug("Loaded " + postCodes.size() + " postcodes "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,13 +360,13 @@ public class RegionAddressRepository {
|
||||||
Cursor query = null;
|
Cursor query = null;
|
||||||
if (street instanceof PostcodeBasedStreet) {
|
if (street instanceof PostcodeBasedStreet) {
|
||||||
// this is postcode
|
// this is postcode
|
||||||
query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = postcode",
|
query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = postcode", //$NON-NLS-1$
|
||||||
new String[] { street.getName().toUpperCase()}, null, null, null);
|
new String[] { street.getName().toUpperCase()}, null, null, null);
|
||||||
} else {
|
} else {
|
||||||
query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = street",
|
query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = street", //$NON-NLS-1$
|
||||||
new String[] { street.getId() + "" }, null, null, null);
|
new String[] { street.getId() + "" }, null, null, null); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
log.debug("Start loading buildings for " + street.getName());
|
log.debug("Start loading buildings for " + street.getName()); //$NON-NLS-1$
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
Building building = new Building();
|
Building building = new Building();
|
||||||
|
@ -354,15 +379,15 @@ public class RegionAddressRepository {
|
||||||
} while (query.moveToNext());
|
} while (query.moveToNext());
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
log.debug("Loaded " + street.getBuildings().size() + " buildings");
|
log.debug("Loaded " + street.getBuildings().size() + " buildings"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preloadStreets(City city){
|
public void preloadStreets(City city){
|
||||||
if (city.isEmptyWithStreets()) {
|
if (city.isEmptyWithStreets()) {
|
||||||
log.debug("Start loading streets for " + city.getName());
|
log.debug("Start loading streets for " + city.getName()); //$NON-NLS-1$
|
||||||
Cursor query = db.query(IndexStreetTable.getTable(), IndexConstants.generateColumnNames(IndexStreetTable.values()), "? = city",
|
Cursor query = db.query(IndexStreetTable.getTable(), IndexConstants.generateColumnNames(IndexStreetTable.values()), "? = city", //$NON-NLS-1$
|
||||||
new String[] { city.getId() + "" }, null, null, null);
|
new String[] { city.getId() + "" }, null, null, null); //$NON-NLS-1$
|
||||||
if (query.moveToFirst()) {
|
if (query.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
Street street = new Street(city);
|
Street street = new Street(city);
|
||||||
|
@ -375,7 +400,7 @@ public class RegionAddressRepository {
|
||||||
} while (query.moveToNext());
|
} while (query.moveToNext());
|
||||||
}
|
}
|
||||||
query.close();
|
query.close();
|
||||||
log.debug("Loaded " + city.getStreets().size() + " streets");
|
log.debug("Loaded " + city.getStreets().size() + " streets"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,10 +429,10 @@ public class RegionAddressRepository {
|
||||||
|
|
||||||
public void preloadCities(){
|
public void preloadCities(){
|
||||||
if (cities.isEmpty()) {
|
if (cities.isEmpty()) {
|
||||||
log.debug("Start loading cities for " +getName());
|
log.debug("Start loading cities for " +getName()); //$NON-NLS-1$
|
||||||
StringBuilder where = new StringBuilder();
|
StringBuilder where = new StringBuilder();
|
||||||
where.append(IndexCityTable.CITY_TYPE.toString()).append('=').
|
where.append(IndexCityTable.CITY_TYPE.toString()).append('=').
|
||||||
append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(" or ").
|
append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(" or "). //$NON-NLS-1$
|
||||||
append(IndexCityTable.CITY_TYPE.toString()).append('=').
|
append(IndexCityTable.CITY_TYPE.toString()).append('=').
|
||||||
append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'');
|
append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'');
|
||||||
Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()),
|
Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()),
|
||||||
|
@ -426,7 +451,7 @@ public class RegionAddressRepository {
|
||||||
|
|
||||||
} while(query.moveToNext());
|
} while(query.moveToNext());
|
||||||
}
|
}
|
||||||
log.debug("Loaded " + cities.size() + " cities");
|
log.debug("Loaded " + cities.size() + " cities"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
query.close();
|
query.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ import com.osmand.views.POIMapLayer;
|
||||||
*/
|
*/
|
||||||
public class ResourceManager {
|
public class ResourceManager {
|
||||||
|
|
||||||
private static final String POI_PATH = "osmand/" + IndexConstants.POI_INDEX_DIR;
|
private static final String POI_PATH = "osmand/" + IndexConstants.POI_INDEX_DIR; //$NON-NLS-1$
|
||||||
private static final String ADDRESS_PATH = "osmand/" + IndexConstants.ADDRESS_INDEX_DIR;
|
private static final String ADDRESS_PATH = "osmand/" + IndexConstants.ADDRESS_INDEX_DIR; //$NON-NLS-1$
|
||||||
private static final String TILES_PATH = "osmand/tiles/";
|
private static final String TILES_PATH = "osmand/tiles/"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final Log log = LogUtil.getLog(ResourceManager.class);
|
private static final Log log = LogUtil.getLog(ResourceManager.class);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
builder.setLength(0);
|
builder.setLength(0);
|
||||||
builder.append(map.getName()).append('/').append(zoom). append('/').append(x).
|
builder.append(map.getName()).append('/').append(zoom). append('/').append(x).
|
||||||
append('/').append(y).append(map.getTileFormat()).append(".tile");
|
append('/').append(y).append(map.getTileFormat()).append(".tile"); //$NON-NLS-1$
|
||||||
String file = builder.toString();
|
String file = builder.toString();
|
||||||
if(deleteBefore){
|
if(deleteBefore){
|
||||||
cacheOfImages.remove(file);
|
cacheOfImages.remove(file);
|
||||||
|
@ -155,7 +155,7 @@ public class ResourceManager {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
cacheOfImages.put(req.fileToLoad, BitmapFactory.decodeFile(en.getAbsolutePath()));
|
cacheOfImages.put(req.fileToLoad, BitmapFactory.decodeFile(en.getAbsolutePath()));
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms");
|
log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ public class ResourceManager {
|
||||||
|
|
||||||
/// On low memory method ///
|
/// On low memory method ///
|
||||||
public void onLowMemory() {
|
public void onLowMemory() {
|
||||||
log.info("On low memory : cleaning tiles - size = " + cacheOfImages.size());
|
log.info("On low memory : cleaning tiles - size = " + cacheOfImages.size()); //$NON-NLS-1$
|
||||||
clearTiles();
|
clearTiles();
|
||||||
for(AmenityIndexRepository r : amenityRepositories){
|
for(AmenityIndexRepository r : amenityRepositories){
|
||||||
r.clearCache();
|
r.clearCache();
|
||||||
|
@ -362,7 +362,7 @@ public class ResourceManager {
|
||||||
Stack<Object> requests = new Stack<Object>();
|
Stack<Object> requests = new Stack<Object>();
|
||||||
|
|
||||||
public AsyncLoadingThread(){
|
public AsyncLoadingThread(){
|
||||||
super("Loader map objects (tiles, poi)");
|
super("Loader map objects (tiles, poi)"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,11 +64,11 @@ import com.osmand.views.OsmandMapTileView;
|
||||||
public class EditingPOIActivity {
|
public class EditingPOIActivity {
|
||||||
|
|
||||||
// private final static String SITE_API = "http://api06.dev.openstreetmap.org/";
|
// private final static String SITE_API = "http://api06.dev.openstreetmap.org/";
|
||||||
private final static String SITE_API = "http://api.openstreetmap.org/";
|
private final static String SITE_API = "http://api.openstreetmap.org/"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String DELETE_ACTION = "delete"; // NON-NLS
|
private static final String DELETE_ACTION = "delete"; //$NON-NLS-1$
|
||||||
private static final String MODIFY_ACTION = "modify"; // NON-NLS
|
private static final String MODIFY_ACTION = "modify"; //$NON-NLS-1$
|
||||||
private static final String CREATE_ACTION = "create"; // NON-NLS
|
private static final String CREATE_ACTION = "create"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Dialog dlg;
|
private Dialog dlg;
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
|
@ -105,7 +105,7 @@ public class EditingPOIActivity {
|
||||||
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(), "");
|
||||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00");
|
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);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class EditingPOIActivity {
|
||||||
AmenityType aType = AmenityType.values()[which];
|
AmenityType aType = AmenityType.values()[which];
|
||||||
if(aType != a.getType()){
|
if(aType != a.getType()){
|
||||||
a.setType(aType);
|
a.setType(aType);
|
||||||
a.setSubType("");
|
a.setSubType(""); //$NON-NLS-1$
|
||||||
updateType(a);
|
updateType(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,24 +230,24 @@ public class EditingPOIActivity {
|
||||||
DefaultHttpClient httpclient = new DefaultHttpClient(params);
|
DefaultHttpClient httpclient = new DefaultHttpClient(params);
|
||||||
|
|
||||||
if (doAuthenticate) {
|
if (doAuthenticate) {
|
||||||
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(ctx) + ":"
|
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(ctx) + ":" //$NON-NLS-1$
|
||||||
+ OsmandSettings.getUserPassword(ctx));
|
+ OsmandSettings.getUserPassword(ctx));
|
||||||
httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), credentials);
|
httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), credentials);
|
||||||
}
|
}
|
||||||
HttpRequestBase method = null;
|
HttpRequestBase method = null;
|
||||||
if (requestMethod.equals("GET")) {
|
if (requestMethod.equals("GET")) { //$NON-NLS-1$
|
||||||
method = new HttpGet(url);
|
method = new HttpGet(url);
|
||||||
} else if (requestMethod.equals("POST")) {
|
} else if (requestMethod.equals("POST")) { //$NON-NLS-1$
|
||||||
method = new HttpPost(url);
|
method = new HttpPost(url);
|
||||||
} else if (requestMethod.equals("PUT")) {
|
} else if (requestMethod.equals("PUT")) { //$NON-NLS-1$
|
||||||
method = new HttpPut(url);
|
method = new HttpPut(url);
|
||||||
} else if (requestMethod.equals("DELETE")) {
|
} else if (requestMethod.equals("DELETE")) { //$NON-NLS-1$
|
||||||
method = new HttpDelete(url);
|
method = new HttpDelete(url);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(requestMethod + " is invalid method");
|
throw new IllegalArgumentException(requestMethod + " is invalid method"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) {
|
if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// TODO
|
// TODO
|
||||||
// connection.setDoOutput(true);
|
// connection.setDoOutput(true);
|
||||||
// connection.setRequestProperty("Content-type", "text/xml");
|
// connection.setRequestProperty("Content-type", "text/xml");
|
||||||
|
@ -266,9 +266,9 @@ public class EditingPOIActivity {
|
||||||
|
|
||||||
String msg;
|
String msg;
|
||||||
if(response.getStatusLine() != null){
|
if(response.getStatusLine() != null){
|
||||||
msg = userOperation + " failed" ;
|
msg = userOperation + " failed" ; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
msg = userOperation + " failed " + response.getStatusLine().getStatusCode() +" : "+
|
msg = userOperation + " failed " + response.getStatusLine().getStatusCode() +" : "+ //$NON-NLS-1$//$NON-NLS-2$
|
||||||
response.getStatusLine().getReasonPhrase();
|
response.getStatusLine().getReasonPhrase();
|
||||||
}
|
}
|
||||||
log.error(msg);
|
log.error(msg);
|
||||||
|
@ -276,11 +276,11 @@ public class EditingPOIActivity {
|
||||||
} else {
|
} else {
|
||||||
InputStream is = response.getEntity().getContent();
|
InputStream is = response.getEntity().getContent();
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8")); //$NON-NLS-1$
|
||||||
String s;
|
String s;
|
||||||
while ((s = in.readLine()) != null) {
|
while ((s = in.readLine()) != null) {
|
||||||
responseBody.append(s);
|
responseBody.append(s);
|
||||||
responseBody.append("\n");
|
responseBody.append("\n"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
@ -288,17 +288,17 @@ public class EditingPOIActivity {
|
||||||
return responseBody.toString();
|
return responseBody.toString();
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
log.error(userOperation + " failed", e);
|
log.error(userOperation + " failed", e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(userOperation + " failed", e);
|
log.error(userOperation + " failed", e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_io_error_template), userOperation), Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
private String sendRequest(String url, String requestMethod, String requestBody, String userOperation, boolean doAuthenticate) {
|
private String sendRequest(String url, String requestMethod, String requestBody, String userOperation, boolean doAuthenticate) {
|
||||||
log.info("Sending request " + url);
|
log.info("Sending request " + url); //$NON-NLS-1$
|
||||||
// if(true){
|
// if(true){
|
||||||
// return sendRequsetThroughHttpClient(url, requestMethod, requestBody, userOperation, doAuthenticate);
|
// return sendRequsetThroughHttpClient(url, requestMethod, requestBody, userOperation, doAuthenticate);
|
||||||
// }
|
// }
|
||||||
|
@ -310,16 +310,16 @@ public class EditingPOIActivity {
|
||||||
connection.setRequestMethod(requestMethod);
|
connection.setRequestMethod(requestMethod);
|
||||||
StringBuilder responseBody = new StringBuilder();
|
StringBuilder responseBody = new StringBuilder();
|
||||||
if (doAuthenticate) {
|
if (doAuthenticate) {
|
||||||
String token = OsmandSettings.getUserName(ctx) + ":" + OsmandSettings.getUserPassword(ctx);
|
String token = OsmandSettings.getUserName(ctx) + ":" + OsmandSettings.getUserPassword(ctx); //$NON-NLS-1$
|
||||||
connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8")));
|
connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
connection.setDoInput(true);
|
connection.setDoInput(true);
|
||||||
if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) {
|
if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
connection.setRequestProperty("Content-type", "text/xml");
|
connection.setRequestProperty("Content-type", "text/xml"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
OutputStream out = connection.getOutputStream();
|
OutputStream out = connection.getOutputStream();
|
||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 1024);
|
BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 1024); //$NON-NLS-1$
|
||||||
bwr.write(requestBody);
|
bwr.write(requestBody);
|
||||||
bwr.flush();
|
bwr.flush();
|
||||||
}
|
}
|
||||||
|
@ -331,12 +331,12 @@ public class EditingPOIActivity {
|
||||||
log.error(msg);
|
log.error(msg);
|
||||||
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
log.info("Response : " + connection.getResponseMessage());
|
log.info("Response : " + connection.getResponseMessage()); //$NON-NLS-1$
|
||||||
// populate return fields.
|
// populate return fields.
|
||||||
responseBody.setLength(0);
|
responseBody.setLength(0);
|
||||||
InputStream i = connection.getInputStream();
|
InputStream i = connection.getInputStream();
|
||||||
if (i != null) {
|
if (i != null) {
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(i, "UTF-8"), 256);
|
BufferedReader in = new BufferedReader(new InputStreamReader(i, "UTF-8"), 256); //$NON-NLS-1$
|
||||||
String s;
|
String s;
|
||||||
boolean f = true;
|
boolean f = true;
|
||||||
while ((s = in.readLine()) != null) {
|
while ((s = in.readLine()) != null) {
|
||||||
|
@ -372,27 +372,27 @@ public class EditingPOIActivity {
|
||||||
XmlSerializer ser = Xml.newSerializer();
|
XmlSerializer ser = Xml.newSerializer();
|
||||||
try {
|
try {
|
||||||
ser.setOutput(writer);
|
ser.setOutput(writer);
|
||||||
ser.startDocument("UTF-8", true);
|
ser.startDocument("UTF-8", true); //$NON-NLS-1$
|
||||||
ser.startTag(null, "osm");
|
ser.startTag(null, "osm"); //$NON-NLS-1$
|
||||||
ser.startTag(null, "changeset");
|
ser.startTag(null, "changeset"); //$NON-NLS-1$
|
||||||
|
|
||||||
ser.startTag(null, "tag");
|
ser.startTag(null, "tag"); //$NON-NLS-1$
|
||||||
ser.attribute(null, "k", "comment");
|
ser.attribute(null, "k", "comment"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "v", comment);
|
ser.attribute(null, "v", comment); //$NON-NLS-1$
|
||||||
ser.endTag(null, "tag");
|
ser.endTag(null, "tag"); //$NON-NLS-1$
|
||||||
|
|
||||||
ser.startTag(null, "tag");
|
ser.startTag(null, "tag"); //$NON-NLS-1$
|
||||||
ser.attribute(null, "k", "created_by");
|
ser.attribute(null, "k", "created_by"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "v", Version.APP_NAME_VERSION);
|
ser.attribute(null, "v", Version.APP_NAME_VERSION); //$NON-NLS-1$
|
||||||
ser.endTag(null, "tag");
|
ser.endTag(null, "tag"); //$NON-NLS-1$
|
||||||
ser.endTag(null, "changeset");
|
ser.endTag(null, "changeset"); //$NON-NLS-1$
|
||||||
ser.endTag(null, "osm");
|
ser.endTag(null, "osm"); //$NON-NLS-1$
|
||||||
ser.endDocument();
|
ser.endDocument();
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String response = sendRequest(SITE_API + "api/0.6/changeset/create/", "PUT", writer.getBuffer().toString(), "Opening changeset", true);
|
String response = sendRequest(SITE_API + "api/0.6/changeset/create/", "PUT", writer.getBuffer().toString(), "Opening changeset", true); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (response != null && response.length() > 0) {
|
if (response != null && response.length() > 0) {
|
||||||
id = Long.parseLong(response);
|
id = Long.parseLong(response);
|
||||||
}
|
}
|
||||||
|
@ -401,32 +401,32 @@ public class EditingPOIActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeChangeSet(long id){
|
public void closeChangeSet(long id){
|
||||||
String response = sendRequest(SITE_API+"api/0.6/changeset/"+id+"/close", "PUT", "", "Closing changeset", true);
|
String response = sendRequest(SITE_API+"api/0.6/changeset/"+id+"/close", "PUT", "", "Closing changeset", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
log.info("Response : " + response);
|
log.info("Response : " + response); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeNode(Node n, EntityInfo i, XmlSerializer ser, long changeSetId, String user) throws IllegalArgumentException, IllegalStateException, IOException{
|
private void writeNode(Node n, EntityInfo i, XmlSerializer ser, long changeSetId, String user) throws IllegalArgumentException, IllegalStateException, IOException{
|
||||||
ser.startTag(null, "node");
|
ser.startTag(null, "node"); //$NON-NLS-1$
|
||||||
ser.attribute(null, "id", n.getId()+"");
|
ser.attribute(null, "id", n.getId()+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "lat", n.getLatitude()+"");
|
ser.attribute(null, "lat", n.getLatitude()+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "lon", n.getLongitude()+"");
|
ser.attribute(null, "lon", n.getLongitude()+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (i != null) {
|
if (i != null) {
|
||||||
// ser.attribute(null, "timestamp", i.getETimestamp());
|
// ser.attribute(null, "timestamp", i.getETimestamp());
|
||||||
// ser.attribute(null, "uid", i.getUid());
|
// ser.attribute(null, "uid", i.getUid());
|
||||||
// ser.attribute(null, "user", i.getUser());
|
// ser.attribute(null, "user", i.getUser());
|
||||||
ser.attribute(null, "visible", i.getVisible());
|
ser.attribute(null, "visible", i.getVisible()); //$NON-NLS-1$
|
||||||
ser.attribute(null, "version", i.getVersion());
|
ser.attribute(null, "version", i.getVersion()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
ser.attribute(null, "changeset", changeSetId+"");
|
ser.attribute(null, "changeset", changeSetId+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
for(String k : n.getTagKeySet()){
|
for(String k : n.getTagKeySet()){
|
||||||
String val = n.getTag(k);
|
String val = n.getTag(k);
|
||||||
ser.startTag(null, "tag");
|
ser.startTag(null, "tag"); //$NON-NLS-1$
|
||||||
ser.attribute(null, "k", k);
|
ser.attribute(null, "k", k); //$NON-NLS-1$
|
||||||
ser.attribute(null, "v", val);
|
ser.attribute(null, "v", val); //$NON-NLS-1$
|
||||||
ser.endTag(null, "tag");
|
ser.endTag(null, "tag"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
ser.endTag(null, "node");
|
ser.endTag(null, "node"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNodeInIndexes(String action, Node n){
|
private void updateNodeInIndexes(String action, Node n){
|
||||||
|
@ -466,30 +466,30 @@ public class EditingPOIActivity {
|
||||||
XmlSerializer ser = Xml.newSerializer();
|
XmlSerializer ser = Xml.newSerializer();
|
||||||
try {
|
try {
|
||||||
ser.setOutput(writer);
|
ser.setOutput(writer);
|
||||||
ser.startDocument("UTF-8", true);
|
ser.startDocument("UTF-8", true); //$NON-NLS-1$
|
||||||
ser.startTag(null, "osmChange");
|
ser.startTag(null, "osmChange"); //$NON-NLS-1$
|
||||||
ser.attribute(null, "version", "0.6");
|
ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "generator", Version.APP_NAME);
|
ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$
|
||||||
ser.startTag(null, action);
|
ser.startTag(null, action);
|
||||||
ser.attribute(null, "version", "0.6");
|
ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "generator", Version.APP_NAME);
|
ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$
|
||||||
writeNode(n, info, ser, changeSetId, OsmandSettings.getUserName(ctx));
|
writeNode(n, info, ser, changeSetId, OsmandSettings.getUserName(ctx));
|
||||||
ser.endTag(null, action);
|
ser.endTag(null, action);
|
||||||
ser.endTag(null, "osmChange");
|
ser.endTag(null, "osmChange"); //$NON-NLS-1$
|
||||||
ser.endDocument();
|
ser.endDocument();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String res = sendRequest(SITE_API+"api/0.6/changeset/"+changeSetId + "/upload", "POST",
|
String res = sendRequest(SITE_API+"api/0.6/changeset/"+changeSetId + "/upload", "POST", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
writer.getBuffer().toString(), "Commiting node", true);
|
writer.getBuffer().toString(), "Commiting node", true);
|
||||||
log.debug(res+"");
|
log.debug(res+""); //$NON-NLS-1$
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
if (CREATE_ACTION.equals(action)) {
|
if (CREATE_ACTION.equals(action)) {
|
||||||
long newId = n.getId();
|
long newId = n.getId();
|
||||||
int i = res.indexOf("new_id=\"");
|
int i = res.indexOf("new_id=\""); //$NON-NLS-1$
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
i = i + "new_id=\"".length();
|
i = i + "new_id=\"".length(); //$NON-NLS-1$
|
||||||
int end = res.indexOf("\"", i);
|
int end = res.indexOf("\"", i); //$NON-NLS-1$
|
||||||
if (end > 0) {
|
if (end > 0) {
|
||||||
newId = Long.parseLong(res.substring(i, end));
|
newId = Long.parseLong(res.substring(i, end));
|
||||||
Node newN = new Node(n.getLatitude(), n.getLongitude(), newId);
|
Node newN = new Node(n.getLatitude(), n.getLongitude(), newId);
|
||||||
|
@ -511,7 +511,7 @@ public class EditingPOIActivity {
|
||||||
|
|
||||||
public Node loadNode(long id) {
|
public Node loadNode(long id) {
|
||||||
try {
|
try {
|
||||||
String res = sendRequest(SITE_API+"api/0.6/node/"+id, "GET", null, "Loading poi " + id, false);
|
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);
|
||||||
|
@ -523,10 +523,10 @@ public class EditingPOIActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Loading node failed" + id, e);
|
log.error("Loading node failed" + id, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show();
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
log.error("Loading node failed" + id, e);
|
log.error("Loading node failed" + id, e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -140,13 +140,13 @@ public class FavouritesActivity extends ListActivity {
|
||||||
public static class FavouritesDbHelper extends SQLiteOpenHelper {
|
public static class FavouritesDbHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 1;
|
private static final int DATABASE_VERSION = 1;
|
||||||
private static final String FAVOURITE_TABLE_NAME = "favourite";
|
private static final String FAVOURITE_TABLE_NAME = "favourite"; //$NON-NLS-1$
|
||||||
private static final String FAVOURITE_COL_NAME = "name";
|
private static final String FAVOURITE_COL_NAME = "name"; //$NON-NLS-1$
|
||||||
private static final String FAVOURITE_COL_LAT = "latitude";
|
private static final String FAVOURITE_COL_LAT = "latitude"; //$NON-NLS-1$
|
||||||
private static final String FAVOURITE_COL_LON = "longitude";
|
private static final String FAVOURITE_COL_LON = "longitude"; //$NON-NLS-1$
|
||||||
private static final String FAVOURITE_TABLE_CREATE = "CREATE TABLE " + FAVOURITE_TABLE_NAME + " (" +
|
private static final String FAVOURITE_TABLE_CREATE = "CREATE TABLE " + FAVOURITE_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
FAVOURITE_COL_NAME + " TEXT, " + FAVOURITE_COL_LAT + " double, " +
|
FAVOURITE_COL_NAME + " TEXT, " + FAVOURITE_COL_LAT + " double, " + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
FAVOURITE_COL_LON + " double);";
|
FAVOURITE_COL_LON + " double);"; //$NON-NLS-1$
|
||||||
|
|
||||||
FavouritesDbHelper(Context context) {
|
FavouritesDbHelper(Context context) {
|
||||||
super(context, FAVOURITE_TABLE_NAME, null, DATABASE_VERSION);
|
super(context, FAVOURITE_TABLE_NAME, null, DATABASE_VERSION);
|
||||||
|
@ -155,7 +155,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
public boolean addFavourite(FavouritePoint p){
|
public boolean addFavourite(FavouritePoint p){
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
db.execSQL("INSERT INTO " + FAVOURITE_TABLE_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getLatitude(), p.getLongitude()});
|
db.execSQL("INSERT INTO " + FAVOURITE_TABLE_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getLatitude(), p.getLongitude()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -165,7 +165,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
ArrayList<FavouritePoint> list = new ArrayList<FavouritePoint>();
|
ArrayList<FavouritePoint> list = new ArrayList<FavouritePoint>();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
Cursor query = db.rawQuery("SELECT " + FAVOURITE_COL_NAME +", " + FAVOURITE_COL_LAT +"," + FAVOURITE_COL_LON +" FROM " +
|
Cursor query = db.rawQuery("SELECT " + FAVOURITE_COL_NAME +", " + FAVOURITE_COL_LAT +"," + FAVOURITE_COL_LON +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
FAVOURITE_TABLE_NAME, null);
|
FAVOURITE_TABLE_NAME, null);
|
||||||
if(query.moveToFirst()){
|
if(query.moveToFirst()){
|
||||||
do {
|
do {
|
||||||
|
@ -184,7 +184,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
public boolean editFavouriteName(FavouritePoint p, String newName){
|
public boolean editFavouriteName(FavouritePoint p, String newName){
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
db.execSQL("UPDATE " + FAVOURITE_TABLE_NAME + " SET name = ? WHERE name = ?",new Object[]{newName, p.getName()});
|
db.execSQL("UPDATE " + FAVOURITE_TABLE_NAME + " SET name = ? WHERE name = ?",new Object[]{newName, p.getName()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
p.setName(newName);
|
p.setName(newName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
public boolean deleteFavourite(FavouritePoint p){
|
public boolean deleteFavourite(FavouritePoint p){
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if(db != null){
|
if(db != null){
|
||||||
db.execSQL("DELETE FROM " + FAVOURITE_TABLE_NAME + " WHERE name = ?",new Object[]{p.getName()});
|
db.execSQL("DELETE FROM " + FAVOURITE_TABLE_NAME + " WHERE name = ?",new Object[]{p.getName()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -243,7 +243,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Favourite " + getName();
|
return "Favourite " + getName(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,13 +32,14 @@ import com.osmand.LogUtil;
|
||||||
import com.osmand.ProgressDialogImplementation;
|
import com.osmand.ProgressDialogImplementation;
|
||||||
import com.osmand.R;
|
import com.osmand.R;
|
||||||
import com.osmand.ResourceManager;
|
import com.osmand.ResourceManager;
|
||||||
|
import com.osmand.Version;
|
||||||
import com.osmand.activities.search.SearchActivity;
|
import com.osmand.activities.search.SearchActivity;
|
||||||
|
|
||||||
public class MainMenuActivity extends Activity {
|
public class MainMenuActivity extends Activity {
|
||||||
|
|
||||||
private static boolean applicationAlreadyStarted = false;
|
private static boolean applicationAlreadyStarted = false;
|
||||||
private static final String EXCEPTION_PATH = "/osmand/exception.log";
|
private static final String EXCEPTION_PATH = "/osmand/exception.log"; //$NON-NLS-1$
|
||||||
private static final String EXCEPTION_FILE_SIZE = "/osmand/exception.log";
|
private static final String EXCEPTION_FILE_SIZE = "/osmand/exception.log"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Button showMap;
|
private Button showMap;
|
||||||
private Button exitButton;
|
private Button exitButton;
|
||||||
|
@ -55,7 +56,7 @@ public class MainMenuActivity extends Activity {
|
||||||
if(!applicationAlreadyStarted){
|
if(!applicationAlreadyStarted){
|
||||||
final ProgressDialog dlg = ProgressDialog.show(this, "Loading data", "Reading indices...", true);
|
final ProgressDialog dlg = ProgressDialog.show(this, "Loading data", "Reading indices...", true);
|
||||||
final ProgressDialogImplementation impl = new ProgressDialogImplementation(dlg);
|
final ProgressDialogImplementation impl = new ProgressDialogImplementation(dlg);
|
||||||
impl.setRunnable("Initializing app", new Runnable(){
|
impl.setRunnable("Initializing app", new Runnable(){ //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -109,9 +110,9 @@ public class MainMenuActivity extends Activity {
|
||||||
|
|
||||||
Intent notificationIndent = new Intent(MainMenuActivity.this, MapActivity.class);
|
Intent notificationIndent = new Intent(MainMenuActivity.this, MapActivity.class);
|
||||||
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
Notification notification = new Notification(R.drawable.icon, "",
|
Notification notification = new Notification(R.drawable.icon, "", //$NON-NLS-1$
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
notification.setLatestEventInfo(MainMenuActivity.this, "OsmAnd",
|
notification.setLatestEventInfo(MainMenuActivity.this, Version.APP_NAME,
|
||||||
"OsmAnd is running in background", PendingIntent.getActivity(
|
"OsmAnd is running in background", PendingIntent.getActivity(
|
||||||
this.getBaseContext(), 0, notificationIndent,
|
this.getBaseContext(), 0, notificationIndent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT));
|
PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
|
@ -222,8 +223,8 @@ public class MainMenuActivity extends Activity {
|
||||||
PrintStream printStream = new PrintStream(out);
|
PrintStream printStream = new PrintStream(out);
|
||||||
ex.printStackTrace(printStream);
|
ex.printStackTrace(printStream);
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Exception occured in thread " + thread.toString() + " : ").
|
msg.append("Exception occured in thread " + thread.toString() + " : "). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(DateFormat.format("MMMM dd, yyyy h:mm:ss", System.currentTimeMillis())).append("\n").
|
append(DateFormat.format("MMMM dd, yyyy h:mm:ss", System.currentTimeMillis())).append("\n"). //$NON-NLS-1$//$NON-NLS-2$
|
||||||
append(new String(out.toByteArray()));
|
append(new String(out.toByteArray()));
|
||||||
|
|
||||||
if(Environment.getExternalStorageDirectory().canRead()){
|
if(Environment.getExternalStorageDirectory().canRead()){
|
||||||
|
@ -234,7 +235,7 @@ public class MainMenuActivity extends Activity {
|
||||||
defaultHandler.uncaughtException(thread, ex);
|
defaultHandler.uncaughtException(thread, ex);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// swallow all exceptions
|
// swallow all exceptions
|
||||||
Log.e(LogUtil.TAG, "Exception while handle other exception", e);
|
Log.e(LogUtil.TAG, "Exception while handle other exception", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.osmand.activities;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -23,7 +21,6 @@ import android.location.LocationProvider;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.text.format.Formatter;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -248,14 +245,14 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
||||||
// show point view only if gps enabled
|
// show point view only if gps enabled
|
||||||
if(location == null){
|
if(location == null){
|
||||||
if(sensorRegistered) {
|
if(sensorRegistered) {
|
||||||
Log.d(LogUtil.TAG, "Disable sensor");
|
Log.d(LogUtil.TAG, "Disable sensor"); //$NON-NLS-1$
|
||||||
((SensorManager) getSystemService(SENSOR_SERVICE)).unregisterListener(this);
|
((SensorManager) getSystemService(SENSOR_SERVICE)).unregisterListener(this);
|
||||||
sensorRegistered = false;
|
sensorRegistered = false;
|
||||||
locationLayer.setHeading(null);
|
locationLayer.setHeading(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!sensorRegistered && OsmandSettings.isShowingViewAngle(this)){
|
if(!sensorRegistered && OsmandSettings.isShowingViewAngle(this)){
|
||||||
Log.d(LogUtil.TAG, "Enable sensor");
|
Log.d(LogUtil.TAG, "Enable sensor"); //$NON-NLS-1$
|
||||||
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
|
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
|
||||||
Sensor s = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION);
|
Sensor s = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION);
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
|
@ -264,7 +261,6 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
||||||
sensorRegistered = true;
|
sensorRegistered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d(LogUtil.TAG, "Location changed");
|
|
||||||
// TODO delete !!! (only for test purposes) devices support that information (possibly keep for other providers?)
|
// TODO delete !!! (only for test purposes) devices support that information (possibly keep for other providers?)
|
||||||
if(!location.hasSpeed() && locationLayer.getLastKnownLocation() != null){
|
if(!location.hasSpeed() && locationLayer.getLastKnownLocation() != null){
|
||||||
float d = location.distanceTo(locationLayer.getLastKnownLocation());
|
float d = location.distanceTo(locationLayer.getLastKnownLocation());
|
||||||
|
@ -440,7 +436,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
||||||
|
|
||||||
if (wakeLock == null) {
|
if (wakeLock == null) {
|
||||||
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map");
|
wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map"); //$NON-NLS-1$
|
||||||
wakeLock.acquire();
|
wakeLock.acquire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class NavigatePointActivity extends Activity {
|
||||||
((TextView)findViewById(R.id.LongitudeEdit)).setText(convert(lon, newFormat));
|
((TextView)findViewById(R.id.LongitudeEdit)).setText(convert(lon, newFormat));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid");
|
((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid");
|
||||||
Log.w(LogUtil.TAG, "Convertion failed", e);
|
Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class NavigatePointActivity extends Activity {
|
||||||
close();
|
close();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid");
|
((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid");
|
||||||
Log.w(LogUtil.TAG, "Convertion failed", e);
|
Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,10 +145,10 @@ public class NavigatePointActivity extends Activity {
|
||||||
|
|
||||||
public static String convert(double coordinate, int outputType) {
|
public static String convert(double coordinate, int outputType) {
|
||||||
if (coordinate < -180.0 || coordinate > 180.0 || Double.isNaN(coordinate)) {
|
if (coordinate < -180.0 || coordinate > 180.0 || Double.isNaN(coordinate)) {
|
||||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
throw new IllegalArgumentException("coordinate=" + coordinate); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if ((outputType != FORMAT_DEGREES) && (outputType != FORMAT_MINUTES) && (outputType != FORMAT_SECONDS)) {
|
if ((outputType != FORMAT_DEGREES) && (outputType != FORMAT_MINUTES) && (outputType != FORMAT_SECONDS)) {
|
||||||
throw new IllegalArgumentException("outputType=" + outputType);
|
throw new IllegalArgumentException("outputType=" + outputType); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -159,7 +159,7 @@ public class NavigatePointActivity extends Activity {
|
||||||
coordinate = -coordinate;
|
coordinate = -coordinate;
|
||||||
}
|
}
|
||||||
|
|
||||||
DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US));
|
DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US)); //$NON-NLS-1$
|
||||||
if (outputType == FORMAT_MINUTES || outputType == FORMAT_SECONDS) {
|
if (outputType == FORMAT_MINUTES || outputType == FORMAT_SECONDS) {
|
||||||
int degrees = (int) Math.floor(coordinate);
|
int degrees = (int) Math.floor(coordinate);
|
||||||
sb.append(degrees);
|
sb.append(degrees);
|
||||||
|
|
|
@ -124,8 +124,8 @@ public class RoutingHelper {
|
||||||
|
|
||||||
public boolean finishAtLocation(Location currentLocation) {
|
public boolean finishAtLocation(Location currentLocation) {
|
||||||
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
|
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
|
||||||
if(currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < 50){
|
if(currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < 60){
|
||||||
if(lastFixedLocation != null && lastFixedLocation.distanceTo(lastPoint) < 50){
|
if(lastFixedLocation != null && lastFixedLocation.distanceTo(lastPoint) < 60){
|
||||||
// TODO mark as finished
|
// TODO mark as finished
|
||||||
showMessage("You arrived at destination point");
|
showMessage("You arrived at destination point");
|
||||||
currentRoute = routeNodes.size() - 1;
|
currentRoute = routeNodes.size() - 1;
|
||||||
|
|
|
@ -27,17 +27,17 @@ import com.osmand.OsmandSettings;
|
||||||
import com.osmand.Version;
|
import com.osmand.Version;
|
||||||
|
|
||||||
public class SavingTrackHelper extends SQLiteOpenHelper {
|
public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
public final static String TRACKS_PATH = "tracks";
|
public final static String TRACKS_PATH = "tracks"; //$NON-NLS-1$
|
||||||
|
|
||||||
public final static String DATABASE_NAME = "tracks";
|
public final static String DATABASE_NAME = "tracks"; //$NON-NLS-1$
|
||||||
public final static int DATABASE_VERSION = 1;
|
public final static int DATABASE_VERSION = 1;
|
||||||
|
|
||||||
public final static String TRACK_NAME = "track";
|
public final static String TRACK_NAME = "track"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_DATE = "date";
|
public final static String TRACK_COL_DATE = "date"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_LAT = "lat";
|
public final static String TRACK_COL_LAT = "lat"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_LON = "lon";
|
public final static String TRACK_COL_LON = "lon"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_ALTITUDE = "altitude";
|
public final static String TRACK_COL_ALTITUDE = "altitude"; //$NON-NLS-1$
|
||||||
public final static String TRACK_COL_SPEED = "speed";
|
public final static String TRACK_COL_SPEED = "speed"; //$NON-NLS-1$
|
||||||
|
|
||||||
public final static Log log = LogUtil.getLog(SavingTrackHelper.class);
|
public final static Log log = LogUtil.getLog(SavingTrackHelper.class);
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
public SavingTrackHelper(Context ctx){
|
public SavingTrackHelper(Context ctx){
|
||||||
super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
|
super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
updateScript = "INSERT INTO " + TRACK_NAME + " VALUES (?, ?, ?, ?, ?)";
|
updateScript = "INSERT INTO " + TRACK_NAME + " VALUES (?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
db.execSQL("CREATE TABLE " + TRACK_NAME+ " ("+TRACK_COL_LAT +" double, " + TRACK_COL_LON+" double, "
|
db.execSQL("CREATE TABLE " + TRACK_NAME+ " ("+TRACK_COL_LAT +" double, " + TRACK_COL_LON+" double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
+ TRACK_COL_ALTITUDE+" double, " + TRACK_COL_SPEED+" double, "
|
+ TRACK_COL_ALTITUDE+" double, " + TRACK_COL_SPEED+" double, " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
+ TRACK_COL_DATE +" long )" );
|
+ TRACK_COL_DATE +" long )" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,62 +73,62 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
|
||||||
protected void saveToXMLFiles(File dir, Map<String, List<List<TrkPt>>> data ){
|
protected void saveToXMLFiles(File dir, Map<String, List<List<TrkPt>>> data ){
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
for (String f : data.keySet()) {
|
for (String f : data.keySet()) {
|
||||||
File fout = new File(dir, f + ".gpx");
|
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
|
||||||
int ind = 1;
|
int ind = 1;
|
||||||
while(fout.exists()){
|
while(fout.exists()){
|
||||||
fout = new File(dir, f + "_"+(++ind)+".gpx");
|
fout = new File(dir, f + "_"+(++ind)+".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
FileOutputStream output = new FileOutputStream(fout);
|
FileOutputStream output = new FileOutputStream(fout);
|
||||||
XmlSerializer serializer = Xml.newSerializer();
|
XmlSerializer serializer = Xml.newSerializer();
|
||||||
serializer.setOutput(output, "UTF-8");
|
serializer.setOutput(output, "UTF-8"); //$NON-NLS-1$
|
||||||
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
|
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); //$NON-NLS-1$
|
||||||
serializer.startDocument("UTF-8", true);
|
serializer.startDocument("UTF-8", true); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "gpx");
|
serializer.startTag(null, "gpx"); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "version", "1.1");
|
serializer.attribute(null, "version", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.attribute(null, "creator", Version.APP_NAME_VERSION);
|
serializer.attribute(null, "creator", Version.APP_NAME_VERSION); //$NON-NLS-1$
|
||||||
serializer.attribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
serializer.attribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
serializer.attribute("xsi", "schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
|
serializer.attribute("xsi", "schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1");
|
serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
serializer.startTag(null, "trk");
|
serializer.startTag(null, "trk"); //$NON-NLS-1$
|
||||||
for(List<TrkPt> l : data.get(f)){
|
for(List<TrkPt> l : data.get(f)){
|
||||||
serializer.startTag(null, "trkseg");
|
serializer.startTag(null, "trkseg"); //$NON-NLS-1$
|
||||||
for(TrkPt p : l){
|
for(TrkPt p : l){
|
||||||
serializer.startTag(null, "trkpt");
|
serializer.startTag(null, "trkpt"); //$NON-NLS-1$
|
||||||
serializer.attribute(null, "lat", p.lat+"");
|
serializer.attribute(null, "lat", p.lat+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.attribute(null, "lon", p.lon+"");
|
serializer.attribute(null, "lon", p.lon+""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
serializer.startTag(null, "time");
|
serializer.startTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.text(format.format(new Date(p.time)));
|
serializer.text(format.format(new Date(p.time)));
|
||||||
serializer.endTag(null, "time");
|
serializer.endTag(null, "time"); //$NON-NLS-1$
|
||||||
serializer.startTag(null, "ele");
|
serializer.startTag(null, "ele"); //$NON-NLS-1$
|
||||||
serializer.text(p.ele+"");
|
serializer.text(p.ele+""); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "ele");
|
serializer.endTag(null, "ele"); //$NON-NLS-1$
|
||||||
if (p.speed > 0) {
|
if (p.speed > 0) {
|
||||||
serializer.startTag(null, "speed");
|
serializer.startTag(null, "speed"); //$NON-NLS-1$
|
||||||
serializer.text(p.speed + "");
|
serializer.text(p.speed + ""); //$NON-NLS-1$
|
||||||
serializer.endTag(null, "speed");
|
serializer.endTag(null, "speed"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
serializer.endTag(null, "trkpt");
|
serializer.endTag(null, "trkpt"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
serializer.endTag(null, "trkseg");
|
serializer.endTag(null, "trkseg"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
serializer.endTag(null, "trk");
|
serializer.endTag(null, "trk"); //$NON-NLS-1$
|
||||||
|
|
||||||
serializer.endTag(null, "gpx");
|
serializer.endTag(null, "gpx"); //$NON-NLS-1$
|
||||||
serializer.flush();
|
serializer.flush();
|
||||||
serializer.endDocument();
|
serializer.endDocument();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error("Error saving gpx");
|
log.error("Error saving gpx", e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG);
|
Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Error saving gpx");
|
log.error("Error saving gpx", e); //$NON-NLS-1$
|
||||||
Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG);
|
Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,11 +149,11 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
File file = Environment.getExternalStorageDirectory();
|
File file = Environment.getExternalStorageDirectory();
|
||||||
if(db != null && file.canWrite()){
|
if(db != null && file.canWrite()){
|
||||||
file = new File(file, "/osmand/"+TRACKS_PATH);
|
file = new File(file, "/osmand/"+TRACKS_PATH); //$NON-NLS-1$
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
Cursor query = db.rawQuery("SELECT " + TRACK_COL_LAT + "," + TRACK_COL_LON + "," + TRACK_COL_ALTITUDE + ","
|
Cursor query = db.rawQuery("SELECT " + TRACK_COL_LAT + "," + TRACK_COL_LON + "," + TRACK_COL_ALTITUDE + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
+ TRACK_COL_SPEED + "," + TRACK_COL_DATE + " FROM " + TRACK_NAME, null);
|
+ TRACK_COL_SPEED + "," + TRACK_COL_DATE + " FROM " + TRACK_NAME, null); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
long previousTime = 0;
|
long previousTime = 0;
|
||||||
Map<String, List<List<TrkPt>>> data = new LinkedHashMap<String, List<List<TrkPt>>>();
|
Map<String, List<List<TrkPt>>> data = new LinkedHashMap<String, List<List<TrkPt>>>();
|
||||||
List<TrkPt> segment = new ArrayList<TrkPt>();
|
List<TrkPt> segment = new ArrayList<TrkPt>();
|
||||||
|
@ -170,7 +170,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
pt.time = time;
|
pt.time = time;
|
||||||
|
|
||||||
if (previousTime == 0) {
|
if (previousTime == 0) {
|
||||||
data.put(DateFormat.format("yyyy-MM-dd", time).toString(), track);
|
data.put(DateFormat.format("yyyy-MM-dd", time).toString(), track); //$NON-NLS-1$
|
||||||
segment.add(pt);
|
segment.add(pt);
|
||||||
} else if (Math.abs(time - previousTime) < 60000) {
|
} else if (Math.abs(time - previousTime) < 60000) {
|
||||||
// 1 hour - same segment
|
// 1 hour - same segment
|
||||||
|
@ -182,7 +182,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
track.add(segment);
|
track.add(segment);
|
||||||
} else {
|
} else {
|
||||||
// check day (possibly better create new track (not new segment)
|
// check day (possibly better create new track (not new segment)
|
||||||
String date = DateFormat.format("yyyy-MM-dd", time).toString();
|
String date = DateFormat.format("yyyy-MM-dd", time).toString(); //$NON-NLS-1$
|
||||||
if (data.containsKey(date)) {
|
if (data.containsKey(date)) {
|
||||||
track = data.get(date);
|
track = data.get(date);
|
||||||
} else {
|
} else {
|
||||||
|
@ -211,7 +211,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
// cal.set(Calendar.SECOND, 0);
|
// cal.set(Calendar.SECOND, 0);
|
||||||
// cal.set(Calendar.MILLISECOND, 0);
|
// cal.set(Calendar.MILLISECOND, 0);
|
||||||
// remove all from db
|
// remove all from db
|
||||||
db.execSQL("DELETE FROM " + TRACK_NAME+ " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()});
|
db.execSQL("DELETE FROM " + TRACK_NAME+ " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
resources.getString(R.string.interval_30_seconds),
|
resources.getString(R.string.interval_30_seconds),
|
||||||
resources.getString(R.string.interval_1_minute),
|
resources.getString(R.string.interval_1_minute),
|
||||||
resources.getString(R.string.interval_5_minutes)});
|
resources.getString(R.string.interval_5_minutes)});
|
||||||
saveTrackInterval.setEntryValues(new String[]{"1", "2", "5", "15", "30", "60", "300"});
|
saveTrackInterval.setEntryValues(new String[]{"1", "2", "5", "15", "30", "60", "300"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||||
saveTrackInterval.setValue(OsmandSettings.getSavingTrackInterval(this)+"");
|
saveTrackInterval.setValue(OsmandSettings.getSavingTrackInterval(this)+""); //$NON-NLS-1$
|
||||||
|
|
||||||
ApplicationMode[] presets = ApplicationMode.values();
|
ApplicationMode[] presets = ApplicationMode.values();
|
||||||
String[] values = new String[presets.length];
|
String[] values = new String[presets.length];
|
||||||
|
@ -142,7 +142,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
tileSourcePreference.setEntries(entries);
|
tileSourcePreference.setEntries(entries);
|
||||||
tileSourcePreference.setEntryValues(entries);
|
tileSourcePreference.setEntryValues(entries);
|
||||||
tileSourcePreference.setValue(OsmandSettings.getMapTileSourceName(this));
|
tileSourcePreference.setValue(OsmandSettings.getMapTileSourceName(this));
|
||||||
String mapName = " " +OsmandSettings.getMapTileSourceName(this);
|
String mapName = " " +OsmandSettings.getMapTileSourceName(this); //$NON-NLS-1$
|
||||||
String summary = tileSourcePreference.getSummary().toString();
|
String summary = tileSourcePreference.getSummary().toString();
|
||||||
if (summary.lastIndexOf(':') != -1) {
|
if (summary.lastIndexOf(':') != -1) {
|
||||||
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
||||||
|
@ -210,7 +210,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
if (summary.lastIndexOf(':') != -1) {
|
if (summary.lastIndexOf(':') != -1) {
|
||||||
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
||||||
}
|
}
|
||||||
summary += " " + OsmandSettings.getMapTileSourceName(this);
|
summary += " " + OsmandSettings.getMapTileSourceName(this); //$NON-NLS-1$
|
||||||
tileSourcePreference.setSummary(summary);
|
tileSourcePreference.setSummary(summary);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ public class SearchActivity extends TabActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
TabHost host = getTabHost();
|
TabHost host = getTabHost();
|
||||||
host.addTab(host.newTabSpec("Search_POI").setIndicator("POI").setContent(new Intent(this, SearchPoiFilterActivity.class)));
|
host.addTab(host.newTabSpec("Search_POI").setIndicator("POI").setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$
|
||||||
host.addTab(host.newTabSpec("Search_Address").setIndicator(this.getResources().getString(R.string.search_tabs_address)).setContent(new Intent(this, SearchAddressActivity.class)));
|
host.addTab(host.newTabSpec("Search_Address").setIndicator(this.getResources().getString(R.string.search_tabs_address)).setContent(new Intent(this, SearchAddressActivity.class))); //$NON-NLS-1$
|
||||||
host.addTab(host.newTabSpec("Search_Location").setIndicator(this.getResources().getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class)));
|
host.addTab(host.newTabSpec("Search_Location").setIndicator(this.getResources().getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class SearchAddressActivity extends Activity {
|
||||||
OsmandSettings.removeLastSearchedIntersectedStreet(SearchAddressActivity.this);
|
OsmandSettings.removeLastSearchedIntersectedStreet(SearchAddressActivity.this);
|
||||||
startActivity(new Intent(SearchAddressActivity.this, SearchBuildingByNameActivity.class));
|
startActivity(new Intent(SearchAddressActivity.this, SearchBuildingByNameActivity.class));
|
||||||
} else {
|
} else {
|
||||||
OsmandSettings.setLastSearchedIntersectedStreet(SearchAddressActivity.this, "");
|
OsmandSettings.setLastSearchedIntersectedStreet(SearchAddressActivity.this, ""); //$NON-NLS-1$
|
||||||
startActivity(new Intent(SearchAddressActivity.this, SearchStreet2ByNameActivity.class));
|
startActivity(new Intent(SearchAddressActivity.this, SearchStreet2ByNameActivity.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class SearchAddressActivity extends Activity {
|
||||||
|
|
||||||
protected void startLoadDataInThread(String progressMsg){
|
protected void startLoadDataInThread(String progressMsg){
|
||||||
final ProgressDialog dlg = ProgressDialog.show(this, "Loading", progressMsg, true);
|
final ProgressDialog dlg = ProgressDialog.show(this, "Loading", progressMsg, true);
|
||||||
new Thread("Loader search data") {
|
new Thread("Loader search data") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -30,7 +30,7 @@ public abstract class SearchByNameAbstractActivity<T> extends ListActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
setContentView(R.layout.search_by_name);
|
setContentView(R.layout.search_by_name);
|
||||||
NamesAdapter namesAdapter = new NamesAdapter(getObjects(""));
|
NamesAdapter namesAdapter = new NamesAdapter(getObjects("")); //$NON-NLS-1$
|
||||||
setListAdapter(namesAdapter);
|
setListAdapter(namesAdapter);
|
||||||
searchText = (EditText) findViewById(R.id.SearchText);
|
searchText = (EditText) findViewById(R.id.SearchText);
|
||||||
searchText.addTextChangedListener(new TextWatcher(){
|
searchText.addTextChangedListener(new TextWatcher(){
|
||||||
|
@ -51,7 +51,7 @@ public abstract class SearchByNameAbstractActivity<T> extends ListActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
searchText.setText("");
|
searchText.setText(""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -119,7 +119,7 @@ public abstract class SearchByNameAbstractActivity<T> extends ListActivity {
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (handlerToLoop == null) {
|
if (handlerToLoop == null) {
|
||||||
new Thread("Filter data") {
|
new Thread("Filter data") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
|
|
|
@ -37,8 +37,10 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity<City>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTextView(City obj, TextView txt) {
|
public void updateTextView(City obj, TextView txt) {
|
||||||
if(getFilter().length() > 2){
|
LatLon l = obj.getLocation();
|
||||||
txt.setText(obj.getName(region.useEnglishNames()) + " - " + MapUtils.getFormattedDistance((int) MapUtils.getDistance(obj.getLocation(), location)));
|
if (getFilter().length() > 2 && location != null && l != null) {
|
||||||
|
txt.setText(obj.getName(region.useEnglishNames()) + " - " + //$NON-NLS-1$
|
||||||
|
MapUtils.getFormattedDistance((int) MapUtils.getDistance(l, location)));
|
||||||
} else {
|
} else {
|
||||||
txt.setText(obj.getName(region.useEnglishNames()));
|
txt.setText(obj.getName(region.useEnglishNames()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.osmand.osm.MapUtils;
|
||||||
*/
|
*/
|
||||||
public class SearchPOIActivity extends ListActivity {
|
public class SearchPOIActivity extends ListActivity {
|
||||||
|
|
||||||
public static final String AMENITY_FILTER = "com.osmand.amenity_filter";
|
public static final String AMENITY_FILTER = "com.osmand.amenity_filter"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
private Button searchPOILevel;
|
private Button searchPOILevel;
|
||||||
|
@ -145,7 +145,7 @@ public class SearchPOIActivity extends ListActivity {
|
||||||
icon.setImageResource(R.drawable.closed_poi);
|
icon.setImageResource(R.drawable.closed_poi);
|
||||||
}
|
}
|
||||||
|
|
||||||
distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist));
|
distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); //$NON-NLS-1$
|
||||||
return (row);
|
return (row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity<St
|
||||||
|
|
||||||
protected void startLoadDataInThread(String progressMsg){
|
protected void startLoadDataInThread(String progressMsg){
|
||||||
final ProgressDialog dlg = ProgressDialog.show(this, "Loading", progressMsg, true);
|
final ProgressDialog dlg = ProgressDialog.show(this, "Loading", progressMsg, true);
|
||||||
new Thread("Loader search data") {
|
new Thread("Loader search data") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class AnimateDraggingMapThread implements Runnable {
|
||||||
ay = vy * a;
|
ay = vy * a;
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
stopped = false;
|
stopped = false;
|
||||||
Thread thread = new Thread(this,"Animatable dragging");
|
Thread thread = new Thread(this,"Animatable dragging"); //$NON-NLS-1$
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MapInfoLayer implements OsmandMapLayer {
|
||||||
private String cachedSpeedString = null;
|
private String cachedSpeedString = null;
|
||||||
private float cachedSpeed = 0;
|
private float cachedSpeed = 0;
|
||||||
private int cachedZoom = 0;
|
private int cachedZoom = 0;
|
||||||
private String cachedZoomString = "";
|
private String cachedZoomString = ""; //$NON-NLS-1$
|
||||||
private int centerMiniRouteY;
|
private int centerMiniRouteY;
|
||||||
private int centerMiniRouteX;
|
private int centerMiniRouteX;
|
||||||
private float scaleMiniRoute;
|
private float scaleMiniRoute;
|
||||||
|
@ -144,7 +144,7 @@ public class MapInfoLayer implements OsmandMapLayer {
|
||||||
}
|
}
|
||||||
if(view.getZoom() != cachedZoom){
|
if(view.getZoom() != cachedZoom){
|
||||||
cachedZoom = view.getZoom();
|
cachedZoom = view.getZoom();
|
||||||
cachedZoomString = view.getZoom()+"";
|
cachedZoomString = view.getZoom()+""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// draw zoom
|
// draw zoom
|
||||||
canvas.drawRoundRect(boundsForZoom, 3, 3, paintAlphaGray);
|
canvas.drawRoundRect(boundsForZoom, 3, 3, paintAlphaGray);
|
||||||
|
|
|
@ -55,8 +55,8 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
private List<OpenStreetBug> objects = new ArrayList<OpenStreetBug>();
|
private List<OpenStreetBug> objects = new ArrayList<OpenStreetBug>();
|
||||||
private Paint pointClosedUI;
|
private Paint pointClosedUI;
|
||||||
private Paint pointOpenedUI;
|
private Paint pointOpenedUI;
|
||||||
private Pattern patternToParse = Pattern.compile("putAJAXMarker\\((\\d*), ((\\d|\\.)*), ((\\d|\\.)*), '([^']*)', (\\d)\\);");
|
private Pattern patternToParse = Pattern.compile("putAJAXMarker\\((\\d*), ((\\d|\\.)*), ((\\d|\\.)*), '([^']*)', (\\d)\\);"); //$NON-NLS-1$
|
||||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy hh:mm aaa", Locale.US);
|
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy hh:mm aaa", Locale.US); //$NON-NLS-1$
|
||||||
|
|
||||||
private double cTopLatitude;
|
private double cTopLatitude;
|
||||||
private double cBottomLatitude;
|
private double cBottomLatitude;
|
||||||
|
@ -75,7 +75,7 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (handlerToLoop == null) {
|
if (handlerToLoop == null) {
|
||||||
new Thread("Open street bugs layer") {
|
new Thread("Open street bugs layer") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
|
@ -261,47 +261,47 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
|
|
||||||
public boolean createNewBug(double latitude, double longitude, String text, String authorName){
|
public boolean createNewBug(double latitude, double longitude, String text, String authorName){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec?");
|
b.append("http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec?"); //$NON-NLS-1$
|
||||||
b.append("lat=").append(latitude);
|
b.append("lat=").append(latitude); //$NON-NLS-1$
|
||||||
b.append("&lon=").append(longitude);
|
b.append("&lon=").append(longitude); //$NON-NLS-1$
|
||||||
text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]";
|
text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
b.append("&text=").append(URLEncoder.encode(text));
|
b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$
|
||||||
b.append("&name=").append(URLEncoder.encode(authorName));
|
b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$
|
||||||
return editingPOI(b.toString(), "creating bug");
|
return editingPOI(b.toString(), "creating bug"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addingComment(long id, String text, String authorName){
|
public boolean addingComment(long id, String text, String authorName){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec?");
|
b.append("http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec?"); //$NON-NLS-1$
|
||||||
b.append("id=").append(id);
|
b.append("id=").append(id); //$NON-NLS-1$
|
||||||
text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]";
|
text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
b.append("&text=").append(URLEncoder.encode(text));
|
b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$
|
||||||
b.append("&name=").append(URLEncoder.encode(authorName));
|
b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$
|
||||||
return editingPOI(b.toString(), "adding comment");
|
return editingPOI(b.toString(), "adding comment"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean closingBug(long id){
|
public boolean closingBug(long id){
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec?");
|
b.append("http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec?"); //$NON-NLS-1$
|
||||||
b.append("id=").append(id);
|
b.append("id=").append(id); //$NON-NLS-1$
|
||||||
return editingPOI(b.toString(),"closing bug");
|
return editingPOI(b.toString(),"closing bug"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean editingPOI(String urlStr, String debugAction){
|
private boolean editingPOI(String urlStr, String debugAction){
|
||||||
try {
|
try {
|
||||||
log.debug("Action " + debugAction + " " + urlStr);
|
log.debug("Action " + debugAction + " " + urlStr); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
URL url = new URL(urlStr);
|
URL url = new URL(urlStr);
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
while(reader.readLine() != null){
|
while(reader.readLine() != null){
|
||||||
}
|
}
|
||||||
log.debug("Action " + debugAction + " successfull");
|
log.debug("Action " + debugAction + " successfull"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Error " +debugAction, e);
|
log.error("Error " +debugAction, e); //$NON-NLS-1$
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error("Error "+debugAction, e);
|
log.error("Error "+debugAction, e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -309,11 +309,11 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
protected List<OpenStreetBug> loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude,double rightLongitude){
|
protected List<OpenStreetBug> loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude,double rightLongitude){
|
||||||
List<OpenStreetBug> bugs = new ArrayList<OpenStreetBug>();
|
List<OpenStreetBug> bugs = new ArrayList<OpenStreetBug>();
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("http://openstreetbugs.schokokeks.org/api/0.1/getBugs?");
|
b.append("http://openstreetbugs.schokokeks.org/api/0.1/getBugs?"); //$NON-NLS-1$
|
||||||
b.append("b=").append(bottomLatitude);
|
b.append("b=").append(bottomLatitude); //$NON-NLS-1$
|
||||||
b.append("&t=").append(topLatitude);
|
b.append("&t=").append(topLatitude); //$NON-NLS-1$
|
||||||
b.append("&l=").append(leftLongitude);
|
b.append("&l=").append(leftLongitude); //$NON-NLS-1$
|
||||||
b.append("&r=").append(rightLongitude);
|
b.append("&r=").append(rightLongitude); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
URL url = new URL(b.toString());
|
URL url = new URL(b.toString());
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
|
@ -326,17 +326,17 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
bug.setId(Long.parseLong(matcher.group(1)));
|
bug.setId(Long.parseLong(matcher.group(1)));
|
||||||
bug.setLongitude(Double.parseDouble(matcher.group(2)));
|
bug.setLongitude(Double.parseDouble(matcher.group(2)));
|
||||||
bug.setLatitude(Double.parseDouble(matcher.group(4)));
|
bug.setLatitude(Double.parseDouble(matcher.group(4)));
|
||||||
bug.setName(matcher.group(6).replace("<hr />", "\n"));
|
bug.setName(matcher.group(6).replace("<hr />", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
bug.setOpened(matcher.group(7).equals("0"));
|
bug.setOpened(matcher.group(7).equals("0")); //$NON-NLS-1$
|
||||||
bugs.add(bug);
|
bugs.add(bug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.warn("Error loading bugs", e);
|
log.warn("Error loading bugs", e); //$NON-NLS-1$
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
log.warn("Error loading bugs", e);
|
log.warn("Error loading bugs", e); //$NON-NLS-1$
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.warn("Error loading bugs", e);
|
log.warn("Error loading bugs", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return bugs;
|
return bugs;
|
||||||
|
|
|
@ -632,7 +632,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
startDragging = null;
|
startDragging = null;
|
||||||
if(log.isDebugEnabled()){
|
if(log.isDebugEnabled()){
|
||||||
log.debug("On long click event "+ point.x + " " + point.y);
|
log.debug("On long click event "+ point.x + " " + point.y); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
for (int i = layers.size() - 1; i >= 0; i--) {
|
for (int i = layers.size() - 1; i >= 0; i--) {
|
||||||
if (layers.get(i).onLongPressEvent(point)) {
|
if (layers.get(i).onLongPressEvent(point)) {
|
||||||
|
@ -661,7 +661,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
startDragging = null;
|
startDragging = null;
|
||||||
if(log.isDebugEnabled()){
|
if(log.isDebugEnabled()){
|
||||||
log.debug("On click event "+ point.x + " " + point.y);
|
log.debug("On click event "+ point.x + " " + point.y); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
for (int i = layers.size() - 1; i >= 0; i--) {
|
for (int i = layers.size() - 1; i >= 0; i--) {
|
||||||
if (layers.get(i).onTouchEvent(point)) {
|
if (layers.get(i).onTouchEvent(point)) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class RouteLayer implements OsmandMapLayer {
|
||||||
double rightLongitude = MapUtils.getLongitudeFromTile(view.getZoom(), tileRect.right);
|
double rightLongitude = MapUtils.getLongitudeFromTile(view.getZoom(), tileRect.right);
|
||||||
helper.fillLocationsToShow(topLatitude, leftLongitude, bottomLatitude, rightLongitude, points);
|
helper.fillLocationsToShow(topLatitude, leftLongitude, bottomLatitude, rightLongitude, points);
|
||||||
if((System.currentTimeMillis() - time) > 40){
|
if((System.currentTimeMillis() - time) > 40){
|
||||||
Log.e(LogUtil.TAG, "Calculate route layer " + (System.currentTimeMillis() - time));
|
Log.e(LogUtil.TAG, "Calculate route layer " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.size() > 0) {
|
if (points.size() > 0) {
|
||||||
|
|
Loading…
Reference in a new issue