Commit 526c3971 authored by duminil's avatar duminil
Browse files

Fixing errors found by jshint

parent 2ffc83c1
//TODO: Add zoom to extent as control //TODO: Add zoom to extent as control
//TODO: Try to leave everything in 4326 //TODO: Try to leave everything in 4326
//TODO: Add some tiles for offline mode
var reset_btn = $('#reset')[0]; var reset_btn = $('#reset')[0];
var dataPanel = $('#dataPanel'); var dataPanel = $('#dataPanel');
var br = document.createElement('br');
proj4.defs("EPSG:31467", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0" 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/ + " +ellps=bessel +datum=potsdam +units=m +no_defs"); // http://spatialreference.org/ref/epsg/31467/proj4js/
...@@ -19,7 +19,7 @@ var kml_source = new ol.source.KML({ ...@@ -19,7 +19,7 @@ var kml_source = new ol.source.KML({
url : 'data/citygml_hulls.kml', url : 'data/citygml_hulls.kml',
extractAttributes : false, extractAttributes : false,
extractStyles : false extractStyles : false
}) });
function polygon_style(color, alpha) { function polygon_style(color, alpha) {
return new ol.style.Style({ return new ol.style.Style({
...@@ -31,7 +31,7 @@ function polygon_style(color, alpha) { ...@@ -31,7 +31,7 @@ function polygon_style(color, alpha) {
width : 2, width : 2,
lineDash : [ 5, 10 ] lineDash : [ 5, 10 ]
}), }),
}) });
} }
var kml_layer = new ol.layer.Vector({ var kml_layer = new ol.layer.Vector({
...@@ -68,7 +68,7 @@ novafactory_vectors.addNovaFactoryProduct = function(xmin, ymin, xmax, ymax, nam ...@@ -68,7 +68,7 @@ novafactory_vectors.addNovaFactoryProduct = function(xmin, ymin, xmax, ymax, nam
feature["available"] = true; feature["available"] = true;
feature["source"] = "NovaFACTORY"; feature["source"] = "NovaFACTORY";
this.addFeature(feature); this.addFeature(feature);
} };
var novafactory_layer = new ol.layer.Vector({ var novafactory_layer = new ol.layer.Vector({
source : novafactory_vectors, source : novafactory_vectors,
...@@ -85,7 +85,7 @@ var map = new ol.Map({ ...@@ -85,7 +85,7 @@ var map = new ol.Map({
var geoJSONformat = new ol.format.GeoJSON(); var geoJSONformat = new ol.format.GeoJSON();
kml_layer.addEventListener("change", function(event) { kml_layer.addEventListener("change", function() {
map.getView().fitExtent(kml_source.getExtent(), (map.getSize())); map.getView().fitExtent(kml_source.getExtent(), (map.getSize()));
}); });
...@@ -131,7 +131,7 @@ featureOverlay.setMap(map); ...@@ -131,7 +131,7 @@ featureOverlay.setMap(map);
var selected_features = featureOverlay.getFeatures(); var selected_features = featureOverlay.getFeatures();
selected_features.on('add', function(event) { selected_features.on('add', function(event) {
var feature = event.element; var feature = event.element;
feature.on("change", function(event) { feature.on("change", function() {
displayInfo(); displayInfo();
}); });
}); });
...@@ -147,7 +147,7 @@ var modify = new ol.interaction.Modify({ ...@@ -147,7 +147,7 @@ var modify = new ol.interaction.Modify({
}); });
map.addInteraction(modify); map.addInteraction(modify);
draw = new ol.interaction.Draw({ var draw = new ol.interaction.Draw({
features : featureOverlay.getFeatures(), features : featureOverlay.getFeatures(),
type : 'Polygon' type : 'Polygon'
}); });
...@@ -172,7 +172,7 @@ function findIntersections() { ...@@ -172,7 +172,7 @@ function findIntersections() {
function findIntersection(feature) { function findIntersection(feature) {
try { try {
var jsonIntersection = turf.intersect(poly1, feature["geoJSON"]); var jsonIntersection = turf.intersect(poly1, feature["geoJSON"]);
if (undefined != jsonIntersection) { if (undefined !== jsonIntersection) {
if (!intersection_found) { if (!intersection_found) {
dataPanel.append("Intersection found with :<br/>\n"); dataPanel.append("Intersection found with :<br/>\n");
intersection_found = true; intersection_found = true;
...@@ -187,7 +187,7 @@ function findIntersections() { ...@@ -187,7 +187,7 @@ function findIntersections() {
if (feature["available"]) { if (feature["available"]) {
description = "<a href=\"#\" onclick=\"downloadRegionFrom" + feature["source"] + "(" + i description = "<a href=\"#\" onclick=\"downloadRegionFrom" + feature["source"] + "(" + i
+ ");return false;\">" + feature["description"] + "</a>"; + ");return false;\">" + feature["description"] + "</a>";
console.log(description); // console.log(description);
} else { } else {
description = feature['description']; description = feature['description'];
} }
...@@ -205,9 +205,9 @@ function findIntersections() { ...@@ -205,9 +205,9 @@ function findIntersections() {
i++; i++;
} }
var i = 0; var i = 0;
novafactory_vectors.forEachFeature(findIntersection) novafactory_vectors.forEachFeature(findIntersection);
var i = 0; i = 0;
kml_source.forEachFeature(findIntersection) kml_source.forEachFeature(findIntersection);
if (!intersection_found) { if (!intersection_found) {
dataPanel.append("No intersection found with any CityGML or NovaFactory product<br/>\n"); dataPanel.append("No intersection found with any CityGML or NovaFactory product<br/>\n");
} }
...@@ -250,7 +250,7 @@ function displayInfo() { ...@@ -250,7 +250,7 @@ function displayInfo() {
// "," + wgs84_coord[0] + "));<br/>"; // "," + wgs84_coord[0] + "));<br/>";
wgs84_coords += "(" + wgs84_coord[1] + "," + wgs84_coord[0] + ")<br/>"; wgs84_coords += "(" + wgs84_coord[1] + "," + wgs84_coord[0] + ")<br/>";
var gsk3_coord = ol.proj.transform(coords[i], ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:31467')) var gsk3_coord = ol.proj.transform(coords[i], ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:31467'));
gsk3_coords += "(" + gsk3_coord[0] + "," + gsk3_coord[1] + ")<br/>"; gsk3_coords += "(" + gsk3_coord[0] + "," + gsk3_coord[1] + ")<br/>";
} }
dataPanel.append("WGS84 Coordinates<br/>"); dataPanel.append("WGS84 Coordinates<br/>");
...@@ -266,7 +266,7 @@ function displayInfo() { ...@@ -266,7 +266,7 @@ function displayInfo() {
// console.log('Execution time: ' + time); // console.log('Execution time: ' + time);
} }
draw.on('drawend', function(e) { draw.on('drawend', function() {
displayInfo(); displayInfo();
draw.setActive(false); draw.setActive(false);
}); });
...@@ -291,15 +291,15 @@ novafactory_layer.downloadFinished = function() { ...@@ -291,15 +291,15 @@ novafactory_layer.downloadFinished = function() {
this.disabled = false; this.disabled = false;
// FIXME: Doesn't stop waiting cursor // FIXME: Doesn't stop waiting cursor
$("html").removeClass("wait"); $("html").removeClass("wait");
} };
novafactory_layer.updateStatus = function(status) { novafactory_layer.updateStatus = function(status) {
dataPanel.append("NovaFactory : " + status + "<br/>\n"); dataPanel.append("NovaFactory : " + status + "<br/>\n");
} };
novafactory_layer.selectSaveFile = function(zipFilename) { novafactory_layer.selectSaveFile = function(zipFilename) {
fxapp.doSomethingWithThisZIP(zipFilename); fxapp.doSomethingWithThisZIP(zipFilename);
} };
function downloadRegionFromNovaFACTORY(i) { function downloadRegionFromNovaFACTORY(i) {
$("html").addClass("wait"); $("html").addClass("wait");
...@@ -315,12 +315,12 @@ function downloadRegionFromNovaFACTORY(i) { ...@@ -315,12 +315,12 @@ function downloadRegionFromNovaFACTORY(i) {
} }
function sketchAsWKT(epsgId) { function sketchAsWKT(epsgId) {
var epsgId = (typeof epsgId === 'undefined') ? '31467' : epsgId; epsgId = (typeof epsgId === 'undefined') ? '31467' : epsgId;
var wktFormat = new ol.format.WKT(); var wktFormat = new ol.format.WKT();
return wktFormat.writeFeature(sketch, { return wktFormat.writeFeature(sketch, {
dataProjection : ol.proj.get('EPSG:' + epsgId), dataProjection : ol.proj.get('EPSG:' + epsgId),
featureProjection : ol.proj.get('EPSG:3857') featureProjection : ol.proj.get('EPSG:3857')
}) });
} }
function focusOnMap() { function focusOnMap() {
......
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