Commit bcb08e02 authored by Eric Duminil's avatar Eric Duminil
Browse files

RegionChooser: Cleaning up.

parent 4841f1f1
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.logging.Logger;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
...@@ -39,6 +40,8 @@ ...@@ -39,6 +40,8 @@
public class RegionChooserBrowser extends Region public class RegionChooserBrowser extends Region
{ {
private static final Logger LOGGER = Logger.getLogger(RegionChooserBrowser.class.getName());
/** /**
* 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`.
*/ */
...@@ -109,20 +112,6 @@ protected Integer call() throws Exception { ...@@ -109,20 +112,6 @@ protected Integer call() throws Exception {
new Thread(task).start(); new Thread(task).start();
} }
/*
* Download a small region from Gruenbuehl. Useful to test inside js console (with 'fxapp.test();').
*/
public void test() {
try {
downloadRegionFromCityGML(
"POLYGON((3515896.6132767177 5415942.563662692,3516013.1135652466 5415930.341095623,3516035.1608944996 5415925.696283888,3516052.531667652 5415905.3452489935,3516053.640043498 5415793.1428597355,3516092.996199113 5415790.117097386,3516086.9957373445 5415687.30812527,3515953.2106800284 5415687.710348818,3515893.4419519473 5415673.416324939,3515876.73573549 5415736.92758554,3515896.6132767177 5415942.563662692))",
"Gruenbuehl", "Gruenbuehl_LOD2_validated+ADE.gml",
"EPSG:34567");
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void extractZIPtoGML(String zipFilename) throws IOException { public void extractZIPtoGML(String zipFilename) throws IOException {
ZipFile zipFile = new ZipFile(zipFilename); ZipFile zipFile = new ZipFile(zipFilename);
Enumeration<? extends ZipEntry> entries = zipFile.entries(); Enumeration<? extends ZipEntry> entries = zipFile.entries();
...@@ -144,7 +133,7 @@ public void extractZIPtoGML(String zipFilename) throws IOException { ...@@ -144,7 +133,7 @@ public void extractZIPtoGML(String zipFilename) throws IOException {
cityGMLZipReader.close(); cityGMLZipReader.close();
cityGMLInputStream.close(); cityGMLInputStream.close();
cityGMLOutput.close(); cityGMLOutput.close();
System.out.println("Extracted"); LOGGER.info("Extracted");
} }
} }
} }
...@@ -185,7 +174,7 @@ private File selectSaveFileWithDialog(String project, String citygml, String suf ...@@ -185,7 +174,7 @@ private File selectSaveFileWithDialog(String project, String citygml, String suf
} }
public void log(String text) { public void log(String text) {
System.out.println(text); LOGGER.info(text);
} }
private Path citygmlPath(String project, String citygml) { private Path citygmlPath(String project, String citygml) {
...@@ -231,11 +220,9 @@ public RegionChooserBrowser() { ...@@ -231,11 +220,9 @@ public RegionChooserBrowser() {
try { try {
fxapp.importNovaFactoryBoundingBoxes(); fxapp.importNovaFactoryBoundingBoxes();
} catch (Exception ex) { } catch (Exception ex) {
RegionChooserFX.LOGGER.warning("NovaFactory CSV not found or corrupt"); LOGGER.warning("NovaFactory CSV not found or corrupt");
ex.printStackTrace(); ex.printStackTrace();
} }
// fxapp.test();
// System.exit(0);
} }
}); });
//add the web view to the scene //add the web view to the scene
......
package eu.simstadt.regionchooser; package eu.simstadt.regionchooser;
import java.util.logging.Logger;
import javafx.application.Application; import javafx.application.Application;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
...@@ -10,7 +9,6 @@ ...@@ -10,7 +9,6 @@
public class RegionChooserFX extends Application public class RegionChooserFX extends Application
{ {
private Scene scene; private Scene scene;
protected final static Logger LOGGER = Logger.getLogger(RegionChooserFX.class.getName());
/** /**
* Starting point of RegionChooser application. Either "Run as Java" from Eclipse or run * Starting point of RegionChooser application. Either "Run as Java" from Eclipse or run
......
...@@ -23,7 +23,6 @@ var regionChooser = (function(){ ...@@ -23,7 +23,6 @@ var regionChooser = (function(){
source: new ol.source.OSM() source: new ol.source.OSM()
}); });
//NOTE: Use GeoJSON instead?
function read_kml(url){ function read_kml(url){
return new ol.source.KML({ return new ol.source.KML({
projection : ol.proj.get('EPSG:3857'), projection : ol.proj.get('EPSG:3857'),
...@@ -99,7 +98,6 @@ var regionChooser = (function(){ ...@@ -99,7 +98,6 @@ var regionChooser = (function(){
var map = new ol.Map({ var map = new ol.Map({
target : 'map', target : 'map',
layers : [ osm_layer, kml_layer, novafactory_layer, intersections_layer ], layers : [ osm_layer, kml_layer, novafactory_layer, intersections_layer ],
//layers : [ kml_layer, novafactory_layer, intersections_layer ], //TODO: Put OSM back. Was too slow for testing
interactions : ol.interaction.defaults({ interactions : ol.interaction.defaults({
keyboard : true keyboard : true
}) })
......
Supports Markdown
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