summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-04-04 22:40:15 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-04-04 22:40:15 +0100
commit860ca767c8ba0d5d33befc233f1a8047b36eef37 (patch)
tree759b84570822ac206e2aa9bc1b65af560cf0b131 /src
parent18c5740c3aa4d4f89c8cb5fef1111016b130ad37 (diff)
downloadleaflet-soton-860ca767c8ba0d5d33befc233f1a8047b36eef37.tar
leaflet-soton-860ca767c8ba0d5d33befc233f1a8047b36eef37.tar.gz
Better display of vertical passageways
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index c70a12a..f6ce069 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -426,6 +426,8 @@ SELECT * WHERE {\
var fill = 'white';
if (feature.properties.buildingpart === 'corridor') {
fill = '#169EC6';
+ } else if (feature.properties.buildingpart === 'verticalpassage') {
+ fill = '#0A485B';
}
return {
@@ -529,13 +531,21 @@ SELECT * WHERE {\
}
},
onEachFeature: function(feature, layer) {
+ if (feature.properties.buildingpart === "corridor") {
+ return; // No popup for corridors yet
+ }
+
layer.on('click', function(e) {
var content;
var popupOptions = {};
// When the feature is clicked on
if ("buildingpart" in feature.properties) {
- content = roomPopupTemplate(feature.properties);
+ if (feature.properties.buildingpart === "room") {
+ content = roomPopupTemplate(feature.properties);
+ } else if (feature.properties.buildingpart === "verticalpassage") {
+ content = verticalPassagePopupTemplate(feature.properties);
+ }
} else { // Assume that it is a printer
// TODO: Use different icons where appropriate
popupOptions.offset = icons.vendingHotDrinks.options.popupAnchor;
@@ -843,6 +853,40 @@ SELECT * WHERE {\
});
}
+ function verticalPassagePopupTemplate(properties) {
+ properties = L.extend({}, properties);
+
+ if (!("name" in properties)) {
+ if (properties["buildingpart:verticalpassage"] === "stairway") {
+ properties.name = "Stairway";
+ } else {
+ properties.name = "Vertical Passage";
+ }
+
+ if ("ref" in properties) {
+ properties.name += properties.ref;
+ }
+ }
+
+ return getTemplateWrapper(properties, function(content) {
+
+ if ("level" in properties) {
+ content.appendChild(document.createTextNode("Levels:"));
+
+ var levelList = document.createElement("ul");
+
+ properties.level.forEach(function(level) {
+ var levelLi = document.createElement("li");
+ levelLi.textContent = level;
+
+ levelList.appendChild(levelLi);
+ });
+
+ content.appendChild(levelList);
+ }
+ });
+ }
+
function printerPopupTemplate(properties) {
properties.name = "Printer";