diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index b1ef048ec0..226e512a20 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -61,6 +61,7 @@ public class MeasurementEditingContext { private boolean inAddPointMode; private boolean inApproximationMode; + List originalTrackPointList = new ArrayList<>(); private int calculatedPairs; private int pointsToCalculateSize; private CalculationMode lastCalculationMode = WHOLE_TRACK; @@ -69,6 +70,7 @@ public class MeasurementEditingContext { private RouteCalculationProgress calculationProgress; private Map, RoadSegmentData> roadSegmentData = new ConcurrentHashMap<>(); + public enum CalculationMode { NEXT_SEGMENT, WHOLE_TRACK @@ -182,8 +184,14 @@ public class MeasurementEditingContext { public void setInApproximationMode(boolean inApproximationMode) { this.inApproximationMode = inApproximationMode; + if (inApproximationMode) { + originalTrackPointList = new ArrayList<>(before.points); + } } + public List getOriginalTrackPointList() { + return originalTrackPointList; + } @Nullable GpxData getGpxData() { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index 0c56a8c270..ee12e8f205 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -7,6 +7,8 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; +import androidx.core.content.ContextCompat; + import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.WptPt; import net.osmand.Location; @@ -178,7 +180,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL TrkSegment after = editingCtx.getAfterTrkSegmentLine(); new Renderable.StandardTrack(new ArrayList<>(after.points), 17.2). drawSegment(view.getZoom(), lineAttrs.paint, canvas, tb); - + if (editingCtx.isInApproximationMode()) { + List current = editingCtx.getOriginalTrackPointList(); + lineAttrs.customColorPaint.setColor(ContextCompat.getColor(view.getContext(), + R.color.activity_background_transparent_color_dark)); + new Renderable.StandardTrack(new ArrayList<>(current), 17.2). + drawSegment(view.getZoom(), lineAttrs.customColorPaint, canvas, tb); + } drawPoints(canvas, tb); } }