Merge with master complete

- merged with master
#story[877]
main
Fan-Wu Yang 9 years ago
parent a3ccd75f4c
commit ba5e74ab9c

@ -14,7 +14,7 @@ import static junit.framework.TestCase.assertEquals;
*/
public class LegTest {
private CompoundMark ORIGIN_Compound_MARKER = new CompoundMark(new Mark(1, "test mark1", new GPSCoordinate(0, 0)));
private CompoundMark ORIGIN_COMPOUND_MARKER = new CompoundMark(new Mark(1, "test mark1", new GPSCoordinate(0, 0)));
@Test
public void calculateDistanceHandles5nmNorth() {
@ -23,7 +23,7 @@ public class LegTest {
calc.setDirection(0, 5 * Constants.NMToMetersConversion);
CompoundMark endMarker = getEndMarker(calc.getDestinationGeographicPoint());
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
assertEquals(test.getDistanceNauticalMiles(), 5, 1e-8);
}
@ -34,7 +34,7 @@ public class LegTest {
calc.setDirection(90, 12 * Constants.NMToMetersConversion);
CompoundMark endMarker = getEndMarker(calc.getDestinationGeographicPoint());
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
assertEquals(test.getDistanceNauticalMiles(), 12, 1e-8);
}
@ -45,7 +45,7 @@ public class LegTest {
calc.setDirection(180, 0.5 * Constants.NMToMetersConversion);
CompoundMark endMarker = getEndMarker(calc.getDestinationGeographicPoint());
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
assertEquals(test.getDistanceNauticalMiles(), 0.5, 1e-8);
}
@ -56,14 +56,14 @@ public class LegTest {
calc.setDirection(-90, 0.1 * Constants.NMToMetersConversion);
CompoundMark endMarker = getEndMarker(calc.getDestinationGeographicPoint());
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
assertEquals(test.getDistanceNauticalMiles(), 0.1, 1e-8);
}
@Test
public void calculateDistanceHandlesZeroDifference() {
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, ORIGIN_Compound_MARKER, 0);
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, ORIGIN_COMPOUND_MARKER, 0);
assertEquals(test.getDistanceNauticalMiles(), 0, 1e-8);
}

