Mercurial > hg > STI-GWT
changeset 83:f835c707e9be trimmed_data
add support for WMS overlays
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 01 Feb 2013 17:21:36 +0100 |
parents | 7b65d95735d2 |
children | 00f7860d9ee5 |
files | war/scripts/sti/STIMap.js |
diffstat | 1 files changed, 30 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/war/scripts/sti/STIMap.js Fri Feb 01 17:20:36 2013 +0100 +++ b/war/scripts/sti/STIMap.js Fri Feb 01 17:21:36 2013 +0100 @@ -1393,24 +1393,42 @@ setOverlay: function(index){ - if (this.overlayLayers[index] instanceof OpenLayers.Layer.Vector) { + if (this.overlayLayers[index] != null) { this.openlayersMap.removeLayer(this.overlayLayers[index]); this.overlayLayers[index] = null; } else { - var newLayer = new OpenLayers.Layer.Vector("KML", { - projection: this.openlayersMap.displayProjection, - strategies: [new OpenLayers.Strategy.Fixed()], - protocol: new OpenLayers.Protocol.HTTP({ - url: this.core.overlays[index].url, - format: new OpenLayers.Format.KML({ - extractStyles: true, - extractAttributes: true - }) - }) - }); + var overlayInfo = this.core.overlays[index]; + + var newLayer; + + if (overlayInfo.type == "kml") { + newLayer = new OpenLayers.Layer.Vector("KML", { + projection: this.openlayersMap.displayProjection, + strategies: [new OpenLayers.Strategy.Fixed()], + protocol: new OpenLayers.Protocol.HTTP({ + url: overlayInfo.url, + format: new OpenLayers.Format.KML({ + extractStyles: true, + extractAttributes: true + }) + }) + }); + } else if (overlayInfo.type == "wms") { + newLayer = new OpenLayers.Layer.WMS(overlayInfo.label, overlayInfo.url, { + layers: overlayInfo.layer, + format: overlayInfo.format, + transparent: "true" + } + ,{ + projection : overlayInfo.projection + } + ); + newLayer.setIsBaseLayer(false); + } + this.openlayersMap.addLayer(newLayer); this.overlayLayers[index] = newLayer;