Changeset 5476


Ignore:
Timestamp:
10/07/09 12:17:44 (10 years ago)
Author:
domlowe
Message:

fixed problem with coastlayers to prevent high and low res coastlines being loaded at the same time

Location:
cowsclient/trunk/cowsclient/public/js
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • cowsclient/trunk/cowsclient/public/js/mapControl.js

    r5364 r5476  
    108108    _initCoast: function(layerName)  
    109109    { 
    110                 // check if coast layer is loaded or if a different coast layer has been specified; reload, if so 
    111         if (!this.coastLayer || this.coastLayer.params.LAYERS != layerName)  
    112         { 
    113                         this.coastLayer = new OpenLayers.Layer.WMS("Coastline", 
     110        // if there is already a different coastlayer, remove it. 
     111        //console.log(layerName); 
     112        if (this.coastLayer && this.coastLayer.params.LAYERS != layerName) 
     113         { 
     114                //console.log('this is a different coastline'); 
     115                //remove existing coastline 
     116                this.map.removeLayer(this.coastLayer); 
     117         } 
     118         
     119                // now add the new coastlayer (or reload the existing one if it is the same layer) 
     120                this.coastLayer = new OpenLayers.Layer.WMS("Coastline", 
    114121                                           "http://labs.metacarta.com/wms/vmap0", 
    115122                                           {layers: layerName, format: 'image/gif', 
    116123                                            transparent: 'true'}); 
    117         } 
    118                 this.map.addLayer(this.coastLayer); 
     124        //console.log('adding coast layer');                             
     125        this.map.addLayer(this.coastLayer);              
     126                 
    119127    }, 
    120128 
     
    185193                         
    186194                // add the coast outline, if required 
    187         if (this.showCoast) 
    188                 this._initCoast('coastline_01'); 
     195                // Switch to high res coast if needed 
     196                var coastLayer = 'coastline_01'; 
     197                if (this.map.getZoom() > 5) 
     198                    coastLayer = 'coastline_02'; 
     199                if (this.showCoast) 
     200                this._initCoast(coastLayer); 
    189201 
    190202                // add layer to represent the subselection box on the layer              
  • cowsclient/trunk/cowsclient/public/js/wcs.js

    r5341 r5476  
    2020        // NB, there are initially three layers - for the subselection box, coastline and base map 
    2121        var layerNo = app.map.layers.length; 
     22        console.log(app.map.layers) 
    2223        var topLayer = app.map.layers[layerNo - 3]; 
    2324        var wmsurl = topLayer.getFullRequestString(); 
Note: See TracChangeset for help on using the changeset viewer.