Merge remote-tracking branch 'origin/master' into configure_menu_items_fix

This commit is contained in:
veliymolfar 2020-04-27 13:45:53 +03:00
commit 602670fd28
427 changed files with 6376 additions and 334 deletions

View file

@ -25,10 +25,12 @@ import net.osmand.data.MapObject;
import net.osmand.data.QuadRect;
import net.osmand.render.RenderingRuleSearchRequest;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.NativeTransportRoutingResult;
import net.osmand.router.PrecalculatedRouteDirection;
import net.osmand.router.RouteCalculationProgress;
import net.osmand.router.RouteSegmentResult;
import net.osmand.router.RoutingConfiguration;
import net.osmand.router.TransportRoutingConfiguration;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@ -128,6 +130,11 @@ public class NativeLibrary {
return closeBinaryMapFile(filePath);
}
public NativeTransportRoutingResult[] runNativePTRouting(int sx31, int sy31, int ex31, int ey31,
TransportRoutingConfiguration cfg, RouteCalculationProgress progress) {
return nativeTransportRouting(new int[] { sx31, sy31, ex31, ey31 }, cfg, progress);
}
public RouteSegmentResult[] runNativeRouting(int sx31, int sy31, int ex31, int ey31, RoutingConfiguration config,
RouteRegion[] regions, RouteCalculationProgress progress, PrecalculatedRouteDirection precalculatedRouteDirection,
boolean basemap, boolean publicTransport, boolean startTransportStop, boolean targetTransportStop) {
@ -160,6 +167,9 @@ public class NativeLibrary {
PrecalculatedRouteDirection precalculatedRouteDirection, boolean basemap,
boolean publicTransport, boolean startTransportStop, boolean targetTransportStop);
protected static native NativeTransportRoutingResult[] nativeTransportRouting(int[] coordinates, TransportRoutingConfiguration cfg,
RouteCalculationProgress progress);
protected static native void deleteSearchResult(long searchResultHandle);
protected static native boolean initBinaryMapFile(String filePath, boolean useLive, boolean routingOnly);

View file

@ -466,8 +466,6 @@ public class BinaryMapTransportReaderAdapter {
}
}
private TransportStop readTransportRouteStop(int[] dx, int[] dy, long did, TIntObjectHashMap<String> stringTable,
int filePointer) throws IOException {
TransportStop dataObject = new TransportStop();
@ -637,6 +635,4 @@ public class BinaryMapTransportReaderAdapter {
}
}
}
}

View file

