diff --git a/src/main/java/seng302/controllers/BoatPositionController.java b/src/main/java/seng302/controllers/BoatPositionController.java index 4e95ae81..8ca99269 100644 --- a/src/main/java/seng302/controllers/BoatPositionController.java +++ b/src/main/java/seng302/controllers/BoatPositionController.java @@ -39,7 +39,7 @@ public class BoatPositionController { positionVbox.getChildren().removeAll(); for (Boat boat: boatOrder){ - positionVbox.getChildren().add(new Text(boat.getTeamName() + " " + boat.getSpeedInKnots() + " Knots")); + positionVbox.getChildren().add(new Text(boat.getShortName() + " " + boat.getSpeedInKnots() + " Knots")); } } diff --git a/src/main/java/seng302/controllers/CanvasController.java b/src/main/java/seng302/controllers/CanvasController.java index 7e1caf3f..c3920c7d 100644 --- a/src/main/java/seng302/controllers/CanvasController.java +++ b/src/main/java/seng302/controllers/CanvasController.java @@ -14,7 +14,6 @@ import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.text.Font; -import javafx.scene.text.FontSmoothingType; import javafx.scene.text.Text; import javafx.util.Duration; import seng302.models.Boat; @@ -265,7 +264,7 @@ public class CanvasController { boat.setLocation(timelineInfo.getY().doubleValue(), timelineInfo.getX().doubleValue()); - drawBoat(boat.getLongitude(), boat.getLatitude(), boat.getColor(), boat.getTeamName(), boat.getSpeedInKnots(), boat.getHeading()); + drawBoat(boat.getLongitude(), boat.getLatitude(), boat.getColor(), boat.getShortName(), boat.getSpeedInKnots(), boat.getHeading()); } } @@ -280,6 +279,7 @@ public class CanvasController { */ private void drawWake(GraphicsContext gc, double x, double y, double speed, Color color, double heading){ double angle = Math.toRadians(heading); + speed = speed * 0.50; // Half the size of the wake double newX = x + speed * Math.cos(angle);//(nextX * Math.cos(angle) - nextY * Math.sin(angle)) * length; double newY = y + speed * Math.sin(angle);//(nextX * Math.sin(angle) + nextY * Math.cos(angle)) * length; @@ -312,12 +312,14 @@ public class CanvasController { // Set boat text gc.setFont(new Font(14)); gc.setLineWidth(3); - gc.setFontSmoothingType(FontSmoothingType.GRAY); gc.fillText(name + ", " + speed + " knots", x + 15, y + 15); } gc.fillOval(x, y, diameter, diameter); - drawWake(gc, x, y, speed, color, heading); + + if (annotationCheck){ + drawWake(gc, x, y, speed, color, heading); + } } /** diff --git a/src/main/java/seng302/models/Boat.java b/src/main/java/seng302/models/Boat.java index a64bf9c4..0973ad38 100644 --- a/src/main/java/seng302/models/Boat.java +++ b/src/main/java/seng302/models/Boat.java @@ -15,6 +15,7 @@ public class Boat { private Color color; private int markLastPast; private double heading; + private String shortName; public Boat(String teamName) { this.teamName = teamName; @@ -22,6 +23,7 @@ public class Boat { this.lat = 0.0; this.lon = 0.0; this.distanceToNextMark = 0.0; + this.shortName = ""; } /** @@ -29,12 +31,14 @@ public class Boat { * * @param teamName The name of the team sailing the boat * @param boatVelocity The speed of the boat in meters/second + * @param shortName A shorter version of the teams name */ - public Boat(String teamName, double boatVelocity) { + public Boat(String teamName, double boatVelocity, String shortName) { this.teamName = teamName; this.velocity = boatVelocity; this.distanceToNextMark = 0.0; this.color = Colors.getColor(); + this.shortName = shortName; } /** @@ -119,4 +123,8 @@ public class Boat { public double getHeading(){ return this.heading; } + + public String getShortName(){ + return this.shortName; + } } \ No newline at end of file diff --git a/src/main/java/seng302/models/parsers/TeamsParser.java b/src/main/java/seng302/models/parsers/TeamsParser.java index c4d34b1f..2986f448 100644 --- a/src/main/java/seng302/models/parsers/TeamsParser.java +++ b/src/main/java/seng302/models/parsers/TeamsParser.java @@ -27,7 +27,7 @@ public class TeamsParser extends FileParser { String name = element.getElementsByTagName("name").item(0).getTextContent(); String alias = element.getElementsByTagName("alias").item(0).getTextContent(); double velocity = Double.valueOf(element.getElementsByTagName("velocity").item(0).getTextContent()); - Boat boat = new Boat(name, velocity); + Boat boat = new Boat(name, velocity, alias); return boat; } else { throw new NoSuchElementException("Cannot generate a boat by given node"); diff --git a/src/test/java/seng302/BoatTest.java b/src/test/java/seng302/BoatTest.java index 6344bece..0160bb8d 100644 --- a/src/test/java/seng302/BoatTest.java +++ b/src/test/java/seng302/BoatTest.java @@ -26,7 +26,7 @@ public class BoatTest { @Test public void testSetVelocity() { - Boat boat1 = new Boat("Team 1", 29.0); + Boat boat1 = new Boat("Team 1", 29.0, ""); assertEquals(boat1.getVelocity(), (double) 29.0, 1e-15); boat1.setVelocity(12.0);