OpenLayers OpenLayers

Changeset 5723

Show
Ignore:
Timestamp:
01/11/08 13:56:54 (1 year ago)
Author:
enjahova
Message:

added setUrl function to Layer.GML

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/enjahova/openlayers/lib/OpenLayers/Layer/GML.js

    r5719 r5723  
    9898        }     
    9999    },     
    100          
     100     
     101    /** 
     102     * Method: setUrl 
     103     * Change the URL and reload the GML 
     104     * 
     105     * Parameters: 
     106     * url - {String} URL of a GML file. 
     107     */ 
     108    setUrl:function(url) { 
     109        this.url = url; 
     110        this.destroyFeatures(); 
     111        this.loaded = false; 
     112        this.events.triggerEvent("loadstart"); 
     113        this.loadGML(); 
     114    }, 
     115 
    101116     
    102117    /** 
  • sandbox/enjahova/openlayers/tests/Layer/test_GML.html

    r4252 r5723  
    77     
    88    var gml = "./owls.xml"; 
     9    var gml2 = "./mice.xml"; 
    910 
    1011    // if this test is running online, different rules apply 
     
    4142 
    4243    } 
     44    function test_GML_setUrl(t) { 
     45        t.plan(2); 
     46        var layer = new OpenLayers.Layer.GML(name, gml); 
     47        var map = new OpenLayers.Map("map"); 
     48        map.addLayer(layer); 
     49        t.eq(layer.url, gml, "layer has correct original url"); 
     50        layer.setUrl(gml2); 
     51        t.eq(layer.url, gml2, "layer has correctly changed url"); 
     52    } 
    4353  </script> 
    4454</head>