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
688d4dd3
Commit
688d4dd3
authored
Mar 20, 2018
by
Eric Duminil
Browse files
RegionChooser: Some gmls have missing Z in envelope.
parent
8f7fcb88
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/RegionExtractor.java
View file @
688d4dd3
...
@@ -98,8 +98,14 @@ private static String replaceEnvelopeInHeader(String header, Envelope envelope,
...
@@ -98,8 +98,14 @@ private static String replaceEnvelopeInHeader(String header, Envelope envelope,
String
headerWithoutEnvelope
=
header
;
String
headerWithoutEnvelope
=
header
;
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
headerWithoutEnvelope
=
matcher
.
replaceFirst
(
""
);
headerWithoutEnvelope
=
matcher
.
replaceFirst
(
""
);
zMin
=
Double
.
valueOf
(
matcher
.
group
(
1
).
split
(
"\\s+"
)[
2
]);
String
[]
mins
=
matcher
.
group
(
1
).
split
(
"\\s+"
);
zMax
=
Double
.
valueOf
(
matcher
.
group
(
2
).
split
(
"\\s+"
)[
2
]);
String
[]
maxs
=
matcher
.
group
(
2
).
split
(
"\\s+"
);
if
(
mins
.
length
>
2
)
{
zMin
=
Double
.
valueOf
(
mins
[
2
]);
}
if
(
maxs
.
length
>
2
)
{
zMax
=
Double
.
valueOf
(
maxs
[
2
]);
}
}
}
String
newEnvelope
=
"<gml:boundedBy>\r\n"
+
String
newEnvelope
=
"<gml:boundedBy>\r\n"
+
" <gml:Envelope srsName=\""
+
srsName
+
"\" srsDimension=\"3\">\r\n"
+
//NOTE: Would srsDimension="2" be better? Should the original Z get extracted?
" <gml:Envelope srsName=\""
+
srsName
+
"\" srsDimension=\"3\">\r\n"
+
//NOTE: Would srsDimension="2" be better? Should the original Z get extracted?
...
...
test/eu/simstadt/regionchooser/RegionExtractorTests.java
View file @
688d4dd3
...
@@ -125,15 +125,13 @@ public void testExtract0BuildingsFromWeirdGML() throws Throwable {
...
@@ -125,15 +125,13 @@ public void testExtract0BuildingsFromWeirdGML() throws Throwable {
assertTrue
(
emptyGMLString
.
contains
(
"</core:CityModel"
));
// Footer
assertTrue
(
emptyGMLString
.
contains
(
"</core:CityModel"
));
// Footer
}
}
//TODO: Add BuildingParts tests with StuttgartAroundCampus.
@Test
@Test
public
void
testExtractBuildingsFromCitygmlWithBuildingParts
()
throws
Throwable
{
public
void
testExtractBuildingsFromCitygmlWithoutZinEnvelope
()
throws
Throwable
{
//NOTE: Small region, with too many spaces between coordinates
String
wktPolygon
=
"POLYGON((3512683.1280912133 5404783.732132129,3512719.1608604863 5404714.627650777,3512831.40076119 5404768.344155442,3512790.239106708 5404838.614891164,3512683.1280912133 5404783.732132129))"
;
String
wktPolygon
=
"POLYGON((3512683.1280912133 5404783.732132129,3512719.1608604863 5404714.627650777,3512831.40076119 5404768.344155442,3512790.239106708 5404838.614891164,3512683.1280912133 5404783.732132129))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"Stuttgart.proj/Stuttgart_LOD0_LOD1_
around_campus
.gml"
);
Path
citygmlPath
=
repo
.
resolve
(
"Stuttgart.proj/Stuttgart_LOD0_LOD1_
small
.gml"
);
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:31463"
)
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:31463"
)
.
toString
();
.
toString
();
assertEquals
(
countRegexMatches
(
emptyGMLString
,
"<
(core:)?cityObjectMember
"
),
2
);
assertEquals
(
countRegexMatches
(
emptyGMLString
,
"<
bldg:Building gml:id
"
),
2
);
}
}
}
}
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