From e2b44d70ba18d071b25df707dbcd6485b0813482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Thu, 30 Apr 2020 08:56:17 +0000 Subject: [PATCH 1/5] New strings reworked --- OsmAnd/res/values/strings.xml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 15483e1f0b..ec8b1106c5 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -13,9 +13,9 @@ --> Unsupported action %1$s Extra maps - Combine POI types from different categories. Tap switch to select all, tap left side to category selection. - Search poi types - Payment will be charged to your Google Play account at the confirmation of purchase.\n\nSubscription automatically renews unless it is canceled before the renewal date. Your account will be charged for renewal period(month/three month/year) only on the renewal date.\n\nYou can manage and cancel your subscriptions by going to your Google Play settings. + Combine POI types from different categories. Tap \"Switch\" to select all, tap the left side for category selection. + Search for POI types + Your Google Play account is charged upon purchase of a subscription\nand when it expires (month/three month/year),\nit will not renew itself if canceled before then from your Google Play settings. %1$s / %2$s Custom color Lombard @@ -46,16 +46,16 @@ Southern Min Cantonese Some Wikipedia articles may not be available in your language. - Select the languages ​​in which Wikipedia articles will appear on the map. You can switch between all available languages ​​while reading the article. + Select the languages ​​in which Wikipedia articles will appear on the map. You can switch between all available languages​​ while reading the article. Additional maps are needed to view Wikipedia POIs on the map. All languages Language Languages Select track file - Could not import %1$s. - Could not write %1$s. - Could not read %1$s. - Changes applied to %1$s profile. + Could not import from \'%1$s\'. + Could not write to \'%1$s\'. + Could not read from \'%1$s\'. + Changes applied to the \'%1$s\' profile. Items Custom OsmAnd plugin Snowmobile @@ -63,11 +63,11 @@ Replace another point with this Developer Plugin You can move items only inside this category. - You can access these actions by tapping the “Actions” button. + You can access these actions by tapping the \"Additional actions\" button. Main actions - Main actions containt only 4 buttons. - Settings will be reset to the original state after hiding. - These items are hidden from the menu, but the represented options or plugins will remain working. + \'Main actions'\ only contains 4 buttons. + Hiding settings resets them to their original state. + These items are hidden from the menu, but the represented options or plugins will continue to work. Hidden Elements below this point separated by a divider. Divider @@ -76,7 +76,7 @@ Drawer UI Customization Drawer items, context menu - Customize the quantity of items in Drawer, Configure map and context menu.\n\nYou can disable unused plugins, to hide all its controls from the application %1$s. + Customize the quantity of items in Drawer, configure the map and context menu.\n\nYou can turn off unused plugins, to hide all their controls from the app %1$s. Min Square Octagon @@ -101,10 +101,10 @@ Could not back up profile. Importing data from %1$s Importing - OsmAnd check %1$s for duplicates with existing items in the application.\n\nIt may take some time. + OsmAnd check %1$s for duplicates with existing items in the app.\n\nIt may take some time. Items added Import complete - All data from the %1$s is imported, you can use buttons below to open needed part of the application to manage it. + All data from the %1$s is imported, you can use buttons below to open needed part of the app to manage it. Hillshade Enable to view hillshade or slope map. You can read more about this map types on our site Legend @@ -141,7 +141,7 @@ Disable recalculation Open settings Plugin disabled - This plugin is a separate application, you will need to remove it separately if you no longer plan to use it.\n\nThe plugin will remain on the device after removing OsmAnd. + This plugin is a separate app, you will need to remove it separately if you no longer plan to use it.\n\nThe plugin will remain on the device after removing OsmAnd. Menu %1$s — %2$s — %3$s Minimal distance to recalculate route @@ -184,7 +184,7 @@ The imported profile contains additional data. Click Import to import only profile data or select additional data to import. You can select additional data to export along with the profile. Permission is required to use this option. - Check and share detailed logs of the application + Check and share detailed logs of the app No routing rules in \'%1$s\'. Please choose another file. Select a supported %1$s extension file instead. This is a low-speed cut-off filter to not record points below a certain speed. This may make recorded tracks look "smoother" when viewed on the map. From 10df688e44db624bc7e2cbb9503c35cac37cbeed Mon Sep 17 00:00:00 2001 From: aceman444 Date: Thu, 30 Apr 2020 16:01:31 +0200 Subject: [PATCH 2/5] Add missing space in strings.xml --- OsmAnd/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 91a8f162b2..302ff5e50a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -26,7 +26,7 @@ Extra maps Combine POI types from different categories. Tap switch to select all, tap left side to category selection. Search poi types - Payment will be charged to your Google Play account at the confirmation of purchase.\n\nSubscription automatically renews unless it is canceled before the renewal date. Your account will be charged for renewal period(month/three month/year) only on the renewal date.\n\nYou can manage and cancel your subscriptions by going to your Google Play settings. + Payment will be charged to your Google Play account at the confirmation of purchase.\n\nSubscription automatically renews unless it is canceled before the renewal date. Your account will be charged for renewal period (month/three month/year) only on the renewal date.\n\nYou can manage and cancel your subscriptions by going to your Google Play settings. %1$s / %2$s Custom color Lombard From 9ec38f6341890cfc85d4a10a3f7717c620756a5c Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 1 May 2020 16:19:46 +0300 Subject: [PATCH 3/5] string format fix --- OsmAnd-java/src/main/java/net/osmand/data/MapObject.java | 4 ++++ .../src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java index 7d3efda165..b4d3f1118e 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java @@ -211,6 +211,10 @@ public abstract class MapObject implements Comparable { location = new LatLon(latitude, longitude); } + public void setLocation(LatLon loc) { + location = loc; + } + @Override public int compareTo(MapObject o) { return OsmAndCollator.primaryCollator().compare(getName(), o.getName()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index 750272622d..88b30c09ca 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -467,6 +467,9 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil { if (entity != null) { if (!isWay && entity instanceof Node) { // check whether this is node (because id of node could be the same as relation) + if (object instanceof NativeLibrary.RenderedObject && object.getLocation() == null) { + object.setLocation(((NativeLibrary.RenderedObject) object).getLabelLatLon()); + } if (MapUtils.getDistance(entity.getLatLon(), object.getLocation()) < 50) { if (object instanceof Amenity) { return replaceEditOsmTags((Amenity) object, entity); From 70ad2b36a6d72a2f3b76dd26067abd22ec7422e7 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Fri, 1 May 2020 17:08:06 +0300 Subject: [PATCH 4/5] fix static fields --- .../osmand/router/TransportRoutePlanner.java | 41 ++++++++----------- .../plus/routing/TransportRoutingHelper.java | 6 +-- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index d55a7e8087..7b0b5b9f67 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -965,13 +965,12 @@ public class TransportRoutePlanner { } } - - //cache for converted TransportRoutes: - private static TLongObjectHashMap convertedRoutesCache; - private static TLongObjectHashMap convertedStopsCache; - public static List convertToTransportRoutingResult(NativeTransportRoutingResult[] res, - TransportRoutingConfiguration cfg) { + TransportRoutingConfiguration cfg) { + //cache for converted TransportRoutes: + TLongObjectHashMap convertedRoutesCache = new TLongObjectHashMap<>(); + TLongObjectHashMap convertedStopsCache = new TLongObjectHashMap<>(); + if (res.length == 0) { return new ArrayList(); } @@ -983,7 +982,7 @@ public class TransportRoutePlanner { for (NativeTransportRouteResultSegment ntrs : ntrr.segments) { TransportRouteResultSegment trs = new TransportRouteResultSegment(); - trs.route = convertTransportRoute(ntrs.route); + trs.route = convertTransportRoute(ntrs.route, convertedRoutesCache, convertedStopsCache); trs.walkTime = ntrs.walkTime; trs.travelDistApproximate = ntrs.travelDistApproximate; trs.travelTime = ntrs.travelTime; @@ -1001,7 +1000,9 @@ public class TransportRoutePlanner { return convertedRes; } - private static TransportRoute convertTransportRoute(NativeTransportRoute nr) { + private static TransportRoute convertTransportRoute(NativeTransportRoute nr, + TLongObjectHashMap convertedRoutesCache, + TLongObjectHashMap convertedStopsCache) { TransportRoute r = new TransportRoute(); r.setId(nr.id); r.setLocation(nr.routeLat, nr.routeLon); @@ -1013,15 +1014,17 @@ public class TransportRoutePlanner { } } r.setFileOffset(nr.fileOffset); - r.setForwardStops(convertTransportStops(nr.forwardStops)); + r.setForwardStops(convertTransportStops(nr.forwardStops, convertedStopsCache)); r.setRef(nr.ref); r.setOperator(nr.routeOperator); r.setType(nr.type); r.setDist(nr.dist); r.setColor(nr.color); - if (nr.intervals != null && nr.intervals.length > 0 && nr.avgStopIntervals !=null && nr.avgStopIntervals.length > 0 && nr.avgWaitIntervals != null && nr.avgWaitIntervals.length > 0) { - r.setSchedule(new TransportSchedule(new TIntArrayList(nr.intervals), new TIntArrayList(nr.avgStopIntervals), new TIntArrayList(nr.avgWaitIntervals))); + if (nr.intervals != null && nr.intervals.length > 0 && nr.avgStopIntervals !=null + && nr.avgStopIntervals.length > 0 && nr.avgWaitIntervals != null && nr.avgWaitIntervals.length > 0) { + r.setSchedule(new TransportSchedule(new TIntArrayList(nr.intervals), + new TIntArrayList(nr.avgStopIntervals), new TIntArrayList(nr.avgWaitIntervals))); } for (int i = 0; i < nr.waysIds.length; i++) { @@ -1032,16 +1035,14 @@ public class TransportRoutePlanner { r.addWay(new Way(nr.waysIds[i], wnodes)); } - if (convertedRoutesCache == null) { - convertedRoutesCache = new TLongObjectHashMap<>(); - } if (convertedRoutesCache.get(r.getId()) == null) { convertedRoutesCache.put(r.getId(), r); } return r; } - private static List convertTransportStops(NativeTransportStop[] nstops) { + private static List convertTransportStops(NativeTransportStop[] nstops, + TLongObjectHashMap convertedStopsCache) { List stops = new ArrayList<>(); for (NativeTransportStop ns : nstops) { if (convertedStopsCache != null && convertedStopsCache.get(ns.id) != null) { @@ -1065,16 +1066,6 @@ public class TransportRoutePlanner { s.distance = ns.distance; s.x31 = ns.x31; s.y31 = ns.y31; -// List routes1 = new ArrayList<>(); - //cache routes to avoid circular conversion and just search them by id -// for (int i = 0; i < ns.routes.length; i++) { -// if (s.getRoutesIds().length == ns.routes.length && convertedRoutesCache != null -// && convertedRoutesCache.get(ns.routesIds[i]) != null) { -// s.addRoute(convertedRoutesCache.get(ns.routesIds[i])); -// } else { -// s.addRoute(convertTransportRoute(ns.routes[i])); -// } -// } if (ns.pTStopExit_refs != null && ns.pTStopExit_refs.length > 0) { for (int i = 0; i < ns.pTStopExit_refs.length; i++) { diff --git a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java index 822f1dac85..47084fb1f6 100644 --- a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java @@ -491,7 +491,7 @@ public class TransportRoutingHelper { } GeneralRouter prouter = config.getRouter(params.mode.getRoutingProfile()); TransportRoutingConfiguration cfg = new TransportRoutingConfiguration(prouter, params.params); - TransportRoutePlanner planner = new TransportRoutePlanner(); + TransportRoutingContext ctx = new TransportRoutingContext(cfg, library, files); ctx.calculationProgress = params.calculationProgress; if (ctx.library != null && !settings.PT_SAFE_MODE.get()) { @@ -501,9 +501,9 @@ public class TransportRoutingHelper { MapUtils.get31TileNumberX(params.end.getLongitude()), MapUtils.get31TileNumberY(params.end.getLatitude()), cfg, ctx.calculationProgress); - List res = TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg); - return res; + return TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg); } else { + TransportRoutePlanner planner = new TransportRoutePlanner(); return planner.buildRoute(ctx, params.start, params.end); } } From ecb8cf787e9fa2d73ed307f00a473804281bedc5 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Fri, 1 May 2020 17:31:51 +0200 Subject: [PATCH 5/5] Update strings.xml --- OsmAnd/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 52129c04ff..ede6469bd6 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -77,7 +77,7 @@ You can move items only inside this category. You can access these actions by tapping the \"Additional actions\" button. Main actions - \'Main actions'\ only contains 4 buttons. + \'Main actions\' only contains 4 buttons. Hiding settings resets them to their original state. These items are hidden from the menu, but the represented options or plugins will continue to work. Hidden