Map now only shows annotations when in full screen

#story[1295]
This commit is contained in:
hba56
2017-09-19 22:08:27 +12:00
parent f3f60acac6
commit f7d866144a
3 changed files with 68 additions and 37 deletions
@@ -767,6 +767,8 @@ public class RaceViewController extends Controller {
raceCanvas.widthProperty().bind(canvasBase.widthProperty());
raceCanvas.heightProperty().bind(canvasBase.heightProperty());
raceCanvas.setFullScreen(true);
canvasBase1.getChildren().remove(raceCanvas);
canvasBase.getChildren().add(1, raceCanvas);
@@ -774,6 +776,8 @@ public class RaceViewController extends Controller {
raceCanvas.widthProperty().bind(canvasBase1.widthProperty());
raceCanvas.heightProperty().bind(canvasBase1.heightProperty());
raceCanvas.setFullScreen(false);
canvasBase.getChildren().remove(raceCanvas);
canvasBase1.getChildren().add(0, raceCanvas);
}
@@ -44,13 +44,15 @@ public class ResizableRaceCanvas extends ResizableCanvas {
private VisualiserRaceState raceState;
private boolean annoName = true;
private boolean annoName = false;
private boolean annoAbbrev = true;
private boolean annoSpeed = true;
private boolean annoSpeed = false;
private boolean annoPath = true;
private boolean annoEstTime = true;
private boolean annoTimeSinceLastMark = true;
private boolean annoGuideLine = false;
private boolean annoEstTime = false;
private boolean annoTimeSinceLastMark = false;
private boolean annoGuideLine = true;
private boolean isFullScreen = false;
@@ -293,7 +295,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
List<VisualiserBoat> boats = new ArrayList<>(raceState.getBoats());
//Sort to ensure we draw boats in consistent order.
boats.sort(Comparator.comparingInt(Boat::getSourceID));
// boats.sort(Comparator.comparingInt(Boat::getSourceID));
//Current draw order:
// track points
@@ -302,29 +304,29 @@ public class ResizableRaceCanvas extends ResizableCanvas {
// text
//Track points.
for (VisualiserBoat boat : boats) {
drawTrack(boat);
if (isFullScreen){
for (VisualiserBoat boat : boats) {
drawTrack(boat);
}
//Text.
for (VisualiserBoat boat : boats) {
drawBoatText(boat);
}
}
//Wake.
for (VisualiserBoat boat : boats) {
//Only draw wake if they are currently racing.
if (boat.getStatus() == BoatStatusEnum.RACING) {
drawWake(boat);
}
}
// for (VisualiserBoat boat : boats) {
// //Only draw wake if they are currently racing.
// if (boat.getStatus() == BoatStatusEnum.RACING) {
// drawWake(boat);
// }
// }
//Boat.
for (VisualiserBoat boat : boats) {
drawBoat(boat);
}
//Text.
for (VisualiserBoat boat : boats) {
drawBoatText(boat);
}
}
/**
@@ -364,9 +366,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
gc.fillPolygon(x, y, x.length);
gc.restore();
if (boat.getSourceID() == ThisBoat.getInstance().getSourceID()) {
drawSails(boat);
}
// if (boat.getSourceID() == ThisBoat.getInstance().getSourceID()) {
// drawSails(boat);
// }
}
/**
@@ -645,19 +647,23 @@ public class ResizableRaceCanvas extends ResizableCanvas {
//Race boundary.
drawBoundary();
//Guiding Line
if (annoGuideLine){
//rounding lines
if (isFullScreen){
drawRoundingLines();
drawRaceLine();
}
//Guiding Line
// if (annoGuideLine){
// drawRaceLine();
// }
//Boats.
drawBoats();
//Marks.
drawMarks();
//TEMP
drawRoundingLines();
}
@@ -752,7 +758,8 @@ public class ResizableRaceCanvas extends ResizableCanvas {
gc.save();
gc.setLineWidth(2);
gc.setStroke(Color.MEDIUMAQUAMARINE);
gc.setStroke(getLineColor(legs.get(index)));
gc.beginPath();
gc.moveTo(startPath.getX(), startPath.getY());
@@ -772,7 +779,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
gc.save();
gc.setLineWidth(2);
gc.setStroke(Color.MEDIUMAQUAMARINE);
gc.setStroke(getLineColor(legs.get(index)));
gc.beginPath();
gc.moveTo(startPath.getX(), startPath.getY());
@@ -788,6 +795,21 @@ public class ResizableRaceCanvas extends ResizableCanvas {
}
}
private Color getLineColor(Leg leg) {
for (VisualiserBoat boat : raceState.getBoats()) {
if (boat.isClientBoat()) {
if (boat.getCurrentLeg() == leg) {
return Color.ORANGE;
} else {
return Color.MEDIUMAQUAMARINE;
}
}else{
return Color.MEDIUMAQUAMARINE;
}
}
return Color.MEDIUMAQUAMARINE;
}
private void drawArrowHead(GPSCoordinate start, GPSCoordinate end){
GraphCoordinate lineStart = this.map.convertGPS(start);
@@ -862,6 +884,11 @@ public class ResizableRaceCanvas extends ResizableCanvas {
}
public boolean isFullScreen() {
return isFullScreen;
}
public void setFullScreen(boolean fullScreen) {
isFullScreen = fullScreen;
}
}