mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Removed the parser from queing packets incorrectly. Used the marker boat location packets to get the live updates of the marker positions and implemented the markers being updated much like the boats currently are. This means the course more closely resembles the actual intended course design.
#story[820]
This commit is contained in:
@@ -148,6 +148,7 @@ public class BoatGroup extends RaceObject{
|
|||||||
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
|
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
|
||||||
destinationSet = true;
|
destinationSet = true;
|
||||||
boat.setVelocity(StreamParser.boatSpeeds.get((long)boat.getId()));
|
boat.setVelocity(StreamParser.boatSpeeds.get((long)boat.getId()));
|
||||||
|
velocityObject.setText(String.valueOf(boat.getVelocity()));
|
||||||
if (hasRaceId(raceIds)) {
|
if (hasRaceId(raceIds)) {
|
||||||
this.pixelVelocityX = (newXValue - boatPoly.getLayoutX()) / expectedUpdateInterval;
|
this.pixelVelocityX = (newXValue - boatPoly.getLayoutX()) / expectedUpdateInterval;
|
||||||
this.pixelVelocityY = (newYValue - boatPoly.getLayoutY()) / expectedUpdateInterval;
|
this.pixelVelocityY = (newYValue - boatPoly.getLayoutY()) / expectedUpdateInterval;
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ public abstract class Mark {
|
|||||||
* @param name the name of the mark
|
* @param name the name of the mark
|
||||||
* @param markType the type of mark. either GATE_MARK or SINGLE_MARK.
|
* @param markType the type of mark. either GATE_MARK or SINGLE_MARK.
|
||||||
*/
|
*/
|
||||||
public Mark (String name, MarkType markType) {
|
public Mark (String name, MarkType markType, int id) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.markType = markType;
|
this.markType = markType;
|
||||||
id = 0;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mark(String name, MarkType markType, double latitude, double longitude) {
|
public Mark(String name, MarkType markType, double latitude, double longitude) {
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ public class MarkGroup extends RaceObject {
|
|||||||
System.out.println("HERE ARE THE CHILDREN LOL");
|
System.out.println("HERE ARE THE CHILDREN LOL");
|
||||||
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
if (mark.getMarkType() == MarkType.SINGLE_MARK) {
|
||||||
super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
super.getChildren().add(new Circle(0, 0, MARK_RADIUS, color));
|
||||||
|
nodeDestinations = new Point2D[]{
|
||||||
|
new Point2D(super.getChildren().get(0).getLayoutX()
|
||||||
|
, super.getChildren().get(0).getLayoutY())};
|
||||||
} else {
|
} else {
|
||||||
marks.add(((GateMark) mark).getSingleMark1());
|
marks.add(((GateMark) mark).getSingleMark1());
|
||||||
marks.add(((GateMark) mark).getSingleMark2());
|
marks.add(((GateMark) mark).getSingleMark2());
|
||||||
@@ -96,6 +99,7 @@ public class MarkGroup extends RaceObject {
|
|||||||
setDestinationGroup(x, y);
|
setDestinationGroup(x, y);
|
||||||
childrenIndex++;
|
childrenIndex++;
|
||||||
}
|
}
|
||||||
|
updateChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,9 +109,13 @@ public class MarkGroup extends RaceObject {
|
|||||||
this.nodeDestinations[childIndex] = new Point2D(relativeX, relativeY);
|
this.nodeDestinations[childIndex] = new Point2D(relativeX, relativeY);
|
||||||
this.nodePixelVelocitiesX[childIndex] = (relativeX - super.getChildren().get(childIndex).getLayoutX()) / expectedUpdateInterval;
|
this.nodePixelVelocitiesX[childIndex] = (relativeX - super.getChildren().get(childIndex).getLayoutX()) / expectedUpdateInterval;
|
||||||
this.nodePixelVelocitiesY[childIndex] = (relativeY - super.getChildren().get(childIndex).getLayoutY()) / expectedUpdateInterval;
|
this.nodePixelVelocitiesY[childIndex] = (relativeY - super.getChildren().get(childIndex).getLayoutY()) / expectedUpdateInterval;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDestinationGroup (double x, double y) {
|
private void setDestinationGroup (double x, double y) {
|
||||||
|
double relativeX = x - super.getLayoutX();
|
||||||
|
double relativeY = y - super.getLayoutY();
|
||||||
|
this.nodeDestinations[0] = new Point2D(relativeX, relativeY);
|
||||||
pixelVelocityX = (x - super.getLayoutX()) / expectedUpdateInterval;
|
pixelVelocityX = (x - super.getLayoutX()) / expectedUpdateInterval;
|
||||||
pixelVelocityY = (y - super.getLayoutY()) / expectedUpdateInterval;
|
pixelVelocityY = (y - super.getLayoutY()) / expectedUpdateInterval;
|
||||||
}
|
}
|
||||||
@@ -119,11 +127,11 @@ public class MarkGroup extends RaceObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updatePosition (long timeInterval) {
|
public void updatePosition (long timeInterval) {
|
||||||
double x = pixelVelocityX * timeInterval;
|
// double x = pixelVelocityX * timeInterval;
|
||||||
double y = pixelVelocityY * timeInterval;
|
// double y = pixelVelocityY * timeInterval;
|
||||||
double rotation = rotationalVelocity * timeInterval;
|
// double rotation = rotationalVelocity * timeInterval;
|
||||||
moveGroupBy(x, y, rotation);
|
// moveGroupBy(x, y, rotation);
|
||||||
updateChildren(timeInterval);
|
// updateChildren(timeInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveGroupBy (double x, double y, double rotation) {
|
public void moveGroupBy (double x, double y, double rotation) {
|
||||||
@@ -132,42 +140,59 @@ public class MarkGroup extends RaceObject {
|
|||||||
rotateTo(rotation);
|
rotateTo(rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateChildren (double timeInterval) {
|
private void updateChildren () {
|
||||||
|
|
||||||
if (mainMark.getMarkType() != MarkType.SINGLE_MARK) {
|
if (mainMark.getMarkType() != MarkType.SINGLE_MARK) {
|
||||||
|
Line line = (Line) super.getChildren().get(2);
|
||||||
|
for (int childIndex = 0; childIndex < 2; childIndex++){
|
||||||
|
Circle mark = (Circle) super.getChildren().get(childIndex);
|
||||||
|
Point2D dest = nodeDestinations[childIndex];
|
||||||
|
mark.setCenterY(dest.getY());
|
||||||
|
mark.setCenterX(dest.getX());
|
||||||
|
}
|
||||||
|
line.setStartX(nodeDestinations[0].getX());
|
||||||
|
line.setStartY(nodeDestinations[0].getY());
|
||||||
|
line.setEndX(nodeDestinations[1].getX());
|
||||||
|
line.setEndY(nodeDestinations[1].getY());
|
||||||
|
// Circle mark = (Circle) super.getChildren().get(0);
|
||||||
|
// if (nodePixelVelocitiesX[0] > 0 && mark.getLayoutX() >= nodeDestinations[0].getX()) {
|
||||||
|
// nodePixelVelocitiesX[0] = 0;
|
||||||
|
// } else if (nodePixelVelocitiesX[0] < 0 && mark.getLayoutX() <= nodeDestinations[0].getX()) {
|
||||||
|
// nodePixelVelocitiesX[0] = 0;
|
||||||
|
// } else {
|
||||||
|
// mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[0] * timeInterval);
|
||||||
|
// mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[0] * timeInterval);
|
||||||
|
// }
|
||||||
|
// if (nodePixelVelocitiesY[0] >= 0 && mark.getLayoutY() > nodeDestinations[0].getY()) {
|
||||||
|
// nodePixelVelocitiesY[0] = 0;
|
||||||
|
// } else if (nodePixelVelocitiesY[0] < 0 && mark.getLayoutY() <= nodeDestinations[0].getY()) {
|
||||||
|
// nodePixelVelocitiesY[0] = 0;
|
||||||
|
// } else {
|
||||||
|
// mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[0] * timeInterval);
|
||||||
|
// mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[0] * timeInterval);
|
||||||
|
// }
|
||||||
|
// mark = (Circle) super.getChildren().get(1);
|
||||||
|
// if (nodePixelVelocitiesX[1] > 0 && mark.getLayoutX() >= nodeDestinations[1].getX()) {
|
||||||
|
// nodePixelVelocitiesX[1] = 0;
|
||||||
|
// } else if (nodePixelVelocitiesX[1] < 0 && mark.getLayoutX() <= nodeDestinations[1].getX()) {
|
||||||
|
// nodePixelVelocitiesX[1] = 0;
|
||||||
|
// } else {
|
||||||
|
// mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[1] * timeInterval);
|
||||||
|
// mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[1] * timeInterval);
|
||||||
|
// }
|
||||||
|
// if (nodePixelVelocitiesY[1] >= 0 && mark.getLayoutY() > nodeDestinations[1].getY()) {
|
||||||
|
// nodePixelVelocitiesY[1] = 0;
|
||||||
|
// } else if (nodePixelVelocitiesY[1] < 0 && mark.getLayoutY() <= nodeDestinations[1].getY()) {
|
||||||
|
// nodePixelVelocitiesY[1] = 0;
|
||||||
|
// } else {
|
||||||
|
// mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[1] * timeInterval);
|
||||||
|
// mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[1] * timeInterval);
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
Circle mark = (Circle) super.getChildren().get(0);
|
Circle mark = (Circle) super.getChildren().get(0);
|
||||||
if (nodePixelVelocitiesX[0] > 0 && mark.getLayoutX() >= nodeDestinations[0].getX()) {
|
Point2D dest = nodeDestinations[0];
|
||||||
nodePixelVelocitiesX[0] = 0;
|
mark.setCenterY(dest.getY());
|
||||||
} else if (nodePixelVelocitiesX[0] < 0 && mark.getLayoutX() <= nodeDestinations[0].getX()) {
|
mark.setCenterX(dest.getX());
|
||||||
nodePixelVelocitiesX[0] = 0;
|
|
||||||
} else {
|
|
||||||
mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[0] * timeInterval);
|
|
||||||
mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[0] * timeInterval);
|
|
||||||
}
|
|
||||||
if (nodePixelVelocitiesY[0] >= 0 && mark.getLayoutY() > nodeDestinations[0].getY()) {
|
|
||||||
nodePixelVelocitiesY[0] = 0;
|
|
||||||
} else if (nodePixelVelocitiesY[0] < 0 && mark.getLayoutY() <= nodeDestinations[0].getY()) {
|
|
||||||
nodePixelVelocitiesY[0] = 0;
|
|
||||||
} else {
|
|
||||||
mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[0] * timeInterval);
|
|
||||||
mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[0] * timeInterval);
|
|
||||||
}
|
|
||||||
mark = (Circle) super.getChildren().get(1);
|
|
||||||
if (nodePixelVelocitiesX[1] > 0 && mark.getLayoutX() >= nodeDestinations[1].getX()) {
|
|
||||||
nodePixelVelocitiesX[1] = 0;
|
|
||||||
} else if (nodePixelVelocitiesX[1] < 0 && mark.getLayoutX() <= nodeDestinations[1].getX()) {
|
|
||||||
nodePixelVelocitiesX[1] = 0;
|
|
||||||
} else {
|
|
||||||
mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[1] * timeInterval);
|
|
||||||
mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[1] * timeInterval);
|
|
||||||
}
|
|
||||||
if (nodePixelVelocitiesY[1] >= 0 && mark.getLayoutY() > nodeDestinations[1].getY()) {
|
|
||||||
nodePixelVelocitiesY[1] = 0;
|
|
||||||
} else if (nodePixelVelocitiesY[1] < 0 && mark.getLayoutY() <= nodeDestinations[1].getY()) {
|
|
||||||
nodePixelVelocitiesY[1] = 0;
|
|
||||||
} else {
|
|
||||||
mark.setLayoutX(mark.getLayoutX() + nodePixelVelocitiesX[1] * timeInterval);
|
|
||||||
mark.setLayoutY(mark.getLayoutY() + nodePixelVelocitiesY[1] * timeInterval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class SingleMark extends Mark {
|
|||||||
private double lat;
|
private double lat;
|
||||||
private double lon;
|
private double lon;
|
||||||
private String name;
|
private String name;
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,10 +19,11 @@ public class SingleMark extends Mark {
|
|||||||
* @param lat, the latitude of the marker
|
* @param lat, the latitude of the marker
|
||||||
* @param lon, the longitude of the marker
|
* @param lon, the longitude of the marker
|
||||||
*/
|
*/
|
||||||
public SingleMark(String name, double lat, double lon) {
|
public SingleMark(String name, double lat, double lon, int id) {
|
||||||
super(name, MarkType.SINGLE_MARK);
|
super(name, MarkType.SINGLE_MARK, id);
|
||||||
this.lat = lat;
|
this.lat = lat;
|
||||||
this.lon = lon;
|
this.lon = lon;
|
||||||
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,9 +32,10 @@ public class SingleMark extends Mark {
|
|||||||
* @param name, the name of the marker
|
* @param name, the name of the marker
|
||||||
*/
|
*/
|
||||||
public SingleMark(String name) {
|
public SingleMark(String name) {
|
||||||
super(name, MarkType.SINGLE_MARK);
|
super(name, MarkType.SINGLE_MARK, 0);
|
||||||
this.lat = 0;
|
this.lat = 0;
|
||||||
this.lon = 0;
|
this.lon = 0;
|
||||||
|
this.id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getLatitude() {
|
public double getLatitude() {
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ public class CourseParser extends FileParser {
|
|||||||
String name = element.getElementsByTagName("name").item(0).getTextContent();
|
String name = element.getElementsByTagName("name").item(0).getTextContent();
|
||||||
double lat = Double.valueOf(element.getElementsByTagName("latitude").item(0).getTextContent());
|
double lat = Double.valueOf(element.getElementsByTagName("latitude").item(0).getTextContent());
|
||||||
double lon = Double.valueOf(element.getElementsByTagName("longitude").item(0).getTextContent());
|
double lon = Double.valueOf(element.getElementsByTagName("longitude").item(0).getTextContent());
|
||||||
SingleMark singleMark = new SingleMark(name, lat, lon);
|
int id = Integer.valueOf(element.getElementsByTagName("id").item(0).getTextContent());
|
||||||
|
SingleMark singleMark = new SingleMark(name, lat, lon, id);
|
||||||
return singleMark;
|
return singleMark;
|
||||||
} else {
|
} else {
|
||||||
throw new NoSuchElementException("Cannot generate a mark by given node.");
|
throw new NoSuchElementException("Cannot generate a mark by given node.");
|
||||||
|
|||||||
@@ -48,21 +48,20 @@ public class StreamParser extends Thread{
|
|||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
}
|
}
|
||||||
while (StreamReceiver.packetBuffer.peek() != null){
|
while (StreamReceiver.packetBuffer.peek() != null){
|
||||||
StreamPacket packet = StreamReceiver.packetBuffer.peek();
|
// StreamPacket packet = StreamReceiver.packetBuffer.peek();
|
||||||
int delayTime = 1000;
|
// int delayTime = 1000;
|
||||||
int loopTime = delayTime + 1000;
|
// int loopTime = delayTime + 1000;
|
||||||
long sleepTime = 0;
|
// long sleepTime = 0;
|
||||||
long transitTime = (System.currentTimeMillis()%loopTime - packet.getTimeStamp()%loopTime);
|
// long transitTime = (System.currentTimeMillis()%loopTime - packet.getTimeStamp()%loopTime);
|
||||||
if (transitTime < 0){
|
// if (transitTime < 0){
|
||||||
transitTime = loopTime + delayTime;
|
// transitTime = loopTime + delayTime;
|
||||||
}
|
// }
|
||||||
if (transitTime < delayTime) {
|
// if (transitTime < delayTime) {
|
||||||
sleepTime = delayTime - (transitTime);
|
// sleepTime = delayTime - (transitTime);
|
||||||
Thread.sleep(sleepTime);
|
// Thread.sleep(sleepTime);
|
||||||
}
|
// }
|
||||||
System.out.println(sleepTime);
|
// System.out.println(sleepTime);
|
||||||
|
StreamPacket packet = StreamReceiver.packetBuffer.take();
|
||||||
packet = StreamReceiver.packetBuffer.take();
|
|
||||||
parsePacket(packet);
|
parsePacket(packet);
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
while (StreamReceiver.packetBuffer.peek() == null) {
|
while (StreamReceiver.packetBuffer.peek() == null) {
|
||||||
@@ -228,7 +227,6 @@ public class StreamParser extends Thread{
|
|||||||
while (payloadStream.available() > 0 && (currentChar = payloadStream.read()) != 0) {
|
while (payloadStream.available() > 0 && (currentChar = payloadStream.read()) != 0) {
|
||||||
xmlMessage += (char)currentChar;
|
xmlMessage += (char)currentChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create XML document Object
|
//Create XML document Object
|
||||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder db = null;
|
DocumentBuilder db = null;
|
||||||
@@ -323,7 +321,7 @@ public class StreamParser extends Thread{
|
|||||||
// long speed = extractTimeStamp(speedBytes, 2);
|
// long speed = extractTimeStamp(speedBytes, 2);
|
||||||
double groundSpeed = bytesToLong(groundSpeedBytes)/1000.0;
|
double groundSpeed = bytesToLong(groundSpeedBytes)/1000.0;
|
||||||
short s = (short) ((groundSpeedBytes[1] & 0xFF) << 8 | (groundSpeedBytes[0] & 0xFF));
|
short s = (short) ((groundSpeedBytes[1] & 0xFF) << 8 | (groundSpeedBytes[0] & 0xFF));
|
||||||
if ((int)deviceType == 1 || (int)deviceType == 4){
|
if ((int)deviceType == 1 || (int)deviceType == 3){
|
||||||
// System.out.println("boatId = " + boatId);
|
// System.out.println("boatId = " + boatId);
|
||||||
// System.out.println("deviceType = " + (long)deviceType);
|
// System.out.println("deviceType = " + (long)deviceType);
|
||||||
// System.out.println("seq = " + seq);
|
// System.out.println("seq = " + seq);
|
||||||
|
|||||||
@@ -8,17 +8,20 @@
|
|||||||
<name>Start1</name>
|
<name>Start1</name>
|
||||||
<latitude>57.6703330</latitude>
|
<latitude>57.6703330</latitude>
|
||||||
<longitude>11.8278330</longitude>
|
<longitude>11.8278330</longitude>
|
||||||
|
<id>122</id>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Start2</name>
|
<name>Start2</name>
|
||||||
<latitude>57.6706330</latitude>
|
<latitude>57.6706330</latitude>
|
||||||
<longitude>11.8281330</longitude>
|
<longitude>11.8281330</longitude>
|
||||||
|
<id>123</id>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Mid Mark</name>
|
<name>Mid Mark</name>
|
||||||
<latitude>57.6675700</latitude>
|
<latitude>57.6675700</latitude>
|
||||||
<longitude>11.8359880</longitude>
|
<longitude>11.8359880</longitude>
|
||||||
|
<id>131</id>
|
||||||
</mark>
|
</mark>
|
||||||
<gate>
|
<gate>
|
||||||
<name>Leeward Gate</name>
|
<name>Leeward Gate</name>
|
||||||
@@ -26,11 +29,13 @@
|
|||||||
<name>Leeward Gate1</name>
|
<name>Leeward Gate1</name>
|
||||||
<latitude>57.6708220</latitude>
|
<latitude>57.6708220</latitude>
|
||||||
<longitude>11.8433900</longitude>
|
<longitude>11.8433900</longitude>
|
||||||
|
<id>124</id>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Leeward Gate2</name>
|
<name>Leeward Gate2</name>
|
||||||
<latitude>57.6711220</latitude>
|
<latitude>57.6711220</latitude>
|
||||||
<longitude>11.8436900</longitude>
|
<longitude>11.8436900</longitude>
|
||||||
|
<id>125</id>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<gate>
|
<gate>
|
||||||
@@ -39,11 +44,13 @@
|
|||||||
<name>Windward Gate1</name>
|
<name>Windward Gate1</name>
|
||||||
<latitude>57.6650170</latitude>
|
<latitude>57.6650170</latitude>
|
||||||
<longitude>11.8279170</longitude>
|
<longitude>11.8279170</longitude>
|
||||||
|
<id>126</id>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Windward Gate2</name>
|
<name>Windward Gate2</name>
|
||||||
<latitude>57.6653170</latitude>
|
<latitude>57.6653170</latitude>
|
||||||
<longitude>11.8282170</longitude>
|
<longitude>11.8282170</longitude>
|
||||||
|
<id>127</id>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
<gate type="finish-line">
|
<gate type="finish-line">
|
||||||
@@ -52,11 +59,13 @@
|
|||||||
<name>Finish1</name>
|
<name>Finish1</name>
|
||||||
<latitude>57.6715240</latitude>
|
<latitude>57.6715240</latitude>
|
||||||
<longitude>11.8444950</longitude>
|
<longitude>11.8444950</longitude>
|
||||||
|
<id>128</id>
|
||||||
</mark>
|
</mark>
|
||||||
<mark>
|
<mark>
|
||||||
<name>Finish2</name>
|
<name>Finish2</name>
|
||||||
<latitude>57.6718240</latitude>
|
<latitude>57.6718240</latitude>
|
||||||
<longitude>11.8447950</longitude>
|
<longitude>11.8447950</longitude>
|
||||||
|
<id>129</id>
|
||||||
</mark>
|
</mark>
|
||||||
</gate>
|
</gate>
|
||||||
</marks>
|
</marks>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class EventTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBoatHeading() throws Exception {
|
public void testBoatHeading() throws Exception {
|
||||||
Boat boat = new Boat("testBoat");
|
Boat boat = new Boat("testBoat");
|
||||||
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1), new SingleMark("mark2", 121.9,99.2), 0);
|
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1, 1), new SingleMark("mark2", 121.9,99.2, 2), 0);
|
||||||
|
|
||||||
assertEquals(event.getBoatHeading(), 228.0266137055349, 1e-15);
|
assertEquals(event.getBoatHeading(), 228.0266137055349, 1e-15);
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ public class EventTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDistanceBetweenMarks() throws Exception {
|
public void testDistanceBetweenMarks() throws Exception {
|
||||||
Boat boat = new Boat("testBoat");
|
Boat boat = new Boat("testBoat");
|
||||||
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1), new SingleMark("mark2", 121.9,99.2), 0);
|
Event event = new Event(1231242.2, boat, new SingleMark("mark1", 142.5, 122.1, 1), new SingleMark("mark2", 121.9,99.2, 2), 0);
|
||||||
|
|
||||||
assertEquals(event.getDistanceBetweenMarks(), 339059.653830461, 1e-15);
|
assertEquals(event.getDistanceBetweenMarks(), 339059.653830461, 1e-15);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ public class MarkTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
this.singleMark1 = new SingleMark("testMark_SM1", 12.23234, -34.342);
|
this.singleMark1 = new SingleMark("testMark_SM1", 12.23234, -34.342, 1);
|
||||||
this.singleMark2 = new SingleMark("testMark_SM2", 12.23239, -34.352);
|
this.singleMark2 = new SingleMark("testMark_SM2", 12.23239, -34.352, 2);
|
||||||
this.gateMark = new GateMark("testMark_GM", MarkType.OPEN_GATE, singleMark1, singleMark2, singleMark1.getLatitude(), singleMark2.getLongitude());
|
this.gateMark = new GateMark("testMark_GM", MarkType.OPEN_GATE, singleMark1, singleMark2, singleMark1.getLatitude(), singleMark2.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user