Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
a34fa4c4
Commit
a34fa4c4
authored
Nov 28, 2023
by
Eric Duminil
Browse files
Tests: Adding an example with Buildings And Trees
parent
267d07c7
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
src/test/java/eu/simstadt/regionchooser/RegionExtractorTests.java
View file @
a34fa4c4
...
...
@@ -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))"
;
...
...
src/test/resources/testdata/Others.proj/BuildingsAndTrees.gml
0 → 100644
View file @
a34fa4c4
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment