Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
4f76b33f
Commit
4f76b33f
authored
8 years ago
by
duminil
Browse files
Options
Download
Email Patches
Plain Diff
Bit more robust.
parent
b53691f7
master
develop
migrate_to_Java11
0.2.2
0.1.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/eu/simstadt/regionchooser/citygml_parser/BuildingXmlNode.java
+1
-1
...imstadt/regionchooser/citygml_parser/BuildingXmlNode.java
test/eu/simstadt/regionchooser/test/RegionExtractorTests.java
+13
-0
.../eu/simstadt/regionchooser/test/RegionExtractorTests.java
with
14 additions
and
1 deletion
+14
-1
src/eu/simstadt/regionchooser/citygml_parser/BuildingXmlNode.java
+
1
-
1
View file @
4f76b33f
...
...
@@ -37,7 +37,7 @@ public Point getCenterOfMass() throws XPathParseException, NumberFormatException
int
coordinatesOffset
=
(
int
)
offsetAndLength
;
int
coordinatesLength
=
(
int
)
(
offsetAndLength
>>
32
);
String
posList
=
navigator
.
toRawString
(
coordinatesOffset
,
coordinatesLength
);
String
[]
coordinates
=
posList
.
split
(
"
"
);
String
[]
coordinates
=
posList
.
trim
().
split
(
"
\\s+
"
);
for
(
int
k
=
0
;
k
<
coordinates
.
length
;
k
=
k
+
3
)
{
coordinatesCount
++;
xTotal
+=
Double
.
valueOf
(
coordinates
[
k
]);
...
...
This diff is collapsed.
Click to expand it.
test/eu/simstadt/regionchooser/test/RegionExtractorTests.java
+
13
-
0
View file @
4f76b33f
...
...
@@ -67,4 +67,17 @@ public void testExtract0BuildingsWithWrongCoordinates() throws Throwable {
assertTrue
(
emptyGMLString
.
contains
(
"<CityModel"
));
// Header
assertTrue
(
emptyGMLString
.
contains
(
"</CityModel"
));
// Footer
}
@Test
public
void
testExtract0BuildingsFromWeirdGML
()
throws
Throwable
{
//NOTE: Small region, with too many spaces between coordinates
String
wktPolygon
=
"POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"NewYork.proj/broken_nyc_lod2.gml"
);
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:32118"
)
.
toString
();
assertEquals
(
countRegexMatches
(
emptyGMLString
,
"<(core:)?cityObjectMember"
),
0
);
assertTrue
(
emptyGMLString
.
contains
(
"<core:CityModel"
));
// Header
assertTrue
(
emptyGMLString
.
contains
(
"</core:CityModel"
));
// Footer
}
}
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
Menu
Explore
Projects
Groups
Snippets