Fixed JavaDoc, spelling errors, and redundant classes
- Removed some default templates (eg: created by X) - Wrote JavaDoc for classes that had none - Made JavaDoc more clear for classes - Linked JavaDoc to other classes - Minor spelling errors fixed - BoatInRace and BoatInRaceTest commented out (to be removed) #story[1003]
This commit is contained in:
@@ -2,7 +2,9 @@ package seng302;
|
||||
|
||||
/**
|
||||
* GPS Coordinate for the world map.
|
||||
* Created by esa46 on 15/03/17.
|
||||
* It is converted to a {@link seng302.GraphCoordinate GraphCoordinate} via
|
||||
* the {@link seng302.RaceMap RaceMap} to display objects in their relative
|
||||
* positions on the {@link seng302.Model.ResizableRaceMap ResizableRaceMap}.
|
||||
*/
|
||||
public class GPSCoordinate {
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package seng302;
|
||||
|
||||
/**
|
||||
* Graph Coordinate that is to be displayed on the Canvas
|
||||
* Created by cbt24 on 15/03/17.
|
||||
* It is a coordinate representing a location on the
|
||||
* {@link seng302.Model.ResizableRaceMap ResizableRaceMap}.
|
||||
* It has been converted from a {@link seng302.GPSCoordinate GPSCoordinate}
|
||||
* to display objects in their relative positions.
|
||||
*/
|
||||
public class GraphCoordinate {
|
||||
private final int x;
|
||||
|
||||
@@ -15,7 +15,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* XML Read that reads the Boats that are goign to participate in the Race
|
||||
* XML Reader that reads in a file and initializes
|
||||
* {@link seng302.Mock.StreamedBoat StreamedBoat}s that will be participating
|
||||
* in a race.
|
||||
*/
|
||||
public class BoatXMLReader extends XMLReader {
|
||||
private final Map<Integer, StreamedBoat> streamedBoatMap = new HashMap<>();
|
||||
@@ -123,7 +125,8 @@ public class BoatXMLReader extends XMLReader {
|
||||
|
||||
for (int i = 0; i < boat.getChildNodes().getLength(); i++) {
|
||||
Node GPSPosition = boat.getChildNodes().item(i);
|
||||
if (GPSPosition.getNodeName().equals("GPSposition")) readBoatPositionInformation(sourceID, GPSPosition);
|
||||
if (GPSPosition.getNodeName().equals("GPSPosition"))
|
||||
readBoatPositionInformation(sourceID, GPSPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,12 +134,13 @@ public class BoatXMLReader extends XMLReader {
|
||||
|
||||
/**
|
||||
* Reads the positional information about a boat
|
||||
* Ignored values: FlagPosition, MastTop, Z value of GPSposition
|
||||
* Ignored values: FlagPosition, MastTop, Z value of GPSPosition
|
||||
* @param sourceID The source ID of the boat.
|
||||
* @param GPSPosition The relative GPS position of the boat.
|
||||
*/
|
||||
private void readBoatPositionInformation(int sourceID, Node GPSPosition) {
|
||||
// TODO Get relative point before implementing. (GPSposition is based off a relative point).
|
||||
// TODO Get relative point before implementing. (GPSPosition is based
|
||||
// off a relative point).
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -268,9 +268,10 @@ public class StreamedRace implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an estimated time an event will occur, and converts it to the number of seconds before the event will occur.
|
||||
* Takes an estimated time an event will occur, and converts it to the
|
||||
* number of seconds before the event will occur.
|
||||
*
|
||||
* @param estTimeMillis
|
||||
* @param estTimeMillis estimated time in milliseconds
|
||||
* @return int difference between time the race started and the estimated time
|
||||
*/
|
||||
private int convertEstTime(long estTimeMillis, long currentTime) {
|
||||
|
||||
@@ -13,7 +13,14 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Class that processes user selected annotation visibility options to
|
||||
* display the requested information on the race map.
|
||||
* display the requested information on the
|
||||
* {@link seng302.Model.ResizableRaceMap ResizbleRaceMap}. These are displayed
|
||||
* via the {@link seng302.Controllers.RaceController RaceController}. <br>
|
||||
* Annotation options for a {@link seng302.Model.Boat Boat} include: its name,
|
||||
* abbreviation, speed, the time since it passed the last
|
||||
* {@link seng302.Model.Marker Marker}, estimated time to the next marker,
|
||||
* and a path it has travelled made up of
|
||||
* {@link seng302.Model.TrackPoint TrackPoint}s.
|
||||
*/
|
||||
public class Annotations {
|
||||
private ResizableRaceCanvas raceMap;
|
||||
|
||||
@@ -11,7 +11,10 @@ import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 3/03/17.
|
||||
* 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}.
|
||||
*/
|
||||
public class Boat {
|
||||
|
||||
|
||||
@@ -1,310 +1,311 @@
|
||||
package seng302.Model;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.paint.Color;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
import seng302.GPSCoordinate;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* Boat in the Race extends Boat.
|
||||
* Created by esa46 on 15/03/17.
|
||||
*/
|
||||
public class BoatInRace extends Boat {
|
||||
|
||||
private Leg currentLeg;
|
||||
private double scaledVelocity;
|
||||
private double distanceTravelledInLeg;
|
||||
private GPSCoordinate currentPosition;
|
||||
private long timeFinished;
|
||||
private Color colour;
|
||||
private boolean finished = false;
|
||||
private final StringProperty currentLegName;
|
||||
private boolean started = false;
|
||||
private final StringProperty position;
|
||||
private double heading;
|
||||
private static final double WAKE_SCALE = 10;
|
||||
|
||||
private final Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
||||
private long nextValidTime = 0;
|
||||
|
||||
private static final float BASE_TRACK_POINT_TIME_INTERVAL = 5000;
|
||||
private static float trackPointTimeInterval = 5000; // every 1 seconds
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
*
|
||||
* @param name Name of the boat.
|
||||
* @param velocity Speed that the boat travels.
|
||||
* @param colour Colour the boat will be displayed as on the map
|
||||
* @param abbrev of boat
|
||||
*/
|
||||
public BoatInRace(String name, double velocity, Color colour, String abbrev) {
|
||||
super(name, velocity, abbrev);
|
||||
setColour(colour);
|
||||
currentLegName = new SimpleStringProperty("");
|
||||
position = new SimpleStringProperty("-");
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the azimuth of the travel via map coordinates of the raceMarkers
|
||||
*
|
||||
* @return the direction that the boat is heading towards in degrees (-180 to 180).
|
||||
*/
|
||||
public double calculateAzimuth() {
|
||||
|
||||
GeodeticCalculator calc = new GeodeticCalculator();
|
||||
GPSCoordinate start = currentLeg.getStartMarker().getAverageGPSCoordinate();
|
||||
GPSCoordinate end = currentLeg.getEndMarker().getAverageGPSCoordinate();
|
||||
|
||||
calc.setStartingGeographicPoint(start.getLongitude(), start.getLatitude());
|
||||
calc.setDestinationGeographicPoint(end.getLongitude(), end.getLatitude());
|
||||
|
||||
return calc.getAzimuth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an azimuth to a bearing
|
||||
*
|
||||
* @param azimuth azimuth value to be converted
|
||||
* @return the bearings in degrees (0 to 360).
|
||||
*/
|
||||
private static double calculateHeading(double azimuth) {
|
||||
if (azimuth >= 0) {
|
||||
return azimuth;
|
||||
} else {
|
||||
return azimuth + 360;
|
||||
}
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the bearing of the travel via map coordinates of the raceMarkers
|
||||
*
|
||||
* @return the direction that the boat is heading towards in degrees (0 to 360).
|
||||
*/
|
||||
public double calculateHeading() {
|
||||
double azimuth = calculateAzimuth();
|
||||
return calculateHeading(azimuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position of the end of the boat's wake, which is 180 degrees
|
||||
* from the boat's heading, and whose length is proportional to the boat's
|
||||
* speed.
|
||||
*
|
||||
* @return GPSCoordinate of wake endpoint.
|
||||
*/
|
||||
public GPSCoordinate getWake() {
|
||||
double reverseHeading = getHeading() - 180;
|
||||
double distance = WAKE_SCALE * getVelocity();
|
||||
|
||||
GeodeticCalculator calc = new GeodeticCalculator();
|
||||
calc.setStartingGeographicPoint(
|
||||
new Point2D.Double(getCurrentPosition().getLongitude(), getCurrentPosition().getLatitude())
|
||||
);
|
||||
calc.setDirection(reverseHeading, distance);
|
||||
Point2D endpoint = calc.getDestinationGeographicPoint();
|
||||
return new GPSCoordinate(endpoint.getY(), endpoint.getX());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Scaled velocity of the boat
|
||||
*/
|
||||
public double getScaledVelocity() {
|
||||
return scaledVelocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the boat's scaled velocity
|
||||
*
|
||||
* @param velocity of boat
|
||||
*/
|
||||
public void setScaledVelocity(double velocity) {
|
||||
this.scaledVelocity = velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the current position of the boat in a GPSCoordinate Class.
|
||||
* @see GPSCoordinate
|
||||
*/
|
||||
public GPSCoordinate getCurrentPosition() {
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current position on the GPS that the boat.
|
||||
*
|
||||
* @param position GPSCoordinate of the position that the boat is currently on.
|
||||
* @see GPSCoordinate
|
||||
*/
|
||||
public void setCurrentPosition(GPSCoordinate position) {
|
||||
this.currentPosition = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the time that the boat finished the race.
|
||||
*/
|
||||
public long getTimeFinished() {
|
||||
return timeFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time that the boat finished the race.
|
||||
*
|
||||
* @param timeFinished Time the boat finished the race.
|
||||
*/
|
||||
public void setTimeFinished(long timeFinished) {
|
||||
this.timeFinished = timeFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the colour of the boat.
|
||||
*/
|
||||
public Color getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the colour that boat will be shown as when drawn on the ResizableRaceCanvas.
|
||||
*
|
||||
* @param colour Colour that the boat is to be set to.
|
||||
* @see ResizableRaceCanvas
|
||||
*/
|
||||
private void setColour(Color colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current leg that the boat is on.
|
||||
*
|
||||
* @return returns the leg the boat is on in a Leg class
|
||||
* @see Leg
|
||||
*/
|
||||
public Leg getCurrentLeg() {
|
||||
return currentLeg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the boat's current leg.
|
||||
*
|
||||
* @param currentLeg Leg class that the boat is currently on.
|
||||
* @see Leg
|
||||
*/
|
||||
public void setCurrentLeg(Leg currentLeg) {
|
||||
this.currentLeg = currentLeg;
|
||||
this.currentLegName.setValue(currentLeg.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Name of boat's current leg
|
||||
*/
|
||||
public StringProperty getCurrentLegName() {
|
||||
return currentLegName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the distance travelled by the boat in the leg.
|
||||
*
|
||||
* @return Returns the value in nautical miles (1.852km) that the boat has traversed.
|
||||
*/
|
||||
public double getDistanceTravelledInLeg() {
|
||||
return distanceTravelledInLeg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the distance travelled by the boat in the leg in nautical miles (1.852km)
|
||||
*
|
||||
* @param distanceTravelledInLeg Distance travelled by the boat in nautical miles.
|
||||
*/
|
||||
public void setDistanceTravelledInLeg(double distanceTravelledInLeg) {
|
||||
this.distanceTravelledInLeg = distanceTravelledInLeg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if boat has finished, false if not
|
||||
*/
|
||||
public boolean isFinished() {
|
||||
return this.finished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether boat is finished or not
|
||||
*
|
||||
* @param bool is finished value
|
||||
*/
|
||||
public void setFinished(boolean bool) {
|
||||
this.finished = bool;
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return started;
|
||||
}
|
||||
|
||||
public void setStarted(boolean started) {
|
||||
this.started = started;
|
||||
}
|
||||
|
||||
public String getPosition() {
|
||||
return position.get();
|
||||
}
|
||||
|
||||
public StringProperty positionProperty() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
this.position.set(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new point to boat's track.
|
||||
* @param coordinate of point on track
|
||||
* @see seng302.Model.TrackPoint
|
||||
*/
|
||||
public void addTrackPoint(GPSCoordinate coordinate) {
|
||||
Boolean added = System.currentTimeMillis() >= nextValidTime;
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (added && this.started) {
|
||||
nextValidTime = currentTime + (long) trackPointTimeInterval;
|
||||
int TRACK_POINT_LIMIT = 10;
|
||||
track.add(new TrackPoint(coordinate, currentTime, TRACK_POINT_LIMIT * (long) trackPointTimeInterval));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boat's sampled track between start of race and current time.
|
||||
* @return queue of track points
|
||||
* @see seng302.Model.TrackPoint
|
||||
*/
|
||||
public Queue<TrackPoint> getTrack() {
|
||||
return track;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base track point time interval
|
||||
* @return base track point time interval
|
||||
*/
|
||||
public static float getBaseTrackPointTimeInterval() {
|
||||
return BASE_TRACK_POINT_TIME_INTERVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set track point time interval
|
||||
* @param value track point time interval value
|
||||
*/
|
||||
public static void setTrackPointTimeInterval(float value) {
|
||||
trackPointTimeInterval = value;
|
||||
}
|
||||
}
|
||||
//package seng302.Model;
|
||||
//
|
||||
//import javafx.beans.property.SimpleStringProperty;
|
||||
//import javafx.beans.property.StringProperty;
|
||||
//import javafx.scene.paint.Color;
|
||||
//import org.geotools.referencing.GeodeticCalculator;
|
||||
//import seng302.GPSCoordinate;
|
||||
//
|
||||
//import java.awt.geom.Point2D;
|
||||
//import java.util.Queue;
|
||||
//import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
//
|
||||
///**
|
||||
// * Boat in the Race extends {@link seng302.Model.Boat Boat}.
|
||||
// * The extended properties are related to the boats current race position.
|
||||
// * @See seng302.Model.Boat
|
||||
// */
|
||||
//public class BoatInRace extends Boat {
|
||||
//
|
||||
// private Leg currentLeg;
|
||||
// private double scaledVelocity;
|
||||
// private double distanceTravelledInLeg;
|
||||
// private GPSCoordinate currentPosition;
|
||||
// private long timeFinished;
|
||||
// private Color colour;
|
||||
// private boolean finished = false;
|
||||
// private final StringProperty currentLegName;
|
||||
// private boolean started = false;
|
||||
// private final StringProperty position;
|
||||
// private double heading;
|
||||
// private static final double WAKE_SCALE = 10;
|
||||
//
|
||||
// private final Queue<TrackPoint> track = new ConcurrentLinkedQueue<>();
|
||||
// private long nextValidTime = 0;
|
||||
//
|
||||
// private static final float BASE_TRACK_POINT_TIME_INTERVAL = 5000;
|
||||
// private static float trackPointTimeInterval = 5000; // every 1 seconds
|
||||
//
|
||||
// /**
|
||||
// * Constructor method.
|
||||
// *
|
||||
// * @param name Name of the boat.
|
||||
// * @param velocity Speed that the boat travels.
|
||||
// * @param colour Colour the boat will be displayed as on the map
|
||||
// * @param abbrev of boat
|
||||
// */
|
||||
// public BoatInRace(String name, double velocity, Color colour, String abbrev) {
|
||||
// super(name, velocity, abbrev);
|
||||
// setColour(colour);
|
||||
// currentLegName = new SimpleStringProperty("");
|
||||
// position = new SimpleStringProperty("-");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Calculates the azimuth of the travel via map coordinates of the raceMarkers
|
||||
// *
|
||||
// * @return the direction that the boat is heading towards in degrees (-180 to 180).
|
||||
// */
|
||||
// public double calculateAzimuth() {
|
||||
//
|
||||
// GeodeticCalculator calc = new GeodeticCalculator();
|
||||
// GPSCoordinate start = currentLeg.getStartMarker().getAverageGPSCoordinate();
|
||||
// GPSCoordinate end = currentLeg.getEndMarker().getAverageGPSCoordinate();
|
||||
//
|
||||
// calc.setStartingGeographicPoint(start.getLongitude(), start.getLatitude());
|
||||
// calc.setDestinationGeographicPoint(end.getLongitude(), end.getLatitude());
|
||||
//
|
||||
// return calc.getAzimuth();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Converts an azimuth to a bearing
|
||||
// *
|
||||
// * @param azimuth azimuth value to be converted
|
||||
// * @return the bearings in degrees (0 to 360).
|
||||
// */
|
||||
// private static double calculateHeading(double azimuth) {
|
||||
// if (azimuth >= 0) {
|
||||
// return azimuth;
|
||||
// } else {
|
||||
// return azimuth + 360;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public double getHeading() {
|
||||
// return heading;
|
||||
// }
|
||||
//
|
||||
// public void setHeading(double heading) {
|
||||
// this.heading = heading;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Calculates the bearing of the travel via map coordinates of the raceMarkers
|
||||
// *
|
||||
// * @return the direction that the boat is heading towards in degrees (0 to 360).
|
||||
// */
|
||||
// public double calculateHeading() {
|
||||
// double azimuth = calculateAzimuth();
|
||||
// return calculateHeading(azimuth);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the position of the end of the boat's wake, which is 180 degrees
|
||||
// * from the boat's heading, and whose length is proportional to the boat's
|
||||
// * speed.
|
||||
// *
|
||||
// * @return GPSCoordinate of wake endpoint.
|
||||
// */
|
||||
// public GPSCoordinate getWake() {
|
||||
// double reverseHeading = getHeading() - 180;
|
||||
// double distance = WAKE_SCALE * getVelocity();
|
||||
//
|
||||
// GeodeticCalculator calc = new GeodeticCalculator();
|
||||
// calc.setStartingGeographicPoint(
|
||||
// new Point2D.Double(getCurrentPosition().getLongitude(), getCurrentPosition().getLatitude())
|
||||
// );
|
||||
// calc.setDirection(reverseHeading, distance);
|
||||
// Point2D endpoint = calc.getDestinationGeographicPoint();
|
||||
// return new GPSCoordinate(endpoint.getY(), endpoint.getX());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Scaled velocity of the boat
|
||||
// */
|
||||
// public double getScaledVelocity() {
|
||||
// return scaledVelocity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the boat's scaled velocity
|
||||
// *
|
||||
// * @param velocity of boat
|
||||
// */
|
||||
// public void setScaledVelocity(double velocity) {
|
||||
// this.scaledVelocity = velocity;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the current position of the boat in a GPSCoordinate Class.
|
||||
// * @see GPSCoordinate
|
||||
// */
|
||||
// public GPSCoordinate getCurrentPosition() {
|
||||
// return currentPosition;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the current position on the GPS that the boat.
|
||||
// *
|
||||
// * @param position GPSCoordinate of the position that the boat is currently on.
|
||||
// * @see GPSCoordinate
|
||||
// */
|
||||
// public void setCurrentPosition(GPSCoordinate position) {
|
||||
// this.currentPosition = position;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the time that the boat finished the race.
|
||||
// */
|
||||
// public long getTimeFinished() {
|
||||
// return timeFinished;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the time that the boat finished the race.
|
||||
// *
|
||||
// * @param timeFinished Time the boat finished the race.
|
||||
// */
|
||||
// public void setTimeFinished(long timeFinished) {
|
||||
// this.timeFinished = timeFinished;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the colour of the boat.
|
||||
// */
|
||||
// public Color getColour() {
|
||||
// return colour;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the colour that boat will be shown as when drawn on the ResizableRaceCanvas.
|
||||
// *
|
||||
// * @param colour Colour that the boat is to be set to.
|
||||
// * @see ResizableRaceCanvas
|
||||
// */
|
||||
// private void setColour(Color colour) {
|
||||
// this.colour = colour;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the current leg that the boat is on.
|
||||
// *
|
||||
// * @return returns the leg the boat is on in a Leg class
|
||||
// * @see Leg
|
||||
// */
|
||||
// public Leg getCurrentLeg() {
|
||||
// return currentLeg;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the boat's current leg.
|
||||
// *
|
||||
// * @param currentLeg Leg class that the boat is currently on.
|
||||
// * @see Leg
|
||||
// */
|
||||
// public void setCurrentLeg(Leg currentLeg) {
|
||||
// this.currentLeg = currentLeg;
|
||||
// this.currentLegName.setValue(currentLeg.getName());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Name of boat's current leg
|
||||
// */
|
||||
// public StringProperty getCurrentLegName() {
|
||||
// return currentLegName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the distance travelled by the boat in the leg.
|
||||
// *
|
||||
// * @return Returns the value in nautical miles (1.852km) that the boat has traversed.
|
||||
// */
|
||||
// public double getDistanceTravelledInLeg() {
|
||||
// return distanceTravelledInLeg;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the distance travelled by the boat in the leg in nautical miles (1.852km)
|
||||
// *
|
||||
// * @param distanceTravelledInLeg Distance travelled by the boat in nautical miles.
|
||||
// */
|
||||
// public void setDistanceTravelledInLeg(double distanceTravelledInLeg) {
|
||||
// this.distanceTravelledInLeg = distanceTravelledInLeg;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return true if boat has finished, false if not
|
||||
// */
|
||||
// public boolean isFinished() {
|
||||
// return this.finished;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets whether boat is finished or not
|
||||
// *
|
||||
// * @param bool is finished value
|
||||
// */
|
||||
// public void setFinished(boolean bool) {
|
||||
// this.finished = bool;
|
||||
// }
|
||||
//
|
||||
// public boolean isStarted() {
|
||||
// return started;
|
||||
// }
|
||||
//
|
||||
// public void setStarted(boolean started) {
|
||||
// this.started = started;
|
||||
// }
|
||||
//
|
||||
// public String getPosition() {
|
||||
// return position.get();
|
||||
// }
|
||||
//
|
||||
// public StringProperty positionProperty() {
|
||||
// return position;
|
||||
// }
|
||||
//
|
||||
// public void setPosition(String position) {
|
||||
// this.position.set(position);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Adds a new point to boat's track.
|
||||
// * @param coordinate of point on track
|
||||
// * @see seng302.Model.TrackPoint
|
||||
// */
|
||||
// public void addTrackPoint(GPSCoordinate coordinate) {
|
||||
// Boolean added = System.currentTimeMillis() >= nextValidTime;
|
||||
// long currentTime = System.currentTimeMillis();
|
||||
// if (added && this.started) {
|
||||
// nextValidTime = currentTime + (long) trackPointTimeInterval;
|
||||
// int TRACK_POINT_LIMIT = 10;
|
||||
// track.add(new TrackPoint(coordinate, currentTime, TRACK_POINT_LIMIT * (long) trackPointTimeInterval));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the boat's sampled track between start of race and current time.
|
||||
// * @return queue of track points
|
||||
// * @see seng302.Model.TrackPoint
|
||||
// */
|
||||
// public Queue<TrackPoint> getTrack() {
|
||||
// return track;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get base track point time interval
|
||||
// * @return base track point time interval
|
||||
// */
|
||||
// public static float getBaseTrackPointTimeInterval() {
|
||||
// return BASE_TRACK_POINT_TIME_INTERVAL;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Set track point time interval
|
||||
// * @param value track point time interval value
|
||||
// */
|
||||
// public static void setTrackPointTimeInterval(float value) {
|
||||
// trackPointTimeInterval = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -4,7 +4,9 @@ import org.geotools.referencing.GeodeticCalculator;
|
||||
import seng302.GPSCoordinate;
|
||||
|
||||
/**
|
||||
* Created by cbt24 on 6/03/17.
|
||||
* This class represents a leg, which is a portion of a race between two
|
||||
* {@link seng302.Model.Marker Marker}s. A leg is used to identify a
|
||||
* {@link seng302.Model.Boat Boat}'s progress through a race.
|
||||
*/
|
||||
public class Leg {
|
||||
private final String name; //nautical miles
|
||||
|
||||
@@ -6,7 +6,11 @@ import seng302.GPSCoordinate;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
/**
|
||||
* Created by esa46 on 29/03/17.
|
||||
* A marker on a race course that a boat can pass, to be displayed on the
|
||||
* {@link seng302.Model.ResizableRaceCanvas ResizableRaceCanvas}. This is
|
||||
* displayed via the {@link seng302.Controllers.RaceController RaceController}.
|
||||
* <br>Markers are also used to calculate a {@link seng302.Model.Leg Leg}
|
||||
* distance.
|
||||
*/
|
||||
public class Marker {
|
||||
private final GPSCoordinate averageGPSCoordinate;
|
||||
|
||||
@@ -16,7 +16,11 @@ import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by Gondr on 19/04/2017.
|
||||
* This class is used to implement a clock which keeps track of and
|
||||
* displays times relevant to a race. This is displayed on the
|
||||
* {@link seng302.Model.ResizableRaceCanvas ResizableRaceCanvas} via the
|
||||
* {@link seng302.Controllers.RaceController RaceController} and the
|
||||
* {@link seng302.Controllers.StartController StartController}.
|
||||
*/
|
||||
public class RaceClock implements Runnable {
|
||||
private long lastTime;
|
||||
|
||||
@@ -4,7 +4,7 @@ import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 4/05/17.
|
||||
* The abstract class for the resizable race canvases.
|
||||
*/
|
||||
public abstract class ResizableCanvas extends Canvas {
|
||||
protected final GraphicsContext gc;
|
||||
|
||||
@@ -16,9 +16,16 @@ import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This creates a JavaFX Canvas that is fills it's parent.
|
||||
* Cannot be downsized.
|
||||
* Created by fwy13 on 17/03/17.
|
||||
* This JavaFX Canvas is used to update and display details for a
|
||||
* {@link seng302.RaceMap RaceMap} via the
|
||||
* {@link seng302.Controllers.RaceController RaceController}.<br>
|
||||
* It fills it's parent and cannot be downsized. <br>
|
||||
* Details displayed include:
|
||||
* {@link seng302.Model.Boat Boats} (and their
|
||||
* {@link seng302.Model.TrackPoint TrackPoint}s),
|
||||
* {@link seng302.Model.Marker Markers}, a
|
||||
* {@link seng302.Model.RaceClock RaceClock}, a wind direction arrow and
|
||||
* various user selected {@link seng302.Model.Annotations Annotations}.
|
||||
*/
|
||||
public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
private RaceMap map;
|
||||
|
||||
@@ -9,7 +9,10 @@ import seng302.RaceMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 4/05/17.
|
||||
* This JavaFX Canvas is used to generate the size of a
|
||||
* {@link seng302.RaceMap RaceMap} using co-ordinates from a
|
||||
* {@link seng302.RaceDataSource RaceDataSource}. This is done via the
|
||||
* {@link seng302.Controllers.RaceController RaceController}.
|
||||
*/
|
||||
public class ResizableRaceMap extends ResizableCanvas {
|
||||
private RaceMap map;
|
||||
@@ -34,8 +37,8 @@ public class ResizableRaceMap extends ResizableCanvas {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map race that it is auppost to be viewing.
|
||||
* @param map
|
||||
* Sets the map race that it is supposed to be viewing.
|
||||
* @param map the map to be set
|
||||
*/
|
||||
private void setMap(RaceMap map) {
|
||||
this.map = map;
|
||||
|
||||
@@ -12,7 +12,12 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Class to process and modify a sparkline display
|
||||
* Class to process and modify a sparkline display. This display keeps visual
|
||||
* track of {@link seng302.Model.Boat Boats}s in a race and their current
|
||||
* placing position as they complete each {@link seng302.Model.Leg Leg} by
|
||||
* passing a course {@link seng302.Model.Marker Marker}. <br>
|
||||
* This sparkline is displayed using the
|
||||
* {@link seng302.Controllers.RaceController RaceController}.
|
||||
*/
|
||||
public class Sparkline {
|
||||
private ArrayList<String> colours;
|
||||
|
||||
@@ -3,7 +3,13 @@ package seng302.Model;
|
||||
import seng302.GPSCoordinate;
|
||||
|
||||
/**
|
||||
* Created by cbt24 on 7/04/17.
|
||||
* A TrackPoint is a point plotted to display the track a
|
||||
* {@link seng302.Model.Boat Boat} has travelled in a race. <br>
|
||||
* TrackPoints are displayed on a
|
||||
* {@link seng302.Model.ResizableRaceCanvas ResizableRaceCanvas}, via the
|
||||
* {@link seng302.Controllers.RaceController RaceController}. <br>
|
||||
* Track points can be made visible or hidden via the RaceController's
|
||||
* {@link seng302.Model.Annotations Annotations}.
|
||||
*/
|
||||
public class TrackPoint {
|
||||
private final GPSCoordinate coordinate;
|
||||
|
||||
@@ -8,7 +8,11 @@ import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by connortaylorbrown on 19/04/17.
|
||||
* An object that holds relevant data for a race. <br>
|
||||
* Information includes: {@link seng302.Model.Boat Boat}s,
|
||||
* {@link seng302.Model.Leg Leg}s, {@link seng302.Model.Marker Marker}s and
|
||||
* the {@link seng302.GPSCoordinate GPSCoordinate}s to create a
|
||||
* {@link seng302.Model.ResizableRaceMap ResizableRaceMap}.
|
||||
*/
|
||||
public interface RaceDataSource {
|
||||
List<Boat> getBoats();
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package seng302;
|
||||
|
||||
/**
|
||||
* Created by cbt24 on 15/03/17.
|
||||
* The base size of the map to be used for the
|
||||
* {@link seng302.Model.ResizableRaceMap ResizableRaceMap} and
|
||||
* {@link seng302.Model.ResizableRaceCanvas ResizableRaceCanvas}. It is used
|
||||
* to convert {@link seng302.GPSCoordinate GPSCoordinate}s to relative
|
||||
* {@link seng302.GraphCoordinate GraphCoordinate}s.
|
||||
*/
|
||||
public class RaceMap {
|
||||
private final double x1;
|
||||
|
||||
@@ -18,7 +18,9 @@ import java.util.Map;
|
||||
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
||||
|
||||
/**
|
||||
* TCP client which receives packets/messages from a race data source (e.g., mock source, official source), and exposes them to any observers.
|
||||
* TCP client which receives packets/messages from a race data source
|
||||
* (e.g., mock source, official source), and exposes them to any observers.
|
||||
* @see seng302.Mock.StreamedCourse
|
||||
*/
|
||||
public class VisualiserInput implements Runnable {
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 26/03/2017.
|
||||
* The abstract class for reading in XML race data.
|
||||
*/
|
||||
public abstract class XMLReader {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user