Show original track line

This commit is contained in:
Dima-1 2020-09-01 19:43:28 +03:00
parent f232395a71
commit 9c1ffd6c13
2 changed files with 17 additions and 1 deletions

View file

@ -61,6 +61,7 @@ public class MeasurementEditingContext {
private boolean inAddPointMode;
private boolean inApproximationMode;
List<WptPt> 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<Pair<WptPt, WptPt>, 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<WptPt> getOriginalTrackPointList() {
return originalTrackPointList;
}
@Nullable
GpxData getGpxData() {

View file

@ -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<WptPt> 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);
}
}