Commit 5c0578fe authored by duminil's avatar duminil
Browse files

RegionChooser: Testing ConvexHull with WGS84

parent cca35e6d
...@@ -22,8 +22,9 @@ public void testExtractConvexHullFromOneBuilding() throws Throwable { ...@@ -22,8 +22,9 @@ public void testExtractConvexHullFromOneBuilding() throws Throwable {
Path citygmlPath = repo.resolve("Gruenbuehl.proj/20140218_Gruenbuehl_LOD2_1building.gml"); Path citygmlPath = repo.resolve("Gruenbuehl.proj/20140218_Gruenbuehl_LOD2_1building.gml");
Geometry hull = ConvexHullCalculator.calculateFromCityGML(citygmlPath); Geometry hull = ConvexHullCalculator.calculateFromCityGML(citygmlPath);
assertEquals(hull.getCoordinates().length, 4 + 1); // Convex hull of a building should be a closed rectangle assertEquals(hull.getCoordinates().length, 4 + 1); // Convex hull of a building should be a closed rectangle
Point someBuildingPoint = gf.createPoint(new Coordinate(3515960.36, 5415667.91)); // Point someBuildingPoint = gf.createPoint(new Coordinate(3515960.36, 5415667.91)); // Original coordinates, GSK3
assertTrue(hull.contains(someBuildingPoint)); Point someBuildingPoint = gf.createPoint(new Coordinate(9.21656126408, 48.8782253597)); // WGS84
assertTrue("Hull should contain every building point", hull.contains(someBuildingPoint));
} }
@Test @Test
...@@ -32,7 +33,8 @@ public void testExtractConvexHullFromOneSmallRegion() throws Throwable { ...@@ -32,7 +33,8 @@ public void testExtractConvexHullFromOneSmallRegion() throws Throwable {
Path citygmlPath = repo.resolve("Gruenbuehl.proj/Gruenbuehl_LOD2_ALKIS_1010.gml"); Path citygmlPath = repo.resolve("Gruenbuehl.proj/Gruenbuehl_LOD2_ALKIS_1010.gml");
Geometry hull = ConvexHullCalculator.calculateFromCityGML(citygmlPath); Geometry hull = ConvexHullCalculator.calculateFromCityGML(citygmlPath);
assertTrue(hull.getCoordinates().length > 4); // Convex hull should have at least 4 corners assertTrue(hull.getCoordinates().length > 4); // Convex hull should have at least 4 corners
Point somewhereBetweenBuildings = gf.createPoint(new Coordinate(3515883.6668538367, 5415843.300640578)); // Point somewhereBetweenBuildings = gf.createPoint(new Coordinate(3515883.6668538367, 5415843.300640578)); // Original coordinates, GSK3
assertTrue(hull.contains(somewhereBetweenBuildings)); Point somewhereBetweenBuildings = gf.createPoint(new Coordinate(9.21552249084, 48.87980446)); // WGS84
assertTrue("Hull should contain region between buildings", hull.contains(somewhereBetweenBuildings));
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment