Changed arrow to next mark appearance #story[1195]
This commit is contained in:
@@ -111,11 +111,25 @@ public class RaceController extends Controller {
|
|||||||
@FXML private TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
@FXML private TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
||||||
@FXML private LineChart<Number, Number> sparklineChart;
|
@FXML private LineChart<Number, Number> sparklineChart;
|
||||||
|
|
||||||
|
private AnimationTimer arrowToNextMark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ctor.
|
* Ctor.
|
||||||
*/
|
*/
|
||||||
public RaceController() {
|
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
|
@Override
|
||||||
@@ -370,7 +384,27 @@ public class RaceController extends Controller {
|
|||||||
|
|
||||||
private void addThirdPersonAnnotations(Subject3D subject3D) {
|
private void addThirdPersonAnnotations(Subject3D subject3D) {
|
||||||
viewSubjects.add(nextMarkArrow);
|
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 {
|
try {
|
||||||
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
||||||
this.pointToMark = (o, prev, curr) -> {
|
this.pointToMark = (o, prev, curr) -> {
|
||||||
@@ -386,18 +420,19 @@ public class RaceController extends Controller {
|
|||||||
boat.positionProperty().addListener(pointToMark);
|
boat.positionProperty().addListener(pointToMark);
|
||||||
} catch (BoatNotFoundException e) {
|
} catch (BoatNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeThirdPersonAnnotations(Subject3D subject3D) {
|
private void removeThirdPersonAnnotations(Subject3D subject3D) {
|
||||||
viewSubjects.remove(nextMarkArrow);
|
viewSubjects.remove(nextMarkArrow);
|
||||||
|
arrowToNextMark.stop();
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
VisualiserBoat boat = visualiserRace.getVisualiserRaceState().getBoat(subject3D.getSourceID());
|
||||||
boat.positionProperty().removeListener(pointToMark);
|
boat.positionProperty().removeListener(pointToMark);
|
||||||
} catch (BoatNotFoundException e) {
|
} catch (BoatNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user