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

RegionChooser: Checking if EPSG is defined

parent d89923a6
...@@ -177,6 +177,10 @@ public void log(String text) { ...@@ -177,6 +177,10 @@ public void log(String text) {
LOGGER.info(text); LOGGER.info(text);
} }
public void warning(String text) {
LOGGER.warning(text);
}
private Path citygmlPath(String project, String citygml) { private Path citygmlPath(String project, String citygml) {
return repo.resolve(project + ".proj").resolve(citygml); return repo.resolve(project + ".proj").resolve(citygml);
} }
......
...@@ -3,6 +3,7 @@ proj4.defs("EPSG:32632", "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m ...@@ -3,6 +3,7 @@ proj4.defs("EPSG:32632", "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m
proj4.defs("EPSG:31463", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0" + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31463/proj4js/ proj4.defs("EPSG:31463", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0" + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31463/proj4js/
proj4.defs("EPSG:31466", "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs "); // http://spatialreference.org/ref/epsg/31466/proj4js/ proj4.defs("EPSG:31466", "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs "); // http://spatialreference.org/ref/epsg/31466/proj4js/
proj4.defs("EPSG:31467", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0" + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31467/proj4js/ proj4.defs("EPSG:31467", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0" + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31467/proj4js/
proj4.defs("EPSG:31468", "+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +units=m +no_defs");
proj4.defs("EPSG:32118", "+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); // http://spatialreference.org/ref/epsg/32118/proj4js/ proj4.defs("EPSG:32118", "+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); // http://spatialreference.org/ref/epsg/32118/proj4js/
proj4.defs("EPSG:2263", "+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs "); // http://www.spatialreference.org/ref/epsg/nad83-new-york-long-island-ftus/proj4/ proj4.defs("EPSG:2263", "+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs "); // http://www.spatialreference.org/ref/epsg/nad83-new-york-long-island-ftus/proj4/
//NOTE: Proj4 string for 28992 is wrong at http://spatialreference.org/ref/epsg/amersfoort-rd-new/ //NOTE: Proj4 string for 28992 is wrong at http://spatialreference.org/ref/epsg/amersfoort-rd-new/
...@@ -73,6 +74,10 @@ var regionChooser = (function(){ ...@@ -73,6 +74,10 @@ var regionChooser = (function(){
feature = kmlFormat.readFeature(kmlString, options); feature = kmlFormat.readFeature(kmlString, options);
kml_source.addFeature(feature); kml_source.addFeature(feature);
dataPanel.append('.'); dataPanel.append('.');
srsName = feature.get("srsName") || "EPSG:31467";
if (proj4.defs(srsName) === undefined){
console.warning(srsName + " isn't defined by Proj4js!")
}
}; };
publicScope.addNovaFactoryProduct = function(xmin, ymin, xmax, ymax, name, epsgId) { publicScope.addNovaFactoryProduct = function(xmin, ymin, xmax, ymax, name, epsgId) {
...@@ -196,20 +201,21 @@ var regionChooser = (function(){ ...@@ -196,20 +201,21 @@ var regionChooser = (function(){
var citygml_percentage = Math.round(intersectionArea / feature["area"] * 100); var citygml_percentage = Math.round(intersectionArea / feature["area"] * 100);
var sketch_percentage = Math.round(intersectionArea / sketch_area * 100); var sketch_percentage = Math.round(intersectionArea / sketch_area * 100);
intersections.addFeature(intersection); intersections.addFeature(intersection);
var link = '<li>'
var description; var description;
if (fromJavaFX) { if (fromJavaFX) {
description = "<a href=\"#\" onclick=\"regionChooser.downloadRegionFrom" + feature["source"] + "(" + i link += "<a href=\"#\" onclick=\"regionChooser.downloadRegionFrom" + feature["source"] + "(" + i
+ ");return false;\">" + feature["description"] + "</a>"; + ");return false;\">" + feature["description"] + "</a>";
} else { } else {
description = feature['description']; link += feature['description'];
} }
dataPanel.append(description + " (" + citygml_percentage + "%"); link += " (" + citygml_percentage + "%";
if (sketch_percentage == 100) { if (sketch_percentage == 100) {
dataPanel.append(", all inside"); link += ", all inside";
} }
dataPanel.append(")<br/>\n"); dataPanel.append(link + ")\n");
} }
} catch (err) { } catch (err) {
...@@ -360,6 +366,10 @@ var regionChooser = (function(){ ...@@ -360,6 +366,10 @@ var regionChooser = (function(){
console.log = function(message){ console.log = function(message){
fxapp.log(message); fxapp.log(message);
} }
console.warning = function(message){
fxapp.warning(message);
}
} }
function displayHelp(){ function displayHelp(){
......
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