comparison 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
comparison
equal deleted inserted replaced
60:6f2d2b6f969a 61:eac73bf1ce6e
12 this.core = core; 12 this.core = core;
13 this.window = window; 13 this.window = window;
14 this.container = container; 14 this.container = container;
15 this.openlayersMap; 15 this.openlayersMap;
16 this.baseLayers; 16 this.baseLayers;
17 this.overlayLayers;
17 this.objectLayer; 18 this.objectLayer;
18 this.drilldownLayer; 19 this.drilldownLayer;
19 this.connectionLayer; 20 this.connectionLayer;
20 21
21 this.drawPolygon; 22 this.drawPolygon;
51 /** 52 /**
52 * initializes the map for the Spatio Temporal Interface. 53 * initializes the map for the Spatio Temporal Interface.
53 * it includes setting up all layers of the map and defines all map specific interaction possibilities 54 * it includes setting up all layers of the map and defines all map specific interaction possibilities
54 */ 55 */
55 initialize: function(){ 56 initialize: function(){
57
58 this.overlayLayers = new Array();
56 59
57 //OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; 60 //OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
58 var map = this; 61 var map = this;
59 62
60 this.pointSelected = false; 63 this.pointSelected = false;
576 } 579 }
577 580
578 if( this.core.props.historicMaps ){ 581 if( this.core.props.historicMaps ){
579 this.setCanvas(); 582 this.setCanvas();
580 } 583 }
581
582 }, 584 },
583 585
584 /** 586 /**
585 * parses all base layers in a given xmlFile and initializes google and osm layers 587 * parses all base layers in a given xmlFile and initializes google and osm layers
586 * @param {String} xmlFile the name of the file to parse 588 * @param {String} xmlFile the name of the file to parse
1363 this.openlayersMap.fractionalZoom = false; 1365 this.openlayersMap.fractionalZoom = false;
1364 } 1366 }
1365 this.openlayersMap.zoomTo(Math.floor(this.openlayersMap.getZoom()+0.05)); 1367 this.openlayersMap.zoomTo(Math.floor(this.openlayersMap.getZoom()+0.05));
1366 this.openlayersMap.setBaseLayer(this.baseLayers[index]); 1368 this.openlayersMap.setBaseLayer(this.baseLayers[index]);
1367 }, 1369 },
1370
1371 setOverlay: function(index){
1372
1373 if (this.overlayLayers[index] instanceof OpenLayers.Layer.Vector) {
1374
1375 this.openlayersMap.removeLayer(this.overlayLayers[index]);
1376 this.overlayLayers[index] = null;
1377
1378 } else {
1379
1380 var limesLayer = new OpenLayers.Layer.Vector("KML", {
1381 projection: this.openlayersMap.displayProjection,
1382 strategies: [new OpenLayers.Strategy.Fixed()],
1383 protocol: new OpenLayers.Protocol.HTTP({
1384 url: "data/overlay/limes.kml",
1385 format: new OpenLayers.Format.KML({
1386 extractStyles: true,
1387 extractAttributes: true
1388 })
1389 })
1390 });
1391 this.openlayersMap.addLayer(limesLayer);
1392
1393 this.overlayLayers[index] = limesLayer;
1394
1395 //limesLayer.setVisibility(true);
1396 }
1397 },
1368 1398
1369 configure: function(zoom,cLon,cLat,mapId){ 1399 configure: function(zoom,cLon,cLat,mapId){
1370 this.openlayersMap.zoomTo(zoom); 1400 this.openlayersMap.zoomTo(zoom);
1371 this.drawObjectLayer(true); 1401 this.drawObjectLayer(true);
1372 this.setMap(mapId); 1402 this.setMap(mapId);