Compare commits

...

95 commits
master ... r2.6

Author SHA1 Message Date
Victor Shcherb
75ee8f8a1d Fix crashes 2017-05-31 09:54:15 +02:00
Alexey Kulish
2d0367940c Fix TrackSegmentFragment crash on rotate 2017-05-30 19:35:36 +03:00
Alexey Kulish
554e7b0a52 Fix MapRouteInfoMenuFragment crash 2017-05-30 16:59:48 +03:00
Alexey Kulish
c61ff3bbf8 Fix GeoIntentActivity crash 2017-05-30 12:56:41 +03:00
Alexey Kulish
d75ecfa084 Fix crash at OsmandAidlApi 2017-05-30 12:31:13 +03:00
Alexey Kulish
e335f09c29 Fix QuickSearchDialogFragment crash 2017-05-30 12:30:58 +03:00
Alexey Kulish
6f491e030c Fix IabHelper crash 2017-05-30 12:30:42 +03:00
Alexey Kulish
95f7133562 Fix #3746 2017-05-30 00:28:04 +03:00
Victor Shcherb
82512864c5 Try to fix NPE while animating thread
Conflicts:
	OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java
2017-05-29 22:28:12 +02:00
Victor Shcherb
fa407ef386 Fix download NPE 2017-05-29 22:11:48 +02:00
Victor Shcherb
ed93e37f72 Fix avoid road NPE (Test avoid road) 2017-05-29 21:51:46 +02:00
Victor Shcherb
c216ae5fa1 Fix frequent NPE 2017-05-29 21:46:29 +02:00
Victor Shcherb
b5f3f74726 Fix frequest exception android.os.Parcel.readException 2017-05-29 21:46:29 +02:00
Alexey Kulish
9061474aca Fix strings conflict 2017-05-29 19:37:07 +03:00
Alexey Kulish
2b52eacb3a Fix #3819 2017-05-29 19:31:20 +03:00
Alexey Kulish
30221cf06b Fix #3711 2017-05-29 17:03:36 +03:00
Alexey Kulish
f327e61683 Fix #3837 2017-05-29 15:12:54 +03:00
PavelRatushny
25bee8896e Fix #3758 2017-05-29 11:21:34 +03:00
PavelRatushny
92a11cf1b4 test fix#3758 2017-05-29 11:21:22 +03:00
Victor Shcherb
d6a53c43c2 Fix #3712 double check if activity is alive 2017-05-28 14:33:14 +02:00
Victor Shcherb
f454b12d07 Fix #3724 & Fix #3784 2017-05-28 14:22:35 +02:00
xmd5a
d8fd5c012f Add api key to cyclemap link 2017-05-28 15:07:17 +03:00
PavelRatushny
a17edb7402 Fix #3710 2017-05-27 18:50:12 +03:00
PavelRatushny
9779eaa12b Fix #3710 2017-05-27 18:50:05 +03:00
PavelRatushny
a9fd178989 Fix #3710 2017-05-27 18:49:57 +03:00
sonora
83d6a35e60 Show coordinates only in selected format (Fixes #3708) 2017-05-27 18:48:56 +03:00
Alexander Sytnyk
e8a0763ef6 Fix #3799 2017-05-27 18:48:22 +03:00
PavelRatushny
f683a519a6 Fix #3750 2017-05-27 18:40:37 +03:00
PavelRatushny
2c47511fd7 Fix #3750 2017-05-27 18:40:28 +03:00
PavelRatushny
e6bbd20f97 Fix #3783 2017-05-27 18:38:30 +03:00
PavelRatushny
bfcecbe227 Fix #3783 2017-05-27 18:38:22 +03:00
xmd5a
5633a26418 Fix hillshade translation 2017-05-27 18:37:36 +03:00
Alexander Sytnyk
7f7e01ef74 Fix #3779 2017-05-27 18:37:18 +03:00
Alexander Sytnyk
2616ba88ba Fix #3775 2017-05-27 18:36:58 +03:00
Alexey Kulish
586472269d Fix hidden multimenu 2017-05-27 18:36:35 +03:00
Alexey Kulish
55098b39e8 Fix resources NotFoundException 2017-05-27 18:36:14 +03:00
Igor B. Poretsky
a5163938c8 Quick action button accessibility fix 2017-05-27 18:35:44 +03:00
xmd5a
a753a285d0 Fix phrases 2017-05-27 18:33:01 +03:00
Alexey Kulish
dd71cb2a9c Fix random red color in local map list 2017-05-27 18:32:33 +03:00
Alexey Kulish
7fba3e4a3b Fix #3718 2017-05-27 18:31:56 +03:00
xmd5a
2f411cadde Update phrases 2017-05-25 23:02:42 +03:00
Alexey Kulish
1816123d53 Fix broken download of wiki maps 2017-05-25 14:05:29 +03:00
Alexey Kulish
b0db1b8a32 Fix #3699 2017-05-25 12:58:05 +03:00
Victor Shcherb
e3071852d6 Fix issue with opening hours Mo-Fr 08:30-17:00; 12:00-12:40 off; 2017-05-09 00:23:03 +02:00
Alexey Kulish
82eb53ba54 Fix context menu crash 2017-04-25 11:24:06 +03:00
Victor Shcherb
6667051460 Fix potential crash search history 2017-04-25 10:18:56 +02:00
Victor Shcherb
8919740cf9 Fix potential crash search history 2017-04-25 10:14:41 +02:00
Victor Shcherb
141c7173f5 Fix Poi menu #3681 2017-04-25 10:06:04 +02:00
Alexey Kulish
2b9186bd05 Added gpx operations. Added set map location. 2017-04-24 20:27:31 +03:00
Alexey Kulish
6f5be54540 Added aidl map layer api 2017-04-23 17:22:13 +03:00
Alexey Kulish
3d58c07729 Fix #3685 2017-04-23 11:06:04 +03:00
Alexey Kulish
364f11d6b5 Added aidl for markers and widgets 2017-04-22 22:57:55 +03:00
xmd5a
ece6dd79aa Update 2017-04-21 16:11:51 +03:00
xmd5a
8a87a5c39c Improve strings 2017-04-20 19:16:42 +03:00
Alexey Kulish
fb6df5fc4e Fix notifications 2017-04-20 15:54:41 +03:00
Alexey Kulish
8490982312 Fix purchases 2017-04-18 15:31:52 +03:00
Alexey Kulish
236c2a458f Fix search crash 2017-04-18 15:31:35 +03:00
Victor Shcherb
7d1fc07e2e Fix geo intent 2017-04-18 12:13:22 +03:00
Alexey Kulish
8e218323dc Added quick search call on map activity start 2017-04-18 12:04:06 +03:00
Victor Shcherb
3a15e48750 Fix geo intent search 2017-04-18 11:50:21 +03:00
Victor Shcherb
6b291efc6b Update version released 2017-04-18 11:06:43 +03:00
Victor Shcherb
ef6918d828 Fix search core 2017-04-17 20:08:08 +03:00
Alexey Kulish
4b2c3b0b1d Fix first screen no-wifi bug 2017-04-17 19:47:10 +03:00
Alexey Kulish
bc6c8d02ca Fix address selection in route preparation 2017-04-17 19:46:56 +03:00
Victor Shcherb
c08484d63e Fix search issue 2017-04-17 19:46:08 +03:00
xmd5a
12c5524ba9 Add phrase 2017-04-16 23:03:46 +03:00
xmd5a
dc131b2dc4 Fix allow_private_description strings 2017-04-16 17:00:27 +03:00
Victor Shcherb
6b55a731c2 Fix 2.6 2017-04-16 14:16:55 +03:00
Victor Shcherb
49ebb0522d Fix crash size is missing in bitset 2017-04-16 13:49:19 +03:00
Victor Shcherb
bb369dc033 Enable tracks saving during navigation 2017-04-16 13:36:01 +03:00
Victor Shcherb
2c6dc292a8 Avoid out of bound exception 2017-04-16 13:12:09 +03:00
Victor Shcherb
af7d034592 Fix crash when switch to another app while searching 2017-04-16 12:56:49 +03:00
Alexey
52127f9bd4 Fix open location crash 2017-04-14 15:36:40 +03:00
Victor Shcherb
91872cdf3e Fix issue with search 2017-04-14 15:08:46 +03:00
Alexey Kulish
1a6d8bc76d Hide inapp banner when already purchased 2017-04-14 10:48:31 +03:00
Victor Shcherb
9ae7e2263f Fix search 2017-04-14 10:14:06 +03:00
Victor Shcherb
504d7a86bf Fix search for 1-digit houses 2017-04-13 19:45:02 +02:00
xmd5a
ab58aee4ad Add 15 to save_track_precision list. In my tests sometimes 20 is very rough but 10 often skips points that have sufficient accuracy 2017-04-13 19:07:08 +03:00
Victor Shcherb
9564497f99 Fix inversive search 2017-04-13 10:32:00 +02:00
Victor Shcherb
571c96bde8 Fix inversive search 2017-04-13 01:12:05 +02:00
Victor Shcherb
9099ee8ec1 Add common words to geocoding utilities 2017-04-13 01:11:54 +02:00
xmd5a
9e75276019 Fix ru string 2017-04-12 17:41:43 +03:00
xmd5a
40282b88c2 Fix ru string 2017-04-12 10:59:58 +03:00
Alexey Kulish
fd1a5dccc1 Fix 0x1 resource id 2017-04-12 10:07:18 +03:00
Victor Shcherb
2cf480bb94 Fix #3357 2017-04-11 23:42:43 +02:00
xmd5a
981ad9d0c2 Add ru string 2017-04-11 22:56:58 +03:00
Victor Shcherb
a8347f349b Fix test 2017-04-11 21:30:02 +02:00
Victor Shcherb
197b49e794 Fix test 2017-04-11 20:58:01 +02:00
Alexey Kulish
82a74ff223 Fix #3164 2017-04-11 18:29:41 +03:00
Alexey Kulish
7dfbd26cf8 Fix #3642 2017-04-11 12:01:47 +03:00
Alexey Kulish
006fb14afb Move toggle osm notes action to configure map section 2017-04-11 12:01:35 +03:00
Alexey Kulish
66a77c7a18 Merge branch 'r2.6' of https://github.com/osmandapp/Osmand into r2.6 2017-04-11 11:27:02 +03:00
Alexey Kulish
6e3d4eedad Fix #3189 2017-04-11 11:26:50 +03:00
Dmitriy Prodchenko
926ce6cfcc Search Empty state icon 2017-04-11 11:26:34 +03:00
xmd5a
184c9ff539 Add ru strings 2017-04-11 11:10:49 +03:00
171 changed files with 4803 additions and 1288 deletions

View file

@ -684,7 +684,7 @@ public class BinaryMapAddressReaderAdapter {
codedIS.seek(contOffset);
int len = codedIS.readRawVarint32();
int old = codedIS.pushLimit(len);
obj = readCityHeader(null, contOffset, null);
obj = readCityHeader(null, contOffset, reg.attributeTagsTable);
codedIS.popLimit(old);
}
if (obj != null) {

View file

@ -0,0 +1,517 @@
package net.osmand.binary;
import java.util.LinkedHashMap;
import java.util.Map;
public class CommonWords {
private static Map<String, Integer> commonWordsDictionary = new LinkedHashMap<>();
private static void addCommon(String string) {
commonWordsDictionary.put(string, commonWordsDictionary.size());
}
public static int getCommon(String name) {
if(true) {
// not ready for old versions yet
return -1;
}
Integer i = commonWordsDictionary.get(name);
return i == null ? -1 : i.intValue();
}
public static int getCommonSearch(String name) {
Integer i = commonWordsDictionary.get(name);
return i == null ? -1 : i.intValue();
}
public static int getCommonGeocoding(String name) {
Integer i = commonWordsDictionary.get(name);
return i == null ? -1 : i.intValue();
}
static {
addCommon("la");
addCommon("via");
addCommon("rua");
addCommon("de");
addCommon("du");
addCommon("des");
addCommon("del");
addCommon("am");
addCommon("da");
addCommon("a");
addCommon("der");
addCommon("do");
addCommon("los");
addCommon("di");
addCommon("im");
addCommon("el");
addCommon("e");
addCommon("an");
addCommon("g.");
addCommon("rd");
addCommon("dos");
addCommon("dei");
addCommon("b");
addCommon("st");
addCommon("the");
addCommon("las");
addCommon("f");
addCommon("u");
addCommon("jl.");
addCommon("j");
addCommon("sk");
addCommon("w");
addCommon("a.");
addCommon("of");
addCommon("k");
addCommon("r");
addCommon("h");
addCommon("mc");
addCommon("sw");
addCommon("g");
addCommon("v");
addCommon("m");
addCommon("c.");
addCommon("r.");
addCommon("ct");
addCommon("e.");
addCommon("dr.");
addCommon("j.");
addCommon("in");
addCommon("al");
addCommon("út");
addCommon("per");
addCommon("ne");
addCommon("p");
addCommon("et");
addCommon("s.");
addCommon("f.");
addCommon("t");
addCommon("fe");
addCommon("à");
addCommon("i");
addCommon("c");
addCommon("le");
addCommon("s");
addCommon("av.");
addCommon("den");
addCommon("dr");
addCommon("y");
addCommon("un");
addCommon("van");
addCommon("road");
addCommon("street");
addCommon("drive");
addCommon("avenue");
addCommon("rue");
addCommon("lane");
addCommon("улица");
addCommon("спуск");
addCommon("straße");
addCommon("chemin");
addCommon("way");
addCommon("court");
addCommon("calle");
addCommon("place");
addCommon("avenida");
addCommon("boulevard");
addCommon("county");
addCommon("route");
addCommon("trail");
addCommon("circle");
addCommon("close");
addCommon("highway");
addCommon("strada");
addCommon("impasse");
addCommon("utca");
addCommon("creek");
addCommon("carrer");
addCommon("вулиця");
addCommon("allée");
addCommon("weg");
addCommon("площадь");
addCommon("тупик");
addCommon("terrace");
addCommon("jalan");
addCommon("parkway");
addCommon("переулок");
addCommon("carretera");
addCommon("valley");
addCommon("camino");
addCommon("viale");
addCommon("loop");
addCommon("bridge");
addCommon("embankment");
addCommon("township");
addCommon("town");
addCommon("village");
addCommon("piazza");
addCommon("della");
addCommon("plaza");
addCommon("pasaje");
addCommon("expressway");
addCommon("ruta");
addCommon("square");
addCommon("freeway");
addCommon("line");
addCommon("track");
addCommon("zum");
addCommon("rodovia");
addCommon("sokak");
addCommon("sur");
addCommon("path");
addCommon("das");
addCommon("yolu");
addCommon("проспект");
addCommon("auf");
addCommon("alley");
addCommon("são");
addCommon("les");
addCommon("delle");
addCommon("paseo");
addCommon("alte");
addCommon("autostrada");
addCommon("iela");
addCommon("autovía");
addCommon("d");
addCommon("ulica");
addCommon("na");
addCommon("проезд");
addCommon("n");
addCommon("ул.");
addCommon("voie");
addCommon("ring");
addCommon("ruelle");
addCommon("vicolo");
addCommon("avinguda");
addCommon("шоссе");
addCommon("zur");
addCommon("corso");
addCommon("autopista");
addCommon("провулок");
addCommon("broadway");
addCommon("to");
addCommon("passage");
addCommon("sentier");
addCommon("aleja");
addCommon("dem");
addCommon("valle");
addCommon("cruz");
addCommon("bypass");
addCommon("rúa");
addCommon("crest");
addCommon("ave");
addCommon("expressway)");
addCommon("autoroute");
addCommon("crossing");
addCommon("camí");
addCommon("bend");
addCommon("end");
addCommon("caddesi");
addCommon("bis");
addCommon("ქუჩა");
addCommon("kalea");
addCommon("pass");
addCommon("ponte");
addCommon("cruce");
addCommon("se");
addCommon("au");
addCommon("allee");
addCommon("autobahn");
addCommon("väg");
addCommon("sentiero");
addCommon("plaça");
addCommon("o");
addCommon("vej");
addCommon("aux");
addCommon("spur");
addCommon("ringstraße");
addCommon("prospect");
addCommon("m.");
addCommon("chaussee");
addCommon("row");
addCommon("link");
addCommon("travesía");
addCommon("degli");
addCommon("piazzale");
addCommon("vei");
addCommon("waldstraße");
addCommon("promenade");
addCommon("puente");
addCommon("rond-point");
addCommon("vía");
addCommon("pod");
addCommon("triq");
addCommon("hwy");
addCommon("οδός");
addCommon("dels");
addCommon("and");
addCommon("pré");
addCommon("plac");
addCommon("fairway");
// addCommon("farm-to-market");
addCommon("набережная");
addCommon("chaussée");
addCommon("náměstí");
addCommon("tér");
addCommon("roundabout");
addCommon("lakeshore");
addCommon("lakeside");
addCommon("alle");
addCommon("gasse");
addCommon("str.");
// addCommon("p.");
addCommon("ville");
addCommon("beco");
addCommon("platz");
// addCommon("porto");
addCommon("sideroad");
addCommon("pista");
addCommon("аллея");
addCommon("бульвар");
addCommon("город");
addCommon("городок");
addCommon("деревня");
addCommon("дер.");
addCommon("пос.");
addCommon("дорога");
addCommon("дорожка");
addCommon("кольцо");
addCommon("мост");
addCommon("остров");
addCommon("островок");
addCommon("поселок");
addCommon("посёлок");
addCommon("путепровод");
addCommon("слобода");
addCommon("станция");
addCommon("тоннель");
addCommon("тракт");
addCommon("island");
addCommon("islet");
addCommon("tunnel");
addCommon("stadt");
addCommon("brücke");
addCommon("damm");
addCommon("insel");
addCommon("dorf");
addCommon("bereich");
addCommon("überführung");
addCommon("bulevar");
addCommon("ciudad");
addCommon("pueblo");
addCommon("anillo");
addCommon("muelle");
addCommon("isla");
addCommon("islote");
addCommon("carril");
addCommon("viaje");
addCommon("città");
addCommon("paese");
addCommon("villaggio");
addCommon("banchina");
addCommon("isola");
addCommon("isolotto");
addCommon("corsia");
addCommon("viaggio");
addCommon("canale");
addCommon("pont");
addCommon("quai");
addCommon("île");
addCommon("îlot");
addCommon("voyage");
addCommon("descente");
addCommon("straat");
addCommon("stad");
addCommon("dorp");
addCommon("brug");
addCommon("kade");
addCommon("eiland");
addCommon("eilandje");
addCommon("laan");
addCommon("plein");
addCommon("reizen");
addCommon("afkomst");
addCommon("kanaal");
addCommon("doodlopende");
addCommon("stradă");
addCommon("rutier");
addCommon("alee");
addCommon("municipiu");
addCommon("oras");
addCommon("drumuri");
addCommon("poduri");
addCommon("cheu");
addCommon("insula");
addCommon("ostrov");
addCommon("sat");
addCommon("călătorie");
addCommon("coborâre");
addCommon("statie");
addCommon("tunel");
addCommon("fundătură");
addCommon("ulice");
addCommon("silnice");
addCommon("bulvár");
addCommon("město");
addCommon("obec");
addCommon("most");
addCommon("nábřeží");
addCommon("ostrova");
addCommon("ostrůvek");
addCommon("lane");
addCommon("vesnice");
addCommon("jezdit");
addCommon("sestup");
addCommon("nádraží");
addCommon("kanál");
addCommon("ulička");
addCommon("gata");
addCommon("by");
addCommon("bro");
addCommon("kaj");
addCommon("ö");
addCommon("holme");
addCommon("fyrkant");
addCommon("resa");
addCommon("härkomst");
addCommon("kanal");
addCommon("återvändsgränd");
addCommon("cesty");
addCommon("ostrovček");
addCommon("námestie");
addCommon("dediny");
addCommon("jazdiť");
addCommon("zostup");
addCommon("stanice");
addCommon("cesta");
addCommon("pot");
addCommon("mesto");
addCommon("kraj");
addCommon("vas");
addCommon("pomol");
addCommon("otok");
addCommon("otoček");
addCommon("trg");
addCommon("potovanje");
addCommon("spust");
addCommon("postaja");
addCommon("predor");
addCommon("вуліца");
addCommon("шаша");
addCommon("алея");
addCommon("горад");
addCommon("мястэчка");
addCommon("вёска");
addCommon("дарога");
addCommon("набярэжная");
addCommon("востраў");
addCommon("астравок");
addCommon("завулак");
addCommon("плошча");
addCommon("пасёлак");
addCommon("праезд");
addCommon("праспект");
addCommon("станцыя");
addCommon("тунэль");
addCommon("тупік");
addCommon("افي.");
addCommon("إلى");
addCommon("تسوية");
addCommon("جادة");
addCommon("جزيرة");
addCommon("جسر");
addCommon("زقاق");
addCommon("شارع");
addCommon("طريق");
addCommon("قرية");
addCommon("مأزق");
addCommon("محطة");
addCommon("مدينة");
addCommon("مرور");
addCommon("مسار");
addCommon("ممر");
addCommon("منطقة");
addCommon("نفق");
addCommon("път");
addCommon("булевард");
addCommon("град");
addCommon("село");
addCommon("кей");
addCommon("островче");
addCommon("платно");
addCommon("квадрат");
addCommon("пътуване");
addCommon("произход");
addCommon("гара");
addCommon("тунел");
addCommon("канал");
addCommon("körút");
addCommon("híd");
addCommon("rakpart");
addCommon("állomás");
addCommon("alagút");
addCommon("đường");
addCommon("đại");
addCommon("làng");
addCommon("cầu");
addCommon("đảo");
addCommon("phố");
addCommon("gốc");
addCommon("kênh");
addCommon("δρόμο");
addCommon("λεωφόρος");
addCommon("πόλη");
addCommon("κωμόπολη");
addCommon("χωριό");
addCommon("δρόμος");
addCommon("γέφυρα");
addCommon("αποβάθρα");
addCommon("νησί");
addCommon("νησίδα");
addCommon("λωρίδα");
addCommon("πλατεία");
addCommon("χωριό");
addCommon("ταξίδια");
addCommon("ø");
addCommon("bane");
}
}

View file

@ -49,28 +49,6 @@ public class GeocodingUtilities {
public static final float THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER = 1.5f;
public static final float DISTANCE_BUILDING_PROXIMITY = 100;
public static final String[] SUFFIXES = new String[]{
"av.", "avenue", "просп.", "пер.", "пр.", "заул.", "проспект", "переул.", "бул.", "бульвар", "тракт"};
public static final String[] DEFAULT_SUFFIXES = new String[]{
"str.", "street", "улица", "ул.", "вулица", "вул.", "вулиця"};
private static Set<String> SET_DEF_SUFFIXES = null;
private static Set<String> SET_SUFFIXES = null;
public static Set<String> getDefSuffixesSet() {
if (SET_DEF_SUFFIXES == null) {
SET_DEF_SUFFIXES = new TreeSet<String>();
SET_DEF_SUFFIXES.addAll(Arrays.asList(DEFAULT_SUFFIXES));
}
return SET_DEF_SUFFIXES;
}
public static Set<String> getSuffixesSet() {
if (SET_SUFFIXES == null) {
SET_SUFFIXES = new TreeSet<String>();
SET_SUFFIXES.addAll(Arrays.asList(SUFFIXES));
}
return SET_SUFFIXES;
}
public static final Comparator<GeocodingResult> DISTANCE_COMPARATOR = new Comparator<GeocodingResult>() {
@ -201,15 +179,15 @@ public class GeocodingUtilities {
return lst;
}
public List<String> prepareStreetName(String s) {
public List<String> prepareStreetName(String s, boolean addCommonWords) {
List<String> ls = new ArrayList<String>();
int beginning = 0;
for (int i = 1; i < s.length(); i++) {
if (s.charAt(i) == ' ') {
addWord(ls, s.substring(beginning, i));
addWord(ls, s.substring(beginning, i), addCommonWords);
beginning = i;
} else if (s.charAt(i) == '(') {
addWord(ls, s.substring(beginning, i));
addWord(ls, s.substring(beginning, i), addCommonWords);
while (i < s.length()) {
char c = s.charAt(i);
i++;
@ -222,15 +200,18 @@ public class GeocodingUtilities {
}
if (beginning < s.length()) {
String lastWord = s.substring(beginning, s.length());
addWord(ls, lastWord);
addWord(ls, lastWord, addCommonWords);
}
Collections.sort(ls, Collator.getInstance());
return ls;
}
private void addWord(List<String> ls, String word) {
private void addWord(List<String> ls, String word, boolean addCommonWords) {
String w = word.trim().toLowerCase();
if (!Algorithms.isEmpty(w) && !getDefSuffixesSet().contains(w)) {
if (!Algorithms.isEmpty(w)) {
if(!addCommonWords && CommonWords.getCommonGeocoding(word) != -1) {
return;
}
ls.add(w);
}
}
@ -239,25 +220,24 @@ public class GeocodingUtilities {
double knownMinBuildingDistance, final ResultMatcher<GeocodingResult> result) throws IOException {
// test address index search
final List<GeocodingResult> streetsList = new ArrayList<GeocodingResult>();
final List<String> streetNamePacked = prepareStreetName(road.streetName);
if (streetNamePacked.size() > 0) {
log.info("Search street by name " + road.streetName + " " + streetNamePacked);
final List<String> streetNamesUsed = prepareStreetName(road.streetName, true);
final List<String> streetNamesPacked = streetNamesUsed.size() == 0 ?
prepareStreetName(road.streetName, false) : streetNamesUsed;
if (streetNamesPacked.size() > 0) {
log.info("Search street by name " + road.streetName + " " + streetNamesPacked);
String mainWord = "";
for (int i = 0; i < streetNamePacked.size(); i++) {
String s = streetNamePacked.get(i);
if (!getSuffixesSet().contains(s) && s.length() > mainWord.length()) {
for (int i = 0; i < streetNamesPacked.size(); i++) {
String s = streetNamesPacked.get(i);
if (s.length() > mainWord.length()) {
mainWord = s;
}
}
if (Algorithms.isEmpty(mainWord)) {
mainWord = streetNamePacked.get(0);
}
SearchRequest<MapObject> req = BinaryMapIndexReader.buildAddressByNameRequest(
new ResultMatcher<MapObject>() {
@Override
public boolean publish(MapObject object) {
if (object instanceof Street
&& prepareStreetName(object.getName()).equals(streetNamePacked)) {
&& prepareStreetName(object.getName(), true).equals(streetNamesUsed)) {
double d = MapUtils.getDistance(object.getLocation(), road.searchPoint.getLatitude(),
road.searchPoint.getLongitude());
// double check to suport old format

View file

@ -517,6 +517,22 @@ public class RouteDataObject {
return getHighway(types, region);
}
public boolean hasPrivateAccess() {
int sz = types.length;
for (int i = 0; i < sz; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
if ("motorcar".equals(r.getTag())
|| "motor_vehicle".equals(r.getTag())
|| "vehicle".equals(r.getTag())
|| "access".equals(r.getTag())) {
if (r.getValue().equals("private")) {
return true;
}
}
}
return false;
}
public String getValue(String tag) {
for (int i = 0; i < types.length; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);

View file

@ -422,7 +422,7 @@ public class TileSourceManager {
}
public static TileSourceTemplate getCycleMapSource(){
return new TileSourceTemplate("CycleMap", "http://b.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", ".png", 16, 1, 256, 32, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
return new TileSourceTemplate("CycleMap", "https://b.tile.thunderforest.com/cycle/{0}/{1}/{2}.png?apikey=a778ae1a212641d38f46dc11f20ac116", ".png", 16, 1, 256, 32, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}

View file

@ -31,7 +31,8 @@ public class GeneralRouter implements VehicleRouter {
public static final String AVOID_MOTORWAY = "avoid_motorway";
public static final String AVOID_UNPAVED = "avoid_unpaved";
public static final String PREFER_MOTORWAYS = "prefer_motorway";
public static final String ALLOW_PRIVATE = "allow_private";
private final RouteAttributeContext[] objectAttributes;
public final Map<String, String> attributes;
private final Map<String, RoutingParameter> parameters;
@ -41,7 +42,8 @@ public class GeneralRouter implements VehicleRouter {
private final ArrayList<Object> ruleToValue;
private boolean shortestRoute;
private boolean heightObstacles;
private boolean allowPrivate;
private Map<RouteRegion, Map<Integer, Integer>> regionConvert = new LinkedHashMap<RouteRegion, Map<Integer,Integer>>();
// cached values
@ -55,6 +57,7 @@ public class GeneralRouter implements VehicleRouter {
private float maxDefaultSpeed = 10;
private TLongHashSet impassableRoads;
private GeneralRouterProfile profile;
public enum RouteDataObjectAttribute {
@ -95,6 +98,7 @@ public class GeneralRouter implements VehicleRouter {
}
public GeneralRouter(GeneralRouterProfile profile, Map<String, String> attributes) {
this.profile = profile;
this.attributes = new LinkedHashMap<String, String>();
Iterator<Entry<String, String>> e = attributes.entrySet().iterator();
while(e.hasNext()){
@ -113,6 +117,7 @@ public class GeneralRouter implements VehicleRouter {
}
public GeneralRouter(GeneralRouter parent, Map<String, String> params) {
this.profile = parent.profile;
this.attributes = new LinkedHashMap<String, String>();
Iterator<Entry<String, String>> e = parent.attributes.entrySet().iterator();
while (e.hasNext()) {
@ -130,6 +135,7 @@ public class GeneralRouter implements VehicleRouter {
for (int i = 0; i < objectAttributes.length; i++) {
objectAttributes[i] = new RouteAttributeContext(parent.objectAttributes[i], params);
}
allowPrivate = params.containsKey(ALLOW_PRIVATE) && parseSilentBoolean(params.get(ALLOW_PRIVATE), false) ;
shortestRoute = params.containsKey(USE_SHORTEST_WAY) && parseSilentBoolean(params.get(USE_SHORTEST_WAY), false);
heightObstacles = params.containsKey(USE_HEIGHT_OBSTACLES) && parseSilentBoolean(params.get(USE_HEIGHT_OBSTACLES), false);
if(shortestRoute) {
@ -137,6 +143,11 @@ public class GeneralRouter implements VehicleRouter {
}
}
public GeneralRouterProfile getProfile() {
return profile;
}
public Map<String, RoutingParameter> getParameters() {
return parameters;
@ -195,7 +206,11 @@ public class GeneralRouter implements VehicleRouter {
}
return res >= 0;
}
public boolean isAllowPrivate() {
return allowPrivate;
}
public long[] getImpassableRoadIds() {
if(impassableRoads == null) {
return new long[0];
@ -672,7 +687,7 @@ public class GeneralRouter implements VehicleRouter {
if (value instanceof String && value.toString().startsWith("$")) {
BitSet mask = tagRuleMask.get(value.toString().substring(1));
if (mask != null && mask.intersects(types)) {
BitSet findBit = new BitSet(mask.size());
BitSet findBit = new BitSet(mask.length());
findBit.or(mask);
findBit.and(types);
int v = findBit.nextSetBit(0);
@ -753,16 +768,16 @@ public class GeneralRouter implements VehicleRouter {
public void printRule(PrintStream out) {
out.print(" Select " + selectValue + " if ");
for(int k = 0; k < filterTypes.size(); k++) {
for(int k = 0; k < filterTypes.length(); k++) {
if(filterTypes.get(k)) {
String key = universalRulesById.get(k);
out.print(key + " ");
}
}
if(filterNotTypes.size() > 0) {
if(filterNotTypes.length() > 0) {
out.print(" ifnot ");
}
for(int k = 0; k < filterNotTypes.size(); k++) {
for(int k = 0; k < filterNotTypes.length(); k++) {
if(filterNotTypes.get(k)) {
String key = universalRulesById.get(k);
out.print(key + " ");
@ -835,7 +850,7 @@ public class GeneralRouter implements VehicleRouter {
if (selectValue instanceof String && selectValue.toString().startsWith("$")) {
BitSet mask = tagRuleMask.get(selectValue.toString().substring(1));
if (mask != null && mask.intersects(types)) {
BitSet findBit = new BitSet(mask.size());
BitSet findBit = new BitSet(mask.length());
findBit.or(mask);
findBit.and(types);
int value = findBit.nextSetBit(0);

View file

@ -16,5 +16,5 @@ public class RouteCalculationProgress {
public int visitedSegments = 0;
public boolean isCancelled;
public boolean requestPrivateAccessRouting;
}

View file

@ -1,13 +1,6 @@
package net.osmand.router;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import net.osmand.NativeLibrary;
import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapIndexReader;
@ -18,11 +11,19 @@ import net.osmand.data.LatLon;
import net.osmand.data.QuadPoint;
import net.osmand.router.BinaryRoutePlanner.RouteSegment;
import net.osmand.router.BinaryRoutePlanner.RouteSegmentPoint;
import net.osmand.util.Algorithms;
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
public class RoutePlannerFrontEnd {
private boolean useOldVersion;
@ -110,12 +111,44 @@ public class RoutePlannerFrontEnd {
}
private boolean needRequestPrivateAccessRouting(RoutingContext ctx, List<LatLon> points) throws IOException {
boolean res = false;
GeneralRouter router = (GeneralRouter) ctx.getRouter();
if (router != null && !router.isAllowPrivate() &&
router.getParameters().containsKey(GeneralRouter.ALLOW_PRIVATE)) {
ctx.unloadAllData();
LinkedHashMap<String, String> mp = new LinkedHashMap<String, String>();
mp.put(GeneralRouter.ALLOW_PRIVATE, "true");
ctx.setRouter(new GeneralRouter(router.getProfile(), mp));
for (LatLon latLon : points) {
RouteSegmentPoint rp = findRouteSegment(latLon.getLatitude(), latLon.getLongitude(), ctx, null);
if (rp != null && rp.road != null) {
if (rp.road.hasPrivateAccess()) {
res = true;
break;
}
}
}
ctx.unloadAllData();
ctx.setRouter(router);
}
return res;
}
public List<RouteSegmentResult> searchRoute(final RoutingContext ctx, LatLon start, LatLon end, List<LatLon> intermediates,
PrecalculatedRouteDirection routeDirection) throws IOException, InterruptedException {
if (ctx.calculationProgress == null) {
ctx.calculationProgress = new RouteCalculationProgress();
}
boolean intermediatesEmpty = intermediates == null || intermediates.isEmpty();
List<LatLon> targets = new ArrayList<>();
targets.add(end);
if (!intermediatesEmpty) {
targets.addAll(intermediates);
}
if (needRequestPrivateAccessRouting(ctx, targets)) {
ctx.calculationProgress.requestPrivateAccessRouting = true;
}
double maxDistance = MapUtils.getDistance(start, end);
if (!intermediatesEmpty) {
LatLon b = start;

View file

@ -1124,7 +1124,7 @@ public class RouteResultPreparation {
List<int[]> lanesInfo, int roads, int addRoads) {
int activeStartIndex = -1;
boolean lookupSlightTurn = addRoads > 0;
Set<String> addedTurns = new TreeSet<String>();
TIntHashSet addedTurns = new TIntHashSet();
// if we have information increase number of roads per each turn direction
int diffTurnRoads = roads;
int increaseTurnRoads = 0;
@ -1145,7 +1145,7 @@ public class RouteResultPreparation {
String[] laneTurns = splitLaneOptions[ind].split(";");
int cnt = 0;
for(String lTurn : laneTurns) {
boolean added = addedTurns.add(lTurn);
boolean added = addedTurns.add(TurnType.convertType(lTurn));
if(added) {
cnt++;
diffTurnRoads --;
@ -1361,31 +1361,7 @@ public class RouteResultPreparation {
String[] laneOptions = splitLaneOptions[i].split(";");
boolean isTertiaryTurn = false;
for (int j = 0; j < laneOptions.length; j++) {
int turn;
if (laneOptions[j].equals("none") || laneOptions[j].equals("through")) {
turn = TurnType.C;
} else if (laneOptions[j].equals("slight_right") ||
laneOptions[j].equals("merge_to_right")) {
turn = TurnType.TSLR;
} else if (laneOptions[j].equals("slight_left") ||
laneOptions[j].equals("merge_to_left")) {
turn = TurnType.TSLL;
} else if (laneOptions[j].equals("right")) {
turn = TurnType.TR;
} else if (laneOptions[j].equals("left")) {
turn = TurnType.TL;
} else if (laneOptions[j].equals("sharp_right")) {
turn = TurnType.TSHR;
} else if (laneOptions[j].equals("sharp_left")) {
turn = TurnType.TSHL;
} else if (laneOptions[j].equals("reverse")) {
turn = TurnType.TU;
} else {
// Unknown string
turn = TurnType.C;
// continue;
}
int turn = TurnType.convertType(laneOptions[j]);
final int primary = TurnType.getPrimaryTurn(lanes[i]);
if (primary == 0) {

View file

@ -413,6 +413,34 @@ public class TurnType {
}
}
public static int convertType(String lane) {
int turn;
if (lane.equals("none") || lane.equals("through")) {
turn = TurnType.C;
} else if (lane.equals("slight_right") ||
lane.equals("merge_to_right")) {
turn = TurnType.TSLR;
} else if (lane.equals("slight_left") ||
lane.equals("merge_to_left")) {
turn = TurnType.TSLL;
} else if (lane.equals("right")) {
turn = TurnType.TR;
} else if (lane.equals("left")) {
turn = TurnType.TL;
} else if (lane.equals("sharp_right")) {
turn = TurnType.TSHR;
} else if (lane.equals("sharp_left")) {
turn = TurnType.TSHL;
} else if (lane.equals("reverse")) {
turn = TurnType.TU;
} else {
// Unknown string
turn = TurnType.C;
// continue;
}
return turn;
}
}

View file

@ -10,6 +10,7 @@ import net.osmand.binary.BinaryMapAddressReaderAdapter;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.binary.CommonWords;
import net.osmand.data.Amenity;
import net.osmand.data.Building;
import net.osmand.data.City;
@ -131,6 +132,11 @@ public class SearchCoreFactory {
phrase.countUnknownWordsMatch(res);
int cnt = resultMatcher.getCount();
List<String> ws = phrase.getUnknownSearchWords(res.otherWordsMatch);
if(!res.firstUnknownWordMatches) {
ws.add(phrase.getUnknownSearchWord());
}
// publish result to set parentSearchResult before search
resultMatcher.publish(res);
if (!ws.isEmpty() && api != null && api.isSearchAvailable(phrase)) {
SearchPhrase nphrase = phrase.selectWord(res, ws,
phrase.isLastUnknownSearchWordComplete());
@ -139,9 +145,9 @@ public class SearchCoreFactory {
api.search(nphrase, resultMatcher);
resultMatcher.setParentSearchResult(prev);
}
if (resultMatcher.getCount() == cnt) {
resultMatcher.publish(res);
}
// if (resultMatcher.getCount() == cnt) {
// resultMatcher.publish(res);
// }
}
}
@ -281,7 +287,9 @@ public class SearchCoreFactory {
if (phrase.isNoSelectedType() && bbox != null
&& (phrase.isUnknownSearchWordPresent() || phrase.isEmptyQueryAllowed())
&& phrase.isSearchTypeAllowed(ObjectType.CITY)) {
NameStringMatcher nm = phrase.getNameStringMatcher();
String wrd = phrase.getUnknownWordToSearch();
NameStringMatcher nm = phrase.getNameStringMatcher(wrd, phrase.isUnknownSearchWordComplete());
// NameStringMatcher nm = phrase.getNameStringMatcher();
resArray.clear();
resArray = townCitiesQR.queryInBox(bbox, resArray);
int limit = 0;
@ -300,6 +308,7 @@ public class SearchCoreFactory {
if (phrase.isEmptyQueryAllowed() && phrase.isEmpty()) {
resultMatcher.publish(res);
} else if (nm.matches(res.localeName) || nm.matches(res.otherNames)) {
res.firstUnknownWordMatches = wrd.equals(phrase.getUnknownSearchWord());
subSearchApiOrPublish(phrase, resultMatcher, res, cityApi);
}
if (limit++ > LIMIT * phrase.getRadiusLevel()) {
@ -323,6 +332,8 @@ public class SearchCoreFactory {
final int priority = phrase.isNoSelectedType() ?
SEARCH_ADDRESS_BY_NAME_PRIORITY : SEARCH_ADDRESS_BY_NAME_PRIORITY_RADIUS2;
final BinaryMapIndexReader[] currentFile = new BinaryMapIndexReader[1];
ResultMatcher<MapObject> rm = new ResultMatcher<MapObject>() {
int limit = 0;
@Override
@ -422,12 +433,13 @@ public class SearchCoreFactory {
};
Iterator<BinaryMapIndexReader> offlineIterator = phrase.getRadiusOfflineIndexes(DEFAULT_ADDRESS_BBOX_RADIUS * 5,
SearchPhraseDataType.ADDRESS);
while (offlineIterator.hasNext()) {
String wordToSearch = phrase.getUnknownWordToSearch();
while (offlineIterator.hasNext() && wordToSearch.length() > 0) {
BinaryMapIndexReader r = offlineIterator.next();
currentFile[0] = r;
immediateResults.clear();
SearchRequest<MapObject> req = BinaryMapIndexReader.buildAddressByNameRequest(rm, phrase
.getUnknownSearchWord().toLowerCase(),
SearchRequest<MapObject> req = BinaryMapIndexReader.buildAddressByNameRequest(rm, wordToSearch.toLowerCase(),
phrase.isUnknownSearchWordComplete() ? StringMatcherMode.CHECK_EQUALS_FROM_SPACE
: StringMatcherMode.CHECK_STARTS_FROM_SPACE);
if (locSpecified) {
@ -436,9 +448,11 @@ public class SearchCoreFactory {
}
r.searchAddressDataByName(req);
for (SearchResult res : immediateResults) {
res.firstUnknownWordMatches = wordToSearch.equals(phrase.getUnknownSearchWord());
if (res.objectType == ObjectType.STREET) {
City ct = ((Street) res.object).getCity();
phrase.countUnknownWordsMatch(res, ct.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate()),
phrase.countUnknownWordsMatch(res,
ct.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate()),
ct.getAllNames(true));
subSearchApiOrPublish(phrase, resultMatcher, res, streetsApi);
} else {
@ -838,10 +852,13 @@ public class SearchCoreFactory {
sw.getResult().file.preloadStreets(c, null);
}
int limit = 0;
NameStringMatcher nm = phrase.getNameStringMatcher();
String wordToSearch = phrase.getUnknownWordToSearch();
boolean firstUnknownWordMatches = wordToSearch.equals(phrase.getUnknownSearchWord());
NameStringMatcher nm = phrase.getNameStringMatcher(wordToSearch, phrase.isUnknownSearchWordComplete());
for (Street object : c.getStreets()) {
SearchResult res = new SearchResult(phrase);
res.localeName = object.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate());
res.otherNames = object.getAllNames(true);
if (object.getName().startsWith("<")) {
@ -852,6 +869,9 @@ public class SearchCoreFactory {
&& !(nm.matches(res.localeName) || nm.matches(res.otherNames))) {
continue;
}
res.firstUnknownWordMatches = firstUnknownWordMatches ||
phrase.getNameStringMatcher().matches(res.localeName) ||
phrase.getNameStringMatcher().matches(res.otherNames);
res.localeRelatedObjectName = c.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate());
res.object = object;
res.preferredZoom = 17;
@ -928,8 +948,7 @@ public class SearchCoreFactory {
if (s != null) {
BinaryMapIndexReader file = phrase.getLastSelectedWord().getResult().file;
String lw = phrase.getUnknownSearchWord();
NameStringMatcher sm = phrase.getNameStringMatcher();
if (cacheBuilding != s) {
cacheBuilding = s;
SearchRequest<Building> sr = BinaryMapIndexReader
@ -960,10 +979,12 @@ public class SearchCoreFactory {
}
});
}
String lw = phrase.getUnknownWordToSearchBuilding();
NameStringMatcher buildingMatch = phrase.getNameStringMatcher(lw, phrase.isLastUnknownSearchWordComplete());
for (Building b : s.getBuildings()) {
SearchResult res = new SearchResult(phrase);
boolean interpolation = b.belongsToInterpolation(lw);
if ((!sm.matches(b.getName()) && !interpolation)
if ((!buildingMatch.matches(b.getName()) && !interpolation)
|| !phrase.isSearchTypeAllowed(ObjectType.HOUSE)) {
continue;
}
@ -985,10 +1006,14 @@ public class SearchCoreFactory {
res.preferredZoom = 17;
resultMatcher.publish(res);
}
if (Algorithms.isEmpty(lw) || !Character.isDigit(lw.charAt(0))) {
String streetIntersection = phrase.getUnknownWordToSearch();
NameStringMatcher streetMatch = phrase.getNameStringMatcher(streetIntersection, phrase.isLastUnknownSearchWordComplete());
if (Algorithms.isEmpty(streetIntersection) ||
(!Character.isDigit(streetIntersection.charAt(0)) &&
CommonWords.getCommonSearch(streetIntersection) == -1) ) {
for (Street street : s.getIntersectedStreets()) {
SearchResult res = new SearchResult(phrase);
if ((!sm.matches(street.getName()) && !sm.matches(street.getAllNames(true)))
if ((!streetMatch.matches(street.getName()) && !streetMatch.matches(street.getAllNames(true)))
|| !phrase.isSearchTypeAllowed(ObjectType.STREET_INTERSECTION)) {
continue;
}
@ -1406,4 +1431,6 @@ public class SearchCoreFactory {
return SEARCH_LOCATION_PRIORITY;
}
}
}

View file

@ -5,6 +5,7 @@ import net.osmand.CollatorStringMatcher;
import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.StringMatcher;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.CommonWords;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.data.LatLon;
import net.osmand.data.QuadRect;
@ -421,11 +422,16 @@ public class SearchPhrase {
if(sm != null) {
return sm;
}
sm = new NameStringMatcher(unknownSearchWordTrim,
(lastUnknownSearchWordComplete ?
sm = getNameStringMatcher(unknownSearchWordTrim, lastUnknownSearchWordComplete);
return sm;
}
public NameStringMatcher getNameStringMatcher(String word, boolean complete) {
return new NameStringMatcher(word,
(complete ?
StringMatcherMode.CHECK_EQUALS_FROM_SPACE :
StringMatcherMode.CHECK_STARTS_FROM_SPACE));
return sm;
}
public boolean hasObjectType(ObjectType p) {
@ -608,10 +614,70 @@ public class SearchPhrase {
}
}
}
if(!sr.firstUnknownWordMatches) {
sr.firstUnknownWordMatches = localeName.equals(getUnknownSearchWord()) ||
getNameStringMatcher().matches(localeName) ||
getNameStringMatcher().matches(otherNames);
}
}
public int getRadiusSearch(int meters) {
return (1 << (getRadiusLevel() - 1)) * meters;
}
public static int icompare(int x, int y) {
return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
public String getUnknownWordToSearchBuilding() {
List<String> unknownSearchWords = getUnknownSearchWords();
if(unknownSearchWords.size() > 0 && Algorithms.extractFirstIntegerNumber(getUnknownSearchWord()) == 0) {
for(String wrd : unknownSearchWords) {
if(Algorithms.extractFirstIntegerNumber(wrd) != 0) {
return wrd;
}
}
}
return getUnknownSearchWord();
}
public String getUnknownWordToSearch() {
List<String> unknownSearchWords = getUnknownSearchWords();
String wordToSearch = getUnknownSearchWord();
if (unknownSearchWords.size() > 0) {
List<String> searchWords = new ArrayList<>(unknownSearchWords);
searchWords.add(0, getUnknownSearchWord());
Collections.sort(searchWords, new Comparator<String>() {
private int lengthWithoutNumbers(String s) {
int len = 0;
for(int k = 0; k < s.length(); k++) {
if(s.charAt(k) >= '0' && s.charAt(k) <= '9') {
} else {
len++;
}
}
return len;
}
@Override
public int compare(String o1, String o2) {
int i1 = CommonWords.getCommonSearch(o1.toLowerCase());
int i2 = CommonWords.getCommonSearch(o2.toLowerCase());
if (i1 != i2) {
return icompare(i1, i2);
}
// compare length without numbers to not include house numbers
return -icompare(lengthWithoutNumbers(o1), lengthWithoutNumbers(o2));
}
});
wordToSearch = searchWords.get(0);
}
return wordToSearch;
}
}

View file

@ -19,6 +19,7 @@ public class SearchResult {
public String wordsSpan ;
public SearchResult parentSearchResult;
public Collection<String> otherWordsMatch = null;
public boolean firstUnknownWordMatches = true;
@ -27,10 +28,17 @@ public class SearchResult {
}
public int getFoundWordCount() {
if(otherWordsMatch != null) {
return otherWordsMatch.size() + 1;
int inc = 0;
if(firstUnknownWordMatches) {
inc = 1;
}
return 1;
if(otherWordsMatch != null) {
inc += otherWordsMatch.size();
}
if(parentSearchResult != null) {
inc += parentSearchResult.getFoundWordCount();
}
return inc;
}
public double getSearchDistance(LatLon location) {

View file

@ -1336,7 +1336,7 @@ public class GeoPointParserUtil {
}
public static class GeoParsedPoint {
private static final int NO_ZOOM = -1;
public static final int NO_ZOOM = -1;
private double lat = 0;
private double lon = 0;

View file

@ -686,7 +686,9 @@ public class OpeningHoursParser {
formatTime(stHour, stTime, b);
b.append("-"); //$NON-NLS-1$
formatTime(enHour, enTime, b);
}
if(off) {
b.append(" off");
}
}
return b.toString();
@ -864,7 +866,7 @@ public class OpeningHoursParser {
}
}
}
if (thisDay) {
if (thisDay && (startTimes == null || startTimes.isEmpty() || !off)) {
return -1;
}
return 0;
@ -1032,7 +1034,7 @@ public class OpeningHoursParser {
if(t.type == TokenType.TOKEN_UNKNOWN) {
findInArray(t, holidayStr, TokenType.TOKEN_HOLIDAY);
}
if(t.type == TokenType.TOKEN_UNKNOWN && "off".equals(t.text)) {
if(t.type == TokenType.TOKEN_UNKNOWN && ("off".equals(t.text) || "closed".equals(t.text))) {
t.type = TokenType.TOKEN_OFF_ON;
t.mainNumber = 0;
}
@ -1063,6 +1065,7 @@ public class OpeningHoursParser {
if(tokens.get(i).type == TokenType.TOKEN_HOUR_MINUTES ||
tokens.get(i).type == TokenType.TOKEN_OFF_ON) {
hoursSpecified = true;
break;
}
}
for(int i = 0; i < tokens.size(); i ++) {
@ -1187,231 +1190,7 @@ public class OpeningHoursParser {
* @return BasicRule if the String is successfully parsed and UnparseableRule otherwise
*/
public static OpeningHoursParser.OpeningHoursRule parseRule(String r) {
if(true) {
return parseRuleV2(r);
}
// replace words "sunrise" and "sunset" by real hours
r = r.toLowerCase();
final String[] daysStr = new String[]{"mo", "tu", "we", "th", "fr", "sa", "su"};
final String[] monthsStr = new String[]{"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
final String[] holidayStr = new String[]{"ph", "sh"};
final int daysInMonth = 31;
String sunrise = "07:00";
String sunset = "21:00";
String endOfDay = "24:00";
String localRuleString = r.replaceAll("sunset", sunset).replaceAll("sunrise", sunrise)
.replaceAll("\\+", "-" + endOfDay);
int startDay = -1;
int previousDay = -1;
int startMonth = -1;
int previousMonth = -1;
int startDayInMonth = -1;
int previousDayInMonth = -1;
int k = 0; // Position in opening_hours string
BasicOpeningHourRule basic = new BasicOpeningHourRule();
boolean[] days = basic.getDays();
boolean[] months = basic.getMonths();
boolean[] dayMonths = basic.getDayMonths();
// check 24/7
if ("24/7".equals(localRuleString)) {
Arrays.fill(days, true);
Arrays.fill(months, true);
Arrays.fill(dayMonths, true);
basic.addTimeRange(0, 24 * 60);
return basic;
}
for (; k < localRuleString.length(); k++) {
char ch = localRuleString.charAt(k);
if (Character.isDigit(ch)) {
// time starts
break;
}
if ((k + 2 < localRuleString.length())
&& localRuleString.substring(k, k + 3).equals("off")) {
// value "off" is found
break;
}
if (Character.isWhitespace(ch) || ch == ',') {
} else if (ch == '-') {
if (previousDay != -1) {
startDay = previousDay;
} else if (previousMonth != -1) {
startMonth = previousMonth;
} else {
return new UnparseableRule(r);
}
} else if (k < r.length() - 1) {
int i = 0;
for (String s : daysStr) {
if (s.charAt(0) == ch && s.charAt(1) == r.charAt(k + 1)) {
break;
}
i++;
}
if (i < daysStr.length) {
if (startDay != -1) {
for (int j = startDay; j <= i; j++) {
days[j] = true;
}
if (startDay > i) {// overflow handling, e.g. Su-We
for (int j = startDay; j <= 6; j++) {
days[j] = true;
}
for (int j = 0; j <= i; j++) {
days[j] = true;
}
}
startDay = -1;
} else {
days[i] = true;
}
previousDay = i;
} else {
// Read Month
int m = 0;
for (String s : monthsStr) {
if (s.charAt(0) == ch && s.charAt(1) == r.charAt(k + 1)
&& s.charAt(2) == r.charAt(k + 2)) {
break;
}
m++;
}
if (m < monthsStr.length) {
if (startMonth != -1) {
for (int j = startMonth; j <= m; j++) {
months[j] = true;
}
if (startMonth > m) {// overflow handling, e.g. Oct-Mar
for (int j = startMonth; j <= 11; j++) {
months[j] = true;
}
for (int j = 0; j <= m; j++) {
months[j] = true;
}
}
startMonth = -1;
} else {
months[m] = true;
}
previousMonth = m;
}
// Read days
m = 0;
int daysR = 1;
for(int t = 1; t <= daysInMonth; t++) {
String s = t +"";
if (s.charAt(0) == ch && (t < 10 || s.charAt(1) == r.charAt(k+1))) {
break;
}
daysR++;
}
if (daysR <= daysInMonth) {
if (startDayInMonth != -1) {
for (int j = startDayInMonth; j <= m; j++) {
dayMonths[j] = true;
}
if (startMonth > m) {// overflow handling, e.g. 25-2
for (int j = startDayInMonth; j <= daysInMonth; j++) {
dayMonths[j] = true;
}
for (int j = 0; j <= m; j++) {
dayMonths[j] = true;
}
}
startDayInMonth = -1;
} else {
dayMonths[m] = true;
}
previousDayInMonth = m;
}
if (previousMonth == -1) {
if (ch == 'p' && r.charAt(k + 1) == 'h') {
basic.publicHoliday = true;
}
if (ch == 's' && r.charAt(k + 1) == 'h') {
basic.schoolHoliday = true;
}
}
}
} else {
return new UnparseableRule(r);
}
}
if (previousDay == -1 && !basic.publicHoliday && !basic.schoolHoliday) {
// no days given => take all days.
Arrays.fill(days, true);
}
if (previousMonth == -1) {
// no month given => take all months.
Arrays.fill(months, true);
}
if (previousDayInMonth == -1) {
// no days given => take all days.
Arrays.fill(dayMonths, true);
}
String timeSubstr = localRuleString.substring(k);
String[] times = timeSubstr.split(",");
boolean timesExist = true;
for (int i = 0; i < times.length; i++) {
String time = times[i];
time = time.trim();
if (time.length() == 0) {
continue;
}
if (time.equals("off")) {
break; // add no time values
}
if (time.equals("24/7")) {
// for some reason, this is used. See tagwatch.
basic.addTimeRange(0, 24 * 60);
break;
}
String[] stEnd = time.split("-"); //$NON-NLS-1$
if (stEnd.length != 2) {
if (i == times.length - 1 && basic.getStartTime() == 0 && basic.getEndTime() == 0) {
return new UnparseableRule(r);
}
continue;
}
timesExist = true;
int st;
int end;
try {
int i1 = stEnd[0].indexOf(':');
int i2 = stEnd[1].indexOf(':');
int startHour, startMin, endHour, endMin;
if (i1 == -1) {
// if no minutes are given, try complete value as hour
startHour = Integer.parseInt(stEnd[0].trim());
startMin = 0;
} else {
startHour = Integer.parseInt(stEnd[0].substring(0, i1).trim());
startMin = Integer.parseInt(stEnd[0].substring(i1 + 1).trim());
}
if (i2 == -1) {
// if no minutes are given, try complete value as hour
endHour = Integer.parseInt(stEnd[1].trim());
endMin = 0;
} else {
endHour = Integer.parseInt(stEnd[1].substring(0, i2).trim());
endMin = Integer.parseInt(stEnd[1].substring(i2 + 1).trim());
}
st = startHour * 60 + startMin;
end = endHour * 60 + endMin;
} catch (NumberFormatException e) {
return new UnparseableRule(r);
}
basic.addTimeRange(st, end);
}
if (!timesExist) {
return new UnparseableRule(r);
}
return basic;
return parseRuleV2(r);
}
/**
@ -1511,17 +1290,17 @@ public class OpeningHoursParser {
}
public static void main(String[] args) throws ParseException {
// FIXME bug
// 0. not supported MON DAY-MON DAY (only supported Feb 2-14 or Feb-Oct: 09:00-17:30)
// parseOpenedHours("Feb 16-Oct 15: 09:00-18:30; Oct 16-Nov 15: 09:00-17:30; Nov 16-Feb 15: 09:00-16:30");
// not supported (,)
// 1. not supported (,)
// hours = parseOpenedHours("Mo-Su 07:00-23:00, Fr 08:00-20:00");
// 2. not supported break properly
// parseOpenedHours("Sa-Su 10:00-17:00 || \"by appointment\"");
// comment is dropped
// not properly supported
// 3. not properly supported
// hours = parseOpenedHours("Mo-Su (sunrise-00:30)-(sunset+00:30)");
// Test basic case
@ -1551,6 +1330,7 @@ public class OpeningHoursParser {
hours = parseOpenedHours("Mo-Sa 08:30-14:40; Tu 08:00 - 14:00"); //$NON-NLS-1$
System.out.println(hours);
testOpened("07.08.2012 14:20", hours, false);
testOpened("07.08.2012 08:15", hours, true); // Tuesday
// test off value
hours = parseOpenedHours("Mo-Sa 09:00-18:25; Th off"); //$NON-NLS-1$
@ -1692,6 +1472,15 @@ public class OpeningHoursParser {
testOpened("25.12.2015 14:00", hours, false);
testOpened("24.12.2015 08:00", hours, true);
// test time off (not days
hours = parseOpenedHours("Mo-Fr 08:30-17:00; 12:00-12:40 off;");
System.out.println(hours);
testOpened("07.05.2017 14:00", hours, false); // Sunday
testOpened("06.05.2017 12:15", hours, false); // Saturday
testOpened("05.05.2017 14:00", hours, true); // Friday
testOpened("05.05.2017 12:15", hours, false);
testOpened("05.05.2017 12:00", hours, false);
testOpened("05.05.2017 11:45", hours, true);
// Test holidays
String hoursString = "mo-fr 11:00-21:00; PH off";
@ -1699,5 +1488,6 @@ public class OpeningHoursParser {
testParsedAndAssembledCorrectly(hoursString, hours);
}
}

View file

@ -714,6 +714,13 @@
</intent-filter>
</service>
<service android:name="net.osmand.aidl.OsmandAidlService" android:exported="true" >
<intent-filter>
<action android:name="net.osmand.aidl.OsmandAidlService"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
<receiver android:name="net.osmand.plus.OnNavigationServiceAlarmReceiver" />
<receiver android:name="net.osmand.plus.notifications.NotificationDismissReceiver" />

View file

@ -126,6 +126,11 @@ android {
dimension "version"
applicationId "net.osmand"
}
freeres {
dimension "version"
applicationId "net.osmand"
resConfig "en"
}
full {
dimension "version"
applicationId "net.osmand.plus"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -99,7 +99,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_content_padding"
android:orientation="horizontal"
android:visibility="gone">
android:visibility="visible">
<android.support.v7.widget.AppCompatImageView
android:layout_width="54dp"
@ -149,7 +149,7 @@
android:paddingTop="4dp"
android:textColor="@color/color_white"
android:visibility="visible"
tools:text="GET FOR E5"/>
tools:text="GET FOR 5 EUR"/>
</LinearLayout>
@ -162,7 +162,7 @@
android:layout_marginLeft="54dp"
android:layout_marginTop="@dimen/list_content_padding"
android:background="@color/dashboard_divider_dark"
android:visibility="gone"/>
android:visibility="visible"/>
<LinearLayout
android:id="@+id/osmLiveLayout"
@ -219,7 +219,7 @@
android:paddingRight="14dp"
android:paddingTop="4dp"
android:textColor="@color/color_white"
tools:text="GET FOR 1,5E PER MONTH"/>
tools:text="GET FOR 1,5 EUR PER MONTH"/>
</LinearLayout>

View file

@ -16,7 +16,7 @@
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle_blue"
android:contentDescription="@string/zoomIn"
android:contentDescription="@string/configure_screen_quick_action"
android:layout_gravity="bottom|right"
android:visibility="gone"
tools:visibility="visible"

View file

@ -4,23 +4,96 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp">
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
<LinearLayout
android:id="@+id/empty_search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
tools:text="Amsterdam"/>
android:layout_height="wrap_content"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:orientation="horizontal"
android:visibility="visible">
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_empty_state_search"
android:tint="#ec572e"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
android:text="@string/nothing_found"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:text="@string/nothing_found_descr"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"/>
</LinearLayout>
<View
android:id="@+id/more_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/increase_search_radius"/>
</LinearLayout>
</LinearLayout>

View file

@ -2900,7 +2900,7 @@ OsmAnd és de codi obert i es desenvolupa activament . Tothom pot recolzar l\'ap
<string name="srtm_color_scheme">Combinació de colors</string>
<string name="show_from_zoom_level">Mostra segons el nivell d\'escala</string>
<string name="routing_attr_allow_private_name">Permet l\'accés privat</string>
<string name="routing_attr_allow_private_name_description">Permet l\'accés a zones privades</string>
<string name="routing_attr_allow_private_description">Permet l\'accés a zones privades</string>
<string name="hillshade_menu_download_descr">Per veure l\'ombrejat de relleu al mapa cal baixar un mapa especial d\'aquesta zona.</string>
<string name="hillshade_purchase_header">Per veure l\'ombrejat de relleu al mapa cal comprar i instal·lar un connector</string>
<string name="shared_string_plugin">Connector</string>

View file

@ -2767,7 +2767,7 @@ Pokud potřebujete pomoci s aplikací OsmAnd, prosím kontaktujte naši podporu
<string name="srtm_color_scheme">Barevné schéma</string>
<string name="show_from_zoom_level">Zobrazit od úrovně přiblížení</string>
<string name="routing_attr_allow_private_name">Povolit soukromý přístup</string>
<string name="routing_attr_allow_private_name_description">Umožnit přístup k soukromým oblastem</string>
<string name="routing_attr_allow_private_description">Umožnit přístup k soukromým oblastem</string>
<string name="display_zoom_level">Zobrazit úrovně přiblížení: %1$s</string>
<string name="favorite_group_name">Název skupiny</string>
<string name="change_color">Změnit barvu</string>

View file

@ -3110,7 +3110,7 @@ Tidligere destination bliver sidste mellemliggende punkt.</string>
<string name="srtm_color_scheme">Farveskema</string>
<string name="show_from_zoom_level">Vis fra zoomniveau</string>
<string name="routing_attr_allow_private_name">Tillad privat adgang</string>
<string name="routing_attr_allow_private_name_description">Giver adgang til private områder</string>
<string name="routing_attr_allow_private_description">Giver adgang til private områder</string>
<string name="srtm_menu_download_descr">For se højdekurver på kortet, hent højdekurvekort over området.</string>
<string name="shared_string_plugin">Udvidelse</string>
<string name="srtm_purchase_header">For at se højdekurver på kortet, køb og installer udvidelsen</string>

View file

@ -2978,7 +2978,7 @@ Abgedeckte Fläche: %1$s x %2$s</string>
<string name="save_poi_too_many_uppercase">Der Name enthält zu viele Großbuchstaben. Möchten Sie den Vorgang fortsetzen?</string>
<string name="display_zoom_level">Bildschirm-Zoomstufe: %1$s</string>
<string name="routing_attr_allow_private_name">Privatwege berücksichtigen</string>
<string name="routing_attr_allow_private_name_description">Zufahrten zu Privatgrund erlauben</string>
<string name="routing_attr_allow_private_description">Zufahrten zu Privatgrund erlauben</string>
<string name="srtm_color_scheme">Farbschema</string>
<string name="quick_action_showhide_osmbugs_title">OSM-Notizen ein-/ausblenden</string>
<string name="quick_action_osmbugs_show">OSM-Notizen einblenden</string>

View file

@ -2903,7 +2903,7 @@ De Afganujo al Zimbabvo, de Aŭstralio al Usono, Argentino, Brazilo, Kanado, Fra
<string name="srtm_color_scheme">Kolor-skemo</string>
<string name="show_from_zoom_level">Vidigi de skal-nivelo</string>
<string name="routing_attr_allow_private_name">Permesi privatan aliron</string>
<string name="routing_attr_allow_private_name_description">Permesas aliron al privataj areoj</string>
<string name="routing_attr_allow_private_description">Permesas aliron al privataj areoj</string>
<string name="display_zoom_level">Vidigi de skal-nivelo: %1$s</string>
<string name="route_is_too_long_v2">Tiu ĉi kurso povas esti tro longa por kalkuli. Bonvolu aldoni intercelojn, se neniu rezulto estos trovita post 10 minutoj.</string>
<string name="save_poi_too_many_uppercase">Nomo enhavas tro multe da grandaj literoj? Ĉu vi volas pluigi?</string>

View file

@ -2863,7 +2863,7 @@ Algunas de las principales funciones:
<string name="srtm_color_scheme">Esquema de color</string>
<string name="show_from_zoom_level">Mostrar desde el nivel de ampliación</string>
<string name="routing_attr_allow_private_name">Permitir el acceso privado</string>
<string name="routing_attr_allow_private_name_description">Permite acceder a áreas privadas</string>
<string name="routing_attr_allow_private_description">Permite acceder a áreas privadas</string>
<string name="display_zoom_level">Nivel de ampliación de pantalla: %1$s</string>
<string name="route_is_too_long_v2">Esta ruta puede ser muy larga para calcular. Añade destinos intermedios si no se encuentran resultados dentro de los 10 minutos.</string>
<string name="srtm_menu_download_descr">Para ver las curvas de nivel en el mapa, debes descargar el mapa de curvas de nivel de esta región.</string>

View file

@ -2862,7 +2862,7 @@ Algunas de las principales funciones:
<string name="srtm_color_scheme">Esquema de color</string>
<string name="show_from_zoom_level">Mostrar desde el nivel de ampliación</string>
<string name="routing_attr_allow_private_name">Permitir el acceso privado</string>
<string name="routing_attr_allow_private_name_description">Permite acceder a áreas privadas</string>
<string name="routing_attr_allow_private_description">Permite acceder a áreas privadas</string>
<string name="display_zoom_level">Nivel de ampliación de pantalla: %1$s</string>
<string name="route_is_too_long_v2">Esta ruta puede ser muy larga para calcular. Añade destinos intermedios si no se encuentran resultados dentro de los 10 minutos.</string>
<string name="srtm_menu_download_descr">Para ver las curvas de nivel en el mapa, debes descargar el mapa de curvas de nivel de esta región.</string>

View file

@ -2851,7 +2851,7 @@ Algunas de las características principales:
<string name="srtm_color_scheme">Esquema de color</string>
<string name="show_from_zoom_level">Visualización del nivel de acercamiento</string>
<string name="routing_attr_allow_private_name">Permitir el acceso privado</string>
<string name="routing_attr_allow_private_name_description">Permite acceder a áreas privadas</string>
<string name="routing_attr_allow_private_description">Permite acceder a áreas privadas</string>
<string name="display_zoom_level">Nivel de acercamiento de la pantalla: %1$s</string>
<string name="route_is_too_long_v2">Esta ruta puede ser muy larga para calcular. Añade destinos intermedios si no se encuentran resultado dentro de los 10 minutos.</string>
<string name="quick_action_showhide_osmbugs_title">Mostrar/ocultar notas OSM</string>

View file

@ -2971,7 +2971,7 @@ Fonctionnalités principales :
<string name="edit_name">Modifier le nom</string>
<string name="save_poi_too_many_uppercase">Le nom contient beaucoup de majuscules. Souhaitez-vous continuer ?</string>
<string name="routing_attr_allow_private_name">Autoriser les accès privés</string>
<string name="routing_attr_allow_private_name_description">Autoriser l\'accès aux zones privées</string>
<string name="routing_attr_allow_private_description">Autoriser l\'accès aux zones privées</string>
<string name="display_zoom_level">Niveau de zoom de l\'affichage : %1$s</string>
<string name="srtm_color_scheme">Couleur du thème</string>
<string name="show_from_zoom_level">Afficher à partir du niveau de zoom</string>

View file

@ -2498,7 +2498,7 @@ Pódese pechar esta vista desactivándoa aquí ou cambiando o «Estilo de mapa»
<string name="srtm_purchase_header">Para ver as liñas de nivel no mapa hai que comprar e instalar un engadido</string>
<string name="srtm_color_scheme">Esquema de cores</string>
<string name="routing_attr_allow_private_name">Permitir acceso privado</string>
<string name="routing_attr_allow_private_name_description">Permitir acceso a zonas privadas</string>
<string name="routing_attr_allow_private_description">Permitir acceso a zonas privadas</string>
<string name="change_color">Cambiar a cor</string>
<string name="edit_name">Editar o nome</string>
<string name="lang_fy">Frisón</string>

View file

@ -2983,7 +2983,7 @@ OsmAndとOSMをサポートする方法として現状最適な方法である
<string name="srtm_purchase_header">等高線をマップ上で見るには、プラグインの購入とインストールが必要です</string>
<string name="show_from_zoom_level">表示ズームレベル</string>
<string name="routing_attr_allow_private_name">プライベートアクセスを許可</string>
<string name="routing_attr_allow_private_name_description">プライベートエリアにアクセスを許可</string>
<string name="routing_attr_allow_private_description">プライベートエリアにアクセスを許可</string>
<string name="display_zoom_level">表示ズームレベル: %1$s</string>
<string name="index_item_depth_points_southern_hemisphere">南半球の深度マップ</string>
<string name="index_item_depth_points_northern_hemisphere">北半球の深度マップ</string>

View file

@ -1615,10 +1615,10 @@ Reģistrētu lietotāju grupām ir pieejamas tādas papildiespējas kā grupas a
<string name="gpx_info_distance">Distance: %1$s (%2$s punkti) </string>
<string name="gpx_info_start_time">Sākums: %1$tF, %1$tT </string>
<string name="gpx_info_end_time">Beigas: %1$tF, %1$tT </string>
<string name="gpx_info_average_speed">Vidējais ātrums: %11$s </string>
<string name="gpx_info_average_speed">Vidējais ātrums: %1$s </string>
<string name="gpx_info_maximum_speed">Maksimālais ātrums: %1$s </string>
<string name="gpx_info_avg_altitude">Vidējais augstums: %1$s</string>
<string name="gpx_info_diff_altitude">Augstuma starpība: %11$s</string>
<string name="gpx_info_diff_altitude">Augstuma starpība: %1$s</string>
<string name="gpx_info_asc_altitude">Kāpumi: %1$s</string>
<string name="gpx_timespan">Laika periods: %1$s</string>
<string name="gpx_timemoving">Laiks kustībā: %1$s</string>
@ -2557,7 +2557,7 @@ Un vēl...
<string name="coords_format_descr">Ģeogrāfisko koordināšu formāts</string>
<string name="lang_hsb">Sorbu (Augšu)</string>
<string name="search_map_hint">Meklēt pilsētu vai reğionu</string>
<string name="route_roundabout_short">Brauciet pa %$d izeju</string>
<string name="route_roundabout_short">Brauciet pa %1$d izeju</string>
<string name="upload_poi">Augšupielādēt POI</string>
<string name="route_calculation">Maršruta aprēķināšana</string>
<string name="gpx_no_tracks_title">Nav vēl izveidoti treki</string>

View file

@ -2157,7 +2157,7 @@ Representerer området: %1$s x %2$s</string>
<string name="hide_from_zoom_level">Skjul fra zoom-nivå</string>
<string name="show_from_zoom_level">Vis fra zoom-nivå</string>
<string name="routing_attr_allow_private_name">Tillat privat adgang</string>
<string name="routing_attr_allow_private_name_description">Tillat adgang til private områder</string>
<string name="routing_attr_allow_private_description">Tillat adgang til private områder</string>
<string name="favorite_group_name">Gruppenavn</string>
<string name="change_color">Endre farge</string>
<string name="edit_name">Rediger navn</string>

View file

@ -2393,11 +2393,11 @@ Lengtegraad:\t\t%2$s</string>
<string name="clear_updates_proposition_message">Je kan gedownloade updates verwijderen en terugkeren naar de originele kaart</string>
<string name="add_time_span">Periode toevoegen</string>
<string name="road_blocked">Weg geblokkeerd</string>
<string name="shared_string_select">Blokkeer...</string>
<string name="shared_string_select">Selekteer</string>
<string name="reports_for">Verslag voor:</string>
<string name="data_is_not_available">Gegevens niet beschikbaar</string>
<string name="rendering_attr_hideUnderground_name">Ondergrondse objecten</string>
<string name="shared_string_read_more">Lees meer...</string>
<string name="shared_string_read_more">Lees meer</string>
<string name="shared_string_status">Status</string>
<string name="shared_string_save_changes">Wijzigingen opslaan</string>
<string name="shared_string_email_address">E-mailadres</string>
@ -2945,7 +2945,7 @@ voor Gebied: %1$s x %2$s</string>
<string name="srtm_color_scheme">Kleurschema</string>
<string name="show_from_zoom_level">Toon vanaf dit zoom-niveau</string>
<string name="routing_attr_allow_private_name">Privé-wegen toestaan</string>
<string name="routing_attr_allow_private_name_description">Ga ook over privé-terreinen</string>
<string name="routing_attr_allow_private_description">Ga ook over privé-terreinen</string>
<string name="display_zoom_level">Zoomniveau weergave: %1$s</string>
<string name="route_is_too_long_v2">Deze route is misschien te lang. Voeg tussenpunten toe als binnen 10 minuten geen route berekend is.</string>
<string name="osmand_extended_description_part1">"

View file

@ -2964,7 +2964,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="srtm_color_scheme">Zestaw kolorów</string>
<string name="show_from_zoom_level">Wyświetlanie od stopnia przybliżenia</string>
<string name="routing_attr_allow_private_name">Dozwolony prywatny dostęp</string>
<string name="routing_attr_allow_private_name_description">Dozwolony dostęp do prywatnych stref</string>
<string name="routing_attr_allow_private_description">Dozwolony dostęp do prywatnych stref</string>
<string name="route_is_too_long_v2">Ta trasa może być zbyt długa do wyznaczenia. Prosimy dodać punkty pośrednie, jeżeli nie dostaniesz wyniku w ciągu 10 minut.</string>
<string name="save_poi_too_many_uppercase">Nazwa zawiera zbyt wiele wielkich liter. Czy chcesz kontynuować?</string>
<string name="shared_string_plugin">Wtyczka</string>

View file

@ -3103,9 +3103,9 @@
<string name="poi_mdf">Главный кросс</string>
<string name="poi_min_age">Минимальный возраст</string>
<string name="poi_organic_yes">Биопродукты: есть</string>
<string name="poi_organic_no">Биопродукты: отсутствуют</string>
<string name="poi_organic_only">Только биопродукты</string>
<string name="poi_organic_yes">Есть</string>
<string name="poi_organic_no">Отсутствуют</string>
<string name="poi_organic_only">Исключительно</string>
<string name="poi_traffic_mirror">Дорожное зеркало</string>
@ -3383,4 +3383,21 @@
<string name="poi_electronics_repair_phone">Ремонт электроники: телефоны</string>
<string name="poi_electronics_repair_tv">Ремонт электроники: телевизоры</string>
<string name="poi_resort_kids_camp">Детский лагерь</string>
<string name="poi_music_school">Музыкальная школа</string>
<string name="poi_language_school">Школа иностранных языков</string>
<string name="poi_life_ring">Спасательный круг</string>
<string name="poi_zoo_petting_zoo">Контактный зоопарк</string>
<string name="poi_zoo_wildlife_park">Парк дикой природы</string>
<string name="poi_zoo_enclosure">Клетки</string>
<string name="poi_zoo_safari_park">Сафари парк</string>
<string name="poi_zoo_birds">Птицы</string>
<string name="poi_zoo_aviary">Вольер для птиц</string>
<string name="poi_zoo_falconry">Соколиная охота</string>
<string name="poi_zoo_reptile">Рептилии</string>
<string name="poi_zoo_type">Тип</string>
</resources>

View file

@ -1,5 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="private_access_routing_req">Пункт назначения находится в области с частным доступом. Вы хотите разрешить доступ к частным дорогам для этой поездки?</string>
<string name="restart_search">Искать снова</string>
<string name="increase_search_radius">Увеличить радиус поиска</string>
<string name="nothing_found">Ничего не найдено :(</string>
<string name="nothing_found_descr">Попробуйте изменить запрос или увеличить радиус поиска</string>
<string name="quick_action_showhide_osmbugs_title">Показать/скрыть заметки OSM</string>
<string name="quick_action_osmbugs_show">Показать заметки OSM</string>
<string name="quick_action_osmbugs_hide">Скрыть заметки OSM</string>
<string name="quick_action_showhide_osmbugs_descr">Нажатие на кнопку действия отобразит/скроет заметки OSM с карты</string>
<string name="sorted_by_distance">Отсортировано по расстоянию</string>
<string name="search_favorites">Поиск в избранном</string>
<string name="hillshade_menu_download_descr">Для того, чтобы отобразить затенение рельефа, вам нужно загрузить специальную карту для этой области</string>
<string name="hillshade_purchase_header">Для того, чтобы отобразить затенение рельефа, вам нужно купить и установить плагин</string>
<string name="srtm_menu_download_descr">Для того, чтобы отобразить линии контуров рельефа, вам нужно загрузить специальную карту для этой области</string>
@ -15,7 +26,7 @@
<string name="edit_name">Изменить имя</string>
<string name="route_is_too_long_v2">Возможно, потребуется очень много времени для локального (оффлайн) расчёта маршрута. Пожалуйста, добавьте один или более промежуточных пунктов на маршруте, если расчет не закончен через 10 или более минут.</string>
<string name="routing_attr_allow_private_name">Разрешить частный доступ</string>
<string name="routing_attr_allow_private_name_description">Разрешить доступ к частным владениям</string>
<string name="routing_attr_allow_private_description">Разрешить доступ к частным владениям</string>
<string name="shared_string_overview">Обзор</string>
<string name="select_street">Выберите улицу</string>
<string name="shared_string_in_name">в %1$s</string>
@ -386,7 +397,7 @@
<string name="live_monitoring_interval">Интервал онлайн слежения</string>
<string name="live_monitoring_url_descr">Укажите веб-адрес со следующими параметрами: lat={0}, lon={1}, timestamp={2}, hdop={3}, altitude={4}, speed={5}, bearing={6}</string>
<string name="live_monitoring_url">Web адрес онлайн слежения</string>
<string name="gpx_monitoring_disabled_warn">Записывать треки используя GPX виджет или выбрав \"Запись поездки\" в Настройках.</string>
<string name="gpx_monitoring_disabled_warn">Записать трек можно с помощью GPX виджета или выбрав \"Запись поездки\" в Настройках.</string>
<string name="show_current_gpx_title">Показывать текущий путь</string>
<string name="free_version_message">Бесплатная версия OsmAnd ограничена %1$s загрузками и не поддерживает геостатьи из wikipedia.</string>
<string name="free_version_title">Бесплатная версия</string>
@ -825,8 +836,8 @@
<string name="save_current_track">Сохранить текущий трек GPX</string>
<string name="save_track_interval_descr">Выберите интервал для записи трека во время навигации</string>
<string name="save_track_interval">Интервал записи во время навигации</string>
<string name="save_track_to_gpx_descrp">Треки будут сохранены в папку для треков во время навигации</string>
<string name="save_track_to_gpx">Запись трека в файл GPX во время навигации</string>
<string name="save_track_to_gpx_descrp">Во время навигации треки будут автоматически сохранены в папку с треками в формате GPX</string>
<string name="save_track_to_gpx">Автозапись трека во время навигации</string>
<string name="update_tile">Обновить карту</string>
<string name="reload_tile">Обновить часть карты</string>
<string name="open_street_map_login_descr">Укажите имя пользователя (требуется для работы с OSM)</string>
@ -1170,7 +1181,7 @@
<string name="precise_routing_mode">Точный маршрут (alpha)</string>
<string name="support_new_features_descr">Пожертвуйте, чтобы увидеть новые опции реализованными в приложении</string>
<string name="precise_routing_mode_descr">Включите, для расчёта точных маршрутов без затруднений. Всё ещё ограниченн расстоянием и медленный.</string>
<string name="download_hillshade_maps">Затемнение рельефа</string>
<string name="download_hillshade_maps">Затенение рельефа</string>
<string name="av_use_external_camera_descr">Использовать системную программу для фото</string>
<string name="av_use_external_camera">Использовать приложение Камера</string>
<string name="index_name_openmaps">OpenMaps - Европа</string>

View file

@ -3035,7 +3035,7 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="srtm_color_scheme">Ischema de colores</string>
<string name="show_from_zoom_level">Ammustra dae su livellu de ismanniamentu</string>
<string name="routing_attr_allow_private_name">Permiti s\'atzessu privadu</string>
<string name="routing_attr_allow_private_name_description">Permiti s\'atzessu a sas àreas privadas</string>
<string name="routing_attr_allow_private_description">Permiti s\'atzessu a sas àreas privadas</string>
<string name="hillshade_menu_download_descr">Pro bìdere sas umbraduras de sos rilievos in sa mapa depes iscarrigare una mapa ispetziale de custa regione.</string>
<string name="hillshade_purchase_header">Pro bìdere sas umbraduras de sos rilievos in sa mapa depes comporare e installare s\'estensione</string>
<string name="hide_from_zoom_level">Cua dae su livellu de ismanniamentu</string>

View file

@ -2877,7 +2877,7 @@ Zodpovedá oblasti: %1$s x %2$s</string>
<string name="srtm_color_scheme">Farebná schéma</string>
<string name="show_from_zoom_level">Zobraziť od úrovne priblíženia</string>
<string name="routing_attr_allow_private_name">Povoliť súkromný prístup</string>
<string name="routing_attr_allow_private_name_description">Povoliť prístup do súkromných oblastí</string>
<string name="routing_attr_allow_private_description">Povoliť prístup do súkromných oblastí</string>
<string name="display_zoom_level">Priblíženie zobrazenia: %1$s</string>
<string name="route_is_too_long_v2">Táto trasa môže byť príliš dlhá na výpočet. Ak sa nenájde výsledok do 10 minút, vložte prosím tranzitné ciele.</string>
<string name="save_poi_too_many_uppercase">Názov obsahuje príliš veľa veľkých písmen. Chcete pokračovať?</string>

View file

@ -2877,7 +2877,7 @@ Koda predstavlja območje: %1$s x %2$s</string>
<string name="select_postcode">Izberite poštno številko</string>
<string name="srtm_color_scheme">Barvna shema</string>
<string name="routing_attr_allow_private_name">Dovoli zasebni dostop</string>
<string name="routing_attr_allow_private_name_description">Dovoli dostop do zasebnih območij</string>
<string name="routing_attr_allow_private_description">Dovoli dostop do zasebnih območij</string>
<string name="favorite_group_name">Ime skupine</string>
<string name="change_color">Spremeni barvo</string>
<string name="edit_name">Uredi ime</string>

View file

@ -3050,7 +3050,7 @@ OsmAnd 是開放原始碼,而且正在積極的開發。應用程式從報告
<string name="srtm_color_scheme">色調配置</string>
<string name="show_from_zoom_level">由縮放級別來顯示</string>
<string name="routing_attr_allow_private_name">允許私人進入</string>
<string name="routing_attr_allow_private_name_description">允許進入私有區域</string>
<string name="routing_attr_allow_private_description">允許進入私有區域</string>
<string name="srtm_menu_download_descr">要觀看地圖上的等高線,您需要下載該地區的等高線圖。</string>
<string name="shared_string_plugin">外掛元件</string>
<string name="srtm_purchase_header">要看到地圖上的等高線,您需要購買並安裝外掛元件</string>

View file

@ -86,6 +86,7 @@
<string name="poi_vacuum_cleaner_filter">Vacuum cleaner</string>
<string name="poi_free_flying_characteristic">Characteristic</string>
<string name="poi_cafeteria">Cafeteria</string>
<string name="poi_zoo_type">Type</string>
<!-- categories -->
<string name="poi_shop">Store</string>
@ -3089,9 +3090,9 @@
<string name="poi_mdf">Main Distribution Frame</string>
<string name="poi_min_age">Minimum age</string>
<string name="poi_organic_yes">Organic food: yes</string>
<string name="poi_organic_no">Organic food: no</string>
<string name="poi_organic_only">Organic food only</string>
<string name="poi_organic_yes">Yes</string>
<string name="poi_organic_no">No</string>
<string name="poi_organic_only">Only</string>
<string name="poi_traffic_mirror">Traffic mirror</string>
@ -3353,4 +3354,19 @@
<string name="poi_electronics_repair_phone">Electronics repair: phone</string>
<string name="poi_electronics_repair_tv">Electronics repair: tv</string>
<string name="poi_resort_kids_camp">Kids camp</string>
<string name="poi_music_school">Music school</string>
<string name="poi_language_school">Language school</string>
<string name="poi_life_ring">Life ring</string>
<string name="poi_zoo_petting_zoo">Petting zoo</string>
<string name="poi_zoo_wildlife_park">Wildlife park</string>
<string name="poi_zoo_enclosure">Enclosure</string>
<string name="poi_zoo_safari_park">Safari park</string>
<string name="poi_zoo_birds">Birds</string>
<string name="poi_zoo_aviary">Aviary</string>
<string name="poi_zoo_falconry">Falconry</string>
<string name="poi_zoo_reptile">Reptile</string>
</resources>

View file

@ -9,6 +9,28 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="shared_string_permissions">Permissions</string>
<string name="import_gpx_failed_descr">OsmAnd cannot import the file. Please check if OsmAnd has permission to read file from its location.</string>
<string name="distance_moving">Distance corrected</string>
<string name="mapillary_image">Mapillary image</string>
<string name="open_mapillary">Open Mapillary</string>
<string name="shared_string_install">Install</string>
<string name="improve_coverage_mapillary">Improve photo coverage with Mapillary</string>
<string name="improve_coverage_install_mapillary_desc">You can take your own photos or series of photos and attach them to this map location.\n\nTo do this you need to install the Mapillary app from the Google Play Store.</string>
<string name="online_photos">Online photos</string>
<string name="shared_string_add_photos">Add photos</string>
<string name="no_photos_descr">We do not have photos for this location</string>
<string name="mapillary_action_descr">Contribute with your own street-level views of this location via Mapillary.</string>
<string name="mapillary_widget">Mapillary widget</string>
<string name="mapillary_widget_descr">Allows you to quickly contribute to Mapillary</string>
<string name="mapillary_descr">Online street-level photos for everyone. Discover places, collaborate, capture the world.</string>
<string name="mapillary">Mapillary</string>
<string name="plugin_mapillary_descr">Street-level photos for everyone. Discover places, collaborate, capture the world.</string>
<string name="private_access_routing_req">Your destination is located in an area with private access. Do you want to allow access to the private roads for this trip?</string>
<string name="restart_search">Restart search</string>
<string name="increase_search_radius">Increase search radius</string>
<string name="nothing_found">Nothing found :(</string>
<string name="nothing_found_descr">Try to change search query or increase radius of search</string>
<string name="quick_action_showhide_osmbugs_title">Show/hide OSM Notes</string>
<string name="quick_action_osmbugs_show">Show OSM Notes</string>
<string name="quick_action_osmbugs_hide">Hide OSM Notes</string>
@ -24,7 +46,7 @@
<string name="srtm_color_scheme">Color scheme</string>
<string name="show_from_zoom_level">Display from zoom level</string>
<string name="routing_attr_allow_private_name">Allow private access</string>
<string name="routing_attr_allow_private_name_description">Allow access to private areas</string>
<string name="routing_attr_allow_private_description">Allow access to private areas</string>
<string name="display_zoom_level">Display zoom level: %1$s</string>
<string name="favorite_group_name">Group name</string>
<string name="change_color">Change color</string>
@ -952,8 +974,8 @@
<string name="save_track_to_gpx_globally_descr">General position logging to a GPX file can be turned on or off using the GPX logging widget on the map screen</string>
<string name="save_current_track_descr">Save current track to SD now</string>
<string name="save_current_track">Save current GPX track</string>
<string name="save_track_to_gpx">Log track to GPX file during navigation</string>
<string name="save_track_to_gpx_descrp">Tracks will be saved to the tracks folder during navigation</string>
<string name="save_track_to_gpx">Auto-recording track during navigation</string>
<string name="save_track_to_gpx_descrp">Tracks will be automatically saved to the tracks folder during navigation in GPX format</string>
<string name="save_track_interval_globally">Logging interval</string>
<string name="save_track_interval">Logging interval during navigation</string>
<string name="save_track_interval_descr">Choose logging interval for track recording during navigation</string>

View file

@ -0,0 +1,57 @@
package net.osmand.aidl;
import net.osmand.aidl.map.ALatLon;
import net.osmand.aidl.map.SetMapLocationParams;
import net.osmand.aidl.mapmarker.AMapMarker;
import net.osmand.aidl.mapmarker.AddMapMarkerParams;
import net.osmand.aidl.mapmarker.RemoveMapMarkerParams;
import net.osmand.aidl.mapmarker.UpdateMapMarkerParams;
import net.osmand.aidl.calculateroute.CalculateRouteParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.mapwidget.AMapWidget;
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.aidl.maplayer.point.AddMapPointParams;
import net.osmand.aidl.maplayer.point.RemoveMapPointParams;
import net.osmand.aidl.maplayer.point.UpdateMapPointParams;
import net.osmand.aidl.maplayer.AMapLayer;
import net.osmand.aidl.maplayer.AddMapLayerParams;
import net.osmand.aidl.maplayer.RemoveMapLayerParams;
import net.osmand.aidl.maplayer.UpdateMapLayerParams;
interface IOsmAndAidlInterface {
boolean addMapMarker(in AddMapMarkerParams params);
boolean removeMapMarker(in RemoveMapMarkerParams params);
boolean updateMapMarker(in UpdateMapMarkerParams params);
boolean addMapWidget(in AddMapWidgetParams params);
boolean removeMapWidget(in RemoveMapWidgetParams params);
boolean updateMapWidget(in UpdateMapWidgetParams params);
boolean addMapPoint(in AddMapPointParams params);
boolean removeMapPoint(in RemoveMapPointParams params);
boolean updateMapPoint(in UpdateMapPointParams params);
boolean addMapLayer(in AddMapLayerParams params);
boolean removeMapLayer(in RemoveMapLayerParams params);
boolean updateMapLayer(in UpdateMapLayerParams params);
boolean importGpx(in ImportGpxParams params);
boolean showGpx(in ShowGpxParams params);
boolean hideGpx(in HideGpxParams params);
boolean getActiveGpx(out List<ASelectedGpxFile> files);
boolean setMapLocation(in SetMapLocationParams params);
boolean calculateRoute(in CalculateRouteParams params);
}

View file

@ -0,0 +1,637 @@
package net.osmand.aidl;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.view.View;
import net.osmand.IndexConstants;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.maplayer.AMapLayer;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.aidl.mapmarker.AMapMarker;
import net.osmand.aidl.mapwidget.AMapWidget;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.AidlMapLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import net.osmand.util.Algorithms;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class OsmandAidlApi {
private static final String AIDL_REFRESH_MAP = "aidl_refresh_map";
private static final String AIDL_SET_MAP_LOCATION = "aidl_set_map_location";
private static final String AIDL_LATITUDE = "aidl_latitude";
private static final String AIDL_LONGITUDE = "aidl_longitude";
private static final String AIDL_ZOOM = "aidl_zoom";
private static final String AIDL_ANIMATED = "aidl_animated";
private static final String AIDL_OBJECT_ID = "aidl_object_id";
private static final String AIDL_ADD_MAP_WIDGET = "aidl_add_map_widget";
private static final String AIDL_REMOVE_MAP_WIDGET = "aidl_remove_map_widget";
private static final String AIDL_ADD_MAP_LAYER = "aidl_add_map_layer";
private static final String AIDL_REMOVE_MAP_LAYER = "aidl_remove_map_layer";
private OsmandApplication app;
private Map<String, AMapWidget> widgets = new ConcurrentHashMap<>();
private Map<String, TextInfoWidget> widgetControls = new ConcurrentHashMap<>();
private Map<String, AMapLayer> layers = new ConcurrentHashMap<>();
private Map<String, OsmandMapLayer> mapLayers = new ConcurrentHashMap<>();
private BroadcastReceiver refreshMapReceiver;
private BroadcastReceiver setMapLocationReceiver;
private BroadcastReceiver addMapWidgetReceiver;
private BroadcastReceiver removeMapWidgetReceiver;
private BroadcastReceiver addMapLayerReceiver;
private BroadcastReceiver removeMapLayerReceiver;
public OsmandAidlApi(OsmandApplication app) {
this.app = app;
}
public void onCreateMapActivity(final MapActivity mapActivity) {
registerRefreshMapReceiver(mapActivity);
registerSetMapLocationReceiver(mapActivity);
registerAddMapWidgetReceiver(mapActivity);
registerRemoveMapWidgetReceiver(mapActivity);
registerAddMapLayerReceiver(mapActivity);
registerRemoveMapLayerReceiver(mapActivity);
}
public void onDestroyMapActivity(final MapActivity mapActivity) {
if (refreshMapReceiver != null) {
try {
mapActivity.unregisterReceiver(refreshMapReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
refreshMapReceiver = null;
}
if (setMapLocationReceiver != null) {
try {
mapActivity.unregisterReceiver(setMapLocationReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
setMapLocationReceiver = null;
}
if (addMapWidgetReceiver != null) {
try {
mapActivity.unregisterReceiver(addMapWidgetReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
addMapWidgetReceiver = null;
}
if (removeMapWidgetReceiver != null) {
try {
mapActivity.unregisterReceiver(removeMapWidgetReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
removeMapWidgetReceiver = null;
}
widgetControls.clear();
if (addMapLayerReceiver != null) {
try {
mapActivity.unregisterReceiver(addMapLayerReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
addMapLayerReceiver = null;
}
if (removeMapLayerReceiver != null) {
try {
mapActivity.unregisterReceiver(removeMapLayerReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
removeMapLayerReceiver = null;
}
}
private void registerRefreshMapReceiver(final MapActivity mapActivity) {
refreshMapReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
mapActivity.refreshMap();
}
};
mapActivity.registerReceiver(refreshMapReceiver, new IntentFilter(AIDL_REFRESH_MAP));
}
private void registerSetMapLocationReceiver(final MapActivity mapActivity) {
setMapLocationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
double lat = intent.getDoubleExtra(AIDL_LATITUDE, Double.NaN);
double lon = intent.getDoubleExtra(AIDL_LONGITUDE, Double.NaN);
int zoom = intent.getIntExtra(AIDL_ZOOM, 0);
boolean animated = intent.getBooleanExtra(AIDL_ANIMATED, false);
if (!Double.isNaN(lat) && !Double.isNaN(lon)) {
OsmandMapTileView mapView = mapActivity.getMapView();
if (zoom == 0) {
zoom = mapView.getZoom();
} else {
zoom = zoom > mapView.getMaxZoom() ? mapView.getMaxZoom() : zoom;
zoom = zoom < mapView.getMinZoom() ? mapView.getMinZoom() : zoom;
}
if (animated) {
mapView.getAnimatedDraggingThread().startMoving(lat, lon, zoom, true);
} else {
mapView.setLatLon(lat, lon);
mapView.setIntZoom(zoom);
}
}
mapActivity.refreshMap();
}
};
mapActivity.registerReceiver(setMapLocationReceiver, new IntentFilter(AIDL_SET_MAP_LOCATION));
}
private int getDrawableId(String id) {
if (Algorithms.isEmpty(id)) {
return 0;
} else {
return app.getResources().getIdentifier(id, "drawable", app.getPackageName());
}
}
private void registerAddMapWidgetReceiver(final MapActivity mapActivity) {
addMapWidgetReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String widgetId = intent.getStringExtra(AIDL_OBJECT_ID);
if (widgetId != null) {
AMapWidget widget = widgets.get(widgetId);
if (widget != null) {
MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
if (layer != null) {
TextInfoWidget control = createWidgetControl(mapActivity, widgetId);
widgetControls.put(widgetId, control);
int menuIconId = getDrawableId(widget.getMenuIconName());
MapWidgetRegInfo widgetInfo = layer.registerSideWidget(control,
menuIconId, widget.getMenuTitle(), "aidl_widget_" + widgetId,
false, widget.getOrder());
if (!mapActivity.getMapLayers().getMapWidgetRegistry().isVisible(widgetInfo.key)) {
mapActivity.getMapLayers().getMapWidgetRegistry().setVisibility(widgetInfo, true, false);
}
layer.recreateControls();
}
}
}
}
};
mapActivity.registerReceiver(addMapWidgetReceiver, new IntentFilter(AIDL_ADD_MAP_WIDGET));
}
private void registerRemoveMapWidgetReceiver(final MapActivity mapActivity) {
removeMapWidgetReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String widgetId = intent.getStringExtra(AIDL_OBJECT_ID);
if (widgetId != null) {
MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
TextInfoWidget widgetControl = widgetControls.get(widgetId);
if (layer != null && widgetControl != null) {
layer.removeSideWidget(widgetControl);
widgetControls.remove(widgetId);
layer.recreateControls();
}
}
}
};
mapActivity.registerReceiver(removeMapWidgetReceiver, new IntentFilter(AIDL_REMOVE_MAP_WIDGET));
}
public void registerWidgetControls(MapActivity mapActivity) {
for (AMapWidget widget : widgets.values()) {
MapInfoLayer layer = mapActivity.getMapLayers().getMapInfoLayer();
if (layer != null) {
TextInfoWidget control = createWidgetControl(mapActivity, widget.getId());
widgetControls.put(widget.getId(), control);
int menuIconId = getDrawableId(widget.getMenuIconName());
MapWidgetRegInfo widgetInfo = layer.registerSideWidget(control,
menuIconId, widget.getMenuTitle(), "aidl_widget_" + widget.getId(),
false, widget.getOrder());
if (!mapActivity.getMapLayers().getMapWidgetRegistry().isVisible(widgetInfo.key)) {
mapActivity.getMapLayers().getMapWidgetRegistry().setVisibility(widgetInfo, true, false);
}
}
}
}
private void registerAddMapLayerReceiver(final MapActivity mapActivity) {
addMapLayerReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String layerId = intent.getStringExtra(AIDL_OBJECT_ID);
if (layerId != null) {
AMapLayer layer = layers.get(layerId);
if (layer != null) {
OsmandMapLayer mapLayer = mapLayers.get(layerId);
if (mapLayer != null) {
mapActivity.getMapView().removeLayer(mapLayer);
}
mapLayer = new AidlMapLayer(mapActivity, layer);
mapActivity.getMapView().addLayer(mapLayer, layer.getZOrder());
mapLayers.put(layerId, mapLayer);
}
}
}
};
mapActivity.registerReceiver(addMapLayerReceiver, new IntentFilter(AIDL_ADD_MAP_LAYER));
}
private void registerRemoveMapLayerReceiver(final MapActivity mapActivity) {
removeMapLayerReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String layerId = intent.getStringExtra(AIDL_OBJECT_ID);
if (layerId != null) {
OsmandMapLayer mapLayer = mapLayers.remove(layerId);
if (mapLayer != null) {
mapActivity.getMapView().removeLayer(mapLayer);
mapActivity.refreshMap();
}
}
}
};
mapActivity.registerReceiver(removeMapLayerReceiver, new IntentFilter(AIDL_REMOVE_MAP_LAYER));
}
public void registerMapLayers(MapActivity mapActivity) {
for (AMapLayer layer : layers.values()) {
OsmandMapLayer mapLayer = mapLayers.get(layer.getId());
if (mapLayer != null) {
mapActivity.getMapView().removeLayer(mapLayer);
}
mapLayer = new AidlMapLayer(mapActivity, layer);
mapActivity.getMapView().addLayer(mapLayer, layer.getZOrder());
mapLayers.put(layer.getId(), mapLayer);
}
}
private void refreshMap() {
Intent intent = new Intent();
intent.setAction(AIDL_REFRESH_MAP);
app.sendBroadcast(intent);
}
private TextInfoWidget createWidgetControl(final MapActivity mapActivity, final String widgetId) {
final TextInfoWidget control = new TextInfoWidget(mapActivity) {
@Override
public boolean updateInfo(DrawSettings drawSettings) {
AMapWidget widget = widgets.get(widgetId);
if (widget != null) {
String txt = widget.getText();
String subtxt = widget.getDescription();
boolean night = drawSettings != null && drawSettings.isNightMode();
int icon = night ? getDrawableId(widget.getDarkIconName()) : getDrawableId(widget.getLightIconName());
setText(txt, subtxt);
if (icon != 0) {
setImageDrawable(icon);
} else {
setImageDrawable(null);
}
return true;
} else {
return false;
}
}
};
control.updateInfo(null);
control.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AMapWidget widget = widgets.get(widgetId);
if (widget != null && widget.getIntentOnClick() != null) {
app.startActivity(widget.getIntentOnClick());
}
}
});
return control;
}
boolean addMapMarker(AMapMarker marker) {
if (marker != null) {
PointDescription pd = new PointDescription(
PointDescription.POINT_TYPE_MAP_MARKER, marker.getName() != null ? marker.getName() : "");
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
markersHelper.addMapMarker(new LatLon(marker.getLatLon().getLatitude(), marker.getLatLon().getLongitude()), pd);
refreshMap();
return true;
} else {
return false;
}
}
boolean removeMapMarker(AMapMarker marker) {
if (marker != null) {
LatLon latLon = new LatLon(marker.getLatLon().getLatitude(), marker.getLatLon().getLongitude());
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
for (MapMarker m : mapMarkers) {
if (m.getOnlyName().equals(marker.getName()) && latLon.equals(new LatLon(m.getLatitude(), m.getLongitude()))) {
markersHelper.removeMapMarker(m);
refreshMap();
return true;
}
}
return false;
} else {
return false;
}
}
boolean updateMapMarker(AMapMarker markerPrev, AMapMarker markerNew) {
if (markerPrev != null && markerNew != null) {
LatLon latLon = new LatLon(markerPrev.getLatLon().getLatitude(), markerPrev.getLatLon().getLongitude());
LatLon latLonNew = new LatLon(markerNew.getLatLon().getLatitude(), markerNew.getLatLon().getLongitude());
MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
for (MapMarker m : mapMarkers) {
if (m.getOnlyName().equals(markerPrev.getName()) && latLon.equals(new LatLon(m.getLatitude(), m.getLongitude()))) {
PointDescription pd = new PointDescription(
PointDescription.POINT_TYPE_MAP_MARKER, markerNew.getName() != null ? markerNew.getName() : "");
MapMarker marker = new MapMarker(m.point, pd, m.colorIndex, m.selected, m.index);
markersHelper.moveMapMarker(marker, latLonNew);
refreshMap();
return true;
}
}
return false;
} else {
return false;
}
}
boolean addMapWidget(AMapWidget widget) {
if (widget != null) {
if (widgets.containsKey(widget.getId())) {
updateMapWidget(widget);
} else {
widgets.put(widget.getId(), widget);
Intent intent = new Intent();
intent.setAction(AIDL_ADD_MAP_WIDGET);
intent.putExtra(AIDL_OBJECT_ID, widget.getId());
app.sendBroadcast(intent);
}
refreshMap();
return true;
} else {
return false;
}
}
boolean removeMapWidget(String widgetId) {
if (!Algorithms.isEmpty(widgetId) && widgets.containsKey(widgetId)) {
widgets.remove(widgetId);
Intent intent = new Intent();
intent.setAction(AIDL_REMOVE_MAP_WIDGET);
intent.putExtra(AIDL_OBJECT_ID, widgetId);
app.sendBroadcast(intent);
return true;
} else {
return false;
}
}
boolean updateMapWidget(AMapWidget widget) {
if (widget != null && widgets.containsKey(widget.getId())) {
widgets.put(widget.getId(), widget);
refreshMap();
return true;
} else {
return false;
}
}
boolean addMapLayer(AMapLayer layer) {
if (layer != null) {
if (layers.containsKey(layer.getId())) {
updateMapLayer(layer);
} else {
layers.put(layer.getId(), layer);
Intent intent = new Intent();
intent.setAction(AIDL_ADD_MAP_LAYER);
intent.putExtra(AIDL_OBJECT_ID, layer.getId());
app.sendBroadcast(intent);
}
refreshMap();
return true;
} else {
return false;
}
}
boolean removeMapLayer(String layerId) {
if (!Algorithms.isEmpty(layerId) && layers.containsKey(layerId)) {
layers.remove(layerId);
Intent intent = new Intent();
intent.setAction(AIDL_REMOVE_MAP_LAYER);
intent.putExtra(AIDL_OBJECT_ID, layerId);
app.sendBroadcast(intent);
return true;
} else {
return false;
}
}
boolean updateMapLayer(AMapLayer layer) {
if (layer != null && layers.containsKey(layer.getId())) {
layers.put(layer.getId(), layer);
refreshMap();
return true;
} else {
return false;
}
}
boolean putMapPoint(String layerId, AMapPoint point) {
if (point != null) {
AMapLayer layer = layers.get(layerId);
if (layer != null) {
layer.putPoint(point);
refreshMap();
return true;
}
}
return false;
}
boolean removeMapPoint(String layerId, String pointId) {
if (pointId != null) {
AMapLayer layer = layers.get(layerId);
if (layer != null) {
layer.removePoint(pointId);
refreshMap();
return true;
}
}
return false;
}
boolean importGpxFromFile(File source, String destinationPath) {
if (source != null && !Algorithms.isEmpty(destinationPath)) {
if (source.exists() && source.canRead()) {
File destination = app.getAppPath(IndexConstants.GPX_INDEX_DIR + destinationPath);
if (destination.getParentFile().canWrite()) {
try {
Algorithms.fileCopy(source, destination);
return true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return false;
}
boolean importGpxFromUri(Uri gpxUri, String destinationPath) {
if (gpxUri != null && !Algorithms.isEmpty(destinationPath)) {
File destination = app.getAppPath(IndexConstants.GPX_INDEX_DIR + destinationPath);
ParcelFileDescriptor gpxParcelDescriptor = null;
try {
gpxParcelDescriptor = app.getContentResolver().openFileDescriptor(gpxUri, "r");
if (gpxParcelDescriptor != null) {
FileDescriptor fileDescriptor = gpxParcelDescriptor.getFileDescriptor();
InputStream is = new FileInputStream(fileDescriptor);
FileOutputStream fout = new FileOutputStream(destination);
try {
Algorithms.streamCopy(is, fout);
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
}
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
boolean importGpxFromData(String sourceRawData, String destinationPath) {
if (!Algorithms.isEmpty(sourceRawData) && !Algorithms.isEmpty(destinationPath)) {
File destination = app.getAppPath(IndexConstants.GPX_INDEX_DIR + destinationPath);
try {
InputStream is = new ByteArrayInputStream(sourceRawData.getBytes());
FileOutputStream fout = new FileOutputStream(destination);
try {
Algorithms.streamCopy(is, fout);
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
boolean showGpx(String fileName) {
if (!Algorithms.isEmpty(fileName)) {
File f = app.getAppPath(IndexConstants.GPX_INDEX_DIR + fileName);
if (f.exists()) {
GPXFile gpx = GPXUtilities.loadGPXFile(app, f);
app.getSelectedGpxHelper().selectGpxFile(gpx, true, false);
refreshMap();
return true;
}
}
return false;
}
boolean hideGpx(String fileName) {
if (!Algorithms.isEmpty(fileName)) {
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByName(fileName);
if (selectedGpxFile != null) {
app.getSelectedGpxHelper().selectGpxFile(selectedGpxFile.getGpxFile(), false, false);
refreshMap();
}
}
return false;
}
boolean getActiveGpx(List<ASelectedGpxFile> files) {
if (files != null) {
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
String gpxPath = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath();
for (SelectedGpxFile selectedGpxFile : selectedGpxFiles) {
String path = selectedGpxFile.getGpxFile().path;
if (!Algorithms.isEmpty(path)) {
if (path.startsWith(gpxPath)) {
path = path.substring(gpxPath.length() + 1);
}
files.add(new ASelectedGpxFile(path));
}
}
return true;
}
return false;
}
boolean setMapLocation(double latitude, double longitude, int zoom, boolean animated) {
Intent intent = new Intent();
intent.setAction(AIDL_SET_MAP_LOCATION);
intent.putExtra(AIDL_LATITUDE, latitude);
intent.putExtra(AIDL_LONGITUDE, longitude);
intent.putExtra(AIDL_ZOOM, zoom);
intent.putExtra(AIDL_ANIMATED, animated);
app.sendBroadcast(intent);
return true;
}
}

View file

@ -0,0 +1,254 @@
package net.osmand.aidl;
import android.app.Service;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import net.osmand.aidl.calculateroute.CalculateRouteParams;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.map.SetMapLocationParams;
import net.osmand.aidl.maplayer.AddMapLayerParams;
import net.osmand.aidl.maplayer.RemoveMapLayerParams;
import net.osmand.aidl.maplayer.UpdateMapLayerParams;
import net.osmand.aidl.maplayer.point.AddMapPointParams;
import net.osmand.aidl.maplayer.point.RemoveMapPointParams;
import net.osmand.aidl.maplayer.point.UpdateMapPointParams;
import net.osmand.aidl.mapmarker.AddMapMarkerParams;
import net.osmand.aidl.mapmarker.RemoveMapMarkerParams;
import net.osmand.aidl.mapmarker.UpdateMapMarkerParams;
import net.osmand.aidl.mapwidget.AddMapWidgetParams;
import net.osmand.aidl.mapwidget.RemoveMapWidgetParams;
import net.osmand.aidl.mapwidget.UpdateMapWidgetParams;
import net.osmand.plus.OsmandApplication;
import net.osmand.util.Algorithms;
import java.util.List;
public class OsmandAidlService extends Service {
OsmandApplication getApp() {
return (OsmandApplication) getApplication();
}
OsmandAidlApi getApi() {
return getApp().getAidlApi();
}
@Override
public IBinder onBind(Intent intent) {
// Return the interface
return mBinder;
}
private final IOsmAndAidlInterface.Stub mBinder = new IOsmAndAidlInterface.Stub() {
@Override
public boolean addMapMarker(AddMapMarkerParams params) throws RemoteException {
try {
return params != null && getApi().addMapMarker(params.getMarker());
} catch (Exception e) {
return false;
}
}
@Override
public boolean removeMapMarker(RemoveMapMarkerParams params) throws RemoteException {
try {
return params != null && getApi().removeMapMarker(params.getMarker());
} catch (Exception e) {
return false;
}
}
@Override
public boolean updateMapMarker(UpdateMapMarkerParams params) throws RemoteException {
try {
return params != null && getApi().updateMapMarker(params.getMarkerPrev(), params.getMarkerNew());
} catch (Exception e) {
return false;
}
}
@Override
public boolean addMapWidget(AddMapWidgetParams params) throws RemoteException {
try {
return params != null && getApi().addMapWidget(params.getWidget());
} catch (Exception e) {
return false;
}
}
@Override
public boolean removeMapWidget(RemoveMapWidgetParams params) throws RemoteException {
try {
return params != null && getApi().removeMapWidget(params.getId());
} catch (Exception e) {
return false;
}
}
@Override
public boolean updateMapWidget(UpdateMapWidgetParams params) throws RemoteException {
try {
return params != null && getApi().updateMapWidget(params.getWidget());
} catch (Exception e) {
return false;
}
}
@Override
public boolean addMapPoint(AddMapPointParams params) throws RemoteException {
try {
return params != null && getApi().putMapPoint(params.getLayerId(), params.getPoint());
} catch (Exception e) {
return false;
}
}
@Override
public boolean removeMapPoint(RemoveMapPointParams params) throws RemoteException {
try {
return params != null && getApi().removeMapPoint(params.getLayerId(), params.getPointId());
} catch (Exception e) {
return false;
}
}
@Override
public boolean updateMapPoint(UpdateMapPointParams params) throws RemoteException {
try {
return params != null && getApi().putMapPoint(params.getLayerId(), params.getPoint());
} catch (Exception e) {
return false;
}
}
@Override
public boolean addMapLayer(AddMapLayerParams params) throws RemoteException {
try {
return params != null && getApi().addMapLayer(params.getLayer());
} catch (Exception e) {
return false;
}
}
@Override
public boolean removeMapLayer(RemoveMapLayerParams params) throws RemoteException {
try {
return params != null && getApi().removeMapLayer(params.getId());
} catch (Exception e) {
return false;
}
}
@Override
public boolean updateMapLayer(UpdateMapLayerParams params) throws RemoteException {
try {
return params != null && getApi().updateMapLayer(params.getLayer());
} catch (Exception e) {
return false;
}
}
@Override
public boolean importGpx(ImportGpxParams params) throws RemoteException {
if (params != null && !Algorithms.isEmpty(params.getDestinationPath())) {
if (params.getGpxFile() != null) {
return getApi().importGpxFromFile(params.getGpxFile(), params.getDestinationPath());
} else if (params.getGpxUri() != null) {
return getApi().importGpxFromUri(params.getGpxUri(), params.getDestinationPath());
} else if (params.getSourceRawData() != null) {
return getApi().importGpxFromData(params.getSourceRawData(), params.getDestinationPath());
}
}
return false;
}
@Override
public boolean showGpx(ShowGpxParams params) throws RemoteException {
if (params != null && params.getFileName() != null) {
return getApi().showGpx(params.getFileName());
}
return false;
}
@Override
public boolean hideGpx(HideGpxParams params) throws RemoteException {
if (params != null && params.getFileName() != null) {
return getApi().hideGpx(params.getFileName());
}
return false;
}
@Override
public boolean getActiveGpx(List<ASelectedGpxFile> files) throws RemoteException {
return getApi().getActiveGpx(files);
}
@Override
public boolean setMapLocation(SetMapLocationParams params) throws RemoteException {
if (params != null) {
return getApi().setMapLocation(params.getLatitude(), params.getLongitude(),
params.getZoom(), params.isAnimated());
}
return false;
}
@Override
public boolean calculateRoute(CalculateRouteParams params) throws RemoteException {
if (params == null || params.getEndPoint() == null) {
return false;
} else {
/*
final TargetPointsHelper targets = app.getTargetPointsHelper();
targets.removeAllWayPoints(false, true);
List<ALatLon> intermediatePoints = params.getIntermediatePoints();
List<String> intermediateNames = params.getIntermediateNames();
ALatLon intermediatePoint;
String intermediateName;
for (int i = 0; i < intermediatePoints.size(); i++ ) {
intermediatePoint = intermediatePoints.get(i);
if (i < intermediateNames.size()) {
intermediateName = intermediateNames.get(i);
} else {
intermediateName = "";
}
if (intermediateName == null) {
intermediateName = "";
}
targets.navigateToPoint(
new LatLon(intermediatePoint.getLatitude(), intermediatePoint.getLongitude()),
false, -1, new PointDescription(PointDescription.POINT_TYPE_LOCATION, intermediateName));
}
PointDescription endPointDescription = null;
if (params.getEndPointName() != null) {
endPointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, params.getEndPointName());
}
targets.navigateToPoint(
new LatLon(params.getEndPoint().getLatitude(), params.getEndPoint().getLongitude()),
true, -1, endPointDescription);
LatLon startPoint = null;
if (params.getStartPoint() != null) {
startPoint = new LatLon(params.getStartPoint().getLatitude(), params.getStartPoint().getLongitude());
}
PointDescription startPointDescription = null;
if (params.getStartPointName() != null) {
startPointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, params.getStartPointName());
}
//mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, startPoint, startPointDescription, true, false);
*/
return true;
}
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.calculateroute;
parcelable CalculateRouteParams;

View file

@ -0,0 +1,100 @@
package net.osmand.aidl.calculateroute;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.map.ALatLon;
import java.util.ArrayList;
import java.util.List;
public class CalculateRouteParams implements Parcelable {
private ALatLon startPoint;
private String startPointName;
private ALatLon endPoint;
private String endPointName;
private List<ALatLon> intermediatePoints = new ArrayList<>();
private List<String> intermediateNames = new ArrayList<>();
public CalculateRouteParams(ALatLon startPoint, String startPointName,
ALatLon endPoint, String endPointName,
List<ALatLon> intermediatePoints, List<String> intermediateNames) {
if (endPoint == null) {
throw new IllegalArgumentException("endPoint cannot be null");
}
this.startPoint = startPoint;
this.startPointName = startPointName;
this.endPoint = endPoint;
this.endPointName = endPointName;
if (intermediatePoints != null) {
this.intermediatePoints.addAll(intermediatePoints);
}
if (intermediateNames != null) {
this.intermediateNames.addAll(intermediateNames);
}
}
public CalculateRouteParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<CalculateRouteParams> CREATOR = new
Parcelable.Creator<CalculateRouteParams>() {
public CalculateRouteParams createFromParcel(Parcel in) {
return new CalculateRouteParams(in);
}
public CalculateRouteParams[] newArray(int size) {
return new CalculateRouteParams[size];
}
};
public ALatLon getStartPoint() {
return startPoint;
}
public String getStartPointName() {
return startPointName;
}
public ALatLon getEndPoint() {
return endPoint;
}
public String getEndPointName() {
return endPointName;
}
public List<ALatLon> getIntermediatePoints() {
return intermediatePoints;
}
public List<String> getIntermediateNames() {
return intermediateNames;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(startPoint, flags);
out.writeString(startPointName);
out.writeParcelable(endPoint, flags);
out.writeString(endPointName);
out.writeTypedList(intermediatePoints);
out.writeStringList(intermediateNames);
}
private void readFromParcel(Parcel in) {
startPoint = in.readParcelable(ALatLon.class.getClassLoader());
startPointName = in.readString();
endPoint = in.readParcelable(ALatLon.class.getClassLoader());
endPointName = in.readString();
in.readTypedList(intermediatePoints, ALatLon.CREATOR);
in.readStringList(intermediateNames);
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable ASelectedGpxFile;

View file

@ -0,0 +1,45 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class ASelectedGpxFile implements Parcelable {
private String fileName;
public ASelectedGpxFile(String fileName) {
this.fileName = fileName;
}
public ASelectedGpxFile(Parcel in) {
readFromParcel(in);
}
public static final Creator<ASelectedGpxFile> CREATOR = new
Creator<ASelectedGpxFile>() {
public ASelectedGpxFile createFromParcel(Parcel in) {
return new ASelectedGpxFile(in);
}
public ASelectedGpxFile[] newArray(int size) {
return new ASelectedGpxFile[size];
}
};
public String getFileName() {
return fileName;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(fileName);
}
private void readFromParcel(Parcel in) {
fileName = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable HideGpxParams;

View file

@ -0,0 +1,45 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class HideGpxParams implements Parcelable {
private String fileName;
public HideGpxParams(String fileName) {
this.fileName = fileName;
}
public HideGpxParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<HideGpxParams> CREATOR = new
Creator<HideGpxParams>() {
public HideGpxParams createFromParcel(Parcel in) {
return new HideGpxParams(in);
}
public HideGpxParams[] newArray(int size) {
return new HideGpxParams[size];
}
};
public String getFileName() {
return fileName;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(fileName);
}
private void readFromParcel(Parcel in) {
fileName = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable ImportGpxParams;

View file

@ -0,0 +1,86 @@
package net.osmand.aidl.gpx;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.File;
public class ImportGpxParams implements Parcelable {
private File gpxFile;
private Uri gpxUri;
private String sourceRawData;
private String destinationPath;
public ImportGpxParams(File gpxFile, String destinationPath) {
this.gpxFile = gpxFile;
this.destinationPath = destinationPath;
}
public ImportGpxParams(Uri gpxUri, String destinationPath) {
this.gpxUri = gpxUri;
this.destinationPath = destinationPath;
}
public ImportGpxParams(String sourceRawData, String destinationPath) {
this.sourceRawData = sourceRawData;
this.destinationPath = destinationPath;
}
public ImportGpxParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<ImportGpxParams> CREATOR = new
Creator<ImportGpxParams>() {
public ImportGpxParams createFromParcel(Parcel in) {
return new ImportGpxParams(in);
}
public ImportGpxParams[] newArray(int size) {
return new ImportGpxParams[size];
}
};
public File getGpxFile() {
return gpxFile;
}
public Uri getGpxUri() {
return gpxUri;
}
public String getSourceRawData() {
return sourceRawData;
}
public String getDestinationPath() {
return destinationPath;
}
public void writeToParcel(Parcel out, int flags) {
if (gpxFile != null) {
out.writeString(gpxFile.getAbsolutePath());
} else {
out.writeString(null);
}
out.writeParcelable(gpxUri, flags);
out.writeString(sourceRawData);
out.writeString(destinationPath);
}
private void readFromParcel(Parcel in) {
String gpxAbsolutePath = in.readString();
if (gpxAbsolutePath != null) {
gpxFile = new File(gpxAbsolutePath);
}
gpxUri = in.readParcelable(Uri.class.getClassLoader());
sourceRawData = in.readString();
destinationPath = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable ShowGpxParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class ShowGpxParams implements Parcelable {
private String fileName;
public ShowGpxParams(String fileName) {
this.fileName = fileName;
}
public ShowGpxParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<ShowGpxParams> CREATOR = new
Creator<ShowGpxParams>() {
public ShowGpxParams createFromParcel(Parcel in) {
return new ShowGpxParams(in);
}
public ShowGpxParams[] newArray(int size) {
return new ShowGpxParams[size];
}
};
public String getFileName() {
return fileName;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(fileName);
}
private void readFromParcel(Parcel in) {
fileName = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.map;
parcelable ALatLon;

View file

@ -0,0 +1,83 @@
package net.osmand.aidl.map;
import android.os.Parcel;
import android.os.Parcelable;
public class ALatLon implements Parcelable {
private double longitude;
private double latitude;
public ALatLon(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
public ALatLon(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<ALatLon> CREATOR = new
Parcelable.Creator<ALatLon>() {
public ALatLon createFromParcel(Parcel in) {
return new ALatLon(in);
}
public ALatLon[] newArray(int size) {
return new ALatLon[size];
}
};
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
int temp;
temp = (int)Math.floor(latitude * 10000);
result = prime * result + temp;
temp = (int)Math.floor(longitude * 10000);
result = prime * result + temp;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ALatLon other = (ALatLon) obj;
return Math.abs(latitude - other.latitude) < 0.00001
&& Math.abs(longitude - other.longitude) < 0.00001;
}
@Override
public String toString() {
return "Lat " + ((float)latitude) + " Lon " + ((float)longitude);
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public void writeToParcel(Parcel out, int flags) {
out.writeDouble(latitude);
out.writeDouble(longitude);
}
public void readFromParcel(Parcel in) {
latitude = in.readDouble();
longitude = in.readDouble();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.map;
parcelable SetMapLocationParams;

View file

@ -0,0 +1,68 @@
package net.osmand.aidl.map;
import android.os.Parcel;
import android.os.Parcelable;
public class SetMapLocationParams implements Parcelable {
private double latitude;
private double longitude;
private int zoom;
private boolean animated;
public SetMapLocationParams(double latitude, double longitude, int zoom, boolean animated) {
this.latitude = latitude;
this.longitude = longitude;
this.zoom = zoom;
this.animated = animated;
}
public SetMapLocationParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<SetMapLocationParams> CREATOR = new
Creator<SetMapLocationParams>() {
public SetMapLocationParams createFromParcel(Parcel in) {
return new SetMapLocationParams(in);
}
public SetMapLocationParams[] newArray(int size) {
return new SetMapLocationParams[size];
}
};
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public int getZoom() {
return zoom;
}
public boolean isAnimated() {
return animated;
}
public void writeToParcel(Parcel out, int flags) {
out.writeDouble(latitude);
out.writeDouble(longitude);
out.writeInt(zoom);
out.writeByte((byte) (animated ? 1 : 0));
}
private void readFromParcel(Parcel in) {
latitude = in.readDouble();
longitude = in.readDouble();
zoom = in.readInt();
animated = in.readByte() != 0;
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer;
parcelable AMapLayer;

View file

@ -0,0 +1,94 @@
package net.osmand.aidl.maplayer;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.maplayer.point.AMapPoint;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class AMapLayer implements Parcelable {
private String id;
private String name;
private float zOrder = 5.5f;
private Map<String, AMapPoint> points = new ConcurrentHashMap<>();
public AMapLayer(String id, String name, float zOrder, List<AMapPoint> pointList) {
this.id = id;
this.name = name;
this.zOrder = zOrder;
if (pointList != null) {
for (AMapPoint p : pointList) {
this.points.put(p.getId(), p);
}
}
}
public AMapLayer(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<AMapLayer> CREATOR = new
Parcelable.Creator<AMapLayer>() {
public AMapLayer createFromParcel(Parcel in) {
return new AMapLayer(in);
}
public AMapLayer[] newArray(int size) {
return new AMapLayer[size];
}
};
public String getId() {
return id;
}
public String getName() {
return name;
}
public float getZOrder() {
return zOrder;
}
public List<AMapPoint> getPoints() {
return new ArrayList<>(points.values());
}
public boolean hasPoint(String pointId) {
return points.containsKey(pointId);
}
public void putPoint(AMapPoint point) {
points.put(point.getId(), point);
}
public void removePoint(String pointId) {
points.remove(pointId);
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(id);
out.writeString(name);
out.writeFloat(zOrder);
out.writeTypedList(new ArrayList<>(points.values()));
}
private void readFromParcel(Parcel in) {
id = in.readString();
name = in.readString();
zOrder = in.readFloat();
List<AMapPoint> pointList = new ArrayList<>();
in.readTypedList(pointList, AMapPoint.CREATOR);
for (AMapPoint p : pointList) {
this.points.put(p.getId(), p);
}
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer;
parcelable AddMapLayerParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.maplayer;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class AddMapLayerParams implements Parcelable {
private AMapLayer layer;
public AddMapLayerParams(AMapLayer layer) {
this.layer = layer;
}
public AddMapLayerParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<AddMapLayerParams> CREATOR = new
Creator<AddMapLayerParams>() {
public AddMapLayerParams createFromParcel(Parcel in) {
return new AddMapLayerParams(in);
}
public AddMapLayerParams[] newArray(int size) {
return new AddMapLayerParams[size];
}
};
public AMapLayer getLayer() {
return layer;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(layer, flags);
}
private void readFromParcel(Parcel in) {
layer = in.readParcelable(AMapLayer.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer;
parcelable RemoveMapLayerParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.maplayer;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class RemoveMapLayerParams implements Parcelable {
private String id;
public RemoveMapLayerParams(String id) {
this.id = id;
}
public RemoveMapLayerParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<RemoveMapLayerParams> CREATOR = new
Creator<RemoveMapLayerParams>() {
public RemoveMapLayerParams createFromParcel(Parcel in) {
return new RemoveMapLayerParams(in);
}
public RemoveMapLayerParams[] newArray(int size) {
return new RemoveMapLayerParams[size];
}
};
public String getId() {
return id;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(id);
}
private void readFromParcel(Parcel in) {
id = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer;
parcelable UpdateMapLayerParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.maplayer;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class UpdateMapLayerParams implements Parcelable {
private AMapLayer layer;
public UpdateMapLayerParams(AMapLayer layer) {
this.layer = layer;
}
public UpdateMapLayerParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<UpdateMapLayerParams> CREATOR = new
Creator<UpdateMapLayerParams>() {
public UpdateMapLayerParams createFromParcel(Parcel in) {
return new UpdateMapLayerParams(in);
}
public UpdateMapLayerParams[] newArray(int size) {
return new UpdateMapLayerParams[size];
}
};
public AMapLayer getLayer() {
return layer;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(layer, flags);
}
private void readFromParcel(Parcel in) {
layer = in.readParcelable(AMapLayer.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer.point;
parcelable AMapPoint;

View file

@ -0,0 +1,99 @@
package net.osmand.aidl.maplayer.point;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.map.ALatLon;
import java.util.ArrayList;
import java.util.List;
public class AMapPoint implements Parcelable {
private String id;
private String shortName;
private String fullName;
private String typeName;
private int color;
private ALatLon location;
private List<String> details = new ArrayList<>();
public AMapPoint(String id, String shortName, String fullName, String typeName, int color,
ALatLon location, List<String> details) {
this.id = id;
this.shortName = shortName;
this.fullName = fullName;
this.typeName = typeName;
this.color = color;
this.location = location;
if (details != null) {
this.details.addAll(details);
}
}
public AMapPoint(Parcel in) {
readFromParcel(in);
}
public static final Creator<AMapPoint> CREATOR = new
Creator<AMapPoint>() {
public AMapPoint createFromParcel(Parcel in) {
return new AMapPoint(in);
}
public AMapPoint[] newArray(int size) {
return new AMapPoint[size];
}
};
public String getId() {
return id;
}
public String getShortName() {
return shortName;
}
public String getFullName() {
return fullName;
}
public String getTypeName() {
return typeName;
}
public int getColor() {
return color;
}
public ALatLon getLocation() {
return location;
}
public List<String> getDetails() {
return details;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(id);
out.writeString(shortName);
out.writeString(fullName);
out.writeString(typeName);
out.writeInt(color);
out.writeParcelable(location, flags);
out.writeStringList(details);
}
private void readFromParcel(Parcel in) {
id = in.readString();
shortName = in.readString();
fullName = in.readString();
typeName = in.readString();
color = in.readInt();
location = in.readParcelable(ALatLon.class.getClassLoader());
in.readStringList(details);
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer.point;
parcelable AddMapPointParams;

View file

@ -0,0 +1,51 @@
package net.osmand.aidl.maplayer.point;
import android.os.Parcel;
import android.os.Parcelable;
public class AddMapPointParams implements Parcelable {
private String layerId;
private AMapPoint point;
public AddMapPointParams(String layerId, AMapPoint point) {
this.layerId = layerId;
this.point = point;
}
public AddMapPointParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<AddMapPointParams> CREATOR = new
Creator<AddMapPointParams>() {
public AddMapPointParams createFromParcel(Parcel in) {
return new AddMapPointParams(in);
}
public AddMapPointParams[] newArray(int size) {
return new AddMapPointParams[size];
}
};
public String getLayerId() {
return layerId;
}
public AMapPoint getPoint() {
return point;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(layerId);
out.writeParcelable(point, flags);
}
private void readFromParcel(Parcel in) {
layerId = in.readString();
point = in.readParcelable(AMapPoint.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer.point;
parcelable RemoveMapPointParams;

View file

@ -0,0 +1,51 @@
package net.osmand.aidl.maplayer.point;
import android.os.Parcel;
import android.os.Parcelable;
public class RemoveMapPointParams implements Parcelable {
private String layerId;
private String pointId;
public RemoveMapPointParams(String layerId, String pointId) {
this.layerId = layerId;
this.pointId = pointId;
}
public RemoveMapPointParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<RemoveMapPointParams> CREATOR = new
Creator<RemoveMapPointParams>() {
public RemoveMapPointParams createFromParcel(Parcel in) {
return new RemoveMapPointParams(in);
}
public RemoveMapPointParams[] newArray(int size) {
return new RemoveMapPointParams[size];
}
};
public String getLayerId() {
return layerId;
}
public String getPointId() {
return pointId;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(layerId);
out.writeString(pointId);
}
private void readFromParcel(Parcel in) {
layerId = in.readString();
pointId = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.maplayer.point;
parcelable UpdateMapPointParams;

View file

@ -0,0 +1,51 @@
package net.osmand.aidl.maplayer.point;
import android.os.Parcel;
import android.os.Parcelable;
public class UpdateMapPointParams implements Parcelable {
private String layerId;
private AMapPoint point;
public UpdateMapPointParams(String layerId, AMapPoint point) {
this.layerId = layerId;
this.point = point;
}
public UpdateMapPointParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<UpdateMapPointParams> CREATOR = new
Creator<UpdateMapPointParams>() {
public UpdateMapPointParams createFromParcel(Parcel in) {
return new UpdateMapPointParams(in);
}
public UpdateMapPointParams[] newArray(int size) {
return new UpdateMapPointParams[size];
}
};
public String getLayerId() {
return layerId;
}
public AMapPoint getPoint() {
return point;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(layerId);
out.writeParcelable(point, flags);
}
private void readFromParcel(Parcel in) {
layerId = in.readString();
point = in.readParcelable(AMapPoint.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapmarker;
parcelable AMapMarker;

View file

@ -0,0 +1,63 @@
package net.osmand.aidl.mapmarker;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.map.ALatLon;
public class AMapMarker implements Parcelable {
private ALatLon latLon;
private String name;
public AMapMarker(ALatLon latLon, String name) {
if (latLon == null) {
throw new IllegalArgumentException("latLon cannot be null");
}
if (name == null) {
name = "";
}
this.latLon = latLon;
this.name = name;
}
public AMapMarker(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<AMapMarker> CREATOR = new
Parcelable.Creator<AMapMarker>() {
public AMapMarker createFromParcel(Parcel in) {
return new AMapMarker(in);
}
public AMapMarker[] newArray(int size) {
return new AMapMarker[size];
}
};
public ALatLon getLatLon() {
return latLon;
}
public String getName() {
return name;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(latLon, flags);
out.writeString(name);
}
private void readFromParcel(Parcel in) {
latLon = in.readParcelable(ALatLon.class.getClassLoader());
name = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapmarker;
parcelable AddMapMarkerParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.mapmarker;
import android.os.Parcel;
import android.os.Parcelable;
public class AddMapMarkerParams implements Parcelable {
private AMapMarker marker;
public AddMapMarkerParams(AMapMarker marker) {
this.marker = marker;
}
public AddMapMarkerParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<AddMapMarkerParams> CREATOR = new
Parcelable.Creator<AddMapMarkerParams>() {
public AddMapMarkerParams createFromParcel(Parcel in) {
return new AddMapMarkerParams(in);
}
public AddMapMarkerParams[] newArray(int size) {
return new AddMapMarkerParams[size];
}
};
public AMapMarker getMarker() {
return marker;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(marker, flags);
}
private void readFromParcel(Parcel in) {
marker = in.readParcelable(AMapMarker.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapmarker;
parcelable RemoveMapMarkerParams;

View file

@ -0,0 +1,44 @@
package net.osmand.aidl.mapmarker;
import android.os.Parcel;
import android.os.Parcelable;
public class RemoveMapMarkerParams implements Parcelable {
private AMapMarker marker;
public RemoveMapMarkerParams(AMapMarker marker) {
this.marker = marker;
}
public RemoveMapMarkerParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<RemoveMapMarkerParams> CREATOR = new
Parcelable.Creator<RemoveMapMarkerParams>() {
public RemoveMapMarkerParams createFromParcel(Parcel in) {
return new RemoveMapMarkerParams(in);
}
public RemoveMapMarkerParams[] newArray(int size) {
return new RemoveMapMarkerParams[size];
}
};
public AMapMarker getMarker() {
return marker;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(marker, flags);
}
private void readFromParcel(Parcel in) {
marker = in.readParcelable(AMapMarker.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapmarker;
parcelable UpdateMapMarkerParams;

View file

@ -0,0 +1,52 @@
package net.osmand.aidl.mapmarker;
import android.os.Parcel;
import android.os.Parcelable;
public class UpdateMapMarkerParams implements Parcelable {
private AMapMarker markerPrev;
private AMapMarker markerNew;
public UpdateMapMarkerParams(AMapMarker markerPrev, AMapMarker markerNew) {
this.markerPrev = markerPrev;
this.markerNew = markerNew;
}
public UpdateMapMarkerParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<UpdateMapMarkerParams> CREATOR = new
Parcelable.Creator<UpdateMapMarkerParams>() {
public UpdateMapMarkerParams createFromParcel(Parcel in) {
return new UpdateMapMarkerParams(in);
}
public UpdateMapMarkerParams[] newArray(int size) {
return new UpdateMapMarkerParams[size];
}
};
public AMapMarker getMarkerPrev() {
return markerPrev;
}
public AMapMarker getMarkerNew() {
return markerNew;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(markerPrev, flags);
out.writeParcelable(markerNew, flags);
}
private void readFromParcel(Parcel in) {
markerPrev = in.readParcelable(AMapMarker.class.getClassLoader());
markerNew = in.readParcelable(AMapMarker.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapwidget;
parcelable AMapWidget;

View file

@ -0,0 +1,110 @@
package net.osmand.aidl.mapwidget;
import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
public class AMapWidget implements Parcelable {
private String id;
private String menuIconName;
private String menuTitle;
private String lightIconName;
private String darkIconName;
private String text;
private String description;
private int order;
private Intent intentOnClick;
public AMapWidget(String id, String menuIconName, String menuTitle,
String lightIconName, String darkIconName, String text, String description,
int order, Intent intentOnClick) {
this.id = id;
this.menuIconName = menuIconName;
this.menuTitle = menuTitle;
this.lightIconName = lightIconName;
this.darkIconName = darkIconName;
this.text = text;
this.description = description;
this.order = order;
this.intentOnClick = intentOnClick;
}
public AMapWidget(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<AMapWidget> CREATOR = new
Parcelable.Creator<AMapWidget>() {
public AMapWidget createFromParcel(Parcel in) {
return new AMapWidget(in);
}
public AMapWidget[] newArray(int size) {
return new AMapWidget[size];
}
};
public String getId() {
return id;
}
public String getMenuIconName() {
return menuIconName;
}
public String getMenuTitle() {
return menuTitle;
}
public String getLightIconName() {
return lightIconName;
}
public String getDarkIconName() {
return darkIconName;
}
public String getText() {
return text;
}
public String getDescription() {
return description;
}
public int getOrder() {
return order;
}
public Intent getIntentOnClick() {
return intentOnClick;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(id);
out.writeString(menuIconName);
out.writeString(menuTitle);
out.writeString(lightIconName);
out.writeString(darkIconName);
out.writeString(text);
out.writeString(description);
out.writeInt(order);
out.writeParcelable(intentOnClick, flags);
}
private void readFromParcel(Parcel in) {
id = in.readString();
menuIconName = in.readString();
menuTitle = in.readString();
lightIconName = in.readString();
darkIconName = in.readString();
text = in.readString();
description = in.readString();
order = in.readInt();
intentOnClick = in.readParcelable(Intent.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapwidget;
parcelable AddMapWidgetParams;

View file

@ -0,0 +1,43 @@
package net.osmand.aidl.mapwidget;
import android.os.Parcel;
import android.os.Parcelable;
public class AddMapWidgetParams implements Parcelable {
private AMapWidget widget;
public AddMapWidgetParams(AMapWidget widget) {
this.widget = widget;
}
public AddMapWidgetParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<AddMapWidgetParams> CREATOR = new
Parcelable.Creator<AddMapWidgetParams>() {
public AddMapWidgetParams createFromParcel(Parcel in) {
return new AddMapWidgetParams(in);
}
public AddMapWidgetParams[] newArray(int size) {
return new AddMapWidgetParams[size];
}
};
public AMapWidget getWidget() {
return widget;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(widget, flags);
}
private void readFromParcel(Parcel in) {
widget = in.readParcelable(AMapWidget.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapwidget;
parcelable RemoveMapWidgetParams;

View file

@ -0,0 +1,43 @@
package net.osmand.aidl.mapwidget;
import android.os.Parcel;
import android.os.Parcelable;
public class RemoveMapWidgetParams implements Parcelable {
private String id;
public RemoveMapWidgetParams(String id) {
this.id = id;
}
public RemoveMapWidgetParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<RemoveMapWidgetParams> CREATOR = new
Parcelable.Creator<RemoveMapWidgetParams>() {
public RemoveMapWidgetParams createFromParcel(Parcel in) {
return new RemoveMapWidgetParams(in);
}
public RemoveMapWidgetParams[] newArray(int size) {
return new RemoveMapWidgetParams[size];
}
};
public String getId() {
return id;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(id);
}
private void readFromParcel(Parcel in) {
id = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapwidget;
parcelable UpdateMapWidgetParams;

View file

@ -0,0 +1,43 @@
package net.osmand.aidl.mapwidget;
import android.os.Parcel;
import android.os.Parcelable;
public class UpdateMapWidgetParams implements Parcelable {
private AMapWidget widget;
public UpdateMapWidgetParams(AMapWidget widget) {
this.widget = widget;
}
public UpdateMapWidgetParams(Parcel in) {
readFromParcel(in);
}
public static final Parcelable.Creator<UpdateMapWidgetParams> CREATOR = new
Parcelable.Creator<UpdateMapWidgetParams>() {
public UpdateMapWidgetParams createFromParcel(Parcel in) {
return new UpdateMapWidgetParams(in);
}
public UpdateMapWidgetParams[] newArray(int size) {
return new UpdateMapWidgetParams[size];
}
};
public AMapWidget getWidget() {
return widget;
}
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(widget, flags);
}
private void readFromParcel(Parcel in) {
widget = in.readParcelable(AMapWidget.class.getClassLoader());
}
public int describeContents() {
return 0;
}
}

View file

@ -158,12 +158,17 @@ public class PointDescription {
return pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.easting) + " "
+ ((long) pnt.northing);
} else if (f == PointDescription.OLC_FORMAT) {
return getLocationOlcName(lat, lon);
try {
return getLocationOlcName(lat, lon);
} catch (RuntimeException e) {
e.printStackTrace();
return "0+0";
}
} else {
try {
return ctx.getString(sh ? R.string.short_location_on_map : R.string.location_on_map, LocationConvert.convert(lat, f),
LocationConvert.convert(lon, f));
} catch(RuntimeException e) {
} catch (RuntimeException e) {
e.printStackTrace();
return ctx.getString(sh ? R.string.short_location_on_map : R.string.location_on_map, 0, 0);
}
@ -178,11 +183,16 @@ public class PointDescription {
return pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.easting) + " "
+ ((long) pnt.northing);
} else if (f == PointDescription.OLC_FORMAT) {
return getLocationOlcName(lat, lon);
try {
return getLocationOlcName(lat, lon);
} catch (RuntimeException e) {
e.printStackTrace();
return "0+0";
}
} else {
try {
return LocationConvert.convert(lat, f) + ", " + LocationConvert.convert(lon, f);
} catch(RuntimeException e) {
} catch (RuntimeException e) {
e.printStackTrace();
return "0, 0";
}
@ -366,4 +376,4 @@ public class PointDescription {
}
}
}
}

View file

@ -13,6 +13,7 @@ import android.support.v7.app.AlertDialog;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.map.OsmandRegions;
import net.osmand.map.OsmandRegions.RegionTranslation;
@ -85,7 +86,7 @@ public class AppInitializer implements IProgress {
private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
public static final String LATEST_CHANGES_URL = "http://osmand.net/blog?id=osmand-2-5-released";
public static final String LATEST_CHANGES_URL = "http://osmand.net/blog?id=osmand-2-6-released";
// public static final String LATEST_CHANGES_URL = null; // not enough to read
public static final int APP_EXIT_CODE = 4;
public static final String APP_EXIT_KEY = "APP_EXIT_KEY";
@ -363,6 +364,7 @@ public class AppInitializer implements IProgress {
app.gpxDatabase = startupInit(new GPXDatabase(app), GPXDatabase.class);
app.favorites = startupInit(new FavouritesDbHelper(app), FavouritesDbHelper.class);
app.waypointHelper = startupInit(new WaypointHelper(app), WaypointHelper.class);
app.aidlApi = startupInit(new OsmandAidlApi(app), OsmandAidlApi.class);
app.regions = startupInit(new OsmandRegions(), OsmandRegions.class);
updateRegionVars();

View file

@ -46,7 +46,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
public static final int REQUEST_LOCATION_PERMISSION = 100;
private static final String SIMULATED_PROVIDER = "OsmAnd";
public static final String SIMULATED_PROVIDER = "OsmAnd";
public interface OsmAndLocationListener {

View file

@ -120,9 +120,13 @@ public class OsmAndLocationSimulation {
@Override
public void run() {
Location current = directions.isEmpty() ? null : new Location(directions.remove(0));
Location prev = current;
long prevTime = current == null ? 0 : current.getTime();
float meters = metersToGoInFiveSteps(directions, current);
if(current != null) {
current.setProvider(OsmAndLocationProvider.SIMULATED_PROVIDER);
}
while (!directions.isEmpty() && routeAnimation != null) {
int timeout = (int) (time * 1000);
float intervalTime = time;

Some files were not shown because too many files have changed in this diff Show more