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
bcf8c689
Commit
bcf8c689
authored
May 19, 2016
by
duminil
Browse files
RegionChooser: Testing RegionExtractor for GSK3 models
parent
24b24d58
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/eu/simstadt/regionchooser/test/RegionExtractorTests.java
0 → 100644
View file @
bcf8c689
package
eu.simstadt.regionchooser.test
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
org.junit.Test
;
import
eu.simstadt.regionchooser.RegionExtractor
;
public
class
RegionExtractorTests
{
public
static
int
countSubstring
(
String
str
,
String
subStr
)
{
return
(
str
.
length
()
-
str
.
replace
(
subStr
,
""
).
length
())
/
subStr
.
length
();
}
@Test
public
void
testExtract3BuildingsFromGSK3Model
()
throws
Throwable
{
//NOTE: Small region around Martinskirche in Grünbühl
String
wktPolygon
=
"POLYGON((3515848.896028535 5415823.108586172,3515848.9512289143 5415803.590347393,3515829.0815150724 5415803.338023346,3515830.9784850604 5415793.437034622,3515842.0946056456 5415793.272282251,3515843.3515515197 5415766.204935087,3515864.1064344468 5415766.557899496,3515876.489172751 5415805.433782301,3515876.343844858 5415822.009293416,3515848.896028535 5415823.108586172))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"Gruenbuehl.proj\\20140218_Gruenbuehl_LOD2.gml"
);
String
churchGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
).
toString
();
assertEquals
(
countSubstring
(
churchGMLString
,
"<core:cityObjectMember"
),
3
);
assertTrue
(
churchGMLString
.
contains
(
"Donaustr"
));
assertTrue
(
churchGMLString
.
contains
(
"DEBW_LOD2_203056"
));
assertTrue
(
churchGMLString
.
contains
(
"DEBW_LOD2_2869"
));
assertTrue
(
churchGMLString
.
contains
(
"DEBW_LOD2_2909"
));
}
}
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