Skip to content

Commit

Permalink
Show next anchors on map
Browse files Browse the repository at this point in the history
  • Loading branch information
Feodor0090 committed May 29, 2023
1 parent e021a20 commit 3949b28
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mahomaps/route/RouteTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

public class RouteTracker {

private final RouteFollowOverlay o;
Geopoint trueGeolocation = null;
Geopoint extrapolatedGeolocation = null;
final Geopoint[] vertex;
final float[] lineLengths;
final RouteSegment[] segments;
private final Geopoint[] vertex;
private final float[] lineLengths;
private final RouteSegment[] segments;
int currentSegment;

static final int ACCEPTABLE_ERROR = 20;

// drawing temps
String next;
String distLeft;
private RouteFollowOverlay o;

public RouteTracker(Route r, RouteFollowOverlay o) {
this.o = o;
Expand Down Expand Up @@ -70,6 +70,7 @@ public void Update() {
if (d < ACCEPTABLE_ERROR) {
currentSegment = 0;
}
o.ShowPoint(segments[0].GetAnchor());
} else if (currentSegment == segments.length - 1) {
// last segment
Geopoint t = vertex[vertex.length - 1];
Expand All @@ -79,6 +80,7 @@ public void Update() {
if (d < ACCEPTABLE_ERROR) {
currentSegment++;
}
o.ShowPoint(null);
} else if (currentSegment < segments.length) {
// route is follown
RouteSegment s = segments[currentSegment];
Expand All @@ -91,10 +93,12 @@ public void Update() {
if (d < ACCEPTABLE_ERROR) {
currentSegment++;
}
o.ShowPoint(ns.GetAnchor());
} else {
// route ended
next = "Маршрут завершён.";
distLeft = null;
o.ShowPoint(null);
}

}
Expand Down

0 comments on commit 3949b28

Please sign in to comment.