diff options
author | Christopher Baines <cb15g11@soton.ac.uk> | 2014-02-21 12:19:10 +0000 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2014-02-21 12:19:10 +0000 |
commit | 5addce86274887ea9549498f08929f7007244017 (patch) | |
tree | 7a905a7d327593987ec4058e75ef0f399a52fd7b /src | |
parent | e4d1c918444c15e2e1480ecb332e61ec8feb7629 (diff) | |
download | leaflet-soton-5addce86274887ea9549498f08929f7007244017.tar leaflet-soton-5addce86274887ea9549498f08929f7007244017.tar.gz |
Add support for a building part to span mutiple levels
Diffstat (limited to 'src')
-rw-r--r-- | src/leaflet-soton.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index accd7f7..5851158 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -1677,13 +1677,25 @@ L.IndoorLayer = L.Class.extend({ return; } - if (level in layers) { - layer = layers[level]; + if (L.Util.isArray(level)) { + level.forEach(function(level) { + if (level in layers) { + layer = layers[level]; + } else { + layer = layers[level] = L.geoJson({ type: "FeatureCollection", features: [] }, options); + } + + layer.addData(part); + }); } else { - layer = layers[level] = L.geoJson({ type: "FeatureCollection", features: [] }, options); - } + if (level in layers) { + layer = layers[level]; + } else { + layer = layers[level] = L.geoJson({ type: "FeatureCollection", features: [] }, options); + } - layer.addData(part); + layer.addData(part); + } }); }, getLevels: function() { |