@ -474,7 +474,6 @@ public class MockRace extends Race {
if ( boat . isPortSide ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMarkForRounding ( legBearing ) ) & &
GPSCoordinate . passesLine ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMarkForRounding ( legBearing ) . getPosition ( ) ,
roundingChecks . get ( 0 ) , boat . getCurrentPosition ( ) , legBearing ) ) {
System . out . println ( "true" ) ;
boat . increaseRoundingStatus ( ) ;
}
break ;
@ -482,7 +481,7 @@ public class MockRace extends Race {
// System.out.println("round 1");
if ( boat . isPortSide ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMarkForRounding ( legBearing ) ) & &
GPSCoordinate . passesLine ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMarkForRounding ( legBearing ) . getPosition ( ) ,
roundingChecks . get ( 1 ) , boat . getCurrentPosition ( ) , Bearing . fromDegrees ( legBearing . degrees ( ) - 90 ) ) ) { //neg i tive 90 from bearing because of port rounding
roundingChecks . get ( 1 ) , boat . getCurrentPosition ( ) , Bearing . fromDegrees ( legBearing . degrees ( ) - 90 ) ) ) { //neg a tive 90 from bearing because of port rounding
boat . increaseRoundingStatus ( ) ;
}
break ;
@ -501,20 +500,20 @@ public class MockRace extends Race {
* @param boat the boat that is rounding a mark
* @param roundingChecks the checks to run
* /
private void boatRoundingCheckStarboard ( MockBoat boat , List < GPSCoordinate > roundingChecks ){
private void boatRoundingCheckStarboard ( MockBoat boat , List < GPSCoordinate > roundingChecks , Bearing legBearing ){
//boats must pass all checks in order to round a mark
switch ( boat . getRoundingStatus ( ) ) {
case 0 : //hasn't started rounding
if ( boat . is Starboard Side( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark 1( ) ) & &
GPSCoordinate . intersects ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark 1( ) . getPosition ( ) ,
roundingChecks . get ( 0 ) , boat . getCurrentPosition ( ) )) {
if ( boat . is Port Side( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark ForRounding( legBearing ) ) & &
GPSCoordinate . passesLine ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark ForRounding( legBearing ) . getPosition ( ) ,
roundingChecks . get ( 0 ) , boat . getCurrentPosition ( ) , legBearing )) {
boat . increaseRoundingStatus ( ) ;
}
break ;
case 1 : //has been parallel to the mark
if ( boat . is Starboard Side( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark 1( ) ) & &
GPSCoordinate . intersects ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark 1( ) . getPosition ( ) ,
roundingChecks . get ( 1 ) , boat . getCurrentPosition ( ) )) {
if ( boat . is Port Side( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark ForRounding( legBearing ) ) & &
GPSCoordinate . passesLine ( boat . getCurrentLeg ( ) . getEndCompoundMark ( ) . getMark ForRounding( legBearing ) . getPosition ( ) ,
roundingChecks . get ( 1 ) , boat . getCurrentPosition ( ) , Bearing . fromDegrees ( legBearing . degrees ( ) + 90 ) )) { //positive 90 from bearing because of starboard rounding
boat . increaseRoundingStatus ( ) ;
}
break ;
@ -560,7 +559,7 @@ public class MockRace extends Race {
break ;
case PS : //not yet implemented so these gates will be rounded starboard side
case Starboard :
boatRoundingCheckStarboard ( boat , roundingChecks );
boatRoundingCheckStarboard ( boat , roundingChecks , bearingOfDirectionLine );
break ;
}