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
efede371
Commit
efede371
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Write CityGml in buffer, not as a whole string.
parent
135d0bc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/eu/simstadt/regionchooser/RegionChooserBrowser.java
+8
-4
.../java/eu/simstadt/regionchooser/RegionChooserBrowser.java
with
8 additions
and
4 deletions
+8
-4
src/main/java/eu/simstadt/regionchooser/RegionChooserBrowser.java
+
8
-
4
View file @
efede371
...
...
@@ -10,7 +10,6 @@
import
java.util.prefs.Preferences
;
import
org.locationtech.jts.io.ParseException
;
import
com.ximpleware.NavException
;
import
com.ximpleware.XPathEvalException
;
import
com.ximpleware.XPathParseException
;
import
eu.simstadt.regionchooser.fast_xml_parser.ConvexHullCalculator
;
import
javafx.application.Platform
;
...
...
@@ -30,6 +29,7 @@
public
class
RegionChooserBrowser
extends
Region
{
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`.
...
...
@@ -70,15 +70,19 @@ public Void call() throws IOException {
}
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
,
citygmlPath
(
project
,
citygml
));
File
buildingIdsFile
=
selectSaveFileWithDialog
(
project
,
citygml
,
"selected_region"
);
if
(
buildingIdsFile
!=
null
)
{
try
(
BufferedWriter
writer
=
Files
.
newBufferedWriter
(
buildingIdsFile
.
toPath
()))
{
//NOTE: isn't there a better way??
writer
.
write
(
sb
.
toString
());
char
[]
chars
=
new
char
[
BUFFER
];
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
);
}
}
}
}
...
...
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