From 1c01aab1e728341d4bbd9f950ff077d28ba01089 Mon Sep 17 00:00:00 2001 From: William Muir Date: Wed, 17 May 2017 10:34:00 +1200 Subject: [PATCH] Merge on to develop story[955] --- src/main/java/seng302/models/BoatGroup.java | 76 ++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/main/java/seng302/models/BoatGroup.java b/src/main/java/seng302/models/BoatGroup.java index c82811a1..bea2f04b 100644 --- a/src/main/java/seng302/models/BoatGroup.java +++ b/src/main/java/seng302/models/BoatGroup.java @@ -62,8 +62,8 @@ public class BoatGroup extends RaceObject { /** * Creates a BoatGroup with the default triangular boat polygon. * - * @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used - * to tell which BoatGroup to update. + * @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used + * to tell which BoatGroup to update. * @param color The colour of the boat polygon and the trailing line. */ public BoatGroup(Yacht boat, Color color) { @@ -75,11 +75,11 @@ public class BoatGroup extends RaceObject { * Creates a BoatGroup with the boat being the default polygon. The head of the boat should be * at point (0,0). * - * @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used - * to tell which BoatGroup to update. - * @param color The colour of the boat polygon and the trailing line. + * @param boat The boat that the BoatGroup will represent. Must contain an ID which will be used + * to tell which BoatGroup to update. + * @param color The colour of the boat polygon and the trailing line. * @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat - * polygon. + * polygon. */ public BoatGroup(Yacht boat, Color color, double... points) { this.boat = boat; @@ -89,9 +89,9 @@ public class BoatGroup extends RaceObject { /** * Creates the javafx objects that will be the in the group by default. * - * @param color The colour of the boat polygon and the trailing line. + * @param color The colour of the boat polygon and the trailing line. * @param points An array of co-ordinates x1,y1,x2,y2,x3,y3... that will make up the boat - * polygon. + * polygon. */ private void initChildren(Color color, double... points) { boatPoly = new Polygon(points); @@ -104,11 +104,11 @@ public class BoatGroup extends RaceObject { velocityObject = new Text(String.valueOf(boat.getVelocity())); DateFormat format = new SimpleDateFormat("mm:ss"); String timeToNextMark = format - .format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong()); + .format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong()); estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark); if (boat.getMarkRoundingTime() != null) { String elapsedTime = format - .format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime()); + .format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime()); legTimeObject = new Text("Last mark: " + elapsedTime); } else { legTimeObject = new Text("Last mark: -"); @@ -126,7 +126,7 @@ public class BoatGroup extends RaceObject { estTimeToNextMarkObject.setX(ESTTIMETONEXTMARK_X_OFFSET); estTimeToNextMarkObject.setY(ESTTIMETONEXTMARK_Y_OFFSET); estTimeToNextMarkObject - .relocate(estTimeToNextMarkObject.getX(), estTimeToNextMarkObject.getY()); + .relocate(estTimeToNextMarkObject.getX(), estTimeToNextMarkObject.getY()); legTimeObject.setX(LEGTIME_X_OFFSET); legTimeObject.setY(LEGTIME_Y_OFFSET); @@ -134,8 +134,8 @@ public class BoatGroup extends RaceObject { wake = new Wake(0, -BOAT_HEIGHT); super.getChildren() - .addAll(teamNameObject, velocityObject, boatPoly, estTimeToNextMarkObject, - legTimeObject); + .addAll(teamNameObject, velocityObject, boatPoly, estTimeToNextMarkObject, + legTimeObject); } /** @@ -145,9 +145,9 @@ public class BoatGroup extends RaceObject { */ private void initChildren(Color color) { initChildren(color, - -BOAT_WIDTH / 2, BOAT_HEIGHT / 2, - 0.0, -BOAT_HEIGHT / 2, - BOAT_WIDTH / 2, BOAT_HEIGHT / 2); + -BOAT_WIDTH / 2, BOAT_HEIGHT / 2, + 0.0, -BOAT_HEIGHT / 2, + BOAT_WIDTH / 2, BOAT_HEIGHT / 2); } /** @@ -176,8 +176,8 @@ public class BoatGroup extends RaceObject { /** * Moves the boat and its children annotations to coordinates specified * - * @param x The X coordinate to move the boat to - * @param y The Y coordinate to move the boat to + * @param x The X coordinate to move the boat to + * @param y The Y coordinate to move the boat to * @param rotation The heading in degrees from north the boat should rotate to. */ public void moveTo(double x, double y, double rotation) { @@ -211,7 +211,7 @@ public class BoatGroup extends RaceObject { * Updates the position of all graphics in the BoatGroup based off of the given time interval. * * @param timeInterval The interval, in milliseconds, the boat should update it's position based - * on. + * on. */ public void updatePosition(long timeInterval) { //Calculate the movement of the boat. @@ -226,10 +226,10 @@ public class BoatGroup extends RaceObject { distanceTravelled = 0; if (lastPoint != null) { Line l = new Line( - lastPoint.getX(), - lastPoint.getY(), - boatPoly.getLayoutX(), - boatPoly.getLayoutY() + lastPoint.getX(), + lastPoint.getY(), + boatPoly.getLayoutX(), + boatPoly.getLayoutY() ); l.getStrokeDashArray().setAll(3d, 7d); l.setStroke(boat.getColour()); @@ -248,11 +248,11 @@ public class BoatGroup extends RaceObject { * * @param newXValue The X co-ordinate the boat needs to move to. * @param newYValue The Y co-ordinate the boat needs to move to. - * @param rotation Rotation to move graphics to. - * @param raceIds RaceID of the object to move. + * @param rotation Rotation to move graphics to. + * @param raceIds RaceID of the object to move. */ public void setDestination(double newXValue, double newYValue, double rotation, - double groundSpeed, int... raceIds) { + double groundSpeed, int... raceIds) { if (hasRaceId(raceIds)) { if (setToInitialLocation) { destinationSet = true; @@ -281,18 +281,18 @@ public class BoatGroup extends RaceObject { wakeGenerationDelay--; } else { wake.setRotationalVelocity(rotationalVelocity, rotationalGoal, - boat.getVelocity()); + boat.getVelocity()); } velocityObject.setText(String.format("%.2f m/s", boat.getVelocity())); DateFormat format = new SimpleDateFormat("mm:ss"); // estimate time to next mark String timeToNextMark = format - .format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong()); + .format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong()); estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark); // elapsed time if (boat.getMarkRoundingTime() != null) { String elapsedTime = format - .format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime()); + .format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime()); legTimeObject.setText("Last mark: " + elapsedTime); } else { legTimeObject.setText("Last mark: -"); @@ -311,10 +311,10 @@ public class BoatGroup extends RaceObject { setCallCount = 5; if (lastPoint != null) { Line l = new Line( - lastPoint.getX(), - lastPoint.getY(), - newXValue, - newYValue + lastPoint.getX(), + lastPoint.getY(), + newXValue, + newYValue ); l.getStrokeDashArray().setAll(3d, 7d); l.setStroke(boatPoly.getFill()); @@ -328,16 +328,16 @@ public class BoatGroup extends RaceObject { } public void setDestination(double newXValue, double newYValue, double groundSpeed, - int... raceIDs) { + int... raceIDs) { destinationSet = true; if (hasRaceId(raceIDs)) { double rotation = Math.abs( - Math.toDegrees( - Math.atan( - (newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX()) + Math.toDegrees( + Math.atan( + (newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX()) + ) ) - ) ); setDestination(newXValue, newYValue, rotation, groundSpeed, raceIDs); }