Ticket #808: remote_loading.2.patch
| File remote_loading.2.patch, 15.6 kB (added by euzuro, 1 year ago) |
|---|
-
tests/owls.xml
old new 1 <?xml version='1.0' encoding="ISO-8859-1" ?> 2 <wfs:FeatureCollection 3 xmlns:bsc="http://www.bsc-eoc.org/bsc" 4 xmlns:wfs="http://www.opengis.net/wfs" 5 xmlns:gml="http://www.opengis.net/gml" 6 xmlns:ogc="http://www.opengis.net/ogc" 7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 8 xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd 9 http://www.bsc-eoc.org/bsc http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=OWLS&OUTPUTFORMAT=XMLSCHEMA"> 10 <gml:boundedBy> 11 <gml:Box srsName="EPSG:4326"> 12 <gml:coordinates>-89.817223,45.005555 -74.755001,51.701388</gml:coordinates> 13 </gml:Box> 14 </gml:boundedBy> 15 <gml:featureMember><bsc:OWLS> 16 <gml:boundedBy> 17 <gml:Box srsName="EPSG:4326"> 18 <gml:coordinates>-79.771668,45.891110 -79.771668,45.891110</gml:coordinates> 19 </gml:Box> 20 </gml:boundedBy> 21 <bsc:msGeometry> 22 <gml:Point srsName="EPSG:4326"> 23 <gml:coordinates>-79.771668,45.891110</gml:coordinates> 24 </gml:Point> 25 </bsc:msGeometry> 26 </bsc:OWLS> 27 </gml:featureMember> 28 <gml:featureMember> 29 <bsc:OWLS> 30 <gml:boundedBy> 31 <gml:Box srsName="EPSG:4326"> 32 <gml:coordinates>-83.755834,46.365277 -83.755834,46.365277</gml:coordinates> 33 </gml:Box> 34 </gml:boundedBy> 35 <bsc:owlname>owl</bsc:owlname> 36 <bsc:msGeometry> 37 <gml:Point srsName="EPSG:4326"> 38 <gml:coordinates>-83.755834,46.365277</gml:coordinates> 39 </gml:Point> 40 </bsc:msGeometry> 41 </bsc:OWLS> 42 </gml:featureMember> 43 <gml:featureMember> 44 <bsc:OWLS> 45 <gml:boundedBy> 46 <gml:Box srsName="EPSG:4326"> 47 <gml:coordinates>-83.808612,46.175277 -83.808612,46.175277</gml:coordinates> 48 </gml:Box> 49 </gml:boundedBy> 50 <bsc:msGeometry> 51 <gml:Point srsName="EPSG:4326"> 52 <gml:coordinates>-83.808612,46.175277</gml:coordinates> 53 </gml:Point> 54 </bsc:msGeometry> 55 </bsc:OWLS> 56 </gml:featureMember> 57 <gml:featureMember> 58 <bsc:OWLS> 59 <gml:boundedBy> 60 <gml:Box srsName="EPSG:4326"> 61 <gml:coordinates>-84.111112,46.309166 -84.111112,46.309166</gml:coordinates> 62 </gml:Box> 63 </gml:boundedBy> 64 <bsc:msGeometry> 65 <gml:Point srsName="EPSG:4326"> 66 <gml:coordinates>-84.111112,46.309166</gml:coordinates> 67 </gml:Point> 68 </bsc:msGeometry> 69 </bsc:OWLS> 70 </gml:featureMember> 71 <gml:featureMember> 72 <bsc:OWLS> 73 <gml:boundedBy> 74 <gml:Box srsName="EPSG:4326"> 75 <gml:coordinates>-83.678612,46.821110 -83.678612,46.821110</gml:coordinates> 76 </gml:Box> 77 </gml:boundedBy> 78 <bsc:msGeometry> 79 <gml:Point srsName="EPSG:4326"> 80 <gml:coordinates>-83.678612,46.821110</gml:coordinates> 81 </gml:Point> 82 </bsc:msGeometry> 83 </bsc:OWLS> 84 </gml:featureMember> 85 <gml:featureMember> 86 <bsc:OWLS> 87 <gml:boundedBy> 88 <gml:Box srsName="EPSG:4326"> 89 <gml:coordinates>-83.664445,46.518888 -83.664445,46.518888</gml:coordinates> 90 </gml:Box> 91 </gml:boundedBy> 92 <bsc:msGeometry> 93 <gml:Point srsName="EPSG:4326"> 94 <gml:coordinates>-83.664445,46.518888</gml:coordinates> 95 </gml:Point> 96 </bsc:msGeometry> 97 </bsc:OWLS> 98 </gml:featureMember> 99 <gml:featureMember> 100 <bsc:OWLS> 101 <gml:boundedBy> 102 <gml:Box srsName="EPSG:4326"> 103 <gml:coordinates>-80.613334,46.730277 -80.613334,46.730277</gml:coordinates> 104 </gml:Box> 105 </gml:boundedBy> 106 <bsc:msGeometry> 107 <gml:Point srsName="EPSG:4326"> 108 <gml:coordinates>-80.613334,46.730277</gml:coordinates> 109 </gml:Point> 110 </bsc:msGeometry> 111 </bsc:OWLS> 112 </gml:featureMember> 113 <gml:featureMember> 114 <bsc:OWLS> 115 <gml:boundedBy> 116 <gml:Box srsName="EPSG:4326"> 117 <gml:coordinates>-79.676946,45.428054 -79.676946,45.428054</gml:coordinates> 118 </gml:Box> 119 </gml:boundedBy> 120 <bsc:msGeometry> 121 <gml:Point srsName="EPSG:4326"> 122 <gml:coordinates>-79.676946,45.428054</gml:coordinates> 123 </gml:Point> 124 </bsc:msGeometry> 125 </bsc:OWLS> 126 </gml:featureMember> 127 <gml:featureMember> 128 <bsc:OWLS> 129 <gml:boundedBy> 130 <gml:Box srsName="EPSG:4326"> 131 <gml:coordinates>-83.853056,46.236944 -83.853056,46.236944</gml:coordinates> 132 </gml:Box> 133 </gml:boundedBy> 134 <bsc:msGeometry> 135 <gml:Point srsName="EPSG:4326"> 136 <gml:coordinates>-83.853056,46.236944</gml:coordinates> 137 </gml:Point> 138 </bsc:msGeometry> 139 </bsc:OWLS> 140 </gml:featureMember> 141 <gml:featureMember> 142 <bsc:OWLS> 143 <gml:boundedBy> 144 <gml:Box srsName="EPSG:4326"> 145 <gml:coordinates>-82.289167,45.896388 -82.289167,45.896388</gml:coordinates> 146 </gml:Box> 147 </gml:boundedBy> 148 <bsc:msGeometry> 149 <gml:Point srsName="EPSG:4326"> 150 <gml:coordinates>-82.289167,45.896388</gml:coordinates> 151 </gml:Point> 152 </bsc:msGeometry> 153 </bsc:OWLS> 154 </gml:featureMember> 155 </wfs:FeatureCollection> 156 -
tests/Layer/test_GML.html
old new 5 5 6 6 var name = "GML Layer"; 7 7 8 var gml = "./owls.xml"; 9 10 // if this test is running online, different rules apply 11 var isMSIE = (navigator.userAgent.indexOf("MSIE") > -1); 12 if (isMSIE) { 13 gml = "." + gml; 14 } 15 8 16 function test_01_Layer_GML_constructor(t) { 9 17 t.plan(3); 10 18 … … 14 22 t.ok(layer.renderer.CLASS_NAME, "layer has a renderer"); 15 23 16 24 } 25 function test_Layer_GML_events(t) { 26 t.plan(3); 27 28 var layer = new OpenLayers.Layer.GML(name, gml, {isBaseLayer: true}); 29 layer.events.register("loadstart", layer, function() { 30 t.ok(true, "loadstart called.") 31 }); 32 layer.events.register("loadend", layer, function() { 33 t.ok(true, "loadend called.") 34 }); 35 var map = new OpenLayers.Map("map"); 36 map.addLayer(layer); 37 map.zoomToMaxExtent(); 38 t.delay_call(1, function() { 39 t.ok(true, "waited for 1s"); 40 }); 41 42 } 17 43 </script> 18 44 </head> 19 45 <body> -
tests/Layer/test_Text.html
old new 118 118 t.eq(map.popups.length, 0, "no popup on second marker"); 119 119 }); 120 120 } 121 function test_Layer_Text_loadend_Event(t) { 122 t.plan(2); 123 layer = new OpenLayers.Layer.Text('Test Layer', {location:datafile}); 124 t.delay_call(2, function() { 125 layer.events.register('loadend', layer, function() { 126 t.ok(true, "Loadend event fired"); 127 }); 128 layer.parseData({ 129 'responseText':'' 130 }); 131 t.ok(true, "Parsing data didn't fail"); 132 }); 133 } 121 134 122 135 function test_99_Layer_Text_destroy (t) { 123 136 t.plan( 1 ); -
tests/Layer/test_GeoRSS.html
old new 80 80 map.addLayer(layer); 81 81 map.setCenter(new OpenLayers.LonLat(0,0),0); 82 82 var event = {}; 83 t.delay_call( 1, function() {83 t.delay_call( 2, function() { 84 84 t.ok(layer.markers[0].events, "First marker has an events object"); 85 85 t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object"); 86 86 layer.markers[0].events.triggerEvent('click', event); … … 159 159 t.eq(otherLayer.markers[0].icon.url, the_icon.url,"The layer with an icon has that icon."); 160 160 }); 161 161 } 162 162 function test_Layer_GeoRSS_loadend_Event(t) { 163 var browserCode = OpenLayers.Util.getBrowserName(); 164 if (browserCode == "msie") { 165 t.plan(1); 166 t.ok(true, "IE fails the GeoRSS test. This could probably be fixed by someone with enough energy to fix it."); 167 } else { 168 t.plan(2); 169 layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt); 170 t.delay_call(2, function() { 171 layer.events.register('loadend', layer, function() { 172 t.ok(true, "Loadend event fired"); 173 }); 174 layer.parseData({ 175 'responseText': '<xml xmlns="http://example.com"><title> </title></xml>' 176 }); 177 t.ok(true, "Parsing data didn't fail"); 178 }); 179 } 180 } 181 163 182 function test_99_Layer_GeoRSS_destroy (t) { 164 183 t.plan( 1 ); 165 184 layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt); -
lib/OpenLayers/Tile/WFS.js
old new 75 75 */ 76 76 draw:function() { 77 77 if (OpenLayers.Tile.prototype.draw.apply(this, arguments)) { 78 if (this.isLoading) { 79 //if already loading, send 'reload' instead of 'loadstart'. 80 this.events.triggerEvent("reload"); 81 } else { 82 this.isLoading = true; 83 this.events.triggerEvent("loadstart"); 84 } 78 85 this.loadFeaturesForRegion(this.requestSuccess); 79 86 } 80 87 }, … … 121 128 this.addResults(resultFeatures); 122 129 } 123 130 } 131 if (this.events) { 132 this.events.triggerEvent("loadend"); 133 } 124 134 }, 125 135 126 136 /** -
lib/OpenLayers/Layer/GML.js
old new 81 81 // loaded after the GML is paited. 82 82 // See http://trac.openlayers.org/ticket/404 83 83 if(this.visibility && !this.loaded){ 84 this.events.triggerEvent("loadstart"); 84 85 this.loadGML(); 85 86 } 86 87 }, … … 113 114 114 115 var gml = this.format ? new this.format() : new OpenLayers.Format.GML(); 115 116 this.addFeatures(gml.read(doc)); 117 this.events.triggerEvent("loadend"); 116 118 }, 117 119 118 120 /** … … 125 127 */ 126 128 requestFailure: function(request) { 127 129 alert("Error in loading GML file "+this.url); 130 this.events.triggerEvent("loadend"); 128 131 }, 129 132 130 133 CLASS_NAME: "OpenLayers.Layer.GML" -
lib/OpenLayers/Layer/Text.js
old new 47 47 OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments); 48 48 this.features = new Array(); 49 49 if (this.location != null) { 50 OpenLayers.loadURL(this.location, null, this, this.parseData); 50 51 var onFail = function(e) { 52 this.events.triggerEvent("loadend"); 53 }; 54 55 this.events.triggerEvent("loadstart"); 56 OpenLayers.loadURL(this.location, null, 57 this, this.parseData, onFail); 51 58 } 52 59 }, 53 60 … … 155 162 } 156 163 } 157 164 } 165 this.events.triggerEvent("loadend"); 158 166 }, 159 167 160 168 /** -
lib/OpenLayers/Layer/WFS.js
old new 23 23 isBaseLayer: false, 24 24 25 25 /** 26 * Property: tile 27 * {<OpenLayers.Tile.WFS>} 28 */ 29 tile: null, 30 31 /** 26 32 * APIProperty: ratio 27 33 * {Float} the ratio of image/tile size to map size (this is the untiled 28 34 * buffer) … … 234 240 if (!this.tile) { 235 241 this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds, 236 242 url, tileSize); 243 this.addTileMonitoringHooks(this.tile); 237 244 this.tile.draw(); 238 245 } else { 239 246 if (this.vectorMode) { … … 243 250 this.clearMarkers(); 244 251 } 245 252 this.tile.destroy(); 253 this.removeTileMonitoringHooks(this.tile); 246 254 247 255 this.tile = null; 248 256 this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds, … … 252 260 } 253 261 }, 254 262 263 /** 264 * Method: addTileMonitoringHooks 265 * This function takes a tile as input and adds the appropriate hooks to 266 * the tile so that the layer can keep track of the loading tile 267 * (making sure to check that the tile is always the layer's current 268 * tile before taking any action). 269 * 270 * Parameters: 271 * tile - {<OpenLayers.Tile>} 272 */ 273 addTileMonitoringHooks: function(tile) { 274 tile.onLoadStart = function() { 275 //if this is the the layer's current tile, then trigger 276 // a 'loadstart' 277 if (this == this.layer.tile) { 278 this.layer.events.triggerEvent("loadstart"); 279 } 280 }; 281 tile.events.register("loadstart", tile, tile.onLoadStart); 282 283 tile.onLoadEnd = function() { 284 //if this is the the layer's current tile, then trigger 285 // a 'tileloaded' and 'loadend' 286 if (this == this.layer.tile) { 287 this.layer.events.triggerEvent("tileloaded"); 288 this.layer.events.triggerEvent("loadend"); 289 } 290 }; 291 tile.events.register("loadend", tile, tile.onLoadEnd); 292 }, 293 294 /** 295 * Method: removeTileMonitoringHooks 296 * This function takes a tile as input and removes the tile hooks 297 * that were added in addTileMonitoringHooks() 298 * 299 * Parameters: 300 * tile - {<OpenLayers.Tile>} 301 */ 302 removeTileMonitoringHooks: function(tile) { 303 tile.events.unregister("loadstart", tile, tile.onLoadStart); 304 tile.events.unregister("loadend", tile, tile.onLoadEnd); 305 }, 306 255 307 /** 256 308 * Method: onMapResize 257 309 * Call the onMapResize method of the appropriate parent class. -
lib/OpenLayers/Layer/GeoRSS.js
old new 67 67 OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]); 68 68 this.location = location; 69 69 this.features = []; 70 this.events.triggerEvent("loadstart"); 70 71 OpenLayers.loadURL(location, null, this, this.parseData); 71 72 }, 72 73 … … 209 210 marker.events.register('click', feature, this.markerClick); 210 211 this.addMarker(marker); 211 212 } 213 this.events.triggerEvent("loadend"); 212 214 }, 213 215 214 216 /**
