Changeset 8012
- Timestamp:
- 09/12/08 13:24:20 (3 months ago)
- Files:
-
- branches/openlayers/2.7/build/license.txt (modified) (1 diff)
- branches/openlayers/2.7/examples/animator.js (copied) (copied from trunk/openlayers/examples/animator.js)
- branches/openlayers/2.7/examples/measure.html (modified) (3 diffs)
- branches/openlayers/2.7/examples/protocol-gears.html (copied) (copied from trunk/openlayers/examples/protocol-gears.html)
- branches/openlayers/2.7/examples/proxy.cgi (modified) (2 diffs)
- branches/openlayers/2.7/examples/spherical-mercator.html (modified) (4 diffs)
- branches/openlayers/2.7/examples/strategy-bbox.html (copied) (copied from trunk/openlayers/examples/strategy-bbox.html)
- branches/openlayers/2.7/examples/strategy-cluster.html (copied) (copied from trunk/openlayers/examples/strategy-cluster.html)
- branches/openlayers/2.7/examples/strategy-paging.html (copied) (copied from trunk/openlayers/examples/strategy-paging.html)
- branches/openlayers/2.7/examples/vector-formats.html (modified) (4 diffs)
- branches/openlayers/2.7/examples/wfs-reprojection.html (modified) (2 diffs)
- branches/openlayers/2.7/lib/Gears (copied) (copied from trunk/openlayers/lib/Gears)
- branches/openlayers/2.7/lib/Gears/gears_init.js (copied) (copied from trunk/openlayers/lib/Gears/gears_init.js)
- branches/openlayers/2.7/lib/OpenLayers.js (modified) (4 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Control/Permalink.js (modified) (3 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Format.js (modified) (2 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Format/GML (copied) (copied from trunk/openlayers/lib/OpenLayers/Format/GML)
- branches/openlayers/2.7/lib/OpenLayers/Format/GML/Base.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Format/GML/Base.js)
- branches/openlayers/2.7/lib/OpenLayers/Format/GML/v2.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Format/GML/v2.js)
- branches/openlayers/2.7/lib/OpenLayers/Format/GML/v3.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Format/GML/v3.js)
- branches/openlayers/2.7/lib/OpenLayers/Format/XML.js (modified) (4 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Layer/TMS.js (modified) (1 diff)
- branches/openlayers/2.7/lib/OpenLayers/Layer/Vector.js (modified) (8 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Map.js (modified) (1 diff)
- branches/openlayers/2.7/lib/OpenLayers/Protocol/HTTP.js (modified) (2 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Protocol/SQL (copied) (copied from trunk/openlayers/lib/OpenLayers/Protocol/SQL)
- branches/openlayers/2.7/lib/OpenLayers/Protocol/SQL.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Protocol/SQL.js)
- branches/openlayers/2.7/lib/OpenLayers/Protocol/SQL/Gears.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Protocol/SQL/Gears.js)
- branches/openlayers/2.7/lib/OpenLayers/Renderer/Elements.js (modified) (1 diff)
- branches/openlayers/2.7/lib/OpenLayers/Renderer/SVG.js (modified) (1 diff)
- branches/openlayers/2.7/lib/OpenLayers/Renderer/VML.js (modified) (10 diffs)
- branches/openlayers/2.7/lib/OpenLayers/Request.js (modified) (1 diff)
- branches/openlayers/2.7/lib/OpenLayers/Strategy/BBOX.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js)
- branches/openlayers/2.7/lib/OpenLayers/Strategy/Cluster.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Strategy/Cluster.js)
- branches/openlayers/2.7/lib/OpenLayers/Strategy/Paging.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Strategy/Paging.js)
- branches/openlayers/2.7/lib/OpenLayers/Util.js (modified) (2 diffs)
- branches/openlayers/2.7/tests/Control/Permalink.html (modified) (1 diff)
- branches/openlayers/2.7/tests/Format.html (modified) (2 diffs)
- branches/openlayers/2.7/tests/Format/GML (copied) (copied from trunk/openlayers/tests/Format/GML)
- branches/openlayers/2.7/tests/Format/GML/cases.js (copied) (copied from trunk/openlayers/tests/Format/GML/cases.js)
- branches/openlayers/2.7/tests/Format/GML/v2.html (copied) (copied from trunk/openlayers/tests/Format/GML/v2.html)
- branches/openlayers/2.7/tests/Format/GML/v3.html (copied) (copied from trunk/openlayers/tests/Format/GML/v3.html)
- branches/openlayers/2.7/tests/Format/XML.html (modified) (3 diffs)
- branches/openlayers/2.7/tests/Protocol/HTTP.html (modified) (4 diffs)
- branches/openlayers/2.7/tests/Protocol/SQL (copied) (copied from trunk/openlayers/tests/Protocol/SQL)
- branches/openlayers/2.7/tests/Protocol/SQL.html (copied) (copied from trunk/openlayers/tests/Protocol/SQL.html)
- branches/openlayers/2.7/tests/Protocol/SQL/Gears.html (copied) (copied from trunk/openlayers/tests/Protocol/SQL/Gears.html)
- branches/openlayers/2.7/tests/Renderer/Elements.html (modified) (1 diff)
- branches/openlayers/2.7/tests/Request.html (modified) (2 diffs)
- branches/openlayers/2.7/tests/Strategy/BBOX.html (copied) (copied from trunk/openlayers/tests/Strategy/BBOX.html)
- branches/openlayers/2.7/tests/Strategy/Cluster.html (copied) (copied from trunk/openlayers/tests/Strategy/Cluster.html)
- branches/openlayers/2.7/tests/Strategy/Paging.html (copied) (copied from trunk/openlayers/tests/Strategy/Paging.html)
- branches/openlayers/2.7/tests/geom_eq.js (copied) (copied from trunk/openlayers/tests/geom_eq.js)
- branches/openlayers/2.7/tests/list-tests.html (modified) (3 diffs)
- branches/openlayers/2.7/tests/run-tests.html (modified) (1 diff)
- branches/openlayers/2.7/tests/xml_eq.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.7/build/license.txt
r7335 r8012 53 53 * http://www.apache.org/licenses/LICENSE-2.0 54 54 */ 55 56 /** 57 * Contains portions of Gears <http://code.google.com/apis/gears/> 58 * 59 * Copyright 2007, Google Inc. 60 * 61 * Redistribution and use in source and binary forms, with or without 62 * modification, are permitted provided that the following conditions are met: 63 * 64 * 1. Redistributions of source code must retain the above copyright notice, 65 * this list of conditions and the following disclaimer. 66 * 2. Redistributions in binary form must reproduce the above copyright notice, 67 * this list of conditions and the following disclaimer in the documentation 68 * and/or other materials provided with the distribution. 69 * 3. Neither the name of Google Inc. nor the names of its contributors may be 70 * used to endorse or promote products derived from this software without 71 * specific prior written permission. 72 * 73 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 74 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 75 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 76 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 77 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 78 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 79 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 80 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 81 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 82 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 83 * 84 * Sets up google.gears.*, which is *the only* supported way to access Gears. 85 * 86 * Circumvent this file at your own risk! 87 * 88 * In the future, Gears may automatically define google.gears.* without this 89 * file. Gears may use these objects to transparently fix bugs and compatibility 90 * issues. Applications that use the code below will continue to work seamlessly 91 * when that happens. 92 */ branches/openlayers/2.7/examples/measure.html
r7965 r8012 93 93 document.getElementById('noneToggle').checked = true; 94 94 } 95 96 function calcVincenty(geometry) { 97 /** 98 * Note: this function assumes geographic coordinates and 99 * will fail otherwise. OpenLayers.Util.distVincenty takes 100 * two objects representing points with geographic coordinates 101 * and returns the geodesic distance between them (shortest 102 * distance between the two points on an ellipsoid) in *kilometers*. 103 * 104 * It is important to realize that the segments drawn on the map 105 * are *not* geodesics (or "great circle" segments). This means 106 * that in general, the measure returned by this function 107 * will not represent the length of segments drawn on the map. 108 */ 109 var dist = 0; 110 for (var i = 1; i < geometry.components.length; i++) { 111 var first = geometry.components[i-1]; 112 var second = geometry.components[i]; 113 dist += OpenLayers.Util.distVincenty( 114 {lon: first.x, lat: first.y}, 115 {lon: second.x, lat: second.y} 116 ); 117 } 118 return dist; 119 } 95 120 96 121 function handleMeasurements(event) { … … 103 128 if(order == 1) { 104 129 out += "measure: " + measure.toFixed(3) + " " + units; 130 if (map.getProjection() == "EPSG:4326") { 131 out += "<br /> Great Circle Distance: " + 132 calcVincenty(geometry).toFixed(3) + " km *"; 133 } 105 134 } else { 106 135 out += "measure: " + measure.toFixed(3) + " " + units + "<sup>2</" + "sup>"; … … 145 174 </li> 146 175 </ul> 176 <p>* Note that the geometries drawn are planar geometries and the 177 metrics returned by the measure control are planar measures. The 178 "great circle" distance does not necessarily represent the length 179 of the segments drawn on the map. Instead, it is a geodesic metric that 180 represents the cumulative shortest path between all vertices in the 181 geometry were they projected onto a sphere.</p> 147 182 </div> 148 183 </body> branches/openlayers/2.7/examples/proxy.cgi
r7134 r8012 19 19 'labs.metacarta.com', 'world.freemap.in', 20 20 'prototype.openmnnd.org', 'geo.openplans.org', 21 'sigma.openplans.org' 21 'sigma.openplans.org', 22 22 'www.openstreetmap.org'] 23 23 … … 41 41 print "Content-Type: text/plain" 42 42 print 43 print "This proxy does not allow you to access that location ."44 print 43 print "This proxy does not allow you to access that location (%s)." % (host,) 44 print 45 45 print os.environ 46 46 branches/openlayers/2.7/examples/spherical-mercator.html
r7676 r8012 29 29 displayProjection: new OpenLayers.Projection("EPSG:4326"), 30 30 units: "m", 31 numZoomLevels: 18, 31 32 maxResolution: 156543.0339, 32 33 maxExtent: new OpenLayers.Bounds(-20037508, -20037508, … … 87 88 } 88 89 ); 89 // create O SM layer90 var mapnik= new OpenLayers.Layer.TMS(90 // create OAM layer 91 var oam = new OpenLayers.Layer.TMS( 91 92 "OpenAerialMap", 92 93 "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/", … … 97 98 98 99 // create OSM layer 100 var mapnik = new OpenLayers.Layer.TMS( 101 "OpenStreetMap (Mapnik)", 102 "http://a.tile.openstreetmap.org/", 103 { 104 type: 'png', getURL: osm_getTileURL, 105 displayOutsideMaxExtent: true, 106 attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>' 107 } 108 ); 109 // create OSM layer 99 110 var osmarender = new OpenLayers.Layer.TMS( 100 111 "OpenStreetMap (Tiles@Home)", 101 "http://tah.openstreetmap.org/Tiles/tile .php/",112 "http://tah.openstreetmap.org/Tiles/tile/", 102 113 { 103 114 type: 'png', getURL: osm_getTileURL, … … 123 134 124 135 map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb, 125 yahoo, yahoosat, yahoohyb, mapnik, osmarender,136 yahoo, yahoosat, yahoohyb, oam, mapnik, osmarender, 126 137 wms, vector]); 127 138 map.addControl(new OpenLayers.Control.LayerSwitcher()); branches/openlayers/2.7/examples/vector-formats.html
r7095 r8012 53 53 'internalProjection': map.baseLayer.projection, 54 54 'externalProjection': new OpenLayers.Projection(OpenLayers.Util.getElement("inproj").value) 55 } 55 }; 56 56 var out_options = { 57 57 'internalProjection': map.baseLayer.projection, 58 58 'externalProjection': new OpenLayers.Projection(OpenLayers.Util.getElement("outproj").value) 59 } 59 }; 60 var gmlOptions = { 61 featureType: "feature", 62 featureNS: "http://example.com/feature" 63 }; 64 var gmlOptionsIn = OpenLayers.Util.extend( 65 OpenLayers.Util.extend({}, gmlOptions), 66 in_options 67 ); 68 var gmlOptionsOut = OpenLayers.Util.extend( 69 OpenLayers.Util.extend({}, gmlOptions), 70 out_options 71 ); 60 72 formats = { 61 73 'in': { … … 63 75 geojson: new OpenLayers.Format.GeoJSON(in_options), 64 76 georss: new OpenLayers.Format.GeoRSS(in_options), 65 gml: new OpenLayers.Format.GML(in_options), 77 gml2: new OpenLayers.Format.GML.v2(gmlOptionsIn), 78 gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn), 66 79 kml: new OpenLayers.Format.KML(in_options) 67 80 }, … … 70 83 geojson: new OpenLayers.Format.GeoJSON(out_options), 71 84 georss: new OpenLayers.Format.GeoRSS(out_options), 72 gml: new OpenLayers.Format.GML(out_options), 85 gml2: new OpenLayers.Format.GML.v2(gmlOptionsOut), 86 gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut), 73 87 kml: new OpenLayers.Format.KML(out_options) 74 88 } … … 170 184 <option value="kml">KML</option> 171 185 <option value="georss">GeoRSS</option> 172 <option value="gml">GML</option> 186 <option value="gml2">GML (v2)</option> 187 <option value="gml3">GML (v3)</option> 173 188 <option value="wkt">Well-Known Text (WKT)</option> 174 189 </select> branches/openlayers/2.7/examples/wfs-reprojection.html
r7884 r8012 46 46 var wfs = layer = new OpenLayers.Layer.WFS( 47 47 "States (SVG)", 48 "http://sigma.openplans.org :8080/geoserver/ows",48 "http://sigma.openplans.org/geoserver/ows", 49 49 {typename: 'topp:states'}, 50 50 { … … 61 61 var wfs = layer = new OpenLayers.Layer.WFS( 62 62 "States (Canvas)", 63 "http://sigma.openplans.org :8080/geoserver/ows",63 "http://sigma.openplans.org/geoserver/ows", 64 64 {typename: 'topp:states'}, 65 65 { branches/openlayers/2.7/lib/OpenLayers.js
r7952 r8012 84 84 "Rico/Corner.js", 85 85 "Rico/Color.js", 86 "Gears/gears_init.js", 86 87 "OpenLayers/Ajax.js", 87 88 "OpenLayers/Request.js", … … 165 166 "OpenLayers/Control/SelectFeature.js", 166 167 "OpenLayers/Control/NavigationHistory.js", 168 "OpenLayers/Control/Measure.js", 167 169 "OpenLayers/Geometry.js", 168 170 "OpenLayers/Geometry/Rectangle.js", … … 185 187 "OpenLayers/Strategy.js", 186 188 "OpenLayers/Strategy/Fixed.js", 189 "OpenLayers/Strategy/Cluster.js", 190 "OpenLayers/Strategy/Paging.js", 191 "OpenLayers/Strategy/BBOX.js", 187 192 "OpenLayers/Protocol.js", 188 193 "OpenLayers/Protocol/HTTP.js", 194 "OpenLayers/Protocol/SQL.js", 195 "OpenLayers/Protocol/SQL/Gears.js", 189 196 "OpenLayers/Layer/PointTrack.js", 190 197 "OpenLayers/Layer/GML.js", … … 200 207 "OpenLayers/Format/XML.js", 201 208 "OpenLayers/Format/GML.js", 209 "OpenLayers/Format/GML/Base.js", 210 "OpenLayers/Format/GML/v2.js", 211 "OpenLayers/Format/GML/v3.js", 202 212 "OpenLayers/Format/KML.js", 203 213 "OpenLayers/Format/GeoRSS.js", branches/openlayers/2.7/lib/OpenLayers/Control/Permalink.js
r7881 r8012 169 169 createParams: function(center, zoom, layers) { 170 170 center = center || this.map.getCenter(); 171 zoom = zoom || this.map.getZoom();172 layers = layers || this.map.layers;173 171 174 172 var params = OpenLayers.Util.getParameters(this.base); … … 178 176 // base link. 179 177 if (center) { 180 181 params.zoom = this.map.getZoom(); 178 179 //zoom 180 params.zoom = zoom || this.map.getZoom(); 181 182 //lon,lat 182 183 var lat = center.lat; 183 184 var lon = center.lon; … … 193 194 params.lat = Math.round(lat*100000)/100000; 194 195 params.lon = Math.round(lon*100000)/100000; 195 196 197 //layers 198 layers = layers || this.map.layers; 196 199 params.layers = ''; 197 for (var i=0, len= this.map.layers.length; i<len; i++) {198 var layer = this.map.layers[i];200 for (var i=0, len=layers.length; i<len; i++) { 201 var layer = layers[i]; 199 202 200 203 if (layer.isBaseLayer) { branches/openlayers/2.7/lib/OpenLayers/Format.js
r7675 r8012 13 13 */ 14 14 OpenLayers.Format = OpenLayers.Class({ 15 16 /** 17 * Property: options 18 * {Object} A reference to options passed to the constructor. 19 */ 20 options: null, 15 21 16 22 /** … … 55 61 initialize: function(options) { 56 62 OpenLayers.Util.extend(this, options); 63 this.options = options; 64 }, 65 66 /** 67 * APIMethod: destroy 68 * Clean up. 69 */ 70 destroy: function() { 57 71 }, 58 72 branches/openlayers/2.7/lib/OpenLayers/Format/XML.js
r7870 r8012 21 21 22 22 /** 23 * Property: namespaces 24 * {Object} Mapping of namespace aliases to namespace URIs. Properties 25 * of this object should not be set individually. Read-only. All 26 * XML subclasses should have their own namespaces object. Use 27 * <setNamespace> to add or set a namespace alias after construction. 28 */ 29 namespaces: null, 30 31 /** 32 * Property: namespaceAlias 33 * {Object} Mapping of namespace URI to namespace alias. This object 34 * is read-only. Use <setNamespace> to add or set a namespace alias. 35 */ 36 namespaceAlias: null, 37 38 /** 39 * Property: defaultPrefix 40 * {String} The default namespace alias for creating element nodes. 41 */ 42 defaultPrefix: null, 43 44 /** 45 * Property: readers 46 * Contains public functions, grouped by namespace prefix, that will 47 * be applied when a namespaced node is found matching the function 48 * name. The function will be applied in the scope of this parser 49 * with two arguments: the node being read and a context object passed 50 * from the parent. 51 */ 52 readers: {}, 53 54 /** 55 * Property: writers 56 * As a compliment to the <readers> property, this structure contains public 57 * writing functions grouped by namespace alias and named like the 58 * node names they produce. 59 */ 60 writers: {}, 61 62 /** 23 63 * Property: xmldom 24 64 * {XMLDom} If this browser uses ActiveX, this will be set to a XMLDOM … … 45 85 } 46 86 OpenLayers.Format.prototype.initialize.apply(this, [options]); 87 // clone the namespace object and set all namespace aliases 88 this.namespaces = OpenLayers.Util.extend({}, this.namespaces); 89 this.namespaceAlias = {}; 90 for(var alias in this.namespaces) { 91 this.namespaceAlias[this.namespaces[alias]] = alias; 92 } 93 }, 94 95 /** 96 * APIMethod: destroy 97 * Clean up. 98 */ 99 destroy: function() { 100 this.xmldom = null; 101 OpenLayers.Format.prototype.destroy.apply(this, arguments); 102 }, 103 104 /** 105 * Method: setNamespace 106 * Set a namespace alias and URI for the format. 107 * 108 * Parameters: 109 * alias - {String} The namespace alias (prefix). 110 * uri - {String} The namespace URI. 111 */ 112 setNamespace: function(alias, uri) { 113 this.namespaces[alias] = uri; 114 this.namespaceAlias[uri] = alias; 47 115 }, 48 116 … … 290 358 */ 291 359 getChildValue: function(node, def) { 292 var value; 293 if (node && node.firstChild && node.firstChild.nodeValue) { 294 value = node.firstChild.nodeValue; 295 } else { 296 value = (def != undefined) ? def : ""; 360 var value = def || ""; 361 if(node) { 362 var child = node.firstChild; 363 if(child) { 364 value = child.nodeValue || value; 365 } 297 366 } 298 367 return value; … … 385 454 }, 386 455 456 /** 457 * Method: createElementNSPlus 458 * Shorthand for creating namespaced elements with optional attributes and 459 * child text nodes. 460 * 461 * Parameters: 462 * name - {String} The qualified node name. 463 * options - {Object} Optional object for node configuration. 464 * 465 * Valid options: 466 * uri - {String} Optional namespace uri for the element - supply a prefix 467 * instead if the namespace uri is a property of the format's namespace 468 * object. 469 * attributes - {Object} Optional attributes to be set using the 470 * <setAttributes> method. 471 * value - {String} Optional text to be appended as a text node. 472 * 473 * Returns: 474 * {Element} An element node. 475 */ 476 createElementNSPlus: function(name, options) { 477 options = options || {}; 478 var loc = name.indexOf(":"); 479 // order of prefix preference 480 // 1. in the uri option 481 // 2. in the prefix option 482 // 3. in the qualified name 483 // 4. from the defaultPrefix 484 var uri = options.uri || this.namespaces[options.prefix]; 485 if(!uri) { 486 loc = name.indexOf(":"); 487 uri = this.namespaces[name.substring(0, loc)]; 488 } 489 if(!uri) { 490 uri = this.namespaces[this.defaultPrefix]; 491 } 492 var node = this.createElementNS(uri, name); 493 if(options.attributes) { 494 this.setAttributes(node, options.attributes); 495 } 496 if(options.value) { 497 node.appendChild(this.createTextNode(options.value)); 498 } 499 return node; 500 }, 501 502 /** 503 * Method: setAttributes 504 * Set multiple attributes given key value pairs from an object. 505 * 506 * Parameters: 507 * node - {Element} An element node. 508 * obj - {Object || Array} An object whose properties represent attribute 509 * names and values represent attribute values. If an attribute name 510 * is a qualified name ("prefix:local"), the prefix will be looked up 511 * in the parsers {namespaces} object. If the prefix is found, 512 * setAttributeNS will be used instead of setAttribute. 513 */ 514 setAttributes: function(node, obj) { 515 var value, loc, alias, uri; 516 for(var name in obj) { 517 if(obj[name] != null && obj[name].toString) { 518 value = obj[name].toString(); 519 // check for qualified attribute name ("prefix:local") 520 uri = this.namespaces[name.substring(0, name.indexOf(":"))] || null; 521 this.setAttributeNS(node, uri, name, value); 522 } 523 } 524 }, 525 526 /** 527 * Method: readNode 528 * Shorthand for applying one of the named readers given the node 529 * namespace and local name. Readers take two args (node, obj) and 530 * generally extend or modify the second. 531 * 532 * Parameters: 533 * node - {DOMElement} The node to be read (required). 534 * obj - {Object} The object to be modified (optional). 535 * 536 * Returns: 537 * {Object} The input object, modified (or a new one if none was provided). 538 */ 539 readNode: function(node, obj) { 540 if(!obj) { 541 obj = {}; 542 } 543 var group = this.readers[this.namespaceAlias[node.namespaceURI]]; 544 if(group) { 545 var local = node.localName || node.nodeName.split(":").pop(); 546 var reader = group[local] || group["*"]; 547 if(reader) { 548 reader.apply(this, [node, obj]); 549 } 550 } 551 return obj; 552 }, 553 554 /** 555 * Method: readChildNodes 556 * Shorthand for applying the named readers to all children of a node. 557 * For each child of type 1 (element), <readSelf> is called. 558 * 559 * Parameters: 560 * node - {DOMElement} The node to be read (required). 561 * obj - {Object} The object to be modified (optional). 562 * 563 * Returns: 564 * {Object} The input object, modified. 565 */ 566 readChildNodes: function(node, obj) { 567 if(!obj) { 568 obj = {}; 569 } 570 var children = node.childNodes; 571 var child; 572 for(var i=0, len=children.length; i<len; ++i) { 573 child = children[i]; 574 if(child.nodeType == 1) { 575 this.readNode(child, obj); 576 } 577 } 578 return obj; 579 }, 580 581 /** 582 * Method: writeNode 583 * Shorthand for applying one of the named writers and appending the 584 * results to a node. If a qualified name is not provided for the 585 * second argument (and a local name is used instead), the namespace 586 * of the parent node will be assumed. 587 * 588 * Parameters: 589 * name - {String} The name of a node to generate. If a qualified name 590 * (e.g. "pre:Name") is used, the namespace prefix is assumed to be 591 * in the <writers> group. If a local name is used (e.g. "Name") then 592 * the namespace of the parent is assumed. If a local name is used 593 * and no parent is supplied, then the default namespace is assumed. 594 * obj - {Object} Structure containing data for the writer. 595 * parent - {DOMElement} Result will be appended to this node. If no parent 596 * is supplied, the node will not be appended to anything. 597 * 598 * Returns: 599 * {DOMElement} The child node. 600 */ 601 writeNode: function(name, obj, parent) { 602 var prefix, local; 603 var split = name.indexOf(":"); 604 if(split > 0) { 605 prefix = name.substring(0, split); 606 local = name.substring(split + 1); 607 } else { 608 if(parent) { 609 prefix = this.namespaceAlias[parent.namespaceURI]; 610 } else { 611 prefix = this.defaultPrefix; 612 } 613 local = name; 614 } 615 var child = this.writers[prefix][local].apply(this, [obj]); 616 if(parent) { 617 parent.appendChild(child); 618 } 619 return child; 620 }, 621 387 622 CLASS_NAME: "OpenLayers.Format.XML" 388 623 branches/openlayers/2.7/lib/OpenLayers/Layer/TMS.js
r6418 r8012 6 6 /** 7 7 * @requires OpenLayers/Layer/Grid.js 8 * @requires OpenLayers/Tile/Image.js 8 9 */ 9 10 branches/openlayers/2.7/lib/OpenLayers/Layer/Vector.js
r7959 r8012 39 39 * - *beforefeatureadded* Triggered before a feature is added. Listeners 40 40 * will receive an object with a *feature* property referencing the 41 * feature to be added. 41 * feature to be added. To stop the feature from being added, a 42 * listener should return false. 43 * - *beforefeaturesadded* Triggered before an array of features is added. 44 * Listeners will receive an object with a *features* property 45 * referencing the feature to be added. To stop the features from 46 * being added, a listener should return false. 42 47 * - *featureadded* Triggered after a feature is added. The event 43 48 * object passed to listeners will have a *feature* property with a … … 73 78 * for a new set of features. 74 79 */ 75 EVENT_TYPES: ["beforefeatureadded", "featureadded", "featuresadded", 80 EVENT_TYPES: ["beforefeatureadded", "beforefeaturesadded", 81 "featureadded", "featuresadded", 76 82 "beforefeatureremoved", "featureremoved", "featuresremoved", 77 83 "beforefeatureselected", "featureselected", "featureunselected", … … 408 414 409 415 if(!zoomChanged && coordSysUnchanged) { 410 var unrenderedFeatures = {};411 416 for(var i in this.unrenderedFeatures) { 412 417 var feature = this.unrenderedFeatures[i]; 413 if(!this.drawFeature(feature)) { 414 unrenderedFeatures[i] = feature; 415 } 418 this.drawFeature(feature); 416 419 } 417 this.unrenderedFeatures = unrenderedFeatures;418 420 } 419 421 } 420 422 421 423 if (!this.drawn || zoomChanged || !coordSysUnchanged) { 422 this.unrenderedFeatures = {};423 424 this.drawn = true; 424 425 var feature; … … 430 431 } 431 432 feature = this.features[i]; 432 if (!this.drawFeature(feature)) { 433 this.unrenderedFeatures[feature.id] = feature; 434 }; 433 this.drawFeature(feature); 435 434 } 436 435 } … … 451 450 452 451 var notify = !options || !options.silent; 452 if(notify) { 453 var event = {features: features}; 454 var ret = this.events.triggerEvent("beforefeaturesadded", event); 455 if(ret === false) { 456 return; 457 } 458 features = event.features; 459 } 460 453 461 454 462 for (var i=0, len=features.length; i<len; i++) { … … 477 485 478 486 if (notify) { 479 this.events.triggerEvent("beforefeatureadded", { 480 feature: feature 481 }); 487 if(this.events.triggerEvent("beforefeatureadded", 488 {feature: feature}) === false) { 489 continue; 490 }; 482 491 this.preFeatureInsert(feature); 483 492 } 484 493 485 494 if (this.drawn) { 486 if(!this.drawFeature(feature)) { 487 this.unrenderedFeatures[feature.id] = feature; 488 } 495 this.drawFeature(feature); 489 496 } 490 497 … … 604 611 * feature - {<OpenLayers.Feature.Vector>} 605 612 * style - {Object} Symbolizer hash or {String} renderIntent 606 *607 * Returns:608 * {Boolean} true if the renderer was able to draw the feature, false609 * otherwise610 613 */ 611 614 drawFeature: function(feature, style) { … … 619 622 } 620 623 621 return this.renderer.drawFeature(feature, style); 624 if (!this.renderer.drawFeature(feature, style)) { 625 this.unrenderedFeatures[feature.id] = feature; 626 } else { 627 delete this.unrenderedFeatures[feature.id]; 628 }; 622 629 }, 623 630 branches/openlayers/2.7/lib/OpenLayers/Map.js
r7889 r8012 168 168 /** 169 169 * Property: controls 170 * {Array(<OpenLayers.Control>)} List of controls associated with the map 170 * {Array(<OpenLayers.Control>)} List of controls associated with the map. 171 * 172 * If not provided in the map options at construction, the map will 173 * be given the following controls by default: 174 * - <OpenLayers.Control.Navigation> 175 * - <OpenLayers.Control.PanZoom> 176 * - <OpenLayers.Control.ArgParser> 177 * - <OpenLayers.Control.Attribution> 171 178 */ 
