Created wrapper for controlling the position and heading of rendered 3D models.
- Updated View3D to use Subject3D wrappers instead of Shape3D - Fixed HostController for the new architecture - Made position and heading observable in VisualiserBoat - Attached listeners to each VisualiserBoat in RaceController #story[1261]
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.paint.Color;
|
||||
import network.Messages.Enums.BoatStatusEnum;
|
||||
import shared.model.Azimuth;
|
||||
import shared.model.Boat;
|
||||
import shared.model.Constants;
|
||||
import shared.model.GPSCoordinate;
|
||||
import shared.model.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -61,7 +60,8 @@ public class VisualiserBoat extends Boat {
|
||||
private boolean isClientBoat = false;
|
||||
|
||||
|
||||
|
||||
private ObjectProperty<GPSCoordinate> positionProperty;
|
||||
private ObjectProperty<Bearing> bearingProperty;
|
||||
|
||||
|
||||
/**
|
||||
@@ -239,4 +239,38 @@ public class VisualiserBoat extends Boat {
|
||||
public void setClientBoat(boolean clientBoat) {
|
||||
isClientBoat = clientBoat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPSCoordinate getPosition() {
|
||||
return positionProperty.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(GPSCoordinate position) {
|
||||
if(this.positionProperty == null) {
|
||||
this.positionProperty = new SimpleObjectProperty<>();
|
||||
}
|
||||
this.positionProperty.set(position);
|
||||
}
|
||||
|
||||
public ObjectProperty<GPSCoordinate> positionProperty() {
|
||||
return positionProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bearing getBearing() {
|
||||
return bearingProperty.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBearing(Bearing bearing) {
|
||||
if(this.bearingProperty == null) {
|
||||
this.bearingProperty = new SimpleObjectProperty<>();
|
||||
}
|
||||
this.bearingProperty.set(bearing);
|
||||
}
|
||||
|
||||
public ObjectProperty<Bearing> bearingProperty() {
|
||||
return bearingProperty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user