Refactored and moved RaceXMLReader to shared/dataInput.
RaceStatus can provide windspeed in knots in addition to mm/sec. RaceDataSource now provides a list of participating boat sourceIDs instead of boats. Added a RegattaDataSource interface. Angle, Azimuth, Bearing and mutable - careful. Boat has positionInRace. CompoundMarks have an ID and name. Marks can be moved (setPosition(...)). Refactored Mock.Race, Visualiser.StreamedCourse, Visualiser.StreamedRace, into (shared) Race, MockRace, VisualiserRace. VisualiserBoat has color. Added xml and polar files into resources folder.
This commit is contained in:
@@ -2,6 +2,7 @@ package visualiser.model;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.paint.Color;
|
||||
import network.Messages.Enums.BoatStatusEnum;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
import shared.model.Boat;
|
||||
@@ -17,28 +18,50 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
* This adds visualiser specific functionality to a boat.
|
||||
* 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 seng302.Model.ResizableRaceCanvas ResizableRaceCanvas} via the
|
||||
* {@link seng302.Controllers.RaceController RaceController}.
|
||||
* {@link ResizableRaceCanvas ResizableRaceCanvas} via the
|
||||
* {@link visualiser.Controllers.RaceController RaceController}.
|
||||
*/
|
||||
public class VisualiserBoat extends Boat {
|
||||
|
||||
|
||||
/**
|
||||
* The collection of trackpoints generated for the boat.
|
||||
*/
|
||||
private final Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
||||
|
||||
private long nextValidTime = 0;
|
||||
|
||||
private ZonedDateTime timeSinceLastMark;
|
||||
|
||||
/**
|
||||
* The boat's color.
|
||||
*/
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* Boat initializer which keeps all of the information of the boat.
|
||||
*
|
||||
* @param sourceID The source ID of the boat.
|
||||
* @param name Name of the Boat.
|
||||
* @param abbrev The team/country abbreviation of the boat.
|
||||
* @param color The color of the boat.
|
||||
*/
|
||||
public VisualiserBoat(int sourceID, String name, String abbrev) {
|
||||
public VisualiserBoat(int sourceID, String name, String abbrev, Color color) {
|
||||
super(sourceID, name, abbrev);
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a mock boat object from a given boat and polars table.
|
||||
*
|
||||
* @param boat The boat to convert into a MockBoat.
|
||||
* @param color The color of the boat.
|
||||
*/
|
||||
public VisualiserBoat(Boat boat, Color color) {
|
||||
super(boat.getSourceID(), boat.getName(), boat.getCountry());
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +89,7 @@ public class VisualiserBoat extends Boat {
|
||||
/**
|
||||
* Adds a new point to boat's track.
|
||||
* @param coordinate of point on track
|
||||
* @see seng302.Model.TrackPoint
|
||||
* @see TrackPoint
|
||||
*/
|
||||
public void addTrackPoint(GPSCoordinate coordinate) {
|
||||
Boolean added = System.currentTimeMillis() >= nextValidTime;
|
||||
@@ -82,12 +105,19 @@ public class VisualiserBoat extends Boat {
|
||||
/**
|
||||
* Returns the boat's sampled track between start of race and current time.
|
||||
* @return queue of track points
|
||||
* @see seng302.Model.TrackPoint
|
||||
* @see TrackPoint
|
||||
*/
|
||||
public Queue<TrackPoint> getTrack() {
|
||||
return track;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color of the boat.
|
||||
* @return The color of the boat.
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print method prints the name of the boat
|
||||
|
||||
Reference in New Issue
Block a user