mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge branch 'develop' of https://eng-git.canterbury.ac.nz/seng302-2017/team-13 into develop
This commit is contained in:
@@ -50,6 +50,7 @@ public class CanvasController {
|
|||||||
private final int RHS_BUFFER = BUFFER_SIZE + MARK_SIZE / 2;
|
private final int RHS_BUFFER = BUFFER_SIZE + MARK_SIZE / 2;
|
||||||
private final int TOP_BUFFER = BUFFER_SIZE;
|
private final int TOP_BUFFER = BUFFER_SIZE;
|
||||||
private final int BOT_BUFFER = TOP_BUFFER + MARK_SIZE / 2;
|
private final int BOT_BUFFER = TOP_BUFFER + MARK_SIZE / 2;
|
||||||
|
private boolean horizontalInversion = false;
|
||||||
|
|
||||||
private double distanceScaleFactor;
|
private double distanceScaleFactor;
|
||||||
private ScaleDirection scaleDirection;
|
private ScaleDirection scaleDirection;
|
||||||
@@ -128,7 +129,6 @@ public class CanvasController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 1/05/17 cir27 - Make the RaceObjects update on the actual delay.
|
// TODO: 1/05/17 cir27 - Make the RaceObjects update on the actual delay.
|
||||||
elapsedNanos = 1000 / 60;
|
|
||||||
updateRaceObjects();
|
updateRaceObjects();
|
||||||
if (StreamParser.isRaceFinished()) {
|
if (StreamParser.isRaceFinished()) {
|
||||||
this.stop();
|
this.stop();
|
||||||
@@ -386,16 +386,11 @@ public class CanvasController {
|
|||||||
//If the course is on a point on the earth where longitudes wrap around.
|
//If the course is on a point on the earth where longitudes wrap around.
|
||||||
Limit minLonMark = sortedPoints.get(0);
|
Limit minLonMark = sortedPoints.get(0);
|
||||||
Limit maxLonMark = sortedPoints.get(sortedPoints.size()-1);
|
Limit maxLonMark = sortedPoints.get(sortedPoints.size()-1);
|
||||||
SingleMark thisMinLon = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID());
|
minLonPoint = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID());
|
||||||
SingleMark thisMaxLon = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID());
|
minLatPoint = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID());
|
||||||
// TODO: 30/03/17 cir27 - Correctly account for longitude wrapping around.
|
if (maxLonPoint.getLongitude() - minLonPoint.getLongitude() > 180) {
|
||||||
if (thisMaxLon.getLongitude() - thisMinLon.getLongitude() > 180) {
|
horizontalInversion = true;
|
||||||
SingleMark temp = thisMinLon;
|
|
||||||
thisMinLon = thisMaxLon;
|
|
||||||
thisMaxLon = temp;
|
|
||||||
}
|
}
|
||||||
minLonPoint = thisMinLon;
|
|
||||||
maxLonPoint = thisMaxLon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -426,6 +421,9 @@ public class CanvasController {
|
|||||||
referencePointX += distanceScaleFactor * Math.sin(referenceAngle) * Mark.calculateDistance(referencePoint, minLonPoint);
|
referencePointX += distanceScaleFactor * Math.sin(referenceAngle) * Mark.calculateDistance(referencePoint, minLonPoint);
|
||||||
referencePointX += ((CANVAS_WIDTH - (LHS_BUFFER + RHS_BUFFER)) - (minLonToMaxLon * distanceScaleFactor)) / 2;
|
referencePointX += ((CANVAS_WIDTH - (LHS_BUFFER + RHS_BUFFER)) - (minLonToMaxLon * distanceScaleFactor)) / 2;
|
||||||
}
|
}
|
||||||
|
if(horizontalInversion) {
|
||||||
|
referencePointX = CANVAS_WIDTH - RHS_BUFFER - (referencePointX - LHS_BUFFER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -509,6 +507,9 @@ public class CanvasController {
|
|||||||
xAxisLocation -= (int) Math.round(distanceScaleFactor * Math.cos(angleFromReference) * distanceFromReference);
|
xAxisLocation -= (int) Math.round(distanceScaleFactor * Math.cos(angleFromReference) * distanceFromReference);
|
||||||
yAxisLocation += (int) Math.round(distanceScaleFactor * Math.sin(angleFromReference) * distanceFromReference);
|
yAxisLocation += (int) Math.round(distanceScaleFactor * Math.sin(angleFromReference) * distanceFromReference);
|
||||||
}
|
}
|
||||||
|
if(horizontalInversion) {
|
||||||
|
xAxisLocation = CANVAS_WIDTH - RHS_BUFFER - (xAxisLocation - LHS_BUFFER);
|
||||||
|
}
|
||||||
return new Point2D(xAxisLocation, yAxisLocation);
|
return new Point2D(xAxisLocation, yAxisLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,9 +109,13 @@ public class BoatGroup extends RaceObject {
|
|||||||
teamNameObject.setCacheHint(CacheHint.SPEED);
|
teamNameObject.setCacheHint(CacheHint.SPEED);
|
||||||
velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
velocityObject = new Text(String.valueOf(boat.getVelocity()));
|
||||||
DateFormat format = new SimpleDateFormat("mm:ss");
|
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||||
String timeToNextMark = format
|
// TODO: 21/05/17 make a nice way of checking for this to be null
|
||||||
|
estTimeToNextMarkObject = new Text("Next mark: null");
|
||||||
|
if (boat.getEstimateTimeAtNextMark() != null) {
|
||||||
|
String timeToNextMark = format
|
||||||
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||||
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
|
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
|
||||||
|
}
|
||||||
if (boat.getMarkRoundingTime() != null) {
|
if (boat.getMarkRoundingTime() != null) {
|
||||||
String elapsedTime = format
|
String elapsedTime = format
|
||||||
.format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime());
|
.format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime());
|
||||||
@@ -280,9 +284,14 @@ public class BoatGroup extends RaceObject {
|
|||||||
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
|
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
|
||||||
DateFormat format = new SimpleDateFormat("mm:ss");
|
DateFormat format = new SimpleDateFormat("mm:ss");
|
||||||
// estimate time to next mark
|
// estimate time to next mark
|
||||||
String timeToNextMark = format
|
// TODO: 21/05/17 make a nice way of checking for this to be null
|
||||||
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
estTimeToNextMarkObject.setText("Next mark: null");
|
||||||
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
|
if (boat.getEstimateTimeAtNextMark() != null) {
|
||||||
|
String timeToNextMark = format
|
||||||
|
.format(
|
||||||
|
boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
|
||||||
|
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
|
||||||
|
}
|
||||||
// elapsed time
|
// elapsed time
|
||||||
if (boat.getMarkRoundingTime() != null) {
|
if (boat.getMarkRoundingTime() != null) {
|
||||||
String elapsedTime = format
|
String elapsedTime = format
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class Race {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a boat as finished
|
* Set a boat as finished
|
||||||
* @param boat The boat that has finished the race/home/cosc/student/wmu16
|
* @param boat The boat that has finished the race
|
||||||
*/
|
*/
|
||||||
public void setBoatFinished(Yacht boat){
|
public void setBoatFinished(Yacht boat){
|
||||||
this.finishingOrder.add(boat);
|
this.finishingOrder.add(boat);
|
||||||
|
|||||||
Reference in New Issue
Block a user