@ -17,10 +17,7 @@ import seng302.Model.*;
import seng302.VisualiserInput;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.*;
/**
* Created by fwy13 on 15/03/2017.
@ -39,6 +36,7 @@ public class RaceController extends Controller {
private static String abbrevCheckAnno = "abbrev";
private static String speedCheckAnno = "speed";
private static String pathCheckAnno = "path";
private static String timeCheckAnno = "time";
private static int noBtn = 0;
private static int hideBtn = 1;
@ -63,13 +61,13 @@ public class RaceController extends Controller {
@FXML StackPane arrowPane;
@FXML CheckBox showFPS;
@FXML CheckBox showBoatPath;
@FXML Label timer;
@FXML Label FPS;
@FXML Label timeZone;
@FXML CheckBox showName;
@FXML CheckBox showAbbrev;
@FXML CheckBox showSpeed;
@FXML CheckBox showTime;
@FXML Label timer;
@FXML Label FPS;
@FXML Label timeZone;
@FXML Button saveAnno;
@FXML TableView<Boat> boatInfoTable;
@FXML TableColumn<Boat, String> boatPlacingColumn;
@ -357,6 +355,7 @@ public class RaceController extends Controller {
annoShownBeforeHide.put(abbrevCheckAnno, showAbbrev.isSelected());
annoShownBeforeHide.put(pathCheckAnno, showBoatPath.isSelected());
annoShownBeforeHide.put(speedCheckAnno, showSpeed.isSelected());
annoShownBeforeHide.put(timeCheckAnno, showTime.isSelected());
}
/**
@ -370,12 +369,14 @@ public class RaceController extends Controller {
importantAnno.put(abbrevCheckAnno, false);
importantAnno.put(pathCheckAnno, false);
importantAnno.put(speedCheckAnno, false);
importantAnno.put(timeCheckAnno, true);
annoShownBeforeHide = new HashMap<>();
annoShownBeforeHide.put(nameCheckAnno, true);
annoShownBeforeHide.put(abbrevCheckAnno, true);
annoShownBeforeHide.put(pathCheckAnno, true);
annoShownBeforeHide.put(speedCheckAnno, true);
annoShownBeforeHide.put(timeCheckAnno, true);
//listener for show name in annotation
showName.selectedProperty().addListener((ov, old_val, new_val) -> {
if (old_val != new_val) {
@ -451,7 +452,20 @@ public class RaceController extends Controller {
prevBtnChecked = noBtn;
});
showTime.selectedProperty().addListener((ov, old_val, new_val) -> {
raceMap.toggleAnnoTime();
if (old_val != new_val) {
raceMap.toggleAnnoTime();
}
if (buttonChecked != hideBtn) {
if (prevBtnChecked == hideBtn && buttonChecked != showBtn){
storeCurrentAnnotationState();
} else {
annoShownBeforeHide.put(timeCheckAnno, showTime.isSelected());
}
if (buttonChecked == noBtn) {
annotationGroup.selectToggle(showAnnoRBTN);
}
}
prevBtnChecked = noBtn;
raceMap.update();
});
//listener to save currently selected annotation
@ -471,6 +485,7 @@ public class RaceController extends Controller {
showAbbrev.setSelected(false);
showBoatPath.setSelected(false);
showSpeed.setSelected(false);
showTime.setSelected(false);
annotationGroup.selectToggle(hideAnnoRBTN);
raceMap.update();
buttonChecked = noBtn;
@ -483,6 +498,7 @@ public class RaceController extends Controller {
showAbbrev.setSelected(annoShownBeforeHide.get(abbrevCheckAnno));
showBoatPath.setSelected(annoShownBeforeHide.get(pathCheckAnno));
showSpeed.setSelected(annoShownBeforeHide.get(speedCheckAnno));
showTime.setSelected(annoShownBeforeHide.get(timeCheckAnno));
raceMap.update();
buttonChecked = noBtn;
prevBtnChecked = showBtn;
@ -494,7 +510,7 @@ public class RaceController extends Controller {
showAbbrev.setSelected(true);
showSpeed.setSelected(true);
showBoatPath.setSelected(false);
//partialAnnoRBTN.setSelected(true);//as the others will set the show button back to visible then we need to make it so that this is rechecked.
showTime.setSelected(false);
annotationGroup.selectToggle(partialAnnoRBTN);
raceMap.update();
buttonChecked = noBtn;

@ -32,14 +32,14 @@
<CheckBox fx:id="showAbbrev" layoutY="61.0" mnemonicParsing="false" selected="true" text="Show Boat Abbreviation" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="25.0" />
<CheckBox fx:id="showSpeed" layoutY="90.0" mnemonicParsing="false" selected="true" text="Show Boat Speed" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0" />
<CheckBox fx:id="showBoatPath" mnemonicParsing="false" selected="true" text="Show Boat Paths" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="75.0" />
<CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="130.0" />
<Separator prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" />
<Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="105.0" />
<RadioButton fx:id="hideAnnoRBTN" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="130.0" />
<RadioButton fx:id="showAnnoRBTN" mnemonicParsing="false" text="Visible" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="155.0" />
<RadioButton fx:id="partialAnnoRBTN" mnemonicParsing="false" text="Partial" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="180.0" />
<RadioButton fx:id="importantAnnoRBTN" mnemonicParsing="false" text="Important" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="205.0" />
<Button fx:id="saveAnno" layoutX="11.0" layoutY="106.0" maxWidth="154.0" mnemonicParsing="false" prefWidth="154.0" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="230.0" />
<CheckBox fx:id="showTime" mnemonicParsing="false" selected="true" text="Show Boat Leg Time" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="100.0" />
<Separator prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="125.0" />
<Label text="Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="130.0" />
<RadioButton fx:id="hideAnnoRBTN" mnemonicParsing="false" text="Hidden" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="155.0" />
<RadioButton fx:id="showAnnoRBTN" mnemonicParsing="false" text="Visible" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="180.0" />
<RadioButton fx:id="partialAnnoRBTN" mnemonicParsing="false" text="Partial" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="205.0" />
<RadioButton fx:id="importantAnnoRBTN" mnemonicParsing="false" text="Important" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="230.0" />
<Button fx:id="saveAnno" layoutX="11.0" layoutY="106.0" maxWidth="154.0" mnemonicParsing="false" prefWidth="154.0" text="Save Important Annotations" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="255.0" />
</children>
</AnchorPane>
</content>

Loading…
Cancel
Save