Cleaned up line to be in a shippable shape
#story[1101]
This commit is contained in:
@@ -3,8 +3,7 @@ package visualiser.model;
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.paint.*;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import network.Messages.Enums.BoatStatusEnum;
|
||||
import shared.dataInput.RaceDataSource;
|
||||
@@ -502,15 +501,15 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
//Race boundary.
|
||||
drawBoundary();
|
||||
|
||||
//Guiding Line
|
||||
drawRaceLine();
|
||||
|
||||
//Boats.
|
||||
drawBoats();
|
||||
|
||||
//Marks.
|
||||
drawMarks();
|
||||
|
||||
//Guiding Line
|
||||
drawRaceLine();
|
||||
|
||||
//Wind arrow. This rotates the wind arrow node.
|
||||
displayWindArrow(this.visualiserRace.getWindDirection().degrees());
|
||||
|
||||
@@ -558,36 +557,49 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
|
||||
//use the direction line to find a point parallel to it by the mark
|
||||
GPSCoordinate pointToStartCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
||||
150, Azimuth.fromDegrees(bearingOfDirectionLine.degrees()+90));
|
||||
100, Azimuth.fromDegrees(bearingOfDirectionLine.degrees()+90));
|
||||
|
||||
//use the direction line to find a point to curve too
|
||||
GPSCoordinate pointToEndCurve = GPSCoordinate.calculateNewPosition(endDirectionLinePoint,
|
||||
150, Azimuth.fromDegrees(bearingOfNextDirectionLine.degrees()+90));
|
||||
100, Azimuth.fromDegrees(bearingOfNextDirectionLine.degrees()+90));
|
||||
|
||||
//use the curve points to find the two control points for the bezier curve
|
||||
GPSCoordinate controlPoint;
|
||||
GPSCoordinate controlPoint2;
|
||||
Bearing bearingOfCurveLine = GPSCoordinate.calculateBearing(pointToStartCurve, pointToEndCurve);
|
||||
GPSCoordinate controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
||||
75, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+ 50));
|
||||
if ((bearingOfDirectionLine.degrees() - bearingOfNextDirectionLine.degrees() +360)%360< 145){
|
||||
//small turn
|
||||
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
||||
50, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+45));
|
||||
controlPoint2 = controlPoint;
|
||||
}else{
|
||||
//large turn
|
||||
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
|
||||
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+90));
|
||||
controlPoint2 = GPSCoordinate.calculateNewPosition(pointToEndCurve,
|
||||
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+90));
|
||||
}
|
||||
|
||||
|
||||
//change all gps into graph coordinate
|
||||
GraphCoordinate startPath = this.map.convertGPS(startDirectionLinePoint);
|
||||
GraphCoordinate curvePoint = this.map.convertGPS(pointToStartCurve);
|
||||
GraphCoordinate curvePointEnd = this.map.convertGPS(pointToEndCurve);
|
||||
GraphCoordinate c1 = this.map.convertGPS(controlPoint);
|
||||
GraphCoordinate c2 = this.map.convertGPS(controlPoint2);
|
||||
|
||||
gc.setStroke(Color.RED);
|
||||
gc.setLineWidth(1);
|
||||
gc.setLineWidth(2);
|
||||
gc.setStroke(Color.MEDIUMAQUAMARINE);
|
||||
|
||||
gc.beginPath();
|
||||
gc.moveTo(startPath.getX(), startPath.getY());
|
||||
gc.lineTo(curvePoint.getX(), curvePoint.getY());
|
||||
gc.bezierCurveTo(c1.getX(), c1.getY(), c1.getX(), c1.getY(), curvePointEnd.getX(), curvePointEnd.getY());
|
||||
drawArrowHead(startDirectionLinePoint, pointToStartCurve);
|
||||
gc.bezierCurveTo(c1.getX(), c1.getY(), c2.getX(), c2.getY(), curvePointEnd.getX(), curvePointEnd.getY());
|
||||
gc.stroke();
|
||||
gc.closePath();
|
||||
gc.save();
|
||||
|
||||
drawArrowHead(controlPoint, pointToEndCurve);
|
||||
|
||||
return pointToEndCurve;
|
||||
}else{//last leg so no curve
|
||||
GraphCoordinate startPath = this.map.convertGPS(legStartPoint);
|
||||
|
||||
Reference in New Issue
Block a user