Commit a34fa4c4 authored by Eric Duminil's avatar Eric Duminil
Browse files

Tests: Adding an example with Buildings And Trees

parent 267d07c7
......@@ -9,6 +9,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.jupiter.api.Test;
import org.locationtech.proj4j.CoordinateReferenceSystem;
class RegionExtractorTests
......@@ -164,6 +165,22 @@ void testExtractBuildingsFrom2Citygmls() throws Throwable {
assertEquals(17 + 3, countRegexMatches(gmlFromTwoGMLs, "<bldg:Building gml:id"));
}
@Test
void testExtractBuildingsAndTrees() throws Throwable {
String wktPolygon = "POLYGON((9.944100 49.802694, 9.944092 49.802490, 9.944975 49.802466, 9.944956 49.802689, 9.944100 49.802694))";
Path citygml = TEST_REPOSITORY.resolve("Others.proj/BuildingsAndTrees.gml");
CoordinateReferenceSystem crs = RegionChooserUtils.crsFromCityGMLHeader(citygml);
wktPolygon = RegionChooserUtils.wktPolygonToLocalCRS(wktPolygon, crs);
StringWriter gmlWriter = new StringWriter();
int count = RegionExtractor.selectRegionDirectlyFromCityGML(wktPolygon, crs.getName(), gmlWriter, citygml);
String gmlWithSomeBuildingAndTrees = gmlWriter.toString();
assertEquals(4, count);
assertEquals(4, countRegexMatches(gmlWithSomeBuildingAndTrees, "<bldg:Building gml:id"));
assertEquals(1, countRegexMatches(gmlWithSomeBuildingAndTrees, "<veg:PlantCover gml:id"));
assertEquals(3, countRegexMatches(gmlWithSomeBuildingAndTrees, "<veg:SolitaryVegetationObject gml:id"));
}
@Test
void testExtractBuildingsAndRemoveOld() throws Throwable {
String wktPolygon = "POLYGON((293229.6831819388 5623753.072371232,293681.22751166753 5623744.274551504,293668.8482257676 5623469.512992135,293197.09954629745 5623504.821467172,293229.6831819388 5623753.072371232))";
......
This diff is collapsed.
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