Added annotation to toggle all boat paths on and off #Pair[jjg64, zwu18] #Story[759]
This commit is contained in:
@@ -33,6 +33,9 @@ public class RaceController extends Controller {
|
|||||||
@FXML SplitPane race;
|
@FXML SplitPane race;
|
||||||
@FXML
|
@FXML
|
||||||
CheckBox showFPS;
|
CheckBox showFPS;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
CheckBox showBoatPath;
|
||||||
@FXML
|
@FXML
|
||||||
CheckBox showAnnotations;
|
CheckBox showAnnotations;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -226,6 +229,15 @@ public class RaceController extends Controller {
|
|||||||
raceMap.update();
|
raceMap.update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//listener for show abbreviation for annotation
|
||||||
|
showBoatPath.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
||||||
|
public void changed(ObservableValue<? extends Boolean> ov,
|
||||||
|
Boolean old_val, Boolean new_val) {
|
||||||
|
raceMap.toggleBoatPath();
|
||||||
|
raceMap.update();
|
||||||
|
}
|
||||||
|
});
|
||||||
//listener to show speed for annotation
|
//listener to show speed for annotation
|
||||||
showSpeed.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
showSpeed.selectedProperty().addListener(new ChangeListener<Boolean>() {
|
||||||
public void changed(ObservableValue<? extends Boolean> ov,
|
public void changed(ObservableValue<? extends Boolean> ov,
|
||||||
@@ -242,6 +254,7 @@ public class RaceController extends Controller {
|
|||||||
presetAnno.add(showName.isSelected());
|
presetAnno.add(showName.isSelected());
|
||||||
presetAnno.add(showAbbrev.isSelected());
|
presetAnno.add(showAbbrev.isSelected());
|
||||||
presetAnno.add(showSpeed.isSelected());
|
presetAnno.add(showSpeed.isSelected());
|
||||||
|
presetAnno.add(showBoatPath.isSelected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//listener to show saved annotation
|
//listener to show saved annotation
|
||||||
@@ -252,6 +265,7 @@ public class RaceController extends Controller {
|
|||||||
showName.setSelected(presetAnno.get(0));
|
showName.setSelected(presetAnno.get(0));
|
||||||
showAbbrev.setSelected(presetAnno.get(1));
|
showAbbrev.setSelected(presetAnno.get(1));
|
||||||
showSpeed.setSelected(presetAnno.get(2));
|
showSpeed.setSelected(presetAnno.get(2));
|
||||||
|
showBoatPath.setSelected(presetAnno.get(3));
|
||||||
raceMap.update();
|
raceMap.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public abstract class Race implements Runnable {
|
|||||||
protected int scaleFactor;
|
protected int scaleFactor;
|
||||||
|
|
||||||
private int SLEEP_TIME = 100; //time in milliseconds to pause in a paced loop
|
private int SLEEP_TIME = 100; //time in milliseconds to pause in a paced loop
|
||||||
protected int PRERACE_TIME = 0; //120000; //time in milliseconds to pause during pre-race
|
protected int PRERACE_TIME = 120000; //time in milliseconds to pause during pre-race
|
||||||
private boolean timerEnabled = true; //boolean to determine if timer is ran
|
private boolean timerEnabled = true; //boolean to determine if timer is ran
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
private boolean annoName = true;
|
private boolean annoName = true;
|
||||||
private boolean annoAbbrev = true;
|
private boolean annoAbbrev = true;
|
||||||
private boolean annoSpeed = true;
|
private boolean annoSpeed = true;
|
||||||
|
private boolean annoPath = true;
|
||||||
private ArrayList<GPSCoordinate> raceBoundaries;
|
private ArrayList<GPSCoordinate> raceBoundaries;
|
||||||
double[] xpoints = {}, ypoints = {};
|
double[] xpoints = {}, ypoints = {};
|
||||||
|
|
||||||
@@ -298,6 +299,14 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toggleBoatPath() {
|
||||||
|
if (annoPath) {
|
||||||
|
annoPath = false;
|
||||||
|
} else {
|
||||||
|
annoPath = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle abbreviation display in annotation
|
* Toggle abbreviation display in annotation
|
||||||
*/
|
*/
|
||||||
@@ -353,6 +362,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
* @see seng302.Model.TrackPoint
|
* @see seng302.Model.TrackPoint
|
||||||
*/
|
*/
|
||||||
private void drawTrack(BoatInRace boat) {
|
private void drawTrack(BoatInRace boat) {
|
||||||
|
if (annoPath) {
|
||||||
for (TrackPoint point : boat.getTrack()) {
|
for (TrackPoint point : boat.getTrack()) {
|
||||||
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
|
GraphCoordinate scaledCoordinate = this.map.convertGPS(point.getCoordinate());
|
||||||
Color boatColour = boat.getColour();
|
Color boatColour = boat.getColour();
|
||||||
@@ -360,6 +370,7 @@ public class ResizableRaceCanvas extends Canvas {
|
|||||||
gc.fillOval(scaledCoordinate.getX(), scaledCoordinate.getY(), 5, 5);
|
gc.fillOval(scaledCoordinate.getX(), scaledCoordinate.getY(), 5, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setRaceBoundaries(ArrayList<GPSCoordinate> boundaries) {
|
public void setRaceBoundaries(ArrayList<GPSCoordinate> boundaries) {
|
||||||
this.raceBoundaries = new ArrayList<>();
|
this.raceBoundaries = new ArrayList<>();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.text.*?>
|
<?import javafx.scene.text.*?>
|
||||||
|
|
||||||
|
|
||||||
<SplitPane fx:id="race" dividerPositions="0.7" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
<SplitPane fx:id="race" dividerPositions="0.7" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
||||||
<items>
|
<items>
|
||||||
<GridPane fx:id="canvasBase">
|
<GridPane fx:id="canvasBase">
|
||||||
@@ -24,14 +23,15 @@
|
|||||||
<panes>
|
<panes>
|
||||||
<TitledPane animated="false" text="Annotation Control">
|
<TitledPane animated="false" text="Annotation Control">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="240.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
|
<CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="104.0" />
|
||||||
<CheckBox fx:id="showAnnotations" layoutX="-2.0" layoutY="14.0" mnemonicParsing="false" selected="true" text="Show Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<CheckBox fx:id="showAnnotations" layoutX="-2.0" layoutY="14.0" mnemonicParsing="false" selected="true" text="Show Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||||
<CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="26.0" />
|
<CheckBox fx:id="showName" layoutY="39.0" mnemonicParsing="false" selected="true" text="Show Boat Name" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="26.0" />
|
||||||
<CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="52.0" />
|
<CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="52.0" />
|
||||||
<CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="78.0" />
|
<CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="78.0" />
|
||||||
<Button fx:id="saveAnno" layoutX="11.0" layoutY="106.0" maxWidth="154.0" mnemonicParsing="false" prefWidth="154.0" text="Save Annotation" AnchorPane.topAnchor="104.0" />
|
<Button fx:id="saveAnno" layoutX="11.0" layoutY="106.0" maxWidth="154.0" mnemonicParsing="false" prefWidth="154.0" text="Save Annotation" AnchorPane.topAnchor="130.0" />
|
||||||
<Button fx:id="showSetAnno" layoutX="11.0" layoutY="139.0" mnemonicParsing="false" text="Show Set Annotation" AnchorPane.topAnchor="139.0" />
|
<Button fx:id="showSetAnno" layoutX="11.0" layoutY="139.0" mnemonicParsing="false" text="Show Set Annotation" AnchorPane.topAnchor="160.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
Reference in New Issue
Block a user