OpenLayers OpenLayers

Changeset 3208

Show
Ignore:
Timestamp:
05/30/07 10:13:32 (1 year ago)
Author:
crschmidt
Message:

Add patch from penyaskito for #705, along with tests, a new example, and a new
example georss file (grabbed from the new mapufacture, which is pretty).

Thanks, penyaskito!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Layer/GeoRSS.js

    r2803 r3208  
    2424    selectedFeature: null, 
    2525 
     26    /**@type OpenLayers.Icon */ 
     27    icon: null, 
     28     
    2629    /** 
    2730    * @constructor 
     
    3033    * @param {String} location 
    3134    */ 
    32     initialize: function(name, location) { 
    33         OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name]); 
     35    initialize: function(name, location, options) { 
     36        OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]); 
    3437        this.location = location; 
    3538        this.features = new Array(); 
     
    144147            } 
    145148 
    146             data.icon = OpenLayers.Marker.defaultIcon(); 
     149            data.icon = this.icon == null ?  
     150                                     OpenLayers.Marker.defaultIcon() :  
     151                                     this.icon.clone(); 
    147152            data.popupSize = new OpenLayers.Size(250, 120); 
    148153            if ((title != null) && (description != null)) { 
  • trunk/openlayers/tests/Layer/test_GeoRSS.html

    r2850 r3208  
    8383    } 
    8484 
     85    function test_04_Layer_GeoRSS_icon(t) { 
     86        t.plan( 3 ); 
     87        layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt); 
     88        var the_icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png'); 
     89        var otherLayer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt,{icon:the_icon}); 
     90        var map = new OpenLayers.Map('map'); 
     91        var baseLayer = new OpenLayers.Layer.WMS("Test Layer",  
     92            "http://octo.metacarta.com/cgi-bin/mapserv?", 
     93            {map: "/mapdata/vmap_wms.map", layers: "basic"}); 
     94        map.addLayer(baseLayer); 
     95        map.addLayers([layer,otherLayer]); 
     96        map.setCenter(new OpenLayers.LonLat(0,0),0); 
     97        var defaultIcon = OpenLayers.Marker.defaultIcon(); 
     98        t.delay_call( 1, function() { 
     99            t.ok(layer.markers[0].icon, "The layer has a icon"); 
     100            t.eq(layer.markers[0].icon.url, defaultIcon.url, "The layer without icon has the default icon."); 
     101            t.eq(otherLayer.markers[0].icon.url, the_icon.url,"The layer with an icon has that icon."); 
     102        }); 
     103    } 
     104     
    85105    function test_99_Layer_GeoRSS_destroy (t) { 
    86106        t.plan( 1 );