Replaced mark arrow listener with animation timer.
#story[1195]
This commit is contained in:
@@ -82,7 +82,7 @@ public class RaceController extends Controller {
|
||||
private ObservableList<Subject3D> viewSubjects;
|
||||
|
||||
private Subject3D nextMarkArrow;
|
||||
private ChangeListener<? super GPSCoordinate> pointToMark;
|
||||
private AnimationTimer pointToMark;
|
||||
|
||||
/**
|
||||
* The arrow controller.
|
||||
@@ -367,7 +367,9 @@ public class RaceController extends Controller {
|
||||
|
||||
try {
|
||||
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
||||
this.pointToMark = (o, prev, curr) -> {
|
||||
this.pointToMark = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
||||
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
||||
|
||||
@@ -375,9 +377,9 @@ public class RaceController extends Controller {
|
||||
nextMarkArrow.setY(view3D.getPivot().getY());
|
||||
nextMarkArrow.setZ(view3D.getPivot().getZ() + 10);
|
||||
nextMarkArrow.setHeading(headingToMark.degrees());
|
||||
}
|
||||
};
|
||||
|
||||
boat.positionProperty().addListener(pointToMark);
|
||||
pointToMark.start();
|
||||
} catch (BoatNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -385,13 +387,7 @@ public class RaceController extends Controller {
|
||||
|
||||
private void removeThirdPersonAnnotations(Subject3D subject3D) {
|
||||
viewSubjects.remove(nextMarkArrow);
|
||||
|
||||
try {
|
||||
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
||||
boat.positionProperty().removeListener(pointToMark);
|
||||
} catch (BoatNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
pointToMark.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user