Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
efede371
Commit
efede371
authored
Sep 29, 2022
by
Eric Duminil
Browse files
Write CityGml in buffer, not as a whole string.
parent
135d0bc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/eu/simstadt/regionchooser/RegionChooserBrowser.java
View file @
efede371
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
import
java.util.prefs.Preferences
;
import
java.util.prefs.Preferences
;
import
org.locationtech.jts.io.ParseException
;
import
org.locationtech.jts.io.ParseException
;
import
com.ximpleware.NavException
;
import
com.ximpleware.NavException
;
import
com.ximpleware.XPathEvalException
;
import
com.ximpleware.XPathParseException
;
import
com.ximpleware.XPathParseException
;
import
eu.simstadt.regionchooser.fast_xml_parser.ConvexHullCalculator
;
import
eu.simstadt.regionchooser.fast_xml_parser.ConvexHullCalculator
;
import
javafx.application.Platform
;
import
javafx.application.Platform
;
...
@@ -30,6 +29,7 @@
...
@@ -30,6 +29,7 @@
public
class
RegionChooserBrowser
extends
Region
public
class
RegionChooserBrowser
extends
Region
{
{
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RegionChooserBrowser
.
class
.
getName
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RegionChooserBrowser
.
class
.
getName
());
private
static
final
int
BUFFER
=
1024
;
/**
/**
* JavaFX Backend for RegionChooser. Inside simstadt_openlayers.js frontend, this class is available as `fxapp`.
* JavaFX Backend for RegionChooser. Inside simstadt_openlayers.js frontend, this class is available as `fxapp`.
...
@@ -70,15 +70,19 @@ public Void call() throws IOException {
...
@@ -70,15 +70,19 @@ public Void call() throws IOException {
}
}
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
,
String
srsName
)
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
,
String
srsName
)
throws
IOException
,
ParseException
,
XPathParseException
,
NavException
,
XPathEvalException
{
throws
IOException
,
ParseException
,
XPathParseException
,
NavException
{
StringBuilder
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
srsName
,
StringBuilder
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
srsName
,
citygmlPath
(
project
,
citygml
));
citygmlPath
(
project
,
citygml
));
File
buildingIdsFile
=
selectSaveFileWithDialog
(
project
,
citygml
,
"selected_region"
);
File
buildingIdsFile
=
selectSaveFileWithDialog
(
project
,
citygml
,
"selected_region"
);
if
(
buildingIdsFile
!=
null
)
{
if
(
buildingIdsFile
!=
null
)
{
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
buildingIdsFile
.
toPath
()))
{
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
buildingIdsFile
.
toPath
()))
{
//NOTE: isn't there a better way??
char
[]
chars
=
new
char
[
BUFFER
];
writer
.
write
(
sb
.
toString
());
for
(
int
aPosStart
=
0
;
aPosStart
<
sb
.
length
();
aPosStart
+=
BUFFER
)
{
int
chunk
=
Math
.
min
(
BUFFER
,
sb
.
length
()
-
aPosStart
);
sb
.
getChars
(
aPosStart
,
aPosStart
+
chunk
,
chars
,
0
);
writer
.
write
(
chars
,
0
,
chunk
);
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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