Merge branch 'minimap_test' into 'master'
Minimap AC's: -Minimap of current map with player boats is shown -Boats and marks are shown on the minimap -Minimap can be minimized and maximised -Some annotations displayed on maximised minimap See merge request !55
This commit is contained in:
Generated
-6
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -34,10 +34,7 @@ import visualiser.gameController.ControllerClient;
|
||||
import visualiser.gameController.Keys.ControlKey;
|
||||
import visualiser.gameController.Keys.KeyFactory;
|
||||
import visualiser.layout.*;
|
||||
import visualiser.model.Sparkline;
|
||||
import visualiser.model.VisualiserBoat;
|
||||
import visualiser.model.VisualiserRaceEvent;
|
||||
import visualiser.model.VisualiserRaceState;
|
||||
import visualiser.model.*;
|
||||
import visualiser.utils.GPSConverter;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -65,6 +62,8 @@ public class RaceViewController extends Controller {
|
||||
private String keyToPress;
|
||||
private View3D view3D;
|
||||
private ObservableList<Subject3D> viewSubjects;
|
||||
private ResizableRaceCanvas raceCanvas;
|
||||
private boolean mapToggle = true;
|
||||
|
||||
/**
|
||||
* Arrow pointing to next mark in third person
|
||||
@@ -78,6 +77,7 @@ public class RaceViewController extends Controller {
|
||||
// note: it says it's not used but it is! do not remove :)
|
||||
private @FXML ArrowController arrowController;
|
||||
private @FXML GridPane canvasBase;
|
||||
private @FXML GridPane canvasBase1;
|
||||
private @FXML SplitPane racePane;
|
||||
private @FXML StackPane arrowPane;
|
||||
private @FXML Label timer;
|
||||
@@ -111,6 +111,7 @@ public class RaceViewController extends Controller {
|
||||
tutorialCheck();
|
||||
initKeypressHandler();
|
||||
initialiseRaceVisuals();
|
||||
initialiseRaceCanvas();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,6 +147,9 @@ public class RaceViewController extends Controller {
|
||||
// tab key
|
||||
if (codeString.equals("TAB")){toggleTable();}
|
||||
|
||||
//map key
|
||||
if (codeString.equals("M")){bigMap();}
|
||||
|
||||
// any key pressed
|
||||
ControlKey controlKey = keyFactory.getKey(codeString);
|
||||
if(controlKey != null) {
|
||||
@@ -610,6 +614,8 @@ public class RaceViewController extends Controller {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
raceCanvas.drawRace();
|
||||
|
||||
boatInfoTable.sort();
|
||||
}
|
||||
|
||||
@@ -737,4 +743,48 @@ public class RaceViewController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialises the map
|
||||
*/
|
||||
private void initialiseRaceCanvas() {
|
||||
|
||||
//Create canvas.
|
||||
raceCanvas = new ResizableRaceCanvas(raceState);
|
||||
|
||||
//Set properties.
|
||||
raceCanvas.setMouseTransparent(true);
|
||||
raceCanvas.widthProperty().bind(canvasBase1.widthProperty());
|
||||
raceCanvas.heightProperty().bind(canvasBase1.heightProperty());
|
||||
|
||||
//Draw it and show it.
|
||||
raceCanvas.draw();
|
||||
raceCanvas.setVisible(true);
|
||||
|
||||
//Add to scene.
|
||||
canvasBase1.getChildren().add(0, raceCanvas);
|
||||
}
|
||||
|
||||
private void bigMap(){
|
||||
if (mapToggle){
|
||||
raceCanvas.widthProperty().bind(canvasBase.widthProperty());
|
||||
raceCanvas.heightProperty().bind(canvasBase.heightProperty());
|
||||
|
||||
raceCanvas.setFullScreen(true);
|
||||
raceCanvas.setOpacity(0.6);
|
||||
|
||||
canvasBase1.getChildren().remove(raceCanvas);
|
||||
canvasBase.getChildren().add(1, raceCanvas);
|
||||
|
||||
}else{
|
||||
raceCanvas.widthProperty().bind(canvasBase1.widthProperty());
|
||||
raceCanvas.heightProperty().bind(canvasBase1.heightProperty());
|
||||
|
||||
raceCanvas.setFullScreen(false);
|
||||
|
||||
canvasBase.getChildren().remove(raceCanvas);
|
||||
canvasBase1.getChildren().add(0, raceCanvas);
|
||||
}
|
||||
mapToggle = !mapToggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,13 +6,11 @@ import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import network.Messages.Enums.BoatStatusEnum;
|
||||
import shared.dataInput.RaceDataSource;
|
||||
import shared.enums.RoundingType;
|
||||
import shared.model.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -44,13 +42,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 +293,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 +302,29 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
// text
|
||||
|
||||
//Track points.
|
||||
if (isFullScreen){
|
||||
for (VisualiserBoat boat : boats) {
|
||||
drawTrack(boat);
|
||||
}
|
||||
|
||||
//Wake.
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//Wake.
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,9 +364,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);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,7 +605,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
|
||||
//Prepare to draw.
|
||||
gc.setLineWidth(1);
|
||||
gc.setFill(Color.AQUA);
|
||||
gc.setFill(Color.DEEPSKYBLUE);
|
||||
|
||||
|
||||
//Calculate the screen coordinates of the boundary.
|
||||
@@ -645,19 +645,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 +756,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 +777,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 +793,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 +882,11 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
|
||||
}
|
||||
|
||||
public boolean isFullScreen() {
|
||||
return isFullScreen;
|
||||
}
|
||||
|
||||
|
||||
public void setFullScreen(boolean fullScreen) {
|
||||
isFullScreen = fullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,9 @@ public class VisualiserBoat extends Boat {
|
||||
//Update the nextValidTime for the next track point.
|
||||
nextValidTime = currentTimeMilli + trackPointTimeInterval;
|
||||
|
||||
if (track.size() > trackPointLimit) {
|
||||
track.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,30 +79,89 @@
|
||||
</Accordion>
|
||||
</children>
|
||||
</Pane>
|
||||
<Label fx:id="timer" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<Label fx:id="timer" alignment="CENTER" maxHeight="20.0" mouseTransparent="true" text="0:0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="FPS" text="FPS: 0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="timeZone" text="Label" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<Label fx:id="FPS" mouseTransparent="true" text="FPS: 0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font>
|
||||
<padding>
|
||||
<Insets bottom="20.0" />
|
||||
<Insets top="20.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label fx:id="timeZone" mouseTransparent="true" text="Label" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="15.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<StackPane fx:id="arrowPane" alignment="TOP_RIGHT" mouseTransparent="true" prefHeight="150.0" prefWidth="150.0" snapToPixel="false" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<fx:include fx:id="arrow" source="arrow.fxml" />
|
||||
</children>
|
||||
</StackPane>
|
||||
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
|
||||
<AnchorPane maxHeight="200.0" maxWidth="200.0" mouseTransparent="true" opacity="0.6" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0">
|
||||
<children>
|
||||
<AnchorPane maxHeight="200.0" maxWidth="200.0" prefHeight="200.0" prefWidth="216.0">
|
||||
<children>
|
||||
<GridPane fx:id="canvasBase1" maxHeight="200.0" maxWidth="200.0" prefHeight="200.0" prefWidth="216.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
</GridPane>
|
||||
<Pane maxHeight="200.0" maxWidth="200.0" prefHeight="200.0" prefWidth="216.0" visible="false">
|
||||
<children>
|
||||
<Accordion>
|
||||
<panes>
|
||||
<TitledPane animated="false" prefHeight="395.0" prefWidth="222.0" text="Annotation Control">
|
||||
<content>
|
||||
<AnchorPane fx:id="annotationPane1" minHeight="0.0" minWidth="0.0">
|
||||
<children>
|
||||
<CheckBox fx:id="showName1" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<CheckBox fx:id="showAbbrev1" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
|
||||
<CheckBox fx:id="showSpeed1" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" />
|
||||
<CheckBox fx:id="showBoatPath1" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" />
|
||||
<CheckBox fx:id="showTime1" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" />
|
||||
<CheckBox fx:id="showEstTime1" mnemonicParsing="false" selected="true" text="Show Est. Time to Next Mark" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" />
|
||||
<CheckBox fx:id="showGuideline1" mnemonicParsing="false" text="Show Guideline" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="150.0" />
|
||||
<Separator layoutX="19.6" layoutY="175.6" prefHeight="0.0" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="175.0" />
|
||||
<Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="175.0" />
|
||||
<RadioButton fx:id="hideAnnoRBtn1" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="annoToggleGroup1" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="showAnnoRBtn1" mnemonicParsing="false" text="Visible" toggleGroup="$annoToggleGroup1" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="225.0" />
|
||||
<RadioButton fx:id="partialAnnoRBtn1" mnemonicParsing="false" text="Partial" toggleGroup="$annoToggleGroup1" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="250.0" />
|
||||
<RadioButton fx:id="importantAnnoRBtn1" mnemonicParsing="false" text="Important" toggleGroup="$annoToggleGroup1" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="275.0" />
|
||||
<Button fx:id="saveAnno1" layoutX="11.0" layoutY="126.0" mnemonicParsing="false" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="300.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
<TitledPane animated="false" text="FPS Control">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<CheckBox fx:id="showFPS1" layoutX="-14.0" layoutY="13.0" mnemonicParsing="false" selected="true" text="Show FPS" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</panes>
|
||||
</Accordion>
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">
|
||||
|
||||
Reference in New Issue
Block a user