From bb828eb90b274d714f0a6e84a8dbb9ddd6c86689 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 27 Sep 2014 15:55:12 +0100 Subject: Add rooms only found in OSM to the list of rooms in a building Previously, only the rooms in the University data was used, but this leaves a lot out. Also display popups for rooms if they have a URI, to allow the user to navigate to the uri. --- src/leaflet-soton.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index 0eb51be..ec86a7d 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -416,18 +416,10 @@ SELECT * WHERE {\ return; // No popup for corridors yet } - if( !('features' in feature.properties) ) { feature.properties.features=[]; } - if( !('contents' in feature.properties) ) { feature.properties.contents=[]; } - if( !('images' in feature.properties) ) { feature.properties.images=[]; } + if (feature.properties.buildingspart === "room" && + !("uri" in feature.properties)) { - if ('buildingpart' in feature.properties) { - if (feature.properties.buildingpart === "room" && - feature.properties.features.length == 0 && - feature.properties.contents.length == 0 && - feature.properties.images.length == 0) { - - return false; - } + return false; } return true; @@ -1201,9 +1193,11 @@ SELECT * WHERE {\ function imageTemplate(properties, options, map, close) { - if (properties.images.length == 0) { + if (!("images" in properties)) + return false; + + if (properties.images.length === 0) return false; - } var imageWidth; var imageHeight; @@ -1276,7 +1270,7 @@ SELECT * WHERE {\ var room = LS.getFeatureByURI(uri); if (room === null) { - console.err("Unable to find room " + uri); + console.error("Unable to find room " + uri); return; } -- cgit v1.2.3