Unignored a couple of GPS tests
- The issue was with accuracy. Average of two coords is fine fo two point fairly close together (<1km), but not for very very large distances. - We only ever use it for small ranges so changed tests to reflect that #story[881]
This commit is contained in:
@@ -11,7 +11,6 @@ public class CompoundMark extends Marker{
|
||||
private GPSCoordinate averageGPSCoordinate;
|
||||
private Mark mark1;
|
||||
private Mark mark2 = null;
|
||||
private String name;
|
||||
|
||||
public CompoundMark(Mark mark1) {
|
||||
super(mark1.getPosition());
|
||||
@@ -28,15 +27,6 @@ public class CompoundMark extends Marker{
|
||||
|
||||
}
|
||||
|
||||
public CompoundMark(String name, Mark mark1, Mark mark2) {
|
||||
super(name, mark1.getPosition(), mark2.getPosition());
|
||||
this.name = name;
|
||||
this.mark1 = mark1;
|
||||
this.mark2 = mark2;
|
||||
this.averageGPSCoordinate = calculateAverage();
|
||||
|
||||
}
|
||||
|
||||
public GPSCoordinate getMark1() {
|
||||
return mark1.getPosition();
|
||||
}
|
||||
@@ -49,10 +39,6 @@ public class CompoundMark extends Marker{
|
||||
return averageGPSCoordinate;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private GPSCoordinate calculateAverage() {
|
||||
if(mark2 != null) {
|
||||
GeodeticCalculator calc = new GeodeticCalculator();
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.testng.AssertJUnit.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by esa46 on 29/03/17.
|
||||
@@ -29,13 +30,12 @@ public class CompoundMarkTest {
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void averageLatOfTwoMarksIsAccurate() {
|
||||
|
||||
GPSCoordinate testCoord = new GPSCoordinate(10, 0);
|
||||
GPSCoordinate testCoord = new GPSCoordinate(0.001, 0);
|
||||
Marker testMark = new Marker(ORIGIN_COORD, testCoord);
|
||||
assertTrue(testMark.getAverageGPSCoordinate().equals(new GPSCoordinate(5, 0)));
|
||||
assertEquals(testMark.getAverageGPSCoordinate(), new GPSCoordinate(0.0005, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -50,10 +50,11 @@ public class CompoundMarkTest {
|
||||
@Test
|
||||
public void averageLatAndLongOfTwoMarksIsAccurate() {
|
||||
|
||||
GPSCoordinate testCoord1 = new GPSCoordinate(10, 30);
|
||||
GPSCoordinate testCoord2 = new GPSCoordinate(30, 60);
|
||||
GPSCoordinate testCoord1 = new GPSCoordinate(0.0, 30);
|
||||
GPSCoordinate testCoord2 = new GPSCoordinate(0.001, 60);
|
||||
Marker testMark = new Marker(testCoord1, testCoord2);
|
||||
assertTrue(testMark.getAverageGPSCoordinate().equals(new GPSCoordinate(020.644102, 44.014817)));
|
||||
assertEquals(testMark.getAverageGPSCoordinate().getLatitude(), 0.00051776, 1e-8);
|
||||
assertEquals(testMark.getAverageGPSCoordinate().getLongitude(), 45.000000, 1e-8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user