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
fd1b29d4
Commit
fd1b29d4
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Small refactor
parent
48f9e849
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/eu/simstadt/regionchooser/RegionChooserBrowser.java
+11
-4
.../java/eu/simstadt/regionchooser/RegionChooserBrowser.java
with
11 additions
and
4 deletions
+11
-4
src/main/java/eu/simstadt/regionchooser/RegionChooserBrowser.java
+
11
-
4
View file @
fd1b29d4
...
...
@@ -50,9 +50,9 @@ public JavaScriptFXBridge() {
/**
* Launches a background thread in which the hull gets extracted for every CityGML file. The hull gets sent back
* to the JS app in order to be displayed.
*
*
* NOTE: To be very honest, I don't really understand concurrency in JavaFX. Eric
*
*
*/
public
void
refreshHulls
()
{
//NOTE: Could add progress bar?
...
...
@@ -76,6 +76,9 @@ public Void call() throws IOException {
new
Thread
(
task
).
start
();
}
/**
* This method is called from Javascript, with a prepared wktPolygon written in local coordinates.
*/
public
void
downloadRegionFromCityGMLs
(
String
wktPolygon
,
String
project
,
String
csvCitygmls
,
String
srsName
)
throws
IOException
,
ParseException
,
XPathParseException
,
NavException
{
// It doesn't seem possible to pass arrays or list from JS to Java. So csvCitygmls contains names separated by ;
...
...
@@ -85,8 +88,12 @@ public void downloadRegionFromCityGMLs(String wktPolygon, String project, String
File
buildingIdsFile
=
selectSaveFileWithDialog
(
project
,
csvCitygmls
.
replace
(
";"
,
"_"
).
replace
(
".gml"
,
""
),
"selected_region"
);
if
(
buildingIdsFile
!=
null
)
{
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
buildingIdsFile
.
toPath
()))
{
writeStringBuilderToFile
(
sb
,
buildingIdsFile
.
toPath
());
}
private
void
writeStringBuilderToFile
(
StringBuilder
sb
,
Path
outputFile
)
throws
IOException
{
if
(
outputFile
!=
null
)
{
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
outputFile
))
{
char
[]
chars
=
new
char
[
BUFFER
];
for
(
int
aPosStart
=
0
;
aPosStart
<
sb
.
length
();
aPosStart
+=
BUFFER
)
{
int
chunk
=
Math
.
min
(
BUFFER
,
sb
.
length
()
-
aPosStart
);
...
...
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