comparison war/scripts/sti/STIMap.js @ 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
comparison
equal deleted inserted replaced
82:7b65d95735d2 83:f835c707e9be
1391 this.openlayersMap.setBaseLayer(this.baseLayers[index]); 1391 this.openlayersMap.setBaseLayer(this.baseLayers[index]);
1392 }, 1392 },
1393 1393
1394 setOverlay: function(index){ 1394 setOverlay: function(index){
1395 1395
1396 if (this.overlayLayers[index] instanceof OpenLayers.Layer.Vector) { 1396 if (this.overlayLayers[index] != null) {
1397 1397
1398 this.openlayersMap.removeLayer(this.overlayLayers[index]); 1398 this.openlayersMap.removeLayer(this.overlayLayers[index]);
1399 this.overlayLayers[index] = null; 1399 this.overlayLayers[index] = null;
1400 1400
1401 } else { 1401 } else {
1402 1402
1403 var newLayer = new OpenLayers.Layer.Vector("KML", { 1403 var overlayInfo = this.core.overlays[index];
1404 projection: this.openlayersMap.displayProjection, 1404
1405 strategies: [new OpenLayers.Strategy.Fixed()], 1405 var newLayer;
1406 protocol: new OpenLayers.Protocol.HTTP({ 1406
1407 url: this.core.overlays[index].url, 1407 if (overlayInfo.type == "kml") {
1408 format: new OpenLayers.Format.KML({ 1408 newLayer = new OpenLayers.Layer.Vector("KML", {
1409 extractStyles: true, 1409 projection: this.openlayersMap.displayProjection,
1410 extractAttributes: true 1410 strategies: [new OpenLayers.Strategy.Fixed()],
1411 }) 1411 protocol: new OpenLayers.Protocol.HTTP({
1412 }) 1412 url: overlayInfo.url,
1413 }); 1413 format: new OpenLayers.Format.KML({
1414 extractStyles: true,
1415 extractAttributes: true
1416 })
1417 })
1418 });
1419 } else if (overlayInfo.type == "wms") {
1420 newLayer = new OpenLayers.Layer.WMS(overlayInfo.label, overlayInfo.url, {
1421 layers: overlayInfo.layer,
1422 format: overlayInfo.format,
1423 transparent: "true"
1424 }
1425 ,{
1426 projection : overlayInfo.projection
1427 }
1428 );
1429 newLayer.setIsBaseLayer(false);
1430 }
1431
1414 this.openlayersMap.addLayer(newLayer); 1432 this.openlayersMap.addLayer(newLayer);
1415 1433
1416 this.overlayLayers[index] = newLayer; 1434 this.overlayLayers[index] = newLayer;
1417 } 1435 }
1418 }, 1436 },