From e1b8e199668ac054efaed6b5ed074c71448b1505 Mon Sep 17 00:00:00 2001 From: William Muir Date: Mon, 22 May 2017 18:54:07 +1200 Subject: [PATCH] Initial work on finding next marks for boats as from mark rounding messages Marks were very difficult to extend, need large refactor Marks now have a compound ID as well as their sourceID. They need this compound ID to be identifiable by the mark rounding messages. tags: #story[956] #pair[wmu16, mra106] --- .../seng302/controllers/CanvasController.java | 16 +- .../controllers/RaceViewController.java | 8 + src/main/java/seng302/models/Event.java | 172 ------------------ src/main/java/seng302/models/Leg.java | 116 ------------ src/main/java/seng302/models/Yacht.java | 10 + .../java/seng302/models/mark/GateMark.java | 4 +- src/main/java/seng302/models/mark/Mark.java | 15 +- .../java/seng302/models/mark/SingleMark.java | 17 +- .../seng302/models/stream/StreamParser.java | 7 + .../java/seng302/models/stream/XMLParser.java | 5 +- src/test/java/seng302/EventTest.java | 38 ---- src/test/java/seng302/LegTest.java | 54 ------ .../java/seng302/models/mark/MarkTest.java | 6 +- 13 files changed, 54 insertions(+), 414 deletions(-) delete mode 100644 src/main/java/seng302/models/Event.java delete mode 100644 src/main/java/seng302/models/Leg.java delete mode 100644 src/test/java/seng302/EventTest.java delete mode 100644 src/test/java/seng302/LegTest.java diff --git a/src/main/java/seng302/controllers/CanvasController.java b/src/main/java/seng302/controllers/CanvasController.java index 0bdeae25..1b2ea66d 100644 --- a/src/main/java/seng302/controllers/CanvasController.java +++ b/src/main/java/seng302/controllers/CanvasController.java @@ -154,9 +154,9 @@ public class CanvasController { double[] yBoundaryPoints = new double[courseLimits.size()]; for (int i = 0; i < courseLimits.size() - 1; i++) { Limit thisPoint1 = courseLimits.get(i); - SingleMark thisMark1 = new SingleMark("", thisPoint1.getLat(), thisPoint1.getLng(), thisPoint1.getSeqID()); + SingleMark thisMark1 = new SingleMark("", thisPoint1.getLat(), thisPoint1.getLng(), thisPoint1.getSeqID(), thisPoint1.getSeqID()); Limit thisPoint2 = courseLimits.get(i+1); - SingleMark thisMark2 = new SingleMark("", thisPoint2.getLat(), thisPoint2.getLng(), thisPoint2.getSeqID()); + SingleMark thisMark2 = new SingleMark("", thisPoint2.getLat(), thisPoint2.getLng(), thisPoint2.getSeqID(), thisPoint2.getSeqID()); Point2D borderPoint1 = findScaledXY(thisMark1); Point2D borderPoint2 = findScaledXY(thisMark2); gc.strokeLine(borderPoint1.getX(), borderPoint1.getY(), @@ -165,9 +165,9 @@ public class CanvasController { yBoundaryPoints[i] = borderPoint1.getY(); } Limit thisPoint1 = courseLimits.get(courseLimits.size()-1); - SingleMark thisMark1 = new SingleMark("", thisPoint1.getLat(), thisPoint1.getLng(), thisPoint1.getSeqID()); + SingleMark thisMark1 = new SingleMark("", thisPoint1.getLat(), thisPoint1.getLng(), thisPoint1.getSeqID(), thisPoint1.getSeqID()); Limit thisPoint2 = courseLimits.get(0); - SingleMark thisMark2 = new SingleMark("", thisPoint2.getLat(), thisPoint2.getLng(), thisPoint2.getSeqID()); + SingleMark thisMark2 = new SingleMark("", thisPoint2.getLat(), thisPoint2.getLng(), thisPoint2.getSeqID(), thisPoint2.getSeqID()); Point2D borderPoint1 = findScaledXY(thisMark1); Point2D borderPoint2 = findScaledXY(thisMark2); gc.strokeLine(borderPoint1.getX(), borderPoint1.getY(), @@ -355,15 +355,15 @@ public class CanvasController { sortedPoints.sort(Comparator.comparingDouble(Limit::getLat)); Limit minLatMark = sortedPoints.get(0); Limit maxLatMark = sortedPoints.get(sortedPoints.size()-1); - minLatPoint = new SingleMark(minLatMark.toString(), minLatMark.getLat(), minLatMark.getLng(), minLatMark.getSeqID()); - maxLatPoint = new SingleMark(maxLatMark.toString(), maxLatMark.getLat(), maxLatMark.getLng(), maxLatMark.getSeqID()); + minLatPoint = new SingleMark(minLatMark.toString(), minLatMark.getLat(), minLatMark.getLng(), minLatMark.getSeqID(), minLatMark.getSeqID()); + maxLatPoint = new SingleMark(maxLatMark.toString(), maxLatMark.getLat(), maxLatMark.getLng(), maxLatMark.getSeqID(), minLatMark.getSeqID()); sortedPoints.sort(Comparator.comparingDouble(Limit::getLng)); //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); - minLonPoint = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID()); - maxLonPoint = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID()); + minLonPoint = new SingleMark(minLonMark.toString(), minLonMark.getLat(), minLonMark.getLng(), minLonMark.getSeqID(), minLonMark.getSeqID()); + maxLonPoint = new SingleMark(maxLonMark.toString(), maxLonMark.getLat(), maxLonMark.getLng(), maxLonMark.getSeqID(), minLonMark.getSeqID()); if (maxLonPoint.getLongitude() - minLonPoint.getLongitude() > 180) { horizontalInversion = true; } diff --git a/src/main/java/seng302/controllers/RaceViewController.java b/src/main/java/seng302/controllers/RaceViewController.java index 43c04a9b..5c589004 100644 --- a/src/main/java/seng302/controllers/RaceViewController.java +++ b/src/main/java/seng302/controllers/RaceViewController.java @@ -183,6 +183,14 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel updateOrder(); updateBoatSelectionComboBox(); + for (Yacht yacht : StreamParser.getBoatsPos().values()) { + if (yacht.getLastMarkRounded() != null) { + System.out.println(yacht.getLastMarkRounded().getName()); + } else { + System.out.println("sup"); + } + } + }) ); diff --git a/src/main/java/seng302/models/Event.java b/src/main/java/seng302/models/Event.java deleted file mode 100644 index 80f688c7..00000000 --- a/src/main/java/seng302/models/Event.java +++ /dev/null @@ -1,172 +0,0 @@ -package seng302.models; - -import seng302.models.mark.Mark; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** -* Event class containing the time of specific event, related team/boat, and -* event location such as leg. -*/ -public class Event { - private Double time; // Time the event occurs - private Yacht boat; - private boolean isFinishingEvent = false; // This event occurs when a boat finishes the race - private Mark mark1; // This mark - private Mark mark2; // Next mark - private int markPosInRace; // the position of the current mark in the race course - private double heading; - private final double ORIGIN_LAT = 32.320504; - private final double ORIGIN_LON = -64.857063; - private final double SCALE = 16000; - - /** - * Event class containing the time of specific event, related team/boat, and - * event location such as leg. - * - * @param eventTime, what time the event happens - * @param eventBoat, the boat that the event belongs to - */ - public Event(Double eventTime, Yacht eventBoat, Mark mark1, Mark mark2, int markPosInRace) { - this.time = eventTime; - this.boat = eventBoat; - this.mark1 = mark1; - this.mark2 = mark2; - this.markPosInRace = markPosInRace; - this.heading = angleFromCoordinate(mark1, mark2); - - } - - /** - * Event class containing the time of specific event, related team/boat, and - * event location such as leg. - * - * @param eventTime, what time the event happens - * @param eventBoat, the boat that the event belongs to - */ - public Event(Double eventTime, Yacht eventBoat, Mark mark1, int markPosInRace) { - this.time = eventTime; - this.boat = eventBoat; - this.mark1 = mark1; - this.markPosInRace = markPosInRace; - this.isFinishingEvent = true; - } - - public double getTime() { - return this.time; - } - - public void setTime(double eventTime) { - this.time = eventTime; - } - - /** - * Gets the time in a formatted string - * - * @return the string of time - */ - public String getTimeString() { - return (new SimpleDateFormat("mm:ss:SSS")).format(new Date(time.longValue())); - } - - public Yacht getBoat() { - return this.boat; - } - - public void setBoat(Yacht eventBoat) { - this.boat = eventBoat; - } - - public boolean getIsFinishingEvent() { - return this.isFinishingEvent; - } - - /** - * Get a string that contains the timestamp and course information for this event - * - * @return A string that details what happened in this event - */ - public String getEventString() { - // This event is a boat finishing the race - if (this.isFinishingEvent) { - return (this.getTimeString() + ", " + this.getBoat().getBoatName() + " finished the race"); - } -// System.out.println(this.getDistanceBetweenMarks()); - return (this.getTimeString() + ", " + this.getBoat().getBoatName() + " passed " + this.mark1.getName() + " going heading " + this.getBoatHeading() + "°"); - } - - /** - * @return the distance between the two marks - */ - public double getDistanceBetweenMarks() { - double earth_radius = 6378.137; - double dLat = this.mark2.getLatitude() * Math.PI / 180 - this.mark1.getLatitude() * Math.PI / 180; - double dLon = this.mark2.getLongitude() * Math.PI / 180 - this.mark1.getLongitude() * Math.PI / 180; - - double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.mark1.getLatitude() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2); - - double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); - double d = earth_radius * c; - - return d * 1000; - } - - /** - * Calculates current boat heading direction. - * @return the boats heading as degree. vertical upward is 0 degree, and degree goes up clockwise. - */ - public double getBoatHeading() { - if (mark2 == null){ - return 0.0; - } - - double x1 = (mark1.getLongitude() - ORIGIN_LON) * SCALE; - double y1 = (ORIGIN_LAT - mark1.getLatitude()) * SCALE; - double x2 = (mark2.getLongitude() - ORIGIN_LON) * SCALE; - double y2 = (ORIGIN_LAT - mark2.getLatitude()) * SCALE; - - double headingRadians = Math.atan2(y2-y1, x2-x1); - - if (headingRadians < 0){ - headingRadians += 2 * Math.PI; - } - - // Convert back to degrees, and flip 180 degrees -// return ((headingRadians) * 180) / Math.PI; - return (Math.toDegrees(headingRadians) + 90) % 360; - - } - - /** - * Calculates the angle between to angular co-ordinates on a sphere. - * - * @param geoPointOne first geographical location - * @param geoPointTwo second geographical location - * @return the angle from point one to point two - */ - private Double angleFromCoordinate(Mark geoPointOne, Mark geoPointTwo) { - if (geoPointTwo == null) - return null; - - double x1 = geoPointOne.getLatitude(); - double y1 = -geoPointOne.getLongitude(); - double x2 = geoPointTwo.getLatitude(); - double y2 = -geoPointTwo.getLongitude(); - - return Math.toDegrees(Math.atan2(x2-x1, y2-y1)); - - } - - public double getHeading() { - return heading; - } - - public Mark getThisMark() { - return this.mark1; - } - - public int getMarkPosInRace() { - return markPosInRace; - } -} \ No newline at end of file diff --git a/src/main/java/seng302/models/Leg.java b/src/main/java/seng302/models/Leg.java deleted file mode 100644 index 8f21a6ea..00000000 --- a/src/main/java/seng302/models/Leg.java +++ /dev/null @@ -1,116 +0,0 @@ -package seng302.models; - -import seng302.models.mark.SingleMark; - -/** -* Represents the leg of a race. -*/ -public class Leg { - private int heading; - private int distance; - private boolean isFinishingLeg; - private SingleMark startingSingleMark; - - /** - * Create a new leg - * - * @param heading, the magnetic heading of this leg - * @param distance, the total distance of this leg in meters - * @param singleMark, the singleMark this leg starts on - */ - public Leg(int heading, int distance, SingleMark singleMark) { - this.heading = heading; - this.distance = distance; - this.startingSingleMark = singleMark; - this.isFinishingLeg = false; - } - - /** - * Create a new leg - * - * @param heading, the magnetic heading of this leg - * @param distance, the total distance of this leg in meters - * @param markerName, the name of the marker this leg starts on - */ - public Leg(int heading, int distance, String markerName) { - this.heading = heading; - this.distance = distance; - this.startingSingleMark = new SingleMark(markerName); - this.isFinishingLeg = false; - } - - /** - * Get the heading of this leg - * @return int - */ - public int getHeading() { - return this.heading; - } - - /** - * Set the heading for this leg - * @param heading - */ - public void setHeading(int heading) { - this.heading = heading; - } - - /** - * Get the total distance of this leg in meters - * @return int - */ - public int getDistance() { - return this.distance; - } - - /** - * Set the distance of this leg in meters - * @param distance - */ - public void setDistance(int distance) { - this.distance = distance; - } - - /** - * Returns the marker this leg started on - * @return SingleMark - */ - public SingleMark getMarker() { - return this.startingSingleMark; - } - - /** - * Set the singleMark this leg starts on - * @param singleMark - */ - public void setMarker(SingleMark singleMark) { - this.startingSingleMark = singleMark; - } - - /** - * Returns the name of the marker this leg started on - * @return String - */ - public String getMarkerLabel() { - return this.startingSingleMark.getName(); - } - - - - /** - * Specify whether or not the race finishes on this leg - * - * @param isFinishingLeg whether or not the race finishes on this leg - */ - public void setFinishingLeg(boolean isFinishingLeg) { - this.isFinishingLeg = isFinishingLeg; - } - - /** - * Returns whether or not the race finishes after this leg - * @return true if this the race finishes after this leg - */ - public boolean getIsFinishingLeg() { - return this.isFinishingLeg; - } -} \ No newline at end of file diff --git a/src/main/java/seng302/models/Yacht.java b/src/main/java/seng302/models/Yacht.java index 8ae5d76c..a5899540 100644 --- a/src/main/java/seng302/models/Yacht.java +++ b/src/main/java/seng302/models/Yacht.java @@ -1,6 +1,7 @@ package seng302.models; import javafx.scene.paint.Color; +import seng302.models.mark.Mark; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -32,6 +33,7 @@ public class Yacht { private String position; // Mark rounding private Long markRoundingTime; + private Mark lastMarkRounded; /** * Used in EventTest and RaceTest. @@ -167,6 +169,14 @@ public class Yacht { this.markRoundingTime = markRoundingTime; } + public Mark getLastMarkRounded() { + return lastMarkRounded; + } + + public void setLastMarkRounded(Mark lastMarkRounded) { + this.lastMarkRounded = lastMarkRounded; + } + @Override public String toString() { return boatName; diff --git a/src/main/java/seng302/models/mark/GateMark.java b/src/main/java/seng302/models/mark/GateMark.java index 79943114..8459b882 100644 --- a/src/main/java/seng302/models/mark/GateMark.java +++ b/src/main/java/seng302/models/mark/GateMark.java @@ -16,8 +16,8 @@ public class GateMark extends Mark { * @param singleMark1 one single mark inside of the gate mark * @param singleMark2 the second mark inside of the gate mark */ - public GateMark(String name, MarkType type, SingleMark singleMark1, SingleMark singleMark2, double latitude, double longitude) { - super(name, type, latitude, longitude); + public GateMark(String name, MarkType type, SingleMark singleMark1, SingleMark singleMark2, double latitude, double longitude, int compoundMarkID) { + super(name, type, latitude, longitude, compoundMarkID); this.singleMark1 = singleMark1; this.singleMark2 = singleMark2; } diff --git a/src/main/java/seng302/models/mark/Mark.java b/src/main/java/seng302/models/mark/Mark.java index 1ca1f608..31791d99 100644 --- a/src/main/java/seng302/models/mark/Mark.java +++ b/src/main/java/seng302/models/mark/Mark.java @@ -11,24 +11,27 @@ public abstract class Mark { private double latitude; private double longitude; private long id; + private int compoundMarkID; /** * Create a mark instance by passing its name and type * @param name the name of the mark * @param markType the type of mark. either GATE_MARK or SINGLE_MARK. */ - public Mark (String name, MarkType markType, int id) { + public Mark (String name, MarkType markType, int sourceID, int compoundMarkID) { this.name = name; this.markType = markType; - this.id = id; + this.id = sourceID; + this.compoundMarkID = compoundMarkID; } - public Mark(String name, MarkType markType, double latitude, double longitude) { + public Mark(String name, MarkType markType, double latitude, double longitude, int compoundMarkID) { this.name = name; this.markType = markType; this.latitude = latitude; this.longitude = longitude; - id = 0; + this.id = 0; + this.compoundMarkID = compoundMarkID; } /** @@ -132,4 +135,8 @@ public abstract class Mark { public void setId(int id) { this.id = id; } + + public int getCompoundMarkID() { + return compoundMarkID; + } } diff --git a/src/main/java/seng302/models/mark/SingleMark.java b/src/main/java/seng302/models/mark/SingleMark.java index 9239552a..56ba9dc6 100644 --- a/src/main/java/seng302/models/mark/SingleMark.java +++ b/src/main/java/seng302/models/mark/SingleMark.java @@ -9,7 +9,6 @@ public class SingleMark extends Mark { private double lat; private double lon; private String name; - private int id; /** * Represents a marker @@ -18,24 +17,12 @@ public class SingleMark extends Mark { * @param lat, the latitude of the marker * @param lon, the longitude of the marker */ - public SingleMark(String name, double lat, double lon, int id) { - super(name, MarkType.SINGLE_MARK, id); + public SingleMark(String name, double lat, double lon, int sourceID, int compoundMarkID) { + super(name, MarkType.SINGLE_MARK, sourceID, compoundMarkID); this.lat = lat; this.lon = lon; - this.id = id; } - /** - * Represents the marker at the beginning of a leg - * - * @param name, the name of the marker - */ - public SingleMark(String name) { - super(name, MarkType.SINGLE_MARK, 0); - this.lat = 0; - this.lon = 0; - this.id = 0; - } public double getLatitude() { return this.lat; diff --git a/src/main/java/seng302/models/stream/StreamParser.java b/src/main/java/seng302/models/stream/StreamParser.java index f800379c..f31a0519 100644 --- a/src/main/java/seng302/models/stream/StreamParser.java +++ b/src/main/java/seng302/models/stream/StreamParser.java @@ -22,6 +22,7 @@ import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import seng302.models.Yacht; +import seng302.models.mark.Mark; import seng302.models.stream.packets.BoatPositionPacket; import seng302.models.stream.packets.StreamPacket; @@ -441,6 +442,12 @@ public class StreamParser extends Thread{ // assign mark rounding time to boat boats.get((int)subjectId).setMarkRoundingTime(timeStamp); + + for (Mark mark : xmlObject.getRaceXML().getCompoundMarks()) { + if (mark.getCompoundMarkID() == markId) { + boats.get((int)subjectId).setLastMarkRounded(mark); + } + } } /** diff --git a/src/main/java/seng302/models/stream/XMLParser.java b/src/main/java/seng302/models/stream/XMLParser.java index 674a2611..4bda96cf 100644 --- a/src/main/java/seng302/models/stream/XMLParser.java +++ b/src/main/java/seng302/models/stream/XMLParser.java @@ -333,6 +333,7 @@ public class XMLParser { private Mark createMark(Node compoundMark) { List marksList = new ArrayList<>(); + Integer compoundMarkID = getNodeAttributeInt(compoundMark, "CompoundMarkID"); String cMarkName = getNodeAttributeString(compoundMark, "Name"); NodeList childMarks = compoundMark.getChildNodes(); @@ -346,7 +347,7 @@ public class XMLParser { Double targetLat = getNodeAttributeDouble(markNode, "TargetLat"); Double targetLng = getNodeAttributeDouble(markNode, "TargetLng"); - SingleMark mark = new SingleMark(markName, targetLat, targetLng, sourceID); + SingleMark mark = new SingleMark(markName, targetLat, targetLng, sourceID, compoundMarkID); marksList.add(mark); } } @@ -364,7 +365,7 @@ public class XMLParser { } else if (marksList.size() == 2) { return new GateMark(cMarkName, MarkType.OPEN_GATE, marksList.get(0), marksList.get(1), marksList.get(0).getLatitude(), - marksList.get(0).getLongitude()); + marksList.get(0).getLongitude(), compoundMarkID); } else { return null; } diff --git a/src/test/java/seng302/EventTest.java b/src/test/java/seng302/EventTest.java deleted file mode 100644 index 4c98ddd6..00000000 --- a/src/test/java/seng302/EventTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package seng302; - -import org.junit.Test; -import seng302.models.Event; -import seng302.models.Yacht; -import seng302.models.mark.SingleMark; - -import static org.junit.Assert.assertEquals; - -/** - * Test for Event class - * Created by Haoming on 7/03/17. - */ -public class EventTest { - - @Test - public void getTimeString() throws Exception { - Yacht boat = new Yacht("testBoat"); - Event event = new Event(1231242.2, boat, new SingleMark("mark1"), new SingleMark("mark2"), 0); - assertEquals("20:31:242", event.getTimeString()); - } - - @Test - public void testBoatHeading() throws Exception { - Yacht boat = new Yacht("testBoat"); - 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); - } - - @Test - public void testDistanceBetweenMarks() throws Exception { - Yacht boat = new Yacht("testBoat"); - 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); - } -} \ No newline at end of file diff --git a/src/test/java/seng302/LegTest.java b/src/test/java/seng302/LegTest.java deleted file mode 100644 index 9bb64b6c..00000000 --- a/src/test/java/seng302/LegTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package seng302; - -import org.junit.Test; -import seng302.models.Leg; -import seng302.models.mark.SingleMark; - -import static org.junit.Assert.assertEquals; - -/** - * Unit test for the Leg class. - */ -public class LegTest { - - /** - * Test creation of the leg by specifying a string - * for the marker label - */ - @Test - public void testLegCreationUsingMarkerLabel() { - Leg leg = new Leg(010, 100, "SingleMark"); - - assertEquals(leg.getHeading(), 010); - assertEquals(leg.getDistance(), 100); - assertEquals(leg.getMarkerLabel(), "SingleMark"); - assertEquals(leg.getIsFinishingLeg(), false); - } - - /** - * Test creation of the leg by providing a - * SingleMark object - */ - @Test - public void testLegCreation() { - Leg leg = new Leg(010, 100, new SingleMark("SingleMark")); - - assertEquals(leg.getHeading(), 010); - assertEquals(leg.getDistance(), 100); - assertEquals(leg.getMarkerLabel(), "SingleMark"); - assertEquals(leg.getIsFinishingLeg(), false); - } - - /** - * Test changing whether or not a - * leg is the finishing leg - */ - @Test - public void testSetFinishLeg() { - Leg leg = new Leg(010, 100, "SingleMark"); - - leg.setFinishingLeg(true); - assertEquals(leg.getIsFinishingLeg(), true); - } - -} diff --git a/src/test/java/seng302/models/mark/MarkTest.java b/src/test/java/seng302/models/mark/MarkTest.java index 3db92540..8615be5f 100644 --- a/src/test/java/seng302/models/mark/MarkTest.java +++ b/src/test/java/seng302/models/mark/MarkTest.java @@ -16,9 +16,9 @@ public class MarkTest { @Before public void setUp() throws Exception { - this.singleMark1 = new SingleMark("testMark_SM1", 12.23234, -34.342, 1); - 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.singleMark1 = new SingleMark("testMark_SM1", 12.23234, -34.342, 1, 0); + this.singleMark2 = new SingleMark("testMark_SM2", 12.23239, -34.352, 2, 1); + this.gateMark = new GateMark("testMark_GM", MarkType.OPEN_GATE, singleMark1, singleMark2, singleMark1.getLatitude(), singleMark2.getLongitude(), 2); } @Test