From 1d8b4cd794fdc68e2bd60b98be7d09458baddf94 Mon Sep 17 00:00:00 2001 From: duminil <duminil@2c044af0-2e85-064f-a0c3-7471430cffcd> Date: Wed, 15 Jun 2016 12:00:51 +0000 Subject: [PATCH] RegionChooser: Testing NYC before trying to merge both RegionChoosers. --- .../test/RegionExtractorTests.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/eu/simstadt/regionchooser/test/RegionExtractorTests.java b/test/eu/simstadt/regionchooser/test/RegionExtractorTests.java index f314e74..84881bf 100644 --- a/test/eu/simstadt/regionchooser/test/RegionExtractorTests.java +++ b/test/eu/simstadt/regionchooser/test/RegionExtractorTests.java @@ -8,6 +8,7 @@ import java.util.regex.Pattern; import org.junit.Test; import eu.simstadt.regionchooser.RegionExtractor; +import eu.simstadt.regionchooser.RegionExtractorNewYorkEdition; public class RegionExtractorTests @@ -35,4 +36,29 @@ public void testExtract3BuildingsFromGSK3Model() throws Throwable { assertTrue(churchGMLString.contains("DEBW_LOD2_2869")); assertTrue(churchGMLString.contains("DEBW_LOD2_2909")); } + + @Test + public void testExtract3BuildingsFromNAD83Model() throws Throwable { + //NOTE: Small region around WashingtonSquare + String wktPolygon = "POLYGON((300259.78663489706 62835.835907766595,300230.33294975647 62792.0482567884,300213.5667431851 62770.83143720031,300183.6592861123 62730.20347659383,300252.9947486632 62676.938468840905,300273.3862256562 62701.767105345614,300257.5250407747 62715.760413539596,300308.2754543957 62805.14198211394,300259.78663489706 62835.835907766595))"; + Path repo = Paths.get("../TestRepository"); + Path citygmlPath = repo.resolve("NewYork.proj/ManhattanSmall.gml"); + String archGMLString = RegionExtractorNewYorkEdition.selectRegionDirectlyFromCityGML(citygmlPath, wktPolygon) + .toString(); + assertEquals(countRegexMatches(archGMLString, "<(core:)?cityObjectMember"), 2); + assertTrue(archGMLString.contains("WASHINGTON SQUARE")); + assertTrue(archGMLString.contains("uuid_c0980a6e-05ea-4d09-bc83-efab226945a1")); + assertTrue(archGMLString.contains("uuid_0985cebb-922d-4b3e-95e5-15dc6089cd28")); + } + + @Test + public void testExtract0BuildingsWithWrongCoordinates() throws Throwable { + //NOTE: Small region, far away from NYC + String wktPolygon = "POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))"; + Path repo = Paths.get("../TestRepository"); + Path citygmlPath = repo.resolve("NewYork.proj/ManhattanSmall.gml"); + String archGMLString = RegionExtractorNewYorkEdition.selectRegionDirectlyFromCityGML(citygmlPath, wktPolygon) + .toString(); + assertEquals(countRegexMatches(archGMLString, "<(core:)?cityObjectMember"), 0); + } } -- GitLab