From b0b5a4cdb265568bf5d1af702cff0c211b3cf654 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Mon, 5 Apr 2021 14:12:03 +0300 Subject: [PATCH] Fix RouteColorize constructor for MapCreator --- .../main/java/net/osmand/router/RouteColorize.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index a4d5e8a597..0a39d57e25 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -8,6 +8,7 @@ import net.osmand.GPXUtilities.WptPt; import net.osmand.PlatformUtil; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.OsmMapUtils; +import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import org.apache.commons.logging.Log; @@ -81,6 +82,10 @@ public class RouteColorize { /** * @param type ELEVATION, SPEED, SLOPE */ + public RouteColorize(int zoom, GPXFile gpxFile, ColorizationType type) { + this(zoom, gpxFile, null, type, 0); + } + public RouteColorize(int zoom, GPXFile gpxFile, GPXTrackAnalysis analysis, ColorizationType type, float maxProfileSpeed) { if (!gpxFile.hasTrkPt()) { @@ -91,8 +96,13 @@ public class RouteColorize { List latList = new ArrayList<>(); List lonList = new ArrayList<>(); List valList = new ArrayList<>(); - int wptIdx = 0; + + if (analysis == null) { + analysis = Algorithms.isEmpty(gpxFile.path) + ? gpxFile.getAnalysis(System.currentTimeMillis()) + : gpxFile.getAnalysis(gpxFile.modifiedTime); + } for (Track t : gpxFile.tracks) { for (TrkSegment ts : t.segments) { for (WptPt p : ts.points) {