# HG changeset patch # User Sebastian Kruse # Date 1359735696 -3600 # Node ID f835c707e9be755150b560eea9de7245204d5034 # Parent 7b65d95735d26dbd1004642ab5e44991d05f0359 add support for WMS overlays diff -r 7b65d95735d2 -r f835c707e9be war/scripts/sti/STIMap.js --- 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;