Ticket #705: georsslayer_with_icons.patch
| File georsslayer_with_icons.patch, 2.6 kB (added by penyaskito, 1 year ago) |
|---|
-
lib/OpenLayers/Layer/GeoRSS.js
old new 23 23 /** @type OpenLayers.Feature */ 24 24 selectedFeature: null, 25 25 26 /**@type OpenLayers.Icon */ 27 icon:null, 28 26 29 /** 27 30 * @constructor 28 31 * 29 32 * @param {String} name 30 33 * @param {String} location 31 34 */ 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]); 34 37 this.location = location; 35 38 this.features = new Array(); 36 39 OpenLayers.loadURL(location, null, this, this.parseData); … … 143 146 catch (e) {} 144 147 } 145 148 146 data.icon = OpenLayers.Marker.defaultIcon();149 data.icon = this.icon == null ? OpenLayers.Marker.defaultIcon(): this.icon.clone(); 147 150 data.popupSize = new OpenLayers.Size(250, 120); 148 151 if ((title != null) && (description != null)) { 149 152 contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>'; -
tests/Layer/test_GeoRSS.html
old new 82 82 }); 83 83 } 84 84 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 85 105 function test_99_Layer_GeoRSS_destroy (t) { 86 106 t.plan( 1 ); 87 107 layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt);
