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
0fc411d6
Commit
0fc411d6
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Flush stdout
parent
e184abaf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/simstadt/regionchooser/RegionChooserCLI.java
+2
-1
...main/java/eu/simstadt/regionchooser/RegionChooserCLI.java
src/test/java/eu/simstadt/regionchooser/RegionChooserCLITests.java
+2
-3
...java/eu/simstadt/regionchooser/RegionChooserCLITests.java
with
4 additions
and
4 deletions
+4
-4
src/main/java/eu/simstadt/regionchooser/RegionChooserCLI.java
+
2
-
1
View file @
0fc411d6
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
/**
/**
* Command Line Interface for RegionChooser. Could be useful to extract large regions on server, or automate the process
* Command Line Interface for RegionChooser. Could be useful to extract large regions on server, or automate the process
* from batch/python scripts.
* from batch/python scripts.
*
*
*/
*/
// Usage: region_chooser [-hlV] [-e=31467] -o=output.gml -w=polygon.wkt -i=input.
// Usage: region_chooser [-hlV] [-e=31467] -o=output.gml -w=polygon.wkt -i=input.
...
@@ -109,6 +109,7 @@ public Integer call() throws Exception {
...
@@ -109,6 +109,7 @@ public Integer call() throws Exception {
logInfo
(
"CityGML written to stdout."
);
logInfo
(
"CityGML written to stdout."
);
PrintWriter
stdOut
=
spec
.
commandLine
().
getOut
();
PrintWriter
stdOut
=
spec
.
commandLine
().
getOut
();
count
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
localCRS
.
toString
(),
stdOut
,
citygmls
);
count
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
localCRS
.
toString
(),
stdOut
,
citygmls
);
stdOut
.
flush
();
// To make sure the footer is written too.
}
else
{
}
else
{
try
(
BufferedWriter
gmlWriter
=
Files
.
newBufferedWriter
(
outputCityGML
))
{
try
(
BufferedWriter
gmlWriter
=
Files
.
newBufferedWriter
(
outputCityGML
))
{
count
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
localCRS
.
toString
(),
gmlWriter
,
count
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
localCRS
.
toString
(),
gmlWriter
,
...
...
This diff is collapsed.
Click to expand it.
src/test/java/eu/simstadt/regionchooser/RegionChooserCLITests.java
+
2
-
3
View file @
0fc411d6
...
@@ -67,8 +67,6 @@ void testExtractRegionFromTwoCitygmls() throws IOException {
...
@@ -67,8 +67,6 @@ void testExtractRegionFromTwoCitygmls() throws IOException {
wkt
.
write
(
wktPolygon
);
wkt
.
write
(
wktPolygon
);
}
}
assertFalse
(
Files
.
exists
(
outGML
));
assertFalse
(
Files
.
exists
(
outGML
));
// originalOut.println("--input=" + citygml1 + "," + citygml2 + " " +
// "--output=" + outGML + " " + "--wkt=" + inWKT + " " + "--epsg=31463" + " " + "--local");
new
CommandLine
(
new
RegionChooserCLI
()).
execute
(
"--input="
+
citygml1
+
","
+
citygml2
,
"--output="
+
outGML
,
new
CommandLine
(
new
RegionChooserCLI
()).
execute
(
"--input="
+
citygml1
+
","
+
citygml2
,
"--output="
+
outGML
,
"--wkt="
+
inWKT
,
"--epsg=31463"
,
"--local"
);
"--wkt="
+
inWKT
,
"--epsg=31463"
,
"--local"
);
...
@@ -126,7 +124,8 @@ void testExtractRegionWithStandardInputAndStandardOutput() throws IOException {
...
@@ -126,7 +124,8 @@ void testExtractRegionWithStandardInputAndStandardOutput() throws IOException {
assertTrue
(
err
.
toString
().
contains
(
expectedLog
),
err
.
toString
()
+
" should contain "
+
expectedLog
);
assertTrue
(
err
.
toString
().
contains
(
expectedLog
),
err
.
toString
()
+
" should contain "
+
expectedLog
);
String
expectedBuilding
=
"uuid_0547df65-ae80-459e-bb15-c839c1a2e566"
;
String
expectedBuilding
=
"uuid_0547df65-ae80-459e-bb15-c839c1a2e566"
;
assertTrue
(
out
.
toString
().
contains
(
expectedBuilding
),
out
.
toString
()
+
" should contain "
+
expectedBuilding
);
assertTrue
(
out
.
toString
().
contains
(
expectedBuilding
),
out
.
toString
()
+
" should contain "
+
expectedBuilding
);
//FIXME: Footer isn't here, and I don't know why... Should stdout be flushed, closed?
String
expectedFooter
=
"</CityModel>"
;
assertTrue
(
out
.
toString
().
contains
(
expectedFooter
),
out
.
toString
()
+
" should contain "
+
expectedFooter
);
assertFalse
(
Files
.
exists
(
noOutput
));
assertFalse
(
Files
.
exists
(
noOutput
));
}
}
...
...
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