Merge remote-tracking branch 'origin/master' into story_51_rounding_fix
# Conflicts: # racevisionGame/src/main/java/mock/app/Event.java # racevisionGame/src/main/java/mock/xml/RaceXMLCreator.java Also added keybindings.xml to git ignore. #story[1185]
This commit is contained in:
@@ -15,7 +15,7 @@ import java.util.Map;
|
||||
* Class that processes user selected annotation visibility options to
|
||||
* display the requested information on the
|
||||
* {@link ResizableRaceCanvas}. These are displayed
|
||||
* via the {@link visualiser.Controllers.RaceController}. <br>
|
||||
* via the {@link visualiser.Controllers.RaceViewController}. <br>
|
||||
* Annotation options for a {@link VisualiserBoat} include: its name,
|
||||
* abbreviation, speed, the time since it passed the last
|
||||
* {@link shared.model.Mark}, estimated time to the next marker,
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package visualiser.model;
|
||||
|
||||
import com.interactivemesh.jfx.importer.Importer;
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 29/08/17.
|
||||
*/
|
||||
public class BoatDisplay3D extends Pane {
|
||||
|
||||
|
||||
public BoatDisplay3D(String filePath){
|
||||
super();
|
||||
// Shape3D
|
||||
// this.getChildren().add();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
/**
|
||||
* This JavaFX Canvas is used to update and display details for a
|
||||
* {@link RaceMap} via the
|
||||
* {@link visualiser.Controllers.RaceController}.<br>
|
||||
* {@link visualiser.Controllers.RaceViewController}.<br>
|
||||
* It fills it's parent and cannot be downsized. <br>
|
||||
* Details displayed include:
|
||||
* {@link VisualiserBoat}s (and their
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
* placing position as they complete each {@link shared.model.Leg} by
|
||||
* passing a course {@link shared.model.Mark}. <br>
|
||||
* This sparkline is displayed using the
|
||||
* {@link visualiser.Controllers.RaceController}.
|
||||
* {@link visualiser.Controllers.RaceViewController}.
|
||||
*/
|
||||
public class Sparkline {
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import shared.model.GPSCoordinate;
|
||||
* {@link VisualiserBoat Boat} has travelled in a race. <br>
|
||||
* TrackPoints are displayed on a
|
||||
* {@link ResizableRaceCanvas}, via the
|
||||
* {@link visualiser.Controllers.RaceController}. <br>
|
||||
* Track points can be made visible or hidden via the RaceController's
|
||||
* {@link visualiser.Controllers.RaceViewController}. <br>
|
||||
* Track points can be made visible or hidden via the RaceViewController's
|
||||
* {@link Annotations}.
|
||||
*/
|
||||
public class TrackPoint {
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.PerspectiveCamera;
|
||||
import javafx.scene.SubScene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Shape3D;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.scene.transform.Translate;
|
||||
|
||||
/**
|
||||
* Control for rendering 3D objects visible through a PerspectiveCamera. Implements Adapter Pattern to
|
||||
* interface with camera, and allows clients to add shapes to the scene. All scenes contain sea plane and
|
||||
* sky box, whose textures are set with special methods.
|
||||
*/
|
||||
public class View3D extends Pane {
|
||||
/**
|
||||
* Observable list of renderable items
|
||||
*/
|
||||
private ObservableList<Shape3D> items;
|
||||
/**
|
||||
* Rendering container for shapes
|
||||
*/
|
||||
private Group world;
|
||||
/**
|
||||
* Near limit of view frustum
|
||||
*/
|
||||
private double nearClip;
|
||||
/**
|
||||
* Far limit of view frustum
|
||||
*/
|
||||
private double farClip;
|
||||
/**
|
||||
* Position camera pivots around
|
||||
*/
|
||||
private Translate pivot;
|
||||
/**
|
||||
* Distance of camera from pivot point
|
||||
*/
|
||||
private Translate distance;
|
||||
/**
|
||||
* Angle along ground between z-axis and camera
|
||||
*/
|
||||
private Rotate yaw;
|
||||
/**
|
||||
* Angle between ground plane and camera direction
|
||||
*/
|
||||
private Rotate pitch;
|
||||
|
||||
/**
|
||||
* Default constructor for View3D. Sets up Scene and PerspectiveCamera.
|
||||
*/
|
||||
public View3D() {
|
||||
world = new Group();
|
||||
|
||||
SubScene scene = new SubScene(world, 300, 300);
|
||||
scene.widthProperty().bind(this.widthProperty());
|
||||
scene.heightProperty().bind(this.heightProperty());
|
||||
scene.setFill(Color.BLACK);
|
||||
|
||||
scene.setCamera(buildCamera());
|
||||
|
||||
this.getChildren().add(scene);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up camera view frustum and binds transformations
|
||||
* @return perspective camera
|
||||
*/
|
||||
private PerspectiveCamera buildCamera() {
|
||||
PerspectiveCamera camera = new PerspectiveCamera(true);
|
||||
|
||||
// Set up view frustum
|
||||
nearClip = 0.1;
|
||||
farClip = 1000.0;
|
||||
camera.setNearClip(nearClip);
|
||||
camera.setFarClip(farClip);
|
||||
|
||||
// Set up transformations
|
||||
pivot = new Translate();
|
||||
distance = new Translate();
|
||||
yaw = new Rotate(0, Rotate.Y_AXIS);
|
||||
pitch = new Rotate(0, Rotate.X_AXIS);
|
||||
camera.getTransforms().addAll(pivot, yaw, pitch, distance);
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
public void setItems(ObservableList<Shape3D> items) {
|
||||
this.items = items;
|
||||
this.items.addListener((ListChangeListener<? super Shape3D>) c -> {
|
||||
while(c.next()) {
|
||||
if (c.wasRemoved() || c.wasAdded()) {
|
||||
for (Shape3D shape : c.getRemoved()) world.getChildren().remove(shape);
|
||||
for (Shape3D shape : c.getAddedSubList()) world.getChildren().add(shape);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setNearClip(double nearClip) {
|
||||
this.nearClip = nearClip;
|
||||
}
|
||||
|
||||
public void setFarClip(double farClip) {
|
||||
this.farClip = farClip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set object to centre on camera
|
||||
* @param pivot centred object
|
||||
*/
|
||||
public void setPivot(Shape3D pivot) {
|
||||
this.pivot.setX(pivot.getTranslateX());
|
||||
this.pivot.setY(pivot.getTranslateY());
|
||||
this.pivot.setZ(pivot.getTranslateZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set distance of camera from pivot
|
||||
* @param distance in units
|
||||
*/
|
||||
public void setDistance(double distance) {
|
||||
this.distance.setZ(-distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set angle of camera from z-axis along ground
|
||||
* @param yaw in degrees
|
||||
*/
|
||||
public void setYaw(double yaw) {
|
||||
this.yaw.setAngle(yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set elevation of camera
|
||||
* @param pitch in degrees
|
||||
*/
|
||||
public void setPitch(double pitch) {
|
||||
this.pitch.setAngle(-pitch);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -18,7 +17,7 @@ import java.util.List;
|
||||
* This class is used to represent and store information about a boat which may
|
||||
* travel around in a race. It is displayed on the
|
||||
* {@link ResizableRaceCanvas ResizableRaceCanvas} via the
|
||||
* {@link visualiser.Controllers.RaceController RaceController}.
|
||||
* {@link visualiser.Controllers.RaceViewController RaceViewController}.
|
||||
*/
|
||||
public class VisualiserBoat extends Boat {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class VisualiserRaceEvent {
|
||||
|
||||
|
||||
this.serverConnection = new ServerConnection(socket, visualiserRaceState, raceCommands, requestType);
|
||||
this.serverConnectionThread = new Thread(serverConnection, "StartController.enterLobby()->serverConnection thread " + serverConnection);
|
||||
this.serverConnectionThread = new Thread(serverConnection, "RaceStartController.enterLobby()->serverConnection thread " + serverConnection);
|
||||
this.serverConnectionThread.start();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user