Mercurial > hg > STI-GWT
diff war/scripts/sti/STIMap.js @ 61:eac73bf1ce6e CellTable
add overlay functionality (beta)
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 14 Dec 2012 16:33:36 +0100 |
parents | 5ef409e34638 |
children | d69066d16e45 |
line wrap: on
line diff
--- a/war/scripts/sti/STIMap.js Fri Dec 14 16:32:55 2012 +0100 +++ b/war/scripts/sti/STIMap.js Fri Dec 14 16:33:36 2012 +0100 @@ -14,6 +14,7 @@ this.container = container; this.openlayersMap; this.baseLayers; + this.overlayLayers; this.objectLayer; this.drilldownLayer; this.connectionLayer; @@ -53,6 +54,8 @@ * it includes setting up all layers of the map and defines all map specific interaction possibilities */ initialize: function(){ + + this.overlayLayers = new Array(); //OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; var map = this; @@ -578,7 +581,6 @@ if( this.core.props.historicMaps ){ this.setCanvas(); } - }, /** @@ -1365,6 +1367,34 @@ this.openlayersMap.zoomTo(Math.floor(this.openlayersMap.getZoom()+0.05)); this.openlayersMap.setBaseLayer(this.baseLayers[index]); }, + + setOverlay: function(index){ + + if (this.overlayLayers[index] instanceof OpenLayers.Layer.Vector) { + + this.openlayersMap.removeLayer(this.overlayLayers[index]); + this.overlayLayers[index] = null; + + } else { + + var limesLayer = new OpenLayers.Layer.Vector("KML", { + projection: this.openlayersMap.displayProjection, + strategies: [new OpenLayers.Strategy.Fixed()], + protocol: new OpenLayers.Protocol.HTTP({ + url: "data/overlay/limes.kml", + format: new OpenLayers.Format.KML({ + extractStyles: true, + extractAttributes: true + }) + }) + }); + this.openlayersMap.addLayer(limesLayer); + + this.overlayLayers[index] = limesLayer; + + //limesLayer.setVisibility(true); + } + }, configure: function(zoom,cLon,cLat,mapId){ this.openlayersMap.zoomTo(zoom);