Fix route saving
This commit is contained in:
parent
68af54e140
commit
4d9d1fd18f
2 changed files with 15 additions and 10 deletions
|
@ -219,10 +219,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
|
|
||||||
if (editingCtx.isInMultiProfileMode()) {
|
if (editingCtx.isInMultiProfileMode()) {
|
||||||
multiProfileGeometryWayContext.updatePaints(settings.isNightMode(), multiProfileLineAttrs);
|
multiProfileGeometryWayContext.updatePaints(settings.isNightMode(), multiProfileLineAttrs);
|
||||||
List<TrkSegment> allSegments = new ArrayList<>();
|
multiProfileGeometry.updateRoute(tb, editingCtx.getRoadSegmentData(), editingCtx.getBeforeSegments(), editingCtx.getAfterSegments());
|
||||||
allSegments.addAll(editingCtx.getBeforeSegments());
|
|
||||||
allSegments.addAll(editingCtx.getAfterSegments());
|
|
||||||
multiProfileGeometry.updateRoute(tb, editingCtx.getRoadSegmentData(), allSegments);
|
|
||||||
multiProfileGeometry.drawSegments(canvas, tb);
|
multiProfileGeometry.drawSegments(canvas, tb);
|
||||||
} else {
|
} else {
|
||||||
multiProfileGeometry.clearWay();
|
multiProfileGeometry.clearWay();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.PathMeasure;
|
import android.graphics.PathMeasure;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
|
@ -36,7 +37,8 @@ public class MultiProfileGeometryWay extends GeometryWay<MultiProfileGeometryWay
|
||||||
private static final String DEFAULT_PROFILE_KEY = ApplicationMode.DEFAULT.getStringKey();
|
private static final String DEFAULT_PROFILE_KEY = ApplicationMode.DEFAULT.getStringKey();
|
||||||
|
|
||||||
private Map<Pair<WptPt, WptPt>, RoadSegmentData> segmentData;
|
private Map<Pair<WptPt, WptPt>, RoadSegmentData> segmentData;
|
||||||
private List<TrkSegment> segments;
|
private List<TrkSegment> beforeSegments;
|
||||||
|
private List<TrkSegment> afterSegments;
|
||||||
|
|
||||||
public MultiProfileGeometryWay(MultiProfileGeometryWayContext context) {
|
public MultiProfileGeometryWay(MultiProfileGeometryWayContext context) {
|
||||||
super(context, new MultiProfileGeometryWayDrawer(context));
|
super(context, new MultiProfileGeometryWayDrawer(context));
|
||||||
|
@ -70,20 +72,26 @@ public class MultiProfileGeometryWay extends GeometryWay<MultiProfileGeometryWay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRoute(RotatedTileBox tileBox, Map<Pair<WptPt, WptPt>, RoadSegmentData> segmentData, List<TrkSegment> segments) {
|
public void updateRoute(RotatedTileBox tileBox, Map<Pair<WptPt, WptPt>, RoadSegmentData> segmentData,
|
||||||
|
List<TrkSegment> beforeSegments, List<TrkSegment> afterSegments) {
|
||||||
boolean shouldUpdateRoute = tileBox.getMapDensity() != getMapDensity() || segmentDataChanged(segmentData)
|
boolean shouldUpdateRoute = tileBox.getMapDensity() != getMapDensity() || segmentDataChanged(segmentData)
|
||||||
|| this.segments != segments || getLocationProvider() == null;
|
|| this.beforeSegments != beforeSegments || this.afterSegments != afterSegments || getLocationProvider() == null;
|
||||||
if (shouldUpdateRoute) {
|
if (shouldUpdateRoute) {
|
||||||
this.segmentData = segmentData;
|
this.segmentData = segmentData;
|
||||||
this.segments = segments;
|
this.beforeSegments = beforeSegments;
|
||||||
|
this.afterSegments = afterSegments;
|
||||||
|
|
||||||
List<Location> locations;
|
List<Location> locations;
|
||||||
Map<Integer, GeometryWayStyle<?>> styleMap;
|
Map<Integer, GeometryWayStyle<?>> styleMap;
|
||||||
|
|
||||||
List<Way> ways = new ArrayList<>();
|
List<Way> ways = new ArrayList<>();
|
||||||
List<GeometryWayStyle<?>> styles = new ArrayList<>();
|
List<GeometryWayStyle<?>> styles = new ArrayList<>();
|
||||||
setStyles(tileBox, segments, ways, styles);
|
|
||||||
locations = new ArrayList<>();
|
locations = new ArrayList<>();
|
||||||
|
|
||||||
|
List<TrkSegment> allSegments = new ArrayList<>();
|
||||||
|
allSegments.addAll(beforeSegments);
|
||||||
|
allSegments.addAll(afterSegments);
|
||||||
|
setStyles(tileBox, allSegments, ways, styles);
|
||||||
|
|
||||||
styleMap = new TreeMap<>();
|
styleMap = new TreeMap<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
Loading…
Reference in a new issue