@ -42,6 +42,22 @@ public class TransportRoute extends MapObject {
return forwardStops;
}
public void setForwardStops(List<TransportStop> forwardStops) {
this.forwardStops = forwardStops;
}
public void setDist(Integer dist) {
this.dist = dist;
}
public void setForwardWays(List<Way> forwardWays) {
this.forwardWays = forwardWays;
}
public void setSchedule(TransportSchedule schedule) {
this.schedule = schedule;
}
public List<Way> getForwardWays() {
if(forwardWays == null) {
return Collections.emptyList();

View file

@ -9,6 +9,15 @@ public class TransportSchedule {
public TIntArrayList avgStopIntervals = new TIntArrayList();
public TIntArrayList avgWaitIntervals = new TIntArrayList();
public TransportSchedule() {
}
public TransportSchedule(TIntArrayList tripIntervals, TIntArrayList avgStopIntervals, TIntArrayList avgWaitIntervals) {
this.tripIntervals = tripIntervals;
this.avgStopIntervals = avgStopIntervals;
this.avgWaitIntervals = avgWaitIntervals;
}
public int[] getTripIntervals() {
return tripIntervals.toArray();
}

View file

@ -8,6 +8,14 @@ public class TransportStopExit extends MapObject {
public int y31;
public String ref = null;
public TransportStopExit() {}
public TransportStopExit(int x31, int y31, String ref) {
this.x31 = x31;
this.y31 = y31;
this.ref = ref;
}
@Override
public void setLocation(double latitude, double longitude) {
super.setLocation(latitude, longitude);

View file

@ -0,0 +1,33 @@
package net.osmand.router;
public class NativeTransportRoute {
//MapObject part:
public long id = -1l;
public double routeLat = -1;
public double routeLon = -1;
public String name = "";
public String enName = "";
//to HashMap <string, string> names
public String[] namesLng;
public String[] namesNames;
public int fileOffset;
//-----
public NativeTransportStop[] forwardStops;
public String ref = "";
public String routeOperator = "";
public String type = "";
public int dist = -1;
public String color = "";
// Convert into TransportSchedule:
public int[] intervals;
public int[] avgStopIntervals;
public int[] avgWaitIntervals;
// Convert into ways (and nodes):
public long[] waysIds;
public long[][] waysNodesIds;
public double[][] waysNodesLats;
public double[][] waysNodesLons;
}

View file

@ -0,0 +1,12 @@
package net.osmand.router;
public class NativeTransportRouteResultSegment {
public NativeTransportRoute route;
public double walkTime;
public double travelDistApproximate;
public double travelTime;
public int start;
public int end;
public double walkDist ;
public int depTime;
}

View file

@ -0,0 +1,10 @@
package net.osmand.router;
public class NativeTransportRoutingResult {
public NativeTransportRouteResultSegment[] segments;
public double finishWalkDist;
public double routeTime;
}

View file

@ -0,0 +1,29 @@
package net.osmand.router;
public class NativeTransportStop {
//MapObject part:
public long id;
public double stopLat;
public double stopLon;
public String name;
public String enName;
public String[] namesLng;
public String[] namesNames;
public int fileOffset;
//Leave next 3 field as arrays:
public int[] referencesToRoutes;
public long[] deletedRoutesIds;
public long[] routesIds;
public int distance;
public int x31;
public int y31;
public NativeTransportRoute[] routes;
// Convert into List<TransportStopExit> exits:
public int[] pTStopExit_x31s;
public int[] pTStopExit_y31s;
public String[] pTStopExit_refs;
// Convert into LinkedHashMap<String, int[]>
public String[] referenceToRoutesKeys;
public int[][] referenceToRoutesVals;
}

View file

@ -15,6 +15,8 @@ import gnu.trove.iterator.TIntIterator;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.map.hash.TLongObjectHashMap;
import net.osmand.NativeLibrary;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.data.LatLon;
@ -22,6 +24,7 @@ import net.osmand.data.QuadRect;
import net.osmand.data.TransportRoute;
import net.osmand.data.TransportSchedule;
import net.osmand.data.TransportStop;
import net.osmand.data.TransportStopExit;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.Way;
import net.osmand.util.MapUtils;
@ -50,6 +53,7 @@ public class TransportRoutePlanner {
r.distFromStart = r.walkDist / ctx.cfg.walkSpeed;
queue.add(r);
}
double finishTime = ctx.cfg.maxRouteTime;
double maxTravelTimeCmpToWalk = MapUtils.getDistance(start, end) / ctx.cfg.walkSpeed - ctx.cfg.changeTime / 2;
List<TransportRouteSegment> results = new ArrayList<TransportRouteSegment>();
@ -179,7 +183,6 @@ public class TransportRoutePlanner {
updateCalculationProgress(ctx, queue);
}
return prepareResults(ctx, results);
}
@ -448,10 +451,26 @@ public class TransportRoutePlanner {
cfg = ctx.cfg;
}
public TransportRouteResult(TransportRoutingConfiguration cfg) {
this.cfg = cfg;
}
public List<TransportRouteResultSegment> getSegments() {
return segments;
}
public void setFinishWalkDist(double finishWalkDist) {
this.finishWalkDist = finishWalkDist;
}
public void setRouteTime(double routeTime) {
this.routeTime = routeTime;
}
public void addSegment(TransportRouteResultSegment seg) {
segments.add(seg);
}
public double getWalkDist() {
double d = finishWalkDist;
for (TransportRouteResultSegment s : segments) {
@ -678,7 +697,7 @@ public class TransportRoutePlanner {
}
public static class TransportRoutingContext {
public NativeLibrary library;
public RouteCalculationProgress calculationProgress;
public TLongObjectHashMap<TransportRouteSegment> visitedSegments = new TLongObjectHashMap<TransportRouteSegment>();
public TransportRoutingConfiguration cfg;
@ -705,11 +724,12 @@ public class TransportRoutePlanner {
public TransportRoutingContext(TransportRoutingConfiguration cfg, BinaryMapIndexReader... readers) {
public TransportRoutingContext(TransportRoutingConfiguration cfg, NativeLibrary library, BinaryMapIndexReader... readers) {
this.cfg = cfg;
walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31));
walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31));
quadTree = new TLongObjectHashMap<List<TransportRouteSegment>>();
this.library = library;
for (BinaryMapIndexReader r : readers) {
routeMap.put(r, new TIntObjectHashMap<TransportRoute>());
}
@ -943,9 +963,137 @@ public class TransportRoutePlanner {
}
}
}
}
//cache for converted TransportRoutes:
private static TLongObjectHashMap<TransportRoute> convertedRoutesCache;
private static TLongObjectHashMap<TransportStop> convertedStopsCache;
public static List<TransportRouteResult> convertToTransportRoutingResult(NativeTransportRoutingResult[] res,
TransportRoutingConfiguration cfg) {
List<TransportRouteResult> convertedRes = new ArrayList<TransportRouteResult>();
for (NativeTransportRoutingResult ntrr : res) {
TransportRouteResult trr = new TransportRouteResult(cfg);
trr.setFinishWalkDist(ntrr.finishWalkDist);
trr.setRouteTime(ntrr.routeTime);
for (NativeTransportRouteResultSegment ntrs : ntrr.segments) {
TransportRouteResultSegment trs = new TransportRouteResultSegment();
trs.route = convertTransportRoute(ntrs.route);
trs.walkTime = ntrs.walkTime;
trs.travelDistApproximate = ntrs.travelDistApproximate;
trs.travelTime = ntrs.travelTime;
trs.start = ntrs.start;
trs.end = ntrs.end;
trs.walkDist = ntrs.walkDist;
trs.depTime = ntrs.depTime;
trr.addSegment(trs);
}
convertedRes.add(trr);
}
convertedStopsCache.clear();
convertedRoutesCache.clear();
return convertedRes;
}
private static TransportRoute convertTransportRoute(NativeTransportRoute nr) {
TransportRoute r = new TransportRoute();
r.setId(nr.id);
r.setLocation(nr.routeLat, nr.routeLon);
r.setName(nr.name);
r.setEnName(nr.enName);
if (nr.namesLng.length > 0 && nr.namesLng.length == nr.namesNames.length) {
for (int i = 0; i < nr.namesLng.length; i++) {
r.setName(nr.namesLng[i], nr.namesNames[i]);
}
}
r.setFileOffset(nr.fileOffset);
r.setForwardStops(convertTransportStops(nr.forwardStops));
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)));
}
for (int i = 0; i < nr.waysIds.length; i++) {
List<Node> wnodes = new ArrayList<>();
for (int j = 0; j < nr.waysNodesLats[i].length; j++) {
wnodes.add(new Node(nr.waysNodesLats[i][j], nr.waysNodesLons[i][j], -1));
}
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<TransportStop> convertTransportStops(NativeTransportStop[] nstops) {
List<TransportStop> stops = new ArrayList<>();
for (NativeTransportStop ns : nstops) {
if (convertedStopsCache != null && convertedStopsCache.get(ns.id) != null) {
stops.add(convertedStopsCache.get(ns.id));
continue;
}
TransportStop s = new TransportStop();
s.setId(ns.id);
s.setLocation(ns.stopLat, ns.stopLon);
s.setName(ns.name);
s.setEnName(ns.enName);
if (ns.namesLng.length > 0 && ns.namesLng.length == ns.namesNames.length) {
for (int i = 0; i < ns.namesLng.length; i++) {
s.setName(ns.namesLng[i], ns.namesNames[i]);
}
}
s.setFileOffset(ns.fileOffset);
s.setReferencesToRoutes(ns.referencesToRoutes);
s.setDeletedRoutesIds(ns.deletedRoutesIds);
s.setRoutesIds(ns.routesIds);
s.distance = ns.distance;
s.x31 = ns.x31;
s.y31 = ns.y31;
// List<TransportRoute> 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++) {
s.addExit(new TransportStopExit(ns.pTStopExit_x31s[i],
ns.pTStopExit_y31s[i], ns.pTStopExit_refs[i]));
}
}
if (ns.referenceToRoutesKeys != null && ns.referenceToRoutesKeys.length > 0) {
for (int i = 0; i < ns.referenceToRoutesKeys.length; i++) {
s.putReferencesToRoutes(ns.referenceToRoutesKeys[i], ns.referenceToRoutesVals[i]);
}
}
if (convertedStopsCache == null) {
convertedStopsCache = new TLongObjectHashMap<>();
}
if (convertedStopsCache.get(s.getId()) == null) {
convertedStopsCache.put(s.getId(), s);
}
stops.add(s);
}
return stops;
}
}

View file

@ -242,4 +242,6 @@
<string name="enter_device_name_description">Nommez votre nouveau périphérique en max 200 symboles.</string>
<string name="enter_another_device_name">Choisissez un nom que vous n\'avez pas encore utilisé</string>
<string name="monitoring_is_disabled">La surveillance est désactivée</string>
<string name="osmand_connect_desc">Choisissez la version d\'OsmAnd qu\'OsmAnd Tracker utilise pour afficher les positions.</string>
<string name="disconnect_from_telegram_desc">Pour révoquer l\'accès au partage de localisation. Ouvrez Telegram, allez dans Paramètres → Vie privée et sécurité → Sessions, et terminez la session OsmAnd Tracker.</string>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

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