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()) {
|
||||
multiProfileGeometryWayContext.updatePaints(settings.isNightMode(), multiProfileLineAttrs);
|
||||
List<TrkSegment> allSegments = new ArrayList<>();
|
||||
allSegments.addAll(editingCtx.getBeforeSegments());
|
||||
allSegments.addAll(editingCtx.getAfterSegments());
|
||||
multiProfileGeometry.updateRoute(tb, editingCtx.getRoadSegmentData(), allSegments);
|
||||
multiProfileGeometry.updateRoute(tb, editingCtx.getRoadSegmentData(), editingCtx.getBeforeSegments(), editingCtx.getAfterSegments());
|
||||
multiProfileGeometry.drawSegments(canvas, tb);
|
||||
} else {
|
||||
multiProfileGeometry.clearWay();
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PathMeasure;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
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 Map<Pair<WptPt, WptPt>, RoadSegmentData> segmentData;
|
||||
private List<TrkSegment> segments;
|
||||
private List<TrkSegment> beforeSegments;
|
||||
private List<TrkSegment> afterSegments;
|
||||
|
||||
public MultiProfileGeometryWay(MultiProfileGeometryWayContext 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)
|
||||
|| this.segments != segments || getLocationProvider() == null;
|
||||
|| this.beforeSegments != beforeSegments || this.afterSegments != afterSegments || getLocationProvider() == null;
|
||||
if (shouldUpdateRoute) {
|
||||
this.segmentData = segmentData;
|
||||
this.segments = segments;
|
||||
this.beforeSegments = beforeSegments;
|
||||
this.afterSegments = afterSegments;
|
||||
|
||||
List<Location> locations;
|
||||
Map<Integer, GeometryWayStyle<?>> styleMap;
|
||||
|
||||
List<Way> ways = new ArrayList<>();
|
||||
List<GeometryWayStyle<?>> styles = new ArrayList<>();
|
||||
setStyles(tileBox, segments, ways, styles);
|
||||
locations = new ArrayList<>();
|
||||
|
||||
List<TrkSegment> allSegments = new ArrayList<>();
|
||||
allSegments.addAll(beforeSegments);
|
||||
allSegments.addAll(afterSegments);
|
||||
setStyles(tileBox, allSegments, ways, styles);
|
||||
|
||||
styleMap = new TreeMap<>();
|
||||
int i = 0;
|
||||
int k = 0;
|
||||
|
|
Loading…
Reference in a new issue