Commit 14e8c601 authored by Eric Duminil's avatar Eric Duminil
Browse files

RegionChooserJS: Closure to avoid using too many global variables.

parent e9082330
......@@ -159,7 +159,7 @@ private Path citygmlPath(String project, String citygml) {
}
public void importNovaFactoryBoundingBoxes() throws IOException {
JSObject novafactoryVectors = (JSObject) webEngine.executeScript("novafactory_vectors");
JSObject regionChooserJS = (JSObject) webEngine.executeScript("regionChooser");
BufferedReader nf_csv = new BufferedReader(new InputStreamReader(
RegionChooserFX.class.getResourceAsStream("website/data/novafactory_products.csv")));
nf_csv.readLine();
......@@ -171,7 +171,7 @@ public void importNovaFactoryBoundingBoxes() throws IOException {
String[] srs = values[3].split(" ");
String epsgId = srs[srs.length - 1];
// System.out.println(product);
novafactoryVectors.call("addNovaFactoryProduct", values[8], values[9], values[10], values[11], product,
regionChooserJS.call("addNovaFactoryProduct", values[8], values[9], values[10], values[11], product,
epsgId);
}
nf_csv.close();
......@@ -192,9 +192,9 @@ public RegionChooserBrowser() {
webEngine.getLoadWorker().stateProperty().addListener(
(ObservableValue<? extends State> ov, State oldState, State newState) -> {
if (newState == State.SUCCEEDED) {
JSObject win = (JSObject) webEngine.executeScript("window");
win.setMember("fxapp", fxapp);
win.call("ready");
JSObject regionChooserJS = (JSObject) webEngine.executeScript("regionChooser");
regionChooserJS.setMember("fxapp", fxapp);
regionChooserJS.call("ready");
try {
fxapp.importNovaFactoryBoundingBoxes();
} catch (Exception ex) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment