rounding fix for the xml

#story[1087]
main
hba56 8 years ago
parent 0b74acadff
commit 950a801d16

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</component>
</project>

@ -28,7 +28,7 @@ public class MockBoat extends Boat {
* 1: passed only first check * 1: passed only first check
* 2: passed first and second check * 2: passed first and second check
*/ */
private Integer roundingStatus; private Integer roundingStatus = 0;

@ -779,6 +779,7 @@ public class MockRace extends Race {
//boats must pass all checks in order to round a mark //boats must pass all checks in order to round a mark
switch (boat.getRoundingStatus()) { switch (boat.getRoundingStatus()) {
case 0://hasn't started rounding case 0://hasn't started rounding
System.out.println("round 0");
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) && if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) &&
GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(), GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(),
roundingChecks.get(0), boat.getCurrentPosition())) { roundingChecks.get(0), boat.getCurrentPosition())) {
@ -786,6 +787,7 @@ public class MockRace extends Race {
} }
break; break;
case 1://has been parallel to the mark case 1://has been parallel to the mark
System.out.println("round 1");
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) && if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) &&
GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(), GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(),
roundingChecks.get(1), boat.getCurrentPosition())) { roundingChecks.get(1), boat.getCurrentPosition())) {
@ -793,6 +795,7 @@ public class MockRace extends Race {
} }
break; break;
case 2://has traveled 180 degrees around the mark case 2://has traveled 180 degrees around the mark
System.out.println("round 2");
//Move boat on to next leg. //Move boat on to next leg.
boat.resetRoundingStatus(); boat.resetRoundingStatus();
Leg nextLeg = this.legs.get(boat.getCurrentLeg().getLegNumber() + 1); Leg nextLeg = this.legs.get(boat.getCurrentLeg().getLegNumber() + 1);

@ -344,7 +344,8 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
String legName = lastCompoundMark.getName(); String legName = lastCompoundMark.getName();
//Sets the rounding type of this compound mark //Sets the rounding type of this compound mark
lastCompoundMark.setRoundingType(RoundingType.valueOf(cornerRounding));
lastCompoundMark.setRoundingType(RoundingType.getValueOf(cornerRounding));
//For each following corner, create a leg between cornerN and cornerN+1. //For each following corner, create a leg between cornerN and cornerN+1.
for(int i = 1; i < corners.getLength(); i++) { for(int i = 1; i < corners.getLength(); i++) {

@ -31,4 +31,19 @@ public enum RoundingType {
* opposite of SP * opposite of SP
*/ */
PS; PS;
public static RoundingType getValueOf(String value) {
switch (value) {
case "Port":
return RoundingType.Port;
case "Starboard":
return RoundingType.Starboard;
case "SP":
return RoundingType.Port;
case "PS":
return RoundingType.Starboard;
default:
return null;
}
}
} }

@ -8,12 +8,12 @@
<Yacht SourceID="125"/> <Yacht SourceID="125"/>
</Participants> </Participants>
<CompoundMarkSequence> <CompoundMarkSequence>
<Corner CompoundMarkID="1" SeqID="1"/> <Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner CompoundMarkID="2" SeqID="2"/> <Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
<Corner CompoundMarkID="4" SeqID="3"/> <Corner SeqID="3" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
<Corner CompoundMarkID="3" SeqID="4"/> <Corner SeqID="4" CompoundMarkID="3" Rounding="Port" ZoneSize="3" />
<Corner CompoundMarkID="4" SeqID="5"/> <Corner SeqID="5" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
<Corner CompoundMarkID="5" SeqID="6"/> <Corner SeqID="6" CompoundMarkID="5" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence> </CompoundMarkSequence>
<Course> <Course>
<CompoundMark CompoundMarkID="1" Name="Start Line"> <CompoundMark CompoundMarkID="1" Name="Start Line">

Loading…
Cancel
Save