mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge branch 'develop' into issue#10_unifying_marks
# Conflicts: # src/main/java/seng302/App.java # src/main/java/seng302/controllers/CanvasController.java
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 TOP_BUFFER = BUFFER_SIZE;
|
||||
private final int BOT_BUFFER = TOP_BUFFER + MARK_SIZE / 2;
|
||||
private boolean horizontalInversion = false;
|
||||
|
||||
private double distanceScaleFactor;
|
||||
private ScaleDirection scaleDirection;
|
||||
@@ -188,9 +189,9 @@ public class CanvasController {
|
||||
boatGroup.move();
|
||||
}
|
||||
for (MarkGroup markGroup : markGroups) {
|
||||
for (long id : markGroup.getRaceIds()) {
|
||||
if (StreamParser.markPositions.containsKey(id)) {
|
||||
UpdateMarkGroup(id, markGroup);
|
||||
for (int id : markGroup.getRaceIds()) {
|
||||
if (StreamParser.boatPositions.containsKey(id)) {
|
||||
updateMarkGroup(id, markGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,8 +224,8 @@ public class CanvasController {
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateMarkGroup (long raceId, MarkGroup markGroup) {
|
||||
PriorityBlockingQueue<BoatPositionPacket> movementQueue = StreamParser.markPositions.get(raceId);
|
||||
void updateMarkGroup (int raceId, MarkGroup markGroup) {
|
||||
PriorityBlockingQueue<BoatPositionPacket> movementQueue = StreamParser.boatPositions.get(raceId);
|
||||
if (movementQueue.size() > 0){
|
||||
try {
|
||||
BoatPositionPacket positionPacket = movementQueue.take();
|
||||
@@ -353,16 +354,11 @@ public class CanvasController {
|
||||
//If the course is on a point on the earth where longitudes wrap around.
|
||||
Limit minLonMark = sortedPoints.get(0);
|
||||
Limit maxLonMark = sortedPoints.get(sortedPoints.size()-1);
|
||||
SingleMark thisMinLon = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID());
|
||||
SingleMark thisMaxLon = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID());
|
||||
// TODO: 30/03/17 cir27 - Correctly account for longitude wrapping around.
|
||||
if (thisMaxLon.getLongitude() - thisMinLon.getLongitude() > 180) {
|
||||
SingleMark temp = thisMinLon;
|
||||
thisMinLon = thisMaxLon;
|
||||
thisMaxLon = temp;
|
||||
minLonPoint = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID());
|
||||
maxLonPoint = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID());
|
||||
if (maxLonPoint.getLongitude() - minLonPoint.getLongitude() > 180) {
|
||||
horizontalInversion = true;
|
||||
}
|
||||
minLonPoint = thisMinLon;
|
||||
maxLonPoint = thisMaxLon;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,6 +389,9 @@ public class CanvasController {
|
||||
referencePointX += distanceScaleFactor * Math.sin(referenceAngle) * Mark.calculateDistance(referencePoint, minLonPoint);
|
||||
referencePointX += ((CANVAS_WIDTH - (LHS_BUFFER + RHS_BUFFER)) - (minLonToMaxLon * distanceScaleFactor)) / 2;
|
||||
}
|
||||
if(horizontalInversion) {
|
||||
referencePointX = CANVAS_WIDTH - RHS_BUFFER - (referencePointX - LHS_BUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -452,6 +451,9 @@ public class CanvasController {
|
||||
xAxisLocation -= (int) Math.round(distanceScaleFactor * Math.cos(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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user