compound marks now can give the mark they have that needs to be rounded this is used to draw the line around the correct mark

#story[1101]
This commit is contained in:
hba56
2017-08-09 23:25:42 +12:00
parent e2605c3c7c
commit e53d72f24b
2 changed files with 110 additions and 9 deletions
@@ -1,12 +1,13 @@
package visualiser.model;
import javafx.scene.Node;
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 network.Messages.Enums.BoatStatusEnum;
import shared.dataInput.RaceDataSource;
import shared.enums.RoundingType;
import shared.model.*;
import java.util.List;
@@ -510,7 +511,12 @@ public class ResizableRaceCanvas extends ResizableCanvas {
//finds the direction of the current leg as a bearing
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);
//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();
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
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
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
GPSCoordinate controlPoint;
@@ -534,14 +549,14 @@ public class ResizableRaceCanvas extends ResizableCanvas {
if ((bearingOfDirectionLine.degrees() - bearingOfNextDirectionLine.degrees() +360)%360< 145){
//small turn
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
50, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+45));
50, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+(degreesToAdd/2)));
controlPoint2 = controlPoint;
}else{
//large turn
controlPoint = GPSCoordinate.calculateNewPosition(pointToStartCurve,
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+90));
150, Azimuth.fromDegrees(bearingOfCurveLine.degrees()+degreesToAdd));
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
*/
private void drawTrack(VisualiserBoat boat) {
//Check that track points are enabled.
if (this.annoPath) {