mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Removed unnecessary Position and GeoPoint classes to clear the code base.
- put utility classes in a package #story[1047]
This commit is contained in:
@@ -3,6 +3,7 @@ package seng302;
|
||||
import javafx.geometry.Point2D;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import seng302.utilities.GeometryUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package seng302.models.map;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.utilities.GeoPoint;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -11,30 +14,30 @@ import static org.junit.Assert.*;
|
||||
public class MercatorProjectionTest {
|
||||
@Test
|
||||
public void toMapPoint() throws Exception {
|
||||
MapGeo geo1 = new MapGeo(12.485394, 19.38947);
|
||||
MapPoint actualPoint1 = MercatorProjection.toMapPoint(geo1);
|
||||
MapPoint expectedPoint1 = new MapPoint(141.78806755555556, 119.0503853635612);
|
||||
GeoPoint geo1 = new GeoPoint(12.485394, 19.38947);
|
||||
javafx.geometry.Point2D actualPoint1 = MercatorProjection.toMapPoint(geo1);
|
||||
javafx.geometry.Point2D expectedPoint1 = new javafx.geometry.Point2D(141.78806755555556, 119.0503853635612);
|
||||
assertEquals(expectedPoint1.getX(), actualPoint1.getX(), 0.0001);
|
||||
assertEquals(expectedPoint1.getY(), actualPoint1.getY(), 0.0001);
|
||||
|
||||
MapGeo geo2 = new MapGeo(77.456432, -23.456462);
|
||||
MapPoint actualPoint2 = MercatorProjection.toMapPoint(geo2);
|
||||
MapPoint expectedPoint2 = new MapPoint(111.31984924444444, 38.03143323746788);
|
||||
GeoPoint geo2 = new GeoPoint(77.456432, -23.456462);
|
||||
javafx.geometry.Point2D actualPoint2 = MercatorProjection.toMapPoint(geo2);
|
||||
javafx.geometry.Point2D expectedPoint2 = new javafx.geometry.Point2D(111.31984924444444, 38.03143323746788);
|
||||
assertEquals(expectedPoint2.getX(), actualPoint2.getX(), 0.0001);
|
||||
assertEquals(expectedPoint2.getY(), actualPoint2.getY(), 0.0001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toMapGeo() throws Exception {
|
||||
MapPoint point1 = new MapPoint(123.1234, 25.4565);
|
||||
MapGeo actualGeo1 = MercatorProjection.toMapGeo(point1);
|
||||
MapGeo expectedGeo1 = new MapGeo(80.77043127275441, -6.857718749999995);
|
||||
javafx.geometry.Point2D point1 = new javafx.geometry.Point2D(123.1234, 25.4565);
|
||||
GeoPoint actualGeo1 = MercatorProjection.toMapGeo(point1);
|
||||
GeoPoint expectedGeo1 = new GeoPoint(80.77043127275441, -6.857718749999995);
|
||||
assertEquals(expectedGeo1.getLat(), actualGeo1.getLat(), 0.0001);
|
||||
assertEquals(expectedGeo1.getLng(), actualGeo1.getLng(), 0.0001);
|
||||
|
||||
MapPoint point2 = new MapPoint(1.235, 255.4565);
|
||||
MapGeo actualGeo2 = MercatorProjection.toMapGeo(point2);
|
||||
MapGeo expectedGeo2 = new MapGeo(-84.98475532898011, -178.26328125);
|
||||
javafx.geometry.Point2D point2 = new javafx.geometry.Point2D(1.235, 255.4565);
|
||||
GeoPoint actualGeo2 = MercatorProjection.toMapGeo(point2);
|
||||
GeoPoint expectedGeo2 = new GeoPoint(-84.98475532898011, -178.26328125);
|
||||
assertEquals(expectedGeo2.getLat(), actualGeo2.getLat(), 0.0001);
|
||||
assertEquals(expectedGeo2.getLng(), actualGeo2.getLng(), 0.0001);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package seng302.server.simulator;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.server.simulator.mark.Position;
|
||||
import seng302.utilities.GeoPoint;
|
||||
import seng302.utilities.GeoUtility;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -11,10 +12,10 @@ import static org.junit.Assert.*;
|
||||
*/
|
||||
public class GeoUtilityTest {
|
||||
|
||||
private Position p1 = new Position(57.670333, 11.827833);
|
||||
private Position p2 = new Position(57.671524, 11.844495);
|
||||
private Position p3 = new Position(57.670822, 11.843392);
|
||||
private Position p4 = new Position(25.694829, 98.392049);
|
||||
private GeoPoint p1 = new GeoPoint(57.670333, 11.827833);
|
||||
private GeoPoint p2 = new GeoPoint(57.671524, 11.844495);
|
||||
private GeoPoint p3 = new GeoPoint(57.670822, 11.843392);
|
||||
private GeoPoint p4 = new GeoPoint(25.694829, 98.392049);
|
||||
|
||||
private double toleranceRate = 0.01;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class GeoUtilityTest {
|
||||
|
||||
@Test
|
||||
public void getGeoCoordinate() throws Exception {
|
||||
Position expected, actual;
|
||||
GeoPoint expected, actual;
|
||||
|
||||
actual = GeoUtility.getGeoCoordinate(p1, 82.0, 1000.0);
|
||||
expected = p2;
|
||||
|
||||
Reference in New Issue
Block a user