Changeset 3330
- Timestamp:
- 06/15/07 12:29:48 (1 year ago)
- Files:
-
- sandbox/tschaub/google/doc/authors.txt (modified) (1 diff)
- sandbox/tschaub/google/examples/debug.html (copied) (copied from trunk/openlayers/examples/debug.html)
- sandbox/tschaub/google/examples/example.html (modified) (2 diffs)
- sandbox/tschaub/google/examples/georss-markers.html (copied) (copied from trunk/openlayers/examples/georss-markers.html)
- sandbox/tschaub/google/examples/georss-serialize.html (modified) (2 diffs)
- sandbox/tschaub/google/examples/layerswitcher.html (copied) (copied from trunk/openlayers/examples/layerswitcher.html)
- sandbox/tschaub/google/examples/lite.html (modified) (1 diff)
- sandbox/tschaub/google/examples/outOfRangeMarkers.html (modified) (1 diff)
- sandbox/tschaub/google/examples/popups.html (modified) (2 diffs)
- sandbox/tschaub/google/examples/vector-features.html (modified) (3 diffs)
- sandbox/tschaub/google/examples/wkt.html (modified) (2 diffs)
- sandbox/tschaub/google/examples/wrapDateLine.html (copied) (copied from trunk/openlayers/examples/wrapDateLine.html)
- sandbox/tschaub/google/examples/yelp-georss.xml (copied) (copied from trunk/openlayers/examples/yelp-georss.xml)
- sandbox/tschaub/google/lib/Firebug (copied) (copied from trunk/openlayers/lib/Firebug)
- sandbox/tschaub/google/lib/Firebug/errorIcon.png (copied) (copied from trunk/openlayers/lib/Firebug/errorIcon.png)
- sandbox/tschaub/google/lib/Firebug/firebug.css (copied) (copied from trunk/openlayers/lib/Firebug/firebug.css)
- sandbox/tschaub/google/lib/Firebug/firebug.html (copied) (copied from trunk/openlayers/lib/Firebug/firebug.html)
- sandbox/tschaub/google/lib/Firebug/firebug.js (copied) (copied from trunk/openlayers/lib/Firebug/firebug.js)
- sandbox/tschaub/google/lib/Firebug/firebugx.js (copied) (copied from trunk/openlayers/lib/Firebug/firebugx.js)
- sandbox/tschaub/google/lib/Firebug/infoIcon.png (copied) (copied from trunk/openlayers/lib/Firebug/infoIcon.png)
- sandbox/tschaub/google/lib/Firebug/license.txt (copied) (copied from trunk/openlayers/lib/Firebug/license.txt)
- sandbox/tschaub/google/lib/Firebug/readme.txt (copied) (copied from trunk/openlayers/lib/Firebug/readme.txt)
- sandbox/tschaub/google/lib/Firebug/warningIcon.png (copied) (copied from trunk/openlayers/lib/Firebug/warningIcon.png)
- sandbox/tschaub/google/lib/OpenLayers.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Ajax.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/BaseTypes.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Console.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Console.js)
- sandbox/tschaub/google/lib/OpenLayers/Control.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Control/ArgParser.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Control/LayerSwitcher.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Control/OverviewMap.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Control/Panel.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Feature.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Feature/Vector.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Format/GeoRSS.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Format/WFS.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Format/WKT.js (modified) (9 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Geometry.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer.js (modified) (6 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/GeoRSS.js (modified) (3 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/Image.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/KaMap.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Layer/MapServer.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Layer/TMS.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Layer/Vector.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/WMS.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/WMS/Untiled.js (modified) (2 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Layer/WorldWind.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Map.js (modified) (6 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Popup.js (modified) (4 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Popup/AnchoredBubble.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Renderer/SVG.js (modified) (4 diffs)
- sandbox/tschaub/google/lib/OpenLayers/Renderer/VML.js (modified) (1 diff)
- sandbox/tschaub/google/lib/OpenLayers/Util.js (modified) (2 diffs)
- sandbox/tschaub/google/readme.txt (modified) (2 diffs)
- sandbox/tschaub/google/tests/BaseTypes/test_Bounds.html (modified) (1 diff)
- sandbox/tschaub/google/tests/BaseTypes/test_LonLat.html (modified) (1 diff)
- sandbox/tschaub/google/tests/Control/test_LayerSwitcher.html (modified) (2 diffs)
- sandbox/tschaub/google/tests/Format/test_GeoRSS.html (copied) (copied from trunk/openlayers/tests/Format/test_GeoRSS.html)
- sandbox/tschaub/google/tests/Format/test_WKT.html (modified) (3 diffs)
- sandbox/tschaub/google/tests/Layer/test_GeoRSS.html (modified) (3 diffs)
- sandbox/tschaub/google/tests/Layer/test_Grid.html (modified) (1 diff)
- sandbox/tschaub/google/tests/Layer/test_Image.html (modified) (1 diff)
- sandbox/tschaub/google/tests/Layer/test_Vector.html (modified) (4 diffs)
- sandbox/tschaub/google/tests/Layer/test_WMS.html (modified) (2 diffs)
- sandbox/tschaub/google/tests/Layer/test_WrapDateLine.html (copied) (copied from trunk/openlayers/tests/Layer/test_WrapDateLine.html)
- sandbox/tschaub/google/tests/Marker/test_Box.html (modified) (1 diff)
- sandbox/tschaub/google/tests/Tile/test_Image.html (modified) (3 diffs)
- sandbox/tschaub/google/tests/list-tests.html (modified) (5 diffs)
- sandbox/tschaub/google/tests/test_Console.html (copied) (copied from trunk/openlayers/tests/test_Console.html)
- sandbox/tschaub/google/tests/test_Map.html (modified) (5 diffs)
- sandbox/tschaub/google/tests/test_Popup.html (modified) (1 diff)
- sandbox/tschaub/google/tests/test_Util.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/tschaub/google/doc/authors.txt
r2948 r3330 2 2 Howard Butler 3 3 Bertil Chaupis 4 John Cole 4 5 Jeff Dege 5 6 Schuyler Erle sandbox/tschaub/google/examples/example.html
r1582 r3330 10 10 <script src="../lib/OpenLayers.js"></script> 11 11 <script type="text/javascript"> 12 13 12 14 <!-- 13 15 function init(){ 16 17 //set title name to include Browser Detection 18 // this is the only way to test the functionality 19 // of the getBrowserName() function 20 // 21 var header = OpenLayers.Util.getElement("browserHeader"); 22 header.innerHTML = "(browser: "; 23 var browserCode = OpenLayers.Util.getBrowserName(); 24 switch (browserCode) { 25 case "opera": 26 browserName = "Opera"; 27 break; 28 case "msie": 29 browserName = "Internet Explorer"; 30 break; 31 case "safari": 32 browserName = "Safari"; 33 break; 34 case "firefox": 35 browserName = "FireFox"; 36 break; 37 case "mozilla": 38 browserName = "Mozilla"; 39 break; 40 default: 41 browserName = "detection error" 42 break; 43 } 44 header.innerHTML += browserName + ")"; 45 14 46 var map = new OpenLayers.Map('map'); 15 47 … … 46 78 </head> 47 79 <body onload="init()"> 48 <h1>OpenLayers Example</h1> 80 <table><tr><td> 81 <h1>OpenLayers Example</h1> 82 </td><td> 83 <h3 id="browserHeader"></h3> 84 </td></tr></table> 49 85 <div id="map"></div> 50 86 </body> sandbox/tschaub/google/examples/georss-serialize.html
r2978 r3330 3 3 <style type="text/css"> 4 4 #map { 5 width: 512px;5 width: 45%; 6 6 height: 350px; 7 7 border: 1px solid gray; … … 43 43 <body onload="init()"> 44 44 <h1>OpenLayers Draw Point Example</h1> 45 <div style="float:right ">46 <textarea id="gml" cols="80" rows="30"></textarea>45 <div style="float:right;width:50%"> 46 <textarea id="gml" style="width:100%" rows="30"></textarea> 47 47 </div> 48 48 <div id="map"></div> sandbox/tschaub/google/examples/lite.html
r2978 r3330 19 19 map = new OpenLayers.Map( 'map' ); 20 20 layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 21 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 21 "http://labs.metacarta.com/wms/vmap0", 22 {layers: 'basic'} ); 22 23 map.addLayer(layer); 23 24 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); sandbox/tschaub/google/examples/outOfRangeMarkers.html
r3097 r3330 8 8 } 9 9 </style> 10 <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAKsGpqSOKkB-Ih2JopAmNbBTv_3ENzieGiNBMV02NiUJp8KZGIRTQWhul8K0wiNOHDxOF0-W2RmFoRg'></script> 10 <!-- this gmaps key generated for http://openlayers.org/dev/ --> 11 <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 12 <!-- Localhost key --> 13 <!-- <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>--> 14 11 15 <script src="../lib/OpenLayers.js"></script> 12 16 <script type="text/javascript"> sandbox/tschaub/google/examples/popups.html
r1704 r3330 48 48 new OpenLayers.LonLat(5,40), 49 49 new OpenLayers.Size(200,200), 50 "example popup" );50 "example popup", true); 51 51 52 52 map.addPopup(popup); … … 70 70 71 71 function mousedown(evt) { 72 // check to see if the popup was hidden by the close box 73 // if so, then destroy it before continuing 74 if (popup != null) { 75 if (!popup.visible()) { 76 markers.map.removePopup(popup); 77 popup.destroy(); 78 popup = null; 79 } 80 } 72 81 if (popup == null) { 73 popup = feature.createPopup( );82 popup = feature.createPopup(true); 74 83 popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>"); 75 84 popup.setBackgroundColor("yellow"); sandbox/tschaub/google/examples/vector-features.html
r3038 r3330 18 18 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 19 19 map.addLayer(layer); 20 21 var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); 22 style_blue.strokeColor = "blue"; 23 style_blue.fillColor = "blue"; 24 var style_green = { 25 strokeColor: "#00FF00", 26 strokeOpacity: 1, 27 strokeWidth: 3, 28 pointRadius: 6, 29 pointerEvents: "visiblePainted" 30 }; 31 20 32 var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry"); 21 33 22 34 // create a point feature 23 35 var point = new OpenLayers.Geometry.Point(-111.04, 45.68); 24 var pointFeature = new OpenLayers.Feature.Vector(point );36 var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue); 25 37 26 38 // create a line feature from a list of points … … 33 45 } 34 46 var lineFeature = new OpenLayers.Feature.Vector( 35 new OpenLayers.Geometry.LineString(pointList) );47 new OpenLayers.Geometry.LineString(pointList),null,style_green); 36 48 37 49 // create a polygon feature from a linear ring of points … … 60 72 <body onload="init()"> 61 73 <div id="map"></div> 74 <p>This example shows drawing simple vector features -- point, line, polygon 75 in different styles, created 'manually', by constructing the entire style 76 object, via 'copy', extending the default style object, and by 77 inheriting the default style from the layer.</p> 62 78 </body> 63 79 </html> sandbox/tschaub/google/examples/wkt.html
r3043 r3330 79 79 80 80 function displayWKT(feature) { 81 var str = wkt.write(feature .geometry);81 var str = wkt.write(feature); 82 82 // not a good idea in general, just for this demo 83 83 str = str.replace(/,/g, ', '); … … 87 87 function parseWKT() { 88 88 var element = document.getElementById('wkt'); 89 var collection= wkt.read(element.value);89 var features = wkt.read(element.value); 90 90 var bounds; 91 if( collection) {92 if( collection.constructor != Array) {93 collection = [collection];91 if(features) { 92 if(features.constructor != Array) { 93 features = [features]; 94 94 } 95 var features = []; 96 for(var i=0; i<collection.length; ++i) { 97 features.push(new OpenLayers.Feature.Vector(collection[i])); 95 for(var i=0; i<features.length; ++i) { 98 96 if (!bounds) { 99 bounds = collection[i].getBounds(); 97 bounds = features[i].geometry.getBounds(); 98 } else { 99 bounds.extend(features[i].geometry.getBounds()); 100 100 } 101 bounds.extend(collection[i].getBounds());102 101 103 102 } sandbox/tschaub/google/lib/OpenLayers.js
r3141 r3330 55 55 "OpenLayers/BaseTypes.js", 56 56 "OpenLayers/Util.js", 57 "OpenLayers/Console.js", 57 58 "Rico/Corner.js", 58 59 "Rico/Color.js", sandbox/tschaub/google/lib/OpenLayers/Ajax.js
r2803 r3330 212 212 this.transport.send(this.options.method == 'post' ? body : null); 213 213 214 /* Force Firefox to handle ready state 4 for synchronous requests */ 215 if (!this.options.asynchronous && this.transport.overrideMimeType) { 216 this.onStateChange(); 217 } 218 214 219 } catch (e) { 215 220 this.dispatchException(e); … … 297 302 298 303 dispatchException: function(exception) { 299 (this.options.onException || OpenLayers.Ajax.emptyFunction)(this, exception); 304 if (this.options.onException) { 305 this.options.onException(this, exception); 306 } else { 307 // if we get here, Responders.dispatch('onException') will never 308 // be called. too bad. we should probably take out the Responders 309 // stuff anyway. 310 throw exception; 311 } 300 312 OpenLayers.Ajax.Responders.dispatch('onException', this, exception); 301 313 } sandbox/tschaub/google/lib/OpenLayers/BaseTypes.js
r2943 r3330 32 32 // 33 33 // to be revisited in 3.0 34 // 35 if (arguments[i].hasOwnProperty('toString')) { 34 // 35 if((arguments[i].hasOwnProperty && arguments[i].hasOwnProperty('toString')) || 36 (!arguments[i].hasOwnProperty && arguments[i].toString)) { 36 37 proto.toString = arguments[i].toString; 37 38 } … … 297 298 } 298 299 return equals; 300 }, 301 302 /** 303 * @param {OpenLayers.Bounds} maxExtent 304 * 305 * @returns A copy of this lonlat, but wrapped around the "dateline" (as 306 * specified by the borders of maxExtent) 307 * @type OpenLayers.LonLat 308 */ 309 wrapDateLine: function(maxExtent) { 310 311 var newLonLat = this.clone(); 312 313 if (maxExtent) { 314 //shift right? 315 while (newLonLat.lon < maxExtent.left) { 316 newLonLat.lon += maxExtent.getWidth(); 317 } 318 319 //shift left? 320 while (newLonLat.lon > maxExtent.right) { 321 newLonLat.lon -= maxExtent.getWidth(); 322 } 323 } 324 325 return newLonLat; 299 326 }, 300 327 … … 666 693 }, 667 694 695 /** 696 * @param {OpenLayers.Bounds} maxExtent 697 * @param {Object} options 698 * @option {float} leftTolerance Allow for a margin of error with the 699 * 'left' value of this bound. 700 * Default is 0 701 * @option {float} rightTolerance Allow for a margin of error with the 702 * 'right' value of this bound. 703 * Default is 0 704 * 705 * @returns A copy of this bounds, but wrapped around the "dateline" (as 706 * specified by the borders of maxExtent). Note that this 707 * function only returns a different bounds value if this bounds 708 * is *entirely* outside of the maxExtent. If this bounds 709 * straddles the dateline (is part in/part out of maxExtent), 710 * the returned bounds will be merely a copy of this one. 711 * @type OpenLayers.Bounds 712 */ 713 wrapDateLine: function(maxExtent, options) { 714 options = options || new Object(); 715 716 var leftTolerance = options.leftTolerance || 0; 717 var rightTolerance = options.rightTolerance || 0; 718 719 var newBounds = this.clone(); 720 721 if (maxExtent) { 722 723 //shift right? 724 while ( newBounds.left < maxExtent.left && 725 (newBounds.right - rightTolerance) <= maxExtent.left ) { 726 newBounds = newBounds.add(maxExtent.getWidth(), 0); 727 } 728 729 //shift left? 730 while ( (newBounds.left + leftTolerance) >= maxExtent.right && 731 newBounds.right > maxExtent.right ) { 732 newBounds = newBounds.add(-maxExtent.getWidth(), 0); 733 } 734 } 735 736 return newBounds; 737 }, 738 668 739 /** @final @type String */ 669 740 CLASS_NAME: "OpenLayers.Bounds" sandbox/tschaub/google/lib/OpenLayers/Control.js
r2944 r3330 27 27 * Controls can have a 'type'. The type determines the type of interactions 28 28 * which are possible with them when they are placed into a toolbar. 29 * 29 30 * @type OpenLayers.Control.TYPES 30 31 */ … … 32 33 33 34 /** This property is used for CSS related to the drawing of the Control. 35 * 34 36 * @type string 35 37 */ 36 38 displayClass: "", 37 39 38 /** 39 * @type boolean 40 */ 40 /** @type boolean */ 41 41 active: null, 42 42 43 /** 44 * @type OpenLayers.Handler 45 */ 43 /** @type OpenLayers.Handler */ 46 44 handler: null, 47 45 … … 54 52 // We do this before the extend so that instances can override 55 53 // className in options. 56 this.displayClass = this.CLASS_NAME.replace("OpenLayers.", "ol").replace(".",""); 54 this.displayClass = 55 this.CLASS_NAME.replace("OpenLayers.", "ol").replace(".",""); 57 56 58 57 OpenLayers.Util.extend(this, options); sandbox/tschaub/google/lib/OpenLayers/Control/ArgParser.js
r1721 r3330 25 25 * @constructor 26 26 * 27 * @param {DOMElement} element 28 * @param {String} base 27 * @param {Object} options 29 28 */ 30 initialize: function( element, base) {29 initialize: function(options) { 31 30 OpenLayers.Control.prototype.initialize.apply(this, arguments); 32 31 }, sandbox/tschaub/google/lib/OpenLayers/Control/LayerSwitcher.js
r3068 r3330 100 100 101 101 // set mode to minimize 102 this.minimizeControl(); 103 102 if(!this.outsideViewport) { 103 this.minimizeControl(); 104 } 105 104 106 // populate div with current info 105 107 this.redraw(); sandbox/tschaub/google/lib/OpenLayers/Control/OverviewMap.js
r3070 r3330 181 181 OpenLayers.Event.stop(e); 182 182 }); 183 this.rectEvents = new OpenLayers.Events(this, this.extentRectangle); 183 this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, 184 null, true); 184 185 this.rectEvents.register('mouseout', this, this.rectMouseOut); 185 186 this.rectEvents.register('mousedown', this, this.rectMouseDown); … … 521 522 this.extentRectangle.style.top = parseInt(top) + 'px'; 522 523 this.extentRectangle.style.left = parseInt(left) + 'px'; 523 this.extentRectangle.style.height = parseInt( bottom - top)+ 'px';524 this.extentRectangle.style.width = parseInt( right - left) + 'px';524 this.extentRectangle.style.height = parseInt(Math.max(bottom - top, 0))+ 'px'; 525 this.extentRectangle.style.width = parseInt(Math.max(right - left, 0)) + 'px'; 525 526 }, 526 527 sandbox/tschaub/google/lib/OpenLayers/Control/Panel.js
r2978 r3330 104 104 control.trigger(); 105 105 return; 106 } 106 } 107 if (control.type == OpenLayers.Control.TYPE_TOGGLE) { 108 if (control.active) { 109 control.deactivate(); 110 } else { 111 control.activate(); 112 } 113 return; 114 } 107 115 for (var i = 0; i < this.controls.length; i++) { 108 116 if (this.controls[i] == control) { … … 130 138 // Access to this div is via the panel_div attribute of the 131 139 // control added to the panel. 140 // Also, stop mousedowns and clicks, but don't stop mouseup, 141 // since they need to pass through. 132 142 for (var i = 0; i < controls.length; i++) { 133 143 var element = document.createElement("div"); … … 138 148 OpenLayers.Event.observe(controls[i].panel_div, "mousedown", 139 149 OpenLayers.Event.stop.bindAsEventListener()); 140 OpenLayers.Event.observe(controls[i].panel_div, "mouseup",141 OpenLayers.Event.stop.bindAsEventListener());142 150 } 143 151 sandbox/tschaub/google/lib/OpenLayers/Feature.js
r2894 r3330 122 122 123 123 /** 124 * @param {Boolean} closeBox create popup with closebox or not 124 125 * @returns A Popup Object created from the 'lonlat', 'popupSize', 125 126 * and 'popupContentHTML' properties set in this.data. It uses … … 133 134 * @type OpenLayers.Popup.AnchoredBubble 134 135 */ 135 createPopup: function( ) {136 createPopup: function(closeBox) { 136 137 137 138 if (this.lonlat != null) { … … 144 145 this.data.popupSize, 145 146 this.data.popupContentHTML, 146 anchor );147 anchor, closeBox); 147 148 } 148 149 return this.popup; sandbox/tschaub/google/lib/OpenLayers/Feature/Vector.js
r3066 r3330 207 207 strokeOpacity: 1, 208 208 strokeWidth: 1, 209 strokeLinecap: "round", 209 210 hoverStrokeColor: "red", 210 211 hoverStrokeOpacity: 1, … … 223 224 strokeOpacity: 1, 224 225 strokeWidth: 2, 226 strokeLinecap: "round", 225 227 hoverStrokeColor: "red", 226 228 hoverStrokeOpacity: 1, … … 239 241 strokeColor: "yellow", 240 242 strokeOpacity: 1, 243 strokeLinecap: "round", 241 244 strokeWidth: 4, 242 245 hoverStrokeColor: "red", sandbox/tschaub/google/lib/OpenLayers/Format/GeoRSS.js
r2978 r3330 98 98 if (points) { 99 99 for (var i = 0; i < points.length; i++) { 100 path += points[i]. lat + " " + points[i].lon+ " ";100 path += points[i].y + " " + points[i].x + " "; 101 101 } 102 102 } else { 103 path += geometry. lat + " " + geometry.lon+ " ";103 path += geometry.y + " " + geometry.x + " "; 104 104 } 105 105 return document.createTextNode(path); sandbox/tschaub/google/lib/OpenLayers/Format/WFS.js
r2978 r3330 48 48 49 49 var transaction = document.createElementNS('http://www.opengis.net/wfs', 'wfs:Transaction'); 50 transaction.setAttribute("version","1.0.0"); 51 transaction.setAttribute("service","WFS"); 50 52 for (var i=0; i < features.length; i++) { 51 53 switch (features[i].state) { sandbox/tschaub/google/lib/OpenLayers/Format/WKT.js
r2978 r3330 26 26 27 27 /** 28 * Deserialize a WKT string and return an OpenLayers.Geometry or an array 29 * of OpenLayers.Geometry. Supports WKT for POINT, MULTIPOINT, LINESTRING, 30 * MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION. 28 * Deserialize a WKT string and return an OpenLayers.Feature.Vector or an 29 * array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT, 30 * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and 31 * GEOMETRYCOLLECTION. 31 32 * @param {String} wkt A WKT string 32 * @returns {OpenLayers.Geometry|Array} A geometry or array of geometries 33 * for GEOMETRYCOLLECTION WKT. 33 * @returns {OpenLayers.Feature.Vector|Array} A feature or array of 34 * features for 35 * GEOMETRYCOLLECTION WKT. 34 36 */ 35 37 read: function(wkt) { 36 var geometry, type, str;38 var features, type, str; 37 39 var matches = this.regExes.typeStr.exec(wkt); 38 40 if(matches) { … … 40 42 str = matches[2]; 41 43 if(this.parse[type]) { 42 geometry = this.parse[type].apply(this, [str]); 43 } 44 } 45 return geometry; 46 }, 47 48 /** 49 * Serialize a geometry or array of geometries into a WKT string. 50 * @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries 44 features = this.parse[type].apply(this, [str]); 45 } 46 } 47 return features; 48 }, 49 50 /** 51 * Serialize a feature or array of features into a WKT string. 52 * @param {OpenLayers.Feature.Vector|Array} features A feature or array of 53 * features 51 54 * @returns {String} The WKT string representation of the input geometries 52 55 */ 53 write: function( geom) {56 write: function(features) { 54 57 var collection, geometry, type, data, isCollection; 55 if( geom.constructor == Array) {56 collection = geom;58 if(features.constructor == Array) { 59 collection = features; 57 60 isCollection = true; 58 61 } else { 59 collection = [ geom];62 collection = [features]; 60 63 isCollection = false; 61 64 } … … 68 71 pieces.push(','); 69 72 } 70 geometry = collection[i] ;73 geometry = collection[i].geometry; 71 74 type = geometry.CLASS_NAME.split('.')[2].toLowerCase(); 72 75 if(!this.extract[type]) { … … 179 182 parse: { 180 183 /** 181 * Return point geometrygiven a point WKT fragment.184 * Return point feature given a point WKT fragment. 182 185 * @param {String} str A WKT fragment representing the point 183 * @returns {OpenLayers.Geometry.Point} A point geometry 186 * @returns {OpenLayers.Feature.Vector} A point feature 187 * @private 184 188 */ 185 189 'point': function(str) { 186 190 var coords = str.trim().split(this.regExes.spaces); 187 return new OpenLayers.Geometry.Point(coords[0], coords[1]); 188 }, 189 190 /** 191 * Return a multipoint geometry given a multipoint WKT fragment. 191 return new OpenLayers.Feature.Vector( 192 new OpenLayers.Geometry.Point(coords[0], coords[1]) 193 ); 194 }, 195 196 /** 197 * Return a multipoint feature given a multipoint WKT fragment. 192 198 * @param {String} A WKT fragment representing the multipoint 193 * @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry 199 * @returns {OpenLayers.Feature.Vector} A multipoint feature 200 * @private 194 201 */ 195 202 'multipoint': function(str) { … … 197 204 var components = []; 198 205 for(var i=0; i<points.length; ++i) { 199 components.push(this.parse.point.apply(this, [points[i]])); 200 } 201 return new OpenLayers.Geometry.MultiPoint(components); 206 components.push(this.parse.point.apply(this, [points[i]]).geometry); 207 } 208 return new OpenLayers.Feature.Vector( 209 new OpenLayers.Geometry.MultiPoint(components) 210 ); 202 211 }, 203 212 204 213 /** 205 * Return a linestring geometrygiven a linestring WKT fragment.214 * Return a linestring feature given a linestring WKT fragment. 206 215 * @param {String} A WKT fragment representing the linestring 207 * @returns {OpenLayers.Geometry.LineString} A linestring geometry 216 * @returns {OpenLayers.Feature.Vector} A linestring feature 217 * @private 208 218 */ 209 219 'linestring': function(str) { … … 211 221 var components = []; 212 222 for(var i=0; i<points.length; ++i) { 213 components.push(this.parse.point.apply(this, [points[i]])); 214 } 215 return new OpenLayers.Geometry.LineString(components); 216 }, 217 218 /** 219 * Return a multilinestring geometry given a multilinestring WKT fragment. 223 components.push(this.parse.point.apply(this, [points[i]]).geometry); 224 } 225 return new OpenLayers.Feature.Vector( 226 new OpenLayers.Geometry.LineString(components) 227 ); 228 },
