|
|
|
|
@ -111,11 +111,25 @@ public class RaceController extends Controller {
|
|
|
|
|
@FXML private TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
|
|
|
|
@FXML private LineChart<Number, Number> sparklineChart;
|
|
|
|
|
|
|
|
|
|
private AnimationTimer arrowToNextMark;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ctor.
|
|
|
|
|
*/
|
|
|
|
|
public RaceController() {
|
|
|
|
|
this.nextMarkArrow = new Annotation3D(new Box(1,3,0));
|
|
|
|
|
|
|
|
|
|
// Import arrow mesh
|
|
|
|
|
URL asset = HostController.class.getClassLoader().getResource("assets/arrow V1.0.4.stl");
|
|
|
|
|
StlMeshImporter importer = new StlMeshImporter();
|
|
|
|
|
importer.read(asset);
|
|
|
|
|
|
|
|
|
|
MeshView arrow = new MeshView(importer.getImport());
|
|
|
|
|
PhongMaterial arrowMat = new PhongMaterial(Color.RED);
|
|
|
|
|
arrow.setMaterial(arrowMat);
|
|
|
|
|
|
|
|
|
|
this.nextMarkArrow = new Annotation3D(arrow);
|
|
|
|
|
this.nextMarkArrow.setScale(0.1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -370,7 +384,27 @@ public class RaceController extends Controller {
|
|
|
|
|
|
|
|
|
|
private void addThirdPersonAnnotations(Subject3D subject3D) {
|
|
|
|
|
viewSubjects.add(nextMarkArrow);
|
|
|
|
|
final VisualiserBoat boat;
|
|
|
|
|
try {
|
|
|
|
|
boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
|
|
|
|
} catch (BoatNotFoundException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
arrowToNextMark = new AnimationTimer() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long now) {
|
|
|
|
|
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
|
|
|
|
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
|
|
|
|
|
|
|
|
|
nextMarkArrow.setX(view3D.getPivot().getX());
|
|
|
|
|
nextMarkArrow.setY(view3D.getPivot().getY());
|
|
|
|
|
nextMarkArrow.setZ(view3D.getPivot().getZ() + 15);
|
|
|
|
|
nextMarkArrow.setHeading(headingToMark.degrees());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
arrowToNextMark.start();
|
|
|
|
|
/*
|
|
|
|
|
try {
|
|
|
|
|
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
|
|
|
|
this.pointToMark = (o, prev, curr) -> {
|
|
|
|
|
@ -386,18 +420,19 @@ public class RaceController extends Controller {
|
|
|
|
|
boat.positionProperty().addListener(pointToMark);
|
|
|
|
|
} catch (BoatNotFoundException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void removeThirdPersonAnnotations(Subject3D subject3D) {
|
|
|
|
|
viewSubjects.remove(nextMarkArrow);
|
|
|
|
|
|
|
|
|
|
arrowToNextMark.stop();
|
|
|
|
|
/*
|
|
|
|
|
try {
|
|
|
|
|
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
|
|
|
|
boat.positionProperty().removeListener(pointToMark);
|
|
|
|
|
} catch (BoatNotFoundException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|