|
|
|
@ -1,12 +1,13 @@
|
|
|
|
package visualiser.model;
|
|
|
|
package visualiser.model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
|
|
|
|
import javafx.scene.image.Image;
|
|
|
|
import javafx.scene.image.Image;
|
|
|
|
import javafx.scene.paint.*;
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
|
|
|
|
import javafx.scene.paint.Paint;
|
|
|
|
import javafx.scene.transform.Rotate;
|
|
|
|
import javafx.scene.transform.Rotate;
|
|
|
|
import network.Messages.Enums.BoatStatusEnum;
|
|
|
|
import network.Messages.Enums.BoatStatusEnum;
|
|
|
|
import shared.dataInput.RaceDataSource;
|
|
|
|
import shared.dataInput.RaceDataSource;
|
|
|
|
|
|
|
|
import shared.enums.RoundingType;
|
|
|
|
import shared.model.*;
|
|
|
|
import shared.model.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
@ -510,7 +511,12 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
|
|
|
|
|
|
|
|
//finds the direction of the current leg as a bearing
|
|
|
|
//finds the direction of the current leg as a bearing
|
|
|
|
startDirectionLinePoint = legStartPoint;
|
|
|
|
startDirectionLinePoint = legStartPoint;
|
|
|
|
endDirectionLinePoint = legs.get(index).getEndCompoundMark().getMark1Position();
|
|
|
|
GPSCoordinate tempEndDirectionLinePoint = legs.get(index).getEndCompoundMark().getAverageGPSCoordinate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bearingOfDirectionLine = GPSCoordinate.calculateBearing(startDirectionLinePoint, tempEndDirectionLinePoint);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//after finding the initial bearing pick the mark used for rounding
|
|
|
|
|
|
|
|
endDirectionLinePoint = legs.get(index).getEndCompoundMark().getMarkForRounding(bearingOfDirectionLine).getPosition();
|
|
|
|
bearingOfDirectionLine = GPSCoordinate.calculateBearing(startDirectionLinePoint, endDirectionLinePoint);
|
|
|
|
bearingOfDirectionLine = GPSCoordinate.calculateBearing(startDirectionLinePoint, endDirectionLinePoint);
|
|
|
|
|
|
|
|
|
|
|
|
//finds the direction of the next leg as a bearing
|
|
|
|
//finds the direction of the next leg as a bearing
|
|
|
|
@ -519,13 +525,22 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
endNextDirectionLinePoint = legs.get(index + 1).getEndCompoundMark().getMark1Position();
|
|
|
|
endNextDirectionLinePoint = legs.get(index + 1).getEndCompoundMark().getMark1Position();
|
|
|
|
bearingOfNextDirectionLine = GPSCoordinate.calculateBearing(startNextDirectionLinePoint, endNextDirectionLinePoint);
|
|
|
|
bearingOfNextDirectionLine = GPSCoordinate.calculateBearing(startNextDirectionLinePoint, endNextDirectionLinePoint);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double degreesToAdd;
|
|
|
|
|
|
|
|
//find which side is need to be used
|
|
|
|
|
|
|
|
if (legs.get(index).getEndCompoundMark().getRoundingType() == RoundingType.Port ||
|
|
|
|
|
|
|
|
legs.get(index).getEndCompoundMark().getRoundingType() == RoundingType.SP){
|
|
|
|
|
|
|
|
degreesToAdd = 90;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
degreesToAdd = -90;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//use the direction line to find a point parallel to it by the mark
|
|
|
|
//use the direction line to find a point parallel to it by the mark
|
|
|
|
GPSCoordinate pointToStartCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
|
|
|
GPSCoordinate pointToStartCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
|
|
|
100, Azimuth.fromDegrees(bearingOfDirectionLine.degrees()+90));
|
|
|
|
100, Azimuth.fromDegrees(bearingOfDirectionLine.degrees()+degreesToAdd));
|
|
|
|
|
|
|
|
|
|
|
|
//use the direction line to find a point to curve too
|
|
|
|
//use the direction line to find a point to curve too
|
|
|
|
GPSCoordinate pointToEndCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
|
|
|
GPSCoordinate pointToEndCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
|
|
|
100, Azimuth.fromDegrees(bearingOfNextDirectionLine.degrees()+90));
|
|
|
|
100, Azimuth.fromDegrees(bearingOfNextDirectionLine.degrees()+degreesToAdd));
|
|
|
|
|
|
|
|
|
|
|
|
//use the curve points to find the two control points for the bezier curve
|
|
|
|
//use the curve points to find the two control points for the bezier curve
|
|
|
|
GPSCoordinate controlPoint;
|
|
|
|
GPSCoordinate controlPoint;
|
|
|
|
@ -534,14 +549,14 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
if ((bearingOfDirectionLine.degrees() - bearingOfNextDirectionLine.degrees() +360)%360< 145){
|
|
|
|
if ((bearingOfDirectionLine.degrees() - bearingOfNextDirectionLine.degrees() +360)%360< 145){
|
|
|
|
//small turn
|
|
|
|
//small turn
|
|
|
|
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
|
|
|
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
|
|
|
50, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+45));
|
|
|
|
50, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+(degreesToAdd/2)));
|
|
|
|
controlPoint2 = controlPoint;
|
|
|
|
controlPoint2 = controlPoint;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
//large turn
|
|
|
|
//large turn
|
|
|
|
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
|
|
|
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
|
|
|
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+90));
|
|
|
|
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+degreesToAdd));
|
|
|
|
controlPoint2 = GPSCoordinate.calculateNewPosition(pointToEndCurve,
|
|
|
|
controlPoint2 = GPSCoordinate.calculateNewPosition(pointToEndCurve,
|
|
|
|
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+90));
|
|
|
|
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+degreesToAdd));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -618,7 +633,6 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
|
|
|
* @see TrackPoint
|
|
|
|
* @see TrackPoint
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void drawTrack(VisualiserBoat boat) {
|
|
|
|
private void drawTrack(VisualiserBoat boat) {
|
|
|
|
|
|
|
|
|
|
|
|
//Check that track points are enabled.
|
|
|
|
//Check that track points are enabled.
|
|
|
|
if (this.annoPath) {
|
|
|
|
if (this.annoPath) {
|
|
|
|
|
|
|
|
|
|
|
|
|