[OpenLayers-Commits] r11619 - in sandbox/cmoullet/openlayers: . build examples lib lib/Firebug lib/OpenLayers lib/OpenLayers/BaseTypes lib/OpenLayers/Control lib/OpenLayers/Format lib/OpenLayers/Geometry lib/OpenLayers/Handler lib/OpenLayers/Layer lib/OpenLayers/Layer/Google lib/OpenLayers/Protocol/WFS lib/OpenLayers/Renderer lib/OpenLayers/Strategy tests tests/Control tests/Format tests/Handler tests/Layer tests/Renderer tests/Strategy tests/node.js tests/speed tools

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Sat Mar 5 22:50:11 EST 2011


Author: cmoullet
Date: 2011-03-05 19:50:10 -0800 (Sat, 05 Mar 2011)
New Revision: 11619

Added:
   sandbox/cmoullet/openlayers/examples/game-accel-ball.html
   sandbox/cmoullet/openlayers/examples/multitouch.html
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js
   sandbox/cmoullet/openlayers/tests/Control/PinchZoom.html
   sandbox/cmoullet/openlayers/tests/Renderer/SVG2.html
   sandbox/cmoullet/openlayers/tests/node.js/
   sandbox/cmoullet/openlayers/tests/node.js/mockdom.js
   sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg
   sandbox/cmoullet/openlayers/tests/node.js/node.js
   sandbox/cmoullet/openlayers/tests/node.js/run-test.js
   sandbox/cmoullet/openlayers/tests/node.js/run.sh
   sandbox/cmoullet/openlayers/tests/speed/vector-renderers.html
   sandbox/cmoullet/openlayers/tests/speed/vector-renderers.js
Removed:
   sandbox/cmoullet/openlayers/tests/node.js/mockdom.js
   sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg
   sandbox/cmoullet/openlayers/tests/node.js/node.js
   sandbox/cmoullet/openlayers/tests/node.js/run-test.js
   sandbox/cmoullet/openlayers/tests/node.js/run.sh
Modified:
   sandbox/cmoullet/openlayers/
   sandbox/cmoullet/openlayers/build/mobile.cfg
   sandbox/cmoullet/openlayers/examples/bing.html
   sandbox/cmoullet/openlayers/examples/canvas.js
   sandbox/cmoullet/openlayers/examples/marker-shadow.html
   sandbox/cmoullet/openlayers/examples/mobile-base.js
   sandbox/cmoullet/openlayers/examples/mobile-jq.js
   sandbox/cmoullet/openlayers/examples/ordering.html
   sandbox/cmoullet/openlayers/examples/restricted-extent.html
   sandbox/cmoullet/openlayers/examples/snap-split.html
   sandbox/cmoullet/openlayers/examples/spherical-mercator.html
   sandbox/cmoullet/openlayers/examples/vector-features.html
   sandbox/cmoullet/openlayers/examples/wfs-states.js
   sandbox/cmoullet/openlayers/lib/Firebug/firebugx.js
   sandbox/cmoullet/openlayers/lib/OpenLayers.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Element.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Console.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Navigation.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Snapping.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Split.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Events.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GML.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GPX.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/Rectangle.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Pinch.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcGIS93Rest.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcIMS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/EventPane.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Google/v3.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapServer.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TMS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TileCache.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMTS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WorldWind.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Popup.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Projection.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Elements.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Util.js
   sandbox/cmoullet/openlayers/tests/Control/Measure.html
   sandbox/cmoullet/openlayers/tests/Control/Navigation.html
   sandbox/cmoullet/openlayers/tests/Events.html
   sandbox/cmoullet/openlayers/tests/Format/GeoRSS.html
   sandbox/cmoullet/openlayers/tests/Handler/Click.html
   sandbox/cmoullet/openlayers/tests/Handler/Path.html
   sandbox/cmoullet/openlayers/tests/Handler/Point.html
   sandbox/cmoullet/openlayers/tests/Handler/Polygon.html
   sandbox/cmoullet/openlayers/tests/Layer/Vector.html
   sandbox/cmoullet/openlayers/tests/Map.html
   sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html
   sandbox/cmoullet/openlayers/tests/list-tests.html
   sandbox/cmoullet/openlayers/tools/update_dev_dir.sh
Log:
Merge with trunk



Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11528
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11618

Modified: sandbox/cmoullet/openlayers/build/mobile.cfg
===================================================================
--- sandbox/cmoullet/openlayers/build/mobile.cfg	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/build/mobile.cfg	2011-03-06 03:50:10 UTC (rev 11619)
@@ -16,6 +16,7 @@
 OpenLayers/Control/SelectFeature.js
 OpenLayers/Layer/Vector.js
 OpenLayers/Renderer/SVG.js
+OpenLayers/Renderer/Canvas.js
 OpenLayers/Format/GeoJSON.js
 
 [exclude]

Modified: sandbox/cmoullet/openlayers/examples/bing.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/bing.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/bing.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -17,12 +17,10 @@
             // setting restrictedExtent so that we can use the 
             // VirtualEarth-layers, see e.g. 
             // http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/VirtualEarth-js.html
-            var restrictedExtent = new OpenLayers.Bounds(-20037508, -20037508, 
-                20037508, 20037508);
+            var restrictedExtent = new OpenLayers.Bounds(-180, -90, 
+                180, 90);
             
-            map = new OpenLayers.Map("map", {
-                restrictedExtent: restrictedExtent
-            });
+            map = new OpenLayers.Map("map");
             
             map.addControl(new OpenLayers.Control.LayerSwitcher());
 

Modified: sandbox/cmoullet/openlayers/examples/canvas.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/canvas.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/canvas.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -43,9 +43,9 @@
         protocol: new OpenLayers.Protocol.WFS({
             version: "1.1.0",
             srsName: "EPSG:900913",
-            url:  "http://demo.opengeo.org/geoserver/wfs",
+            url:  "http://v2.suite.opengeo.org/geoserver/wfs",
             featureType: "states",
-            featureNS: "http://www.openplans.org/topp"
+            featureNS: "http://usa.opengeo.org"
         }),
         styleMap: styleMap,
         renderers: ["Canvas", "SVG", "VML"]

Copied: sandbox/cmoullet/openlayers/examples/game-accel-ball.html (from rev 11617, trunk/openlayers/examples/game-accel-ball.html)
===================================================================
--- sandbox/cmoullet/openlayers/examples/game-accel-ball.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/examples/game-accel-ball.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,80 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
+    <meta name="apple-mobile-web-app-capable" content="yes" />
+    <title>OpenLayers Game: Bounce Ball</title>
+    <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <link rel="stylesheet" href="style.css" type="text/css" />
+    <script src="../lib/OpenLayers.js?mobile"></script>
+    <style type="text/css">
+      html, body { height: 100%; }
+      #shortdesc { display: none; }
+      #tags { display: none; }
+    </style>  
+
+    <script type="text/javascript">
+        var map, vlayer;
+        function adjustLocation(delta, feature) {
+            feature.geometry.move(delta.x, delta.y);
+            var me = map.maxExtent; 
+            var rad = 6;
+            if (feature.geometry.x > (me.right - rad)) { 
+                feature.geometry.x = me.right - rad;
+            } else if (feature.geometry.x < (me.left+rad)) {
+                feature.geometry.x = me.left+rad;
+            } 
+            if (feature.geometry.y > (me.top-rad)) {
+                feature.geometry.y = me.top-rad;
+            } else if (feature.geometry.y < (me.bottom+rad)) {
+                feature.geometry.y = me.bottom+rad;
+            }    
+            vlayer.drawFeature(feature);
+        }
+        function init() {
+            map = new OpenLayers.Map( 'map', 
+                {
+                 'maxExtent': new OpenLayers.Bounds(0, 0, $("map").clientWidth, $("map").clientHeight), 
+                 controls: [], 
+                 maxResolution: 'auto'} 
+            );
+            var layer = new OpenLayers.Layer("",
+                    {isBaseLayer: true} );
+            map.addLayer(layer);
+            map.zoomToMaxExtent();
+            vlayer = new OpenLayers.Layer.Vector();
+            var feature = new OpenLayers.Feature.Vector(
+                new OpenLayers.Geometry.Point(map.getCenter().lon, map.getCenter().lat));
+            vlayer.addFeatures(feature);    
+            map.addLayer(vlayer);
+            if (window.DeviceMotionEvent) {
+                window.addEventListener('devicemotion', function (evt) {
+                    var delta = null;
+                    if (typeof(evt.accelerationIncludingGravity) != 'undefined') {
+                        delta = {
+                            'x': evt.accelerationIncludingGravity.x * 3,
+                            'y': evt.accelerationIncludingGravity.y * 3,
+                            'z': evt.accelerationIncludingGravity.z
+                        }    
+                    }
+                    adjustLocation(delta, feature);
+                }, true);    
+            } else {
+                alert("This demo does not work on your browser.");
+            }    
+        }
+    </script>
+  </head>
+  <body onload="init()">
+    <h1 id="title">Accelerometer Example</h1>
+    <div id="tags">
+      mobile, game
+    </div>  
+    <div id="shortdesc">Simple acceleration demo; roll a vector feature around
+    on a map. (Only tested on iOS 4.)</div>
+
+    <div id="map" width="100%" height="100%" style="background-color: grey"></div>
+    <div id="docs">
+      Demo works best when device is locked in portrait mode. 
+    </div>
+  </body>
+</html>

Modified: sandbox/cmoullet/openlayers/examples/marker-shadow.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/marker-shadow.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/marker-shadow.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -33,6 +33,10 @@
         function init() {
             map = new OpenLayers.Map("map");
             
+            // allow testing of specific renderers via "?renderer=Canvas", etc
+            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
             layer = new OpenLayers.Layer.Vector(
                 "Marker Drop Shadows",
                 {
@@ -55,7 +59,8 @@
                         pointRadius: 10
                     }),
                     isBaseLayer: true,
-                    rendererOptions: {yOrdering: true}
+                    rendererOptions: {yOrdering: true},
+                    renderers: renderer
                 }
             );
             

Modified: sandbox/cmoullet/openlayers/examples/mobile-base.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-base.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/mobile-base.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -68,9 +68,10 @@
                 transitionEffect: 'resize'
             }), 
             vector
-        ]
+        ],
+        center: new OpenLayers.LonLat(0, 0),
+        zoom: 1
     });
-    map.zoomToMaxExtent();
 
     var style = {
         fillOpacity: 0.1,

Modified: sandbox/cmoullet/openlayers/examples/mobile-jq.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-jq.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/mobile-jq.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -47,10 +47,11 @@
 
     var sprintersLayer = new OpenLayers.Layer.Vector("Sprinters", {
         styleMap: new OpenLayers.StyleMap({
-            externalGraphic : "img/mobile-loc.png",
-            graphicOpacity : 1.0,
-            graphicWith:16,
-            graphicHeight:26
+            externalGraphic: "img/mobile-loc.png",
+            graphicOpacity: 1.0,
+            graphicWith: 16,
+            graphicHeight: 26,
+            graphicYOffset: -26
         })
     });
     

Copied: sandbox/cmoullet/openlayers/examples/multitouch.html (from rev 11617, trunk/openlayers/examples/multitouch.html)
===================================================================
--- sandbox/cmoullet/openlayers/examples/multitouch.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/examples/multitouch.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,26 @@
+<html>
+  <head>
+   <title>Multitouch Test</title>
+  </head>
+  <body>
+   <div style="width:80%; height: 80%; border: 1px solid black; font-size: 5em;" id="box">
+   </div>
+   Touch inside the box. On a touch enabled browser, you will get the number
+   of detected touch events. If the box is red, your browser does not support
+   touch events.
+  <script>
+    var box = document.getElementById("box");
+    box.addEventListener("touchstart", function(evt) {
+        box.innerHTML = evt.touches.length;
+        evt.preventDefault();
+    });    
+    box.addEventListener("touchmove", function(evt) {
+        box.innerHTML = evt.touches.length;
+        evt.preventDefault();
+    });    
+    if (!(typeof box.ontouchstart != 'undefined')) { 
+        box.style.backgroundColor = "red";
+    }    
+  </script>
+  </body>
+</html>  

Modified: sandbox/cmoullet/openlayers/examples/ordering.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/ordering.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/ordering.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -32,6 +32,10 @@
         function initYOrderMap() {
             var map = new OpenLayers.Map("yorder");
             
+            // allow testing of specific renderers via "?renderer=Canvas", etc
+            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
             var layer = new OpenLayers.Layer.Vector(
                 "Y-Order",
                 {
@@ -41,7 +45,8 @@
                         graphicZIndex: GOLD_Z_INDEX
                     }),
                     isBaseLayer: true,
-                    rendererOptions: {yOrdering: true}
+                    rendererOptions: {yOrdering: true},
+                    renderers: renderer
                 }
             );
             

Modified: sandbox/cmoullet/openlayers/examples/restricted-extent.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/restricted-extent.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/restricted-extent.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -9,7 +9,7 @@
     <script src="../lib/OpenLayers.js"></script>
     <script type="text/javascript">
         var map = null;
-        var extent = new OpenLayers.Bounds(-180, -90, 180, 90);
+        var extent = new OpenLayers.Bounds(8, 44.5, 19, 50);
 
         function init() {
             var options = {
@@ -24,7 +24,7 @@
             ); 
 
             map.addLayers([wms]);
-            map.setCenter(extent, 1);
+            map.zoomToExtent(extent);
             document.getElementById("toggle").checked = true;
         }
         
@@ -68,8 +68,8 @@
         <input type="checkbox" id="toggle" checked="checked"
                onclick="toggleRestrictedExtent();" />
         <label for="toggle">
-            Toggle restricted extent (to [-180, -90, 180, 90]).
+            Toggle restricted extent (to [8, 44.5, 19, 50]).
         </label>
     
   </body>
-</html>
+</html>
\ No newline at end of file

Modified: sandbox/cmoullet/openlayers/examples/snap-split.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/snap-split.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/snap-split.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -92,6 +92,10 @@
                 })
             });
 
+            // allow testing of specific renderers via "?renderer=Canvas", etc
+            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
             // create three vector layers
             vectors = new OpenLayers.Layer.Vector("Lines", {
                 isBaseLayer: true,
@@ -103,7 +107,8 @@
                 styleMap: styles,
                 maxExtent: new OpenLayers.Bounds(
                     1549471.9221, 6403610.94, 1550001.32545, 6404015.8
-                )
+                ),
+                renderers: renderer
             });
             map.addLayer(vectors);
             

Modified: sandbox/cmoullet/openlayers/examples/spherical-mercator.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/spherical-mercator.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/spherical-mercator.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -32,7 +32,7 @@
 
 function init(){
     var maxExtent = new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
-        restrictedExtent = maxExtent.clone(-20037508, -20037508, 20037508, 20037508),
+        restrictedExtent = maxExtent.clone(),
         maxResolution = 156543.0339;
     
     var options = {

Modified: sandbox/cmoullet/openlayers/examples/vector-features.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/vector-features.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/vector-features.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -16,6 +16,10 @@
                     "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
             map.addLayer(layer);
 
+            // allow testing of specific renderers via "?renderer=Canvas", etc
+            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
             /*
              * Layer style
              */
@@ -68,7 +72,10 @@
             // graphicTitle only works in Firefox and Internet Explorer
             style_mark.graphicTitle = "this is a test tooltip";
 
-            var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {style: layer_style});
+            var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {
+                style: layer_style,
+                renderers: renderer
+            });
 
             // create a point feature
             var point = new OpenLayers.Geometry.Point(-111.04, 45.68);

Modified: sandbox/cmoullet/openlayers/examples/wfs-states.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/wfs-states.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/examples/wfs-states.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -10,13 +10,18 @@
     );
     map.addLayer(base);
 
+    // allow testing of specific renderers via "?renderer=Canvas", etc
+    var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+    renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
     var wfs = new OpenLayers.Layer.Vector("States", {
         strategies: [new OpenLayers.Strategy.BBOX()],
         protocol: new OpenLayers.Protocol.WFS({
             url: "http://demo.opengeo.org/geoserver/wfs",
             featureType: "states",
             featureNS: "http://www.openplans.org/topp"
-        })
+        }),
+        renderers: renderer
     });
     map.addLayer(wfs);
 

Modified: sandbox/cmoullet/openlayers/lib/Firebug/firebugx.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/Firebug/firebugx.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/Firebug/firebugx.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1,9 +1,10 @@
+(function() {
+    if (!window.console || !console.firebug) {
+        var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
+        "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
 
-if (!window.console || !console.firebug) {
-    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
-    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
-
-    window.console = {};
-    for (var i = 0; i < names.length; ++i)
-        window.console[names[i]] = function() {}
-}
+        window.console = {};
+        for (var i = 0; i < names.length; ++i)
+            window.console[names[i]] = function() {}
+    }
+})();

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -260,7 +260,7 @@
      *          Default is center.
      *
      * Returns:
-     * {<OpenLayers.Bound>} A new bounds that is scaled by ratio
+     * {<OpenLayers.Bounds>} A new bounds that is scaled by ratio
      *                      from origin.
      */
 
@@ -560,6 +560,8 @@
      * Parameters:
      * maxExtent - {<OpenLayers.Bounds>}
      * options - {Object} Some possible options are:
+     *
+     * Allowed Options:
      *                    leftTolerance - {float} Allow for a margin of error 
      *                                            with the 'left' value of this 
      *                                            bound.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Element.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Element.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Element.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -45,12 +45,16 @@
 
     /**
      * APIFunction: hide
-     * Hide element(s) passed in
+     * *Deprecated*. Hide element(s) passed in
      * 
      * Parameters:
      * element - {DOMElement} Actually user can pass any number of elements
      */
     hide: function() {
+        OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", {
+            newMethod: "element.style.display = 'none';"
+        }));
+
         for (var i=0, len=arguments.length; i<len; i++) {
             var element = OpenLayers.Util.getElement(arguments[i]);
             if (element) {
@@ -61,12 +65,16 @@
 
     /**
      * APIFunction: show
-     * Show element(s) passed in
+     * *Deprecated*. Show element(s) passed in
      * 
      * Parameters:
      * element - {DOMElement} Actually user can pass any number of elements
      */
     show: function() {
+        OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", {
+            newMethod: "element.style.display = '';"
+        }));
+
         for (var i=0, len=arguments.length; i<len; i++) {
             var element = OpenLayers.Util.getElement(arguments[i]);
             if (element) {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -25,7 +25,7 @@
      * 
      * Parameters:
      * str - {String} The string to test.
-     * sub - {Sring} The substring to look for.
+     * sub - {String} The substring to look for.
      *  
      * Returns:
      * {Boolean} The first string starts with the second.
@@ -204,7 +204,7 @@
      * *Deprecated*. Whether or not a string starts with another string. 
      * 
      * Parameters:
-     * sStart - {Sring} The string we're testing for.
+     * sStart - {String} The string we're testing for.
      *  
      * Returns:
      * {Boolean} Whether or not this string starts with the string passed in.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Console.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Console.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Console.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -101,7 +101,7 @@
      * Expects a single error message
      * 
      * Parameters:
-     * object - {Object}
+     * error - {Object}
      */
     userError: function(error) {
         alert(error);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -54,16 +54,6 @@
      */
     displayProjection: null, 
 
-    /**
-     * Constructor: OpenLayers.Control.ArgParser
-     *
-     * Parameters:
-     * options - {Object}
-     */
-    initialize: function(options) {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-    },
-
     getParameters: function(url) {
         url = url || window.location.href;
         var parameters = OpenLayers.Util.getParameters(url);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -24,16 +24,6 @@
      */
     separator: ", ",
     
-    /**
-     * Constructor: OpenLayers.Control.Attribution 
-     * 
-     * Parameters:
-     * options - {Object} Options for control.
-     */
-    initialize: function(options) {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-    },
-
     /** 
      * Method: destroy
      * Destroy control.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -33,13 +33,6 @@
      * Pixels to slide by.
      */
     slideFactor: 75,
-
-    /**
-     * Constructor: OpenLayers.Control.KeyboardDefaults
-     */
-    initialize: function() {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-    },
     
     /**
      * APIMethod: destroy

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -82,16 +82,6 @@
     displayProjection: null, 
     
     /**
-     * Constructor: OpenLayers.Control.MousePosition
-     * 
-     * Parameters:
-     * options - {Object} Options for control.
-     */
-    initialize: function(options) {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
-    },
-
-    /**
      * Method: destroy
      */
      destroy: function() {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Navigation.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Navigation.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Navigation.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -32,7 +32,7 @@
     dragPan: null,
 
     /**
-     * APIProprety: dragPanOptions
+     * APIProperty: dragPanOptions
      * {Object} Options passed to the DragPan control.
      */
     dragPanOptions: null,
@@ -163,6 +163,7 @@
         }
 
         var clickCallbacks = { 
+            'click': this.defaultClick,
             'dblclick': this.defaultDblClick, 
             'dblrightclick': this.defaultDblRightClick 
         };
@@ -190,6 +191,18 @@
     },
 
     /**
+     * Method: defaultClick
+     *
+     * Parameters:
+     * evt - {Event}
+     */
+    defaultClick: function (evt) {
+        if (evt.lastTouches && evt.lastTouches.length == 2) {
+            this.map.zoomOut();
+        }
+    },
+
+    /**
      * Method: defaultDblClick 
      * 
      * Parameters:

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -85,13 +85,6 @@
     zoomStart: null,
 
     /**
-     * Constructor: OpenLayers.Control.PanZoomBar
-     */ 
-    initialize: function() {
-        OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
-    },
-
-    /**
      * APIMethod: destroy
      */
     destroy: function() {

Copied: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js (from rev 11617, trunk/openlayers/lib/OpenLayers/Control/PinchZoom.js)
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,192 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Handler/Pinch.js
+ */
+
+/**
+ * Class: OpenLayers.Control.PinchZoom
+ *
+ * Inherits:
+ *  - <OpenLayers.Control>
+ */
+OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
+
+    /** 
+     * Property: type
+     * {OpenLayers.Control.TYPES}
+     */
+    type: OpenLayers.Control.TYPE_TOOL,
+
+    /**
+     * Property: containerOrigin
+     * {Object} Cached object representing the layer container origin (in pixels).
+     */
+    containerOrigin: null,
+
+    /**
+     * Property: pinchOrigin
+     * {Object} Cached object representing the pinch start (in pixels).
+     */
+    pinchOrigin: null,    
+    
+    /**
+     * Property: currentCenter
+     * {Object} Cached object representing the latest pinch center (in pixels).
+     */
+    currentCenter: null,    
+
+    /**
+     * APIProperty: autoActivate
+     * {Boolean} Activate the control when it is added to a map.  Default is
+     *     true.
+     */
+    autoActivate: true,
+    
+    /**
+     * Constructor: OpenLayers.Control.PinchZoom
+     * Create a control for zooming with pinch gestures.  This works on devices
+     *     with multi-touch support.
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *                    the control
+     */
+    initialize: function(options) {
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+        this.handler = new OpenLayers.Handler.Pinch(this, {
+            start: this.pinchStart,
+            move: this.pinchMove,
+            done: this.pinchDone
+        }, this.handlerOptions);
+    },
+    
+    /**
+     * APIMethod: activate
+     * Activate this control.  Must be called after the control is added to a 
+     * map.
+     *
+     * Returns:
+     * {Boolean} The control was successfully activated.
+     */
+    activate: function() {
+        var activated = OpenLayers.Control.prototype.activate.apply(this,arguments);
+        if (activated) {
+            this.map.events.on({
+                moveend: this.updateContainerOrigin,
+                scope: this
+            });
+            this.updateContainerOrigin();
+        }
+        return activated;
+    },
+
+    /**
+     * APIMethod: deactivate
+     * Deactivate this control.
+     *
+     * Returns:
+     * {Boolean} The control was successfully deactivated.
+     */
+    deactivate: function() {
+        var deactivated = OpenLayers.Control.prototype.deactivate.apply(this,arguments);
+        if (this.map && this.map.events) {
+            this.map.events.un({
+                moveend: this.updateContainerOrigin,
+                scope: this
+            });
+        }
+        return deactivated;
+    },
+    
+    /**
+     * Method: updateContainerOrigin
+     * Must be called each time the layer container origin changes.
+     */
+    updateContainerOrigin: function() {
+        var container = this.map.layerContainerDiv;
+        this.containerOrigin = {
+            x: parseInt(container.style.left, 10),
+            y: parseInt(container.style.top, 10)
+        };
+    },
+
+    /**
+     * Method: pinchStart
+     *
+     * Parameters:
+     * evt - {Event}
+     * pinchData - {Object} pinch data object related to the current touchmove
+     *     of the pinch gesture. This give us the current scale of the pinch.
+     */
+    pinchStart: function(evt, pinchData) {
+        this.pinchOrigin = evt.xy;
+    },
+    
+    /**
+     * Method: pinchMove
+     *
+     * Parameters:
+     * evt - {Event}
+     * pinchData - {Object} pinch data object related to the current touchmove
+     *     of the pinch gesture. This give us the current scale of the pinch.
+     */
+    pinchMove: function(evt, pinchData) {
+        var scale = pinchData.scale;
+        var containerOrigin = this.containerOrigin;
+        var pinchOrigin = this.pinchOrigin;
+        var current = evt.xy;
+
+        var dx = Math.round((current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
+        var dy = Math.round((current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
+
+        this.applyTransform(
+            "translate(" + dx + "px, " + dy + "px) scale(" + scale + ")"
+        );
+        this.currentCenter = current;
+    },
+    
+    /**
+     * Method: applyTransform
+     * Applies the given transform to layers.
+     */
+    applyTransform: function(transform) {
+        var style = this.map.layerContainerDiv.style;
+        style['-webkit-transform'] = transform;
+        style['-moz-transform'] = transform;
+    },
+    
+    /**
+     * Method: pinchDone
+     *
+     * Parameters:
+     * evt - {Event}
+     * start - {Object} pinch data object related to the touchstart event that
+     *     started the pinch gesture.
+     * last - {Object} pinch data object related to the last touchmove event
+     *     of the pinch gesture. This give us the final scale of the pinch.
+     */
+    pinchDone: function(evt, start, last) {
+        var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
+        var resolution = this.map.getResolutionForZoom(zoom);
+
+        var location = this.map.getLonLatFromPixel(this.pinchOrigin);
+        var zoomPixel = this.currentCenter;        
+        var size = this.map.getSize();
+        
+        location.lon += resolution * ((size.w / 2) - zoomPixel.x);
+        location.lat -= resolution * ((size.h / 2) - zoomPixel.y);
+
+        this.map.setCenter(location, zoom);
+
+        var style = this.map.layerContainerDiv.style;
+        style['-webkit-transform'] = "";
+        style['-moz-transform'] = "";
+    },
+
+    CLASS_NAME: "OpenLayers.Control.PinchZoom"
+
+});

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -73,18 +73,6 @@
     geodesic: false,
 
     /**
-     * Constructor: OpenLayers.Control.ScaleLine
-     * Create a new scale line control.
-     * 
-     * Parameters:
-     * options - {Object} An optional object whose properties will be used
-     *     to extend the control.
-     */
-    initialize: function(options) {
-        OpenLayers.Control.prototype.initialize.apply(this, [options]);     
-    },
-
-    /**
      * Method: draw
      * 
      * Returns:

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -132,7 +132,7 @@
     
     /**
      * Property: layers
-     * {Array(<OpenLayers.Layer.Vector>} The layers this control will work on,
+     * {Array(<OpenLayers.Layer.Vector>)} The layers this control will work on,
      * or null if the control was configured with a single layer
      */
     layers: null,

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Snapping.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Snapping.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Snapping.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -372,7 +372,7 @@
      * Method: considerSnapping
      *
      * Parameters:
-     * point - {<OpenLayers.Geometry.Point}} The vertex to be snapped (or
+     * point - {<OpenLayers.Geometry.Point>} The vertex to be snapped (or
      *     unsnapped).
      * loc - {<OpenLayers.Geometry.Point>} The location of the mouse in map
      *     coords.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Split.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Split.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Split.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -297,7 +297,7 @@
      * Remove a feature from a list based on the given geometry.
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>} A list of features.
+     * features - {Array(<OpenLayers.Feature.Vector>)} A list of features.
      * geometry - {<OpenLayers.Geometry>} A geometry.
      */
     removeByGeometry: function(features, geometry) {
@@ -340,7 +340,7 @@
      *     will be split if eligible.
      *
      * Parameters:
-     * feature - {<OpenLayers.Feature.Vector}} The newly created or modified
+     * feature - {<OpenLayers.Feature.Vector>} The newly created or modified
      *     feature.
      *
      * Returns:

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -5,14 +5,15 @@
 
 /**
  * @requires OpenLayers/Control/DragPan.js
+ * @requires OpenLayers/Control/PinchZoom.js
  * @requires OpenLayers/Handler/Click.js
  */
 
 /**
  * Class: OpenLayers.Control.TouchNavigation
  * The navigation control handles map browsing with touch events (dragging,
- *     double-tapping, and tap with two fingers).  Create a new navigation
- *     control with the <OpenLayers.Control.TouchNavigation> control.
+ *     double-tapping, tap with two fingers, and pinch zoom).  Create a new 
+ *     control with the <OpenLayers.Control.TouchNavigation> constructor.
  *
  * Inherits:
  *  - <OpenLayers.Control>
@@ -26,12 +27,24 @@
     dragPan: null,
 
     /**
-     * APIProprety: dragPanOptions
+     * APIProperty: dragPanOptions
      * {Object} Options passed to the DragPan control.
      */
     dragPanOptions: null,
 
     /**
+     * Property: pinchZoom
+     * {<OpenLayers.Control.PinchZoom>}
+     */
+    pinchZoom: null,
+
+    /**
+     * APIProperty: pinchZoomOptions
+     * {Object} Options passed to the PinchZoom control.
+     */
+    pinchZoomOptions: null,
+
+    /**
      * APIProperty: documentDrag
      * {Boolean} Allow panning of the map by dragging outside map viewport.
      *     Default is false.
@@ -70,6 +83,10 @@
             this.dragPan.destroy();
         }
         this.dragPan = null;
+        if (this.pinchZoom) {
+            this.pinchZoom.destroy();
+            delete this.pinchZoom;
+        }
         OpenLayers.Control.prototype.destroy.apply(this,arguments);
     },
 
@@ -80,6 +97,7 @@
         if(OpenLayers.Control.prototype.activate.apply(this,arguments)) {
             this.dragPan.activate();
             this.handlers.click.activate();
+            this.pinchZoom.activate();
             return true;
         }
         return false;
@@ -92,11 +110,12 @@
         if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)) {
             this.dragPan.deactivate();
             this.handlers.click.deactivate();
+            this.pinchZoom.deactivate();
             return true;
         }
         return false;
     },
-
+    
     /**
      * Method: draw
      */
@@ -119,6 +138,9 @@
             }, this.dragPanOptions)
         );
         this.dragPan.draw();
+        this.pinchZoom = new OpenLayers.Control.PinchZoom(
+            OpenLayers.Util.extend({map: this.map}, this.pinchZoomOptions)
+        );
     },
 
     /**

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -71,13 +71,14 @@
     map: null,
 
     /** 
-     * Property: div 
-     * {DOMElement} 
+     * APIProperty: div 
+     * {DOMElement} The element that contains the control, if not present the 
+     *     control is placed inside the map.
      */
     div: null,
 
     /** 
-     * Property: type 
+     * APIProperty: type 
      * {Number} Controls can have a 'type'. The type determines the type of
      * interactions which are possible with them when they are placed in an
      * <OpenLayers.Control.Panel>. 
@@ -101,7 +102,7 @@
     displayClass: "",
     
     /**
-    * Property: title  
+    * APIProperty: title  
     * {string}  This property is used for showing a tooltip over the  
     * Control.  
     */ 
@@ -136,9 +137,9 @@
     eventListeners: null,
 
     /** 
-     * Property: events
-     * {<OpenLayers.Events>} Events instance for triggering control specific
-     *     events.
+     * APIProperty: events
+     * {<OpenLayers.Events>} Events instance for listeners and triggering
+     *     control specific events.
      */
     events: null,
 
@@ -296,7 +297,7 @@
     },
 
     /**
-     * Method: activate
+     * APIMethod: activate
      * Explicitly activates a control and it's associated
      * handler if one has been set.  Controls can be
      * deactivated by calling the deactivate() method.
@@ -324,7 +325,7 @@
     },
     
     /**
-     * Method: deactivate
+     * APIMethod: deactivate
      * Deactivates a control and it's associated handler if any.  The exact
      * effect of this depends on the control itself.
      * 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Events.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Events.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Events.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -604,6 +604,9 @@
      * events.register("loadstart", object, loadStartListener);
      * events.register("loadstart", object, loadEndListener);
      * (end)
+     *
+     * Parameters:
+     *  object - {Object}     
      */
     on: function(object) {
         for(var type in object) {
@@ -821,10 +824,20 @@
             // noone's listening, bail out
             return;
         }
-        // add clientX & clientY to all events - only corresponds to the first touch
-        if (evt.touches && evt.touches[0]) {
-            evt.clientX = evt.touches[0].clientX;
-            evt.clientY = evt.touches[0].clientY;
+        // add clientX & clientY to all events - corresponds to average x, y
+        var touches = evt.touches;
+        if (touches && touches[0]) {
+            var x = 0;
+            var y = 0;
+            var num = touches.length;
+            var touch;
+            for (var i=0; i<num; ++i) {
+                touch = touches[i];
+                x += touch.clientX;
+                y += touch.clientY;
+            }
+            evt.clientX = x / num;
+            evt.clientY = y / num;
         }
         if (this.includeXY) {
             evt.xy = this.getMousePosition(evt);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GML.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GML.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GML.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -582,7 +582,7 @@
      * Method: parseAttributes
      *
      * Parameters:
-     * node - {<DOMElement>}
+     * node - {DOMElement}
      *
      * Returns:
      * {Object} An attributes object.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GPX.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GPX.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GPX.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -134,7 +134,7 @@
     * Method: extractSegment
     *
     * Parameters:
-    * segment - {<DOMElement>} a trkseg or rte node to parse
+    * segment - {DOMElement} a trkseg or rte node to parse
     * segmentType - {String} nodeName of waypoints that form the line
     *
     * Returns:

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -253,7 +253,7 @@
         var eles = this.getElementsByTagNameNS(node, nsuri, name);
         if(eles && eles[0] && eles[0].firstChild
             && eles[0].firstChild.nodeValue) {
-            value = eles[0].firstChild.nodeValue;
+            value = OpenLayers.Format.XML.prototype.getChildValue(eles[0]);
         } else {
             value = (def == undefined) ? "" : def;
         }
@@ -263,12 +263,12 @@
     /**
      * APIMethod: read
      * Return a list of features from a GeoRSS doc
-     
+     *
      * Parameters:
-     * data - {Element} 
+     * doc - {Element} 
      *
      * Returns:
-     * An Array of <OpenLayers.Feature.Vector>s
+     * {Array(<OpenLayers.Feature.Vector>)}
      */
     read: function(doc) {
         if (typeof doc == "string") { 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1125,7 +1125,7 @@
      * Accept Feature Collection, and return a string. 
      * 
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>} An array of features.
+     * features - {Array(<OpenLayers.Feature.Vector>)} An array of features.
      *
      * Returns:
      * {String} A KML string.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/Rectangle.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/Rectangle.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/Rectangle.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -50,7 +50,7 @@
      * Constructor: OpenLayers.Geometry.Rectangle
      * 
      * Parameters:
-     * points - {Array(<OpenLayers.Geometry.Point>}
+     * points - {Array(<OpenLayers.Geometry.Point>)}
      */
     initialize: function(x, y, width, height) {
         OpenLayers.Geometry.prototype.initialize.apply(this, arguments);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -126,7 +126,7 @@
      */
     initialize: function(control, callbacks, options) {
         OpenLayers.Handler.prototype.initialize.apply(this, arguments);
-        // optionally register for mouseup and mousedown
+        // optionally register for mousedown
         if(this.pixelTolerance != null) {
             this.mousedown = function(evt) {
                 this.down = this.getEventInfo(evt);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -223,12 +223,12 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mousedown: function(evt) {
+    down: function(evt) {
         var stopDown = this.stopDown;
         if(this.freehandMode(evt)) {
             stopDown = true;
         }
-        if(!this.lastDown || !this.lastDown.equals(evt.xy)) {
+        if (!this.touch && (!this.lastDown || !this.passesTolerance(this.lastDown, evt.xy, this.pixelTolerance))) {
             this.modifyFeature(evt.xy, !!this.lastUp);
         }
         this.mouseDown = true;
@@ -248,7 +248,7 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mousemove: function (evt) {
+    move: function (evt) {
         if(this.stoppedDown && this.freehandMode(evt)) {
             if(this.persist) {
                 this.destroyPersistedFeature();
@@ -256,7 +256,7 @@
             this.addPoint(evt.xy);
             return false;
         }
-        if(!this.mouseDown || this.stoppedDown) {
+        if (!this.touch && (!this.mouseDown || this.stoppedDown)) {
             this.modifyFeature(evt.xy, !!this.lastUp);
         }
         return true;
@@ -273,13 +273,17 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mouseup: function (evt) {
-        if(this.mouseDown && (!this.lastUp || !this.lastUp.equals(evt.xy))) {
+    up: function (evt) {
+        if (this.mouseDown && (!this.lastUp || !this.passesTolerance(
+                this.lastUp, evt.xy, this.dblclickTolerance))) {
             if(this.stoppedDown && this.freehandMode(evt)) {
                 this.removePoint();
                 this.finalize();
             } else {
-                if(this.lastDown.equals(evt.xy)) {
+                if (this.passesTolerance(this.lastDown, evt.xy, this.pixelTolerance)) {
+                    if (this.touch) {
+                        this.modifyFeature(evt.xy);
+                    }
                     if(this.lastUp == null && this.persist) {
                         this.destroyPersistedFeature();
                     }
@@ -290,10 +294,18 @@
         }
         this.stoppedDown = this.stopDown;
         this.mouseDown = false;
-        return !this.stopUp;
+        return !this.stopUp && !this.isDblclick;
     },
 
     /**
+     * Method: finishTouchGeometry
+     * Finish the geometry and send it back to the control.
+     */
+    finishTouchGeometry: function() {
+        this.finishGeometry();
+    },
+
+    /**
      * APIMethod: finishGeometry
      * Finish the geometry and send it back to the control.
      */

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Pinch.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Pinch.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Pinch.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -120,13 +120,15 @@
      * {Boolean} Let the event propagate.
      */
     touchmove: function(evt) {
+        var propagate = true;
         if (this.started && OpenLayers.Event.isMultiTouch(evt)) {
             this.pinching = true;
             var current = this.getPinchData(evt);
             this.callback("move", [evt, current]);
             this.last = current;
+            propagate = false;
         }
-        return true;
+        return propagate;
     },
 
     /**
@@ -140,14 +142,16 @@
      * {Boolean} Let the event propagate.
      */
     touchend: function(evt) {
+        var propagate = true;
         if (this.started) {
             this.started = false;
             this.pinching = false;
             this.callback("done", [evt, this.start, this.last]);
             this.start = null;
             this.last = null;
+            propagate = false;
         }
-        return true;
+        return propagate;
     },
 
     /**

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -95,8 +95,51 @@
      * {Object} Any optional properties to be set on the sketch layer.
      */
     layerOptions: null,
+    
+    /**
+     * APIProperty: pixelTolerance
+     * {Number} Maximum number of pixels between mouseup and mousedown for an
+     *     event to be considered a click.  Default is 5.  If set to an
+     *     integer value, clicks with a drag greater than the value will be
+     *     ignored.  This property can only be set when the handler is
+     *     constructed.
+     */
+    pixelTolerance: 5,
 
     /**
+     * APIProperty: dblclickTolerance
+     * {Number} Maximum number of pixels between two touchend for an
+     *     event to be considered a dblclick.  Default is 20.
+     */
+    dblclickTolerance: 20,
+
+    /**
+     * Property: touch
+     * {Boolean} Indcates the support of touch events.
+     */
+    touch: false,
+
+    /**
+     * Property: timerId
+     * {Integer} The timer used to test the double touch.
+     */
+    timerId: null,
+
+    /**
+     * Property: last
+     * {<OpenLayers.Pixel>} The last pixel used to know the distance between
+     * two touches (for double touch).
+     */
+    last: null,
+
+    /**
+     * Property: dblclick
+     * {Boolean} The current event is a dblclick.
+     */
+    isDblclick: false,
+    
+    
+    /**
      * Constructor: OpenLayers.Handler.Point
      * Create a new point handler.
      *
@@ -214,6 +257,14 @@
     },
 
     /**
+     * Method: finishTouchGeometry
+     * Finish the geometry and send it back to the control.
+     */
+    finishTouchGeometry: function() {
+        this.finalize();
+    },
+    
+    /**
      * Method: finalize
      * Finish the geometry and call the "done" callback.
      *
@@ -333,6 +384,127 @@
         var geom = this.getGeometry();
         return geom && geom.clone();
     },
+
+    /**
+     * Method: mousedown
+     * Handle mousedown.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    mousedown: function(evt) {
+        if (this.touch) {
+            return;
+        }
+        return this.down(evt);
+    },
+
+    /**
+     * Method: touchstart
+     * Handle touchstart.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    touchstart: function(evt) {
+        this.touch = true;
+
+        var last = this.last;
+        this.last = evt.xy;
+
+        if (this.timerId &&
+                this.passesTolerance(last, evt.xy, this.dblclickTolerance)) {
+            this.isDblclick = true;
+            // a valid touch immediately adds a component and leaves us with a
+            // complete geometry
+            this.finishTouchGeometry();
+            window.clearTimeout(this.timerId);
+            this.timerId = null;
+            return false;
+        }
+        else {
+            if (this.timerId) {
+                window.clearTimeout(this.timerId);
+                this.timerId = null;
+            }
+            this.isDblclick = false;
+            this.timerId = window.setTimeout(
+                OpenLayers.Function.bind(function() {
+                    this.timerId = null;
+                }, this), 300);
+            return this.down(evt);
+        }
+    },
+
+    /**
+     * Method: mousemove
+     * Handle mousemove.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    mousemove: function(evt) {
+        if (this.touch) {
+            return;
+        }
+        return this.move(evt);
+    },
+
+    /**
+     * Method: touchmove
+     * Handle touchmove.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    touchmove: function(evt) {
+        this.last = evt.xy;
+        return this.move(evt);
+    },
+
+    /**
+     * Method: mouseup
+     * Handle mouseup.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    mouseup: function(evt) {
+        if (this.touch) {
+            return;
+        }
+        return this.up(evt);
+    },
+
+    /**
+     * Method: touchend
+     * Handle touchend.
+     * 
+     * Parameters:
+     * evt - {Event} The browser event
+     *
+     * Returns: 
+     * {Boolean} Allow event propagation
+     */
+    touchend: function(evt) {
+        evt.xy = this.last;
+        return this.up(evt);
+    },
   
     /**
      * Method: mousedown
@@ -345,10 +517,12 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mousedown: function(evt) {
+    down: function(evt) {
         this.mouseDown = true;
         this.lastDown = evt.xy;
-        this.modifyFeature(evt.xy);
+        if (!this.touch) {
+            this.modifyFeature(evt.xy);
+        }
         this.stoppedDown = this.stopDown;
         return !this.stopDown;
     },
@@ -364,8 +538,8 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mousemove: function (evt) {
-        if(!this.mouseDown || this.stoppedDown) {
+    move: function (evt) {
+        if(!this.touch && (!this.mouseDown || this.stoppedDown)) {
             this.modifyFeature(evt.xy);
         }
         return true;
@@ -382,18 +556,24 @@
      * Returns: 
      * {Boolean} Allow event propagation
      */
-    mouseup: function (evt) {
+    up: function (evt) {
         this.mouseDown = false;
         this.stoppedDown = this.stopDown;
+
         // check keyboard modifiers
         if(!this.checkModifiers(evt)) {
             return true;
         }
         // ignore double-clicks
-        if(this.lastUp && this.lastUp.equals(evt.xy)) {
+        if (this.lastUp && this.passesTolerance(this.lastUp, evt.xy,
+                                                    this.dblclickTolerance)) {
             return true;
         }
-        if(this.lastDown && this.lastDown.equals(evt.xy)) {
+        if (this.lastDown && this.passesTolerance(this.lastDown, evt.xy,
+                                                    this.pixelTolerance)) {
+            if (this.touch) {
+                this.modifyFeature(evt.xy);
+            }
             if(this.persist) {
                 this.destroyPersistedFeature();
             }
@@ -420,5 +600,28 @@
         }
     },
 
+    /**
+     * Method: passesTolerance
+     * Determine whether the event is within the optional pixel tolerance.
+     * Note that the pixel tolerance check only works if mousedown events get
+     * to the listeners registered here.  If they are stopped by other
+     * elements, <pixelTolerance> and <dblclickTolerance> will have no effect
+     * here (this method will always return true).
+     *
+     * Returns:
+     * {Boolean} The click is within the pixel tolerance (if specified).
+     */
+    passesTolerance: function(pixel1, pixel2, tolerance) {
+        var passes = true;
+
+        if (tolerance != null && pixel1 && pixel2) {
+            var dist = pixel1.distanceTo(pixel2);
+            if (dist > tolerance) {
+                passes = false;
+            }
+        }
+        return passes;
+    },
+    
     CLASS_NAME: "OpenLayers.Handler.Point"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -148,8 +148,19 @@
             point.y = last.y;
         }
     },
-    
+
     /**
+     * Method: finishTouchGeometry
+     * Finish the geometry and send it back to the control.
+     */
+    finishTouchGeometry: function() {
+        var index = this.line.geometry.components.length - 2;
+        this.line.geometry.removeComponent(this.line.geometry.components[index]);
+        this.removePoint();
+        this.finalize();
+    },
+
+    /**
      * Method: finalizeInteriorRing
      * Enforces that new ring has some area and doesn't contain vertices of any
      *     other rings.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcGIS93Rest.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcGIS93Rest.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcGIS93Rest.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -232,22 +232,5 @@
                                                              newArguments);
     },
 
-    /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div. 
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
-
-    
     CLASS_NAME: "OpenLayers.Layer.ArcGIS93Rest"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcIMS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcIMS.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/ArcIMS.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -445,22 +445,5 @@
         return obj;
     },
     
-    /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div. 
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added image tile.
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(
-            this, position, bounds, null, this.tileSize
-        );
-    },
-    
     CLASS_NAME: "OpenLayers.Layer.ArcIMS"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/EventPane.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/EventPane.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/EventPane.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -211,6 +211,24 @@
         OpenLayers.Layer.prototype.setZIndex.apply(this, arguments);
         this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
     },
+    
+    /**
+     * Method: moveByPx
+     * Move the layer based on pixel vector. To be implemented by subclasses.
+     *
+     * Parameters:
+     * dx - {Number} The x coord of the displacement vector.
+     * dy - {Number} The y coord of the displacement vector.
+     */
+    moveByPx: function(dx, dy) {
+        OpenLayers.Layer.prototype.moveByPx.apply(this, arguments);
+        
+        if (this.dragPanMapObject) {
+            this.dragPanMapObject(dx, -dy);
+        } else {
+            this.moveTo(this.map.getCachedCenter());
+        }
+    },
 
     /**
      * Method: moveTo
@@ -240,7 +258,7 @@
                 if ( !(newCenter.equals(oldCenter)) || 
                      !(newZoom == oldZoom) ) {
 
-                    if (dragging && this.dragPanMapObject && 
+                    if (!zoomChanged && oldCenter && this.dragPanMapObject && 
                         this.smoothDragPan) {
                         var oldPx = this.map.getViewPortPxFromLonLat(oldCenter);
                         var newPx = this.map.getViewPortPxFromLonLat(newCenter);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Google/v3.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Google/v3.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Google/v3.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -181,15 +181,16 @@
         if (this.visibility) {
             google.maps.event.trigger(this.mapObject, "resize");
         } else {
-            if (!this._resized) {
+            var cache = OpenLayers.Layer.Google.cache[this.map.id];
+            if (!cache.resized) {
                 var layer = this;
                 google.maps.event.addListenerOnce(this.mapObject, "tilesloaded", function() {
-                    delete layer._resized;
                     google.maps.event.trigger(layer.mapObject, "resize");
                     layer.moveTo(layer.map.getCenter(), layer.map.getZoom());
+                    delete cache.resized;
                 });
             }
-            this._resized = true;
+            cache.resized = true;
         }
     },
 
@@ -202,7 +203,7 @@
      */
     setGMapVisibility: function(visible) {
         var cache = OpenLayers.Layer.Google.cache[this.map.id];
-        if (cache) {
+        if (cache && !cache.resized) {
             var type = this.type;
             var layers = this.map.layers;
             var layer;

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -251,19 +251,37 @@
                 if (forceReTile || !tilesBounds.containsBounds(bounds, true)) {
                     this.initGriddedTiles(bounds);
                 } else {
-                    // we might have to shift our buffer tiles, schedule
-                    // that
-                    if (this.timerId != null) {
-                        window.clearTimeout(this.timerId);
-                    }
-                    this.timerId = window.setTimeout(
-                        this._moveGriddedTiles,
-                        this.tileLoadingDelay
-                    );
+                    this.scheduleMoveGriddedTiles();
                 }
             }
         }
     },
+
+    /**
+     * Method: moveByPx
+     * Move the layer based on pixel vector.
+     *
+     * Parameters:
+     * dx - {Number}
+     * dy - {Number}
+     */
+    moveByPx: function(dx, dy) {
+        this.scheduleMoveGriddedTiles();
+    },
+
+    /**
+     * Method: scheduleMoveGriddedTiles
+     * Schedule the move of tiles.
+     */
+    scheduleMoveGriddedTiles: function() {
+        if (this.timerId != null) {
+            window.clearTimeout(this.timerId);
+        }
+        this.timerId = window.setTimeout(
+            this._moveGriddedTiles,
+            this.tileLoadingDelay
+        );
+    },
     
     /**
      * APIMethod: setTileSize
@@ -611,9 +629,7 @@
 
     /**
      * APIMethod: addTile
-     * Gives subclasses of Grid the opportunity to create an 
-     * OpenLayer.Tile of their choosing. The implementer should initialize 
-     * the new tile and take whatever steps necessary to display it.
+     * Create a tile, initialize it, and add it to the layer div. 
      *
      * Parameters
      * bounds - {<OpenLayers.Bounds>}
@@ -623,7 +639,8 @@
      * {<OpenLayers.Tile>} The added OpenLayers.Tile
      */
     addTile:function(bounds, position) {
-        // Should be implemented by subclasses
+        return new OpenLayers.Tile.Image(this, position, bounds, null, 
+                                         this.tileSize, this.tileOptions);
     },
     
     /** 
@@ -682,7 +699,9 @@
         var shifted = true;
         var buffer = this.buffer || 1;
         var tlLayer = this.grid[0][0].position;
-        var tlViewPort = this.map.getViewPortPxFromLayerPx(tlLayer);
+        var offsetX = parseInt(this.map.layerContainerDiv.style.left);
+        var offsetY = parseInt(this.map.layerContainerDiv.style.top);
+        tlViewPort = tlLayer.add(offsetX, offsetY);
         if (tlViewPort.x > -this.tileSize.w * (buffer - 1)) {
             this.shiftColumn(true);
         } else if (tlViewPort.x < -this.tileSize.w * buffer) {
@@ -779,7 +798,7 @@
      * 
      * Parameters:
      * rows - {Integer} Maximum number of rows we want our grid to have.
-     * colums - {Integer} Maximum number of columns we want our grid to have.
+     * columns - {Integer} Maximum number of columns we want our grid to have.
      */
     removeExcessTiles: function(rows, columns) {
         

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/KaMap.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -94,22 +94,6 @@
                       });
     },
 
-    /**
-     * Method: addTile
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>}
-     */    
-    addTile:function(bounds,position) {
-        var url = this.getURL(bounds);
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                             url, this.tileSize);
-    },
-
     /** 
      * Method: calculateGridLayout
      * ka-Map uses the center point of the map as an origin for 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapGuide.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -234,22 +234,6 @@
     },
 
     /**
-     * Method: addTile
-     * Creates a tile, initializes it, and adds it to the layer div. 
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
-
-    /**
      * Method: getURL
      * Return a query string for this layer
      *

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapServer.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapServer.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/MapServer.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -76,22 +76,6 @@
 
         return obj;
     },
-
-    /**
-     * Method: addTile
-     * Creates a tile, initializes it, and adds it to the layer div. 
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
     
     /**
      * Method: getURL

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TMS.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TMS.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -131,22 +131,6 @@
         return url + path;
     },
 
-    /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div. 
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
-
     /** 
      * APIMethod: setMap
      * When the layer is added to a map, then we can fetch our origin 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TileCache.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/TileCache.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -144,23 +144,6 @@
         url = (url.charAt(url.length - 1) == '/') ? url : url + '/';
         return url + path;
     },
-
-    /**
-     * Method: addTile
-     * Create a tile, initialize it, and add it to the layer div. 
-     *
-     * Parameters: 
-     * bounds - {<OpenLayers.Bounds>} 
-     * position - {<OpenLayers.Pixel>}
-     *
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added <OpenLayers.Tile.Image>
-     */
-    addTile:function(bounds, position) {
-        var url = this.getURL(bounds);
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                             url, this.tileSize);
-    },
     
     CLASS_NAME: "OpenLayers.Layer.TileCache"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -472,34 +472,38 @@
     moveTo: function(bounds, zoomChanged, dragging) {
         OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
         
-        var coordSysUnchanged = true;
+        var ng = (this.renderer instanceof OpenLayers.Renderer.NG);
+        if (ng) {
+            zoomChanged && this.renderer.updateDimensions();
+        } else {
+            var coordSysUnchanged = true;
 
-        if (!dragging) {
-            this.renderer.root.style.visibility = "hidden";
+            if (!dragging) {
+                this.renderer.root.style.visibility = "hidden";
             
-            this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
-            this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
-            var extent = this.map.getExtent();
-            coordSysUnchanged = this.renderer.setExtent(extent, zoomChanged);
+                this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
+                this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
+                var extent = this.map.getExtent();
+                coordSysUnchanged = this.renderer.setExtent(extent, zoomChanged);
             
-            this.renderer.root.style.visibility = "visible";
+                this.renderer.root.style.visibility = "visible";
 
-            // Force a reflow on gecko based browsers to prevent jump/flicker.
-            // This seems to happen on only certain configurations; it was originally
-            // noticed in FF 2.0 and Linux.
-            if (OpenLayers.IS_GECKO === true) {
-                this.div.scrollLeft = this.div.scrollLeft;
-            }
+                // Force a reflow on gecko based browsers to prevent jump/flicker.
+                // This seems to happen on only certain configurations; it was originally
+                // noticed in FF 2.0 and Linux.
+                if (OpenLayers.IS_GECKO === true) {
+                    this.div.scrollLeft = this.div.scrollLeft;
+                }
             
-            if(!zoomChanged && coordSysUnchanged) {
-                for(var i in this.unrenderedFeatures) {
-                    var feature = this.unrenderedFeatures[i];
-                    this.drawFeature(feature);
+                if(!zoomChanged && coordSysUnchanged) {
+                    for(var i in this.unrenderedFeatures) {
+                        var feature = this.unrenderedFeatures[i];
+                        this.drawFeature(feature);
+                    }
                 }
             }
         }
-        
-        if (!this.drawn || zoomChanged || !coordSysUnchanged) {
+        if (!this.drawn || (!ng && (zoomChanged || !coordSysUnchanged))) {
             this.drawn = true;
             var feature;
             for(var i=0, len=this.features.length; i<len; i++) {
@@ -510,6 +514,20 @@
         }    
     },
     
+    /**
+     * APIMethod: redraw
+     * Redraws the layer.  Returns true if the layer was redrawn, false if not.
+     *
+     * Returns:
+     * {Boolean} The layer was redrawn.
+     */
+    redraw: function() {
+        if (this.renderer instanceof OpenLayers.Renderer.NG) {
+            this.drawn = false;
+        }
+        return OpenLayers.Layer.prototype.redraw.apply(this, arguments);
+    },
+    
     /** 
      * APIMethod: display
      * Hide or show the Layer

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -203,22 +203,6 @@
     },
 
     /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div. 
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize, this.tileOptions);
-    },
-
-    /**
      * APIMethod: mergeNewParams
      * Catch changeParams and uppercase the new params to be merged in
      *     before calling changeParams on the super class.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMTS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMTS.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMTS.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -456,21 +456,5 @@
         }
     },
 
-    /**
-     * Method: addTile
-     * Create a tile, initialize it, and add it to the layer div. 
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile: function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
-
     CLASS_NAME: "OpenLayers.Layer.WMTS"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WorldWind.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WorldWind.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WorldWind.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -59,20 +59,6 @@
             this.params, this.DEFAULT_PARAMS
         );
     },
-    /**
-     * Method: addTile
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                             null, this.tileSize);
-    },
 
     /**
      * Method: getZoom

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -151,22 +151,6 @@
         return {'x': x, 'y': y, 'z': z};
     },
     
-    /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div. 
-     * 
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     * 
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds, 
-                                         null, this.tileSize);
-    },
-     
     /* APIMethod: setMap
      * When the layer is added to a map, then we can fetch our origin 
      *    (if we don't have one.) 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Zoomify.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -239,22 +239,6 @@
     },
 
     /**
-     * Method: addTile
-     * addTile creates a tile, initializes it, and adds it to the layer div.
-     *
-     * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
-     * position - {<OpenLayers.Pixel>}
-     *
-     * Returns:
-     * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
-     */
-    addTile:function(bounds,position) {
-        return new OpenLayers.Tile.Image(this, position, bounds,
-                                         null, this.tileSize);
-    },
-
-    /**
      * APIMethod: setMap
      * When the layer is added to a map, then we can fetch our origin
      *    (if we don't have one.)

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -556,7 +556,7 @@
      * Method: moveTo
      * 
      * Parameters:
-     * bound - {<OpenLayers.Bounds>}
+     * bounds - {<OpenLayers.Bounds>}
      * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
      *     do some init work in that case.
      * dragging - {Boolean}
@@ -570,6 +570,17 @@
     },
 
     /**
+     * Method: moveByPx
+     * Move the layer based on pixel vector. To be implemented by subclasses.
+     *
+     * Parameters:
+     * dx - {Number} The x coord of the displacement vector.
+     * dy - {Number} The y coord of the displacement vector.
+     */
+    moveByPx: function(dx, dy) {
+    },
+
+    /**
      * Method: setMap
      * Set the map property for the layer. This is done through an accessor
      *     so that subclasses can override this and take special action once 
@@ -704,7 +715,7 @@
      *     subverted.
      * 
      * Parameters:
-     * visible - {Boolean} Whether or not to display the layer (if in range)
+     * visibility - {Boolean} Whether or not to display the layer (if in range)
      */
     setVisibility: function(visibility) {
         if (visibility != this.visibility) {
@@ -1068,7 +1079,7 @@
      * APIMethod: getZoomForExtent
      * 
      * Parameters:
-     * bounds - {<OpenLayers.Bounds>}
+     * extent - {<OpenLayers.Bounds>}
      * closest - {Boolean} Find the zoom level that most closely fits the 
      *     specified bounds. Note that this may result in a zoom that does 
      *     not exactly contain the entire extent.
@@ -1201,22 +1212,17 @@
      */
     getLonLatFromViewPortPx: function (viewPortPx) {
         var lonlat = null;
-        if (viewPortPx != null) {
-            var size = this.map.getSize();
-            var center = this.map.getCenter();
-            if (center) {
-                var res  = this.map.getResolution();
-        
-                var delta_x = viewPortPx.x - (size.w / 2);
-                var delta_y = viewPortPx.y - (size.h / 2);
-            
-                lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
-                                             center.lat - delta_y * res); 
+        var map = this.map;
+        if (viewPortPx != null && map.minPx) {
+            var res = map.getResolution();
+            var maxExtent = map.getMaxExtent({restricted: true});
+            var lon = (viewPortPx.x - map.minPx.x) * res + maxExtent.left;
+            var lat = (map.minPx.y - viewPortPx.y) * res + maxExtent.top;
+            lonlat = new OpenLayers.LonLat(lon, lat);
 
-                if (this.wrapDateLine) {
-                    lonlat = lonlat.wrapDateLine(this.maxExtent);
-                }
-            } // else { DEBUG STATEMENT }
+            if (this.wrapDateLine) {
+                lonlat = lonlat.wrapDateLine(this.maxExtent);
+            }
         }
         return lonlat;
     },

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -416,6 +416,23 @@
     paddingForPopups : null,
     
     /**
+     * Property: minPx
+     * {<OpenLayers.Pixel>} Lower left of maxExtent in viewport pixel space.
+     *     Used to verify in moveByPx that the new location we're moving to
+     *     is valid. It is also used in the getLonLatFromViewPortPx function
+     *     of Layer.
+     */
+    minPx: null,
+    
+    /**
+     * Property: maxPx
+     * {<OpenLayers.Pixel>} Top right of maxExtent in viewport pixel space.
+     *     Used to verify in moveByPx that the new location we're moving to
+     *     is valid.
+     */
+    maxPx: null,
+    
+    /**
      * Constructor: OpenLayers.Map
      * Constructor for a new OpenLayers.Map instance.  There are two possible
      *     ways to call the map constructor.  See the examples below.
@@ -722,7 +739,13 @@
      * options - {Object} Hashtable of options to tag to the map
      */
     setOptions: function(options) {
+        var updatePxExtent = this.minPx &&
+            options.restrictedExtent != this.restrictedExtent;
         OpenLayers.Util.extend(this, options);
+        // force recalculation of minPx and maxPx
+        updatePxExtent && this.moveTo(this.getCachedCenter(), this.zoom, {
+            forceZoomChange: true
+        });
     },
 
     /**
@@ -1140,7 +1163,7 @@
             if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
 
                 // preserve center and scale when changing base layers
-                var center = this.getCenter();
+                var center = this.getCachedCenter();
                 var newResolution = OpenLayers.Util.getResolutionFromScale(
                     this.getScale(), newBaseLayer.units
                 );
@@ -1402,7 +1425,7 @@
                     this.layers[i].onMapResize();                
                 }
     
-                var center = this.getCenter();
+                var center = this.getCachedCenter();
     
                 if (this.baseLayer != null && center != null) {
                     var zoom = this.getZoom();
@@ -1453,7 +1476,7 @@
         var extent = null;
         
         if (center == null) {
-            center = this.getCenter();
+            center = this.getCachedCenter();
         }                
         if (resolution == null) {
             resolution = this.getResolution();
@@ -1493,12 +1516,27 @@
      */
     getCenter: function () {
         var center = null;
-        if (this.center) {
-            center = this.center.clone();
+        var cachedCenter = this.getCachedCenter();
+        if (cachedCenter) {
+            center = cachedCenter.clone();
         }
         return center;
     },
 
+    /**
+     * Method: getCachedCenter
+     *
+     * Returns:
+     * {<OpenLayers.LonLat>}
+     */
+    getCachedCenter: function() {
+        if (!this.center && this.size) {
+            this.center = this.getLonLatFromViewPortPx(
+                new OpenLayers.Pixel(this.size.w / 2, this.size.h / 2)
+            );
+        }
+        return this.center;
+    },
 
     /**
      * APIMethod: getZoom
@@ -1527,22 +1565,30 @@
             animate: true,
             dragging: false
         });
-        // getCenter
-        var centerPx = this.getViewPortPxFromLonLat(this.getCenter());
+        if (options.dragging) {
+            if (dx != 0 || dy != 0) {
+                this.moveByPx(dx, dy);
+            }
+        } else {
+            // if we don't have a center, we were using moveByPx previously
+            var forceSetCenter = !this.center;
+            
+            // getCenter
+            var centerPx = this.getViewPortPxFromLonLat(this.getCachedCenter());
 
-        // adjust
-        var newCenterPx = centerPx.add(dx, dy);
-        
-        // only call setCenter if not dragging or there has been a change
-        if (!options.dragging || !newCenterPx.equals(centerPx)) {
-            var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx);
-            if (options.animate) {
-                this.panTo(newCenterLonLat);
-            } else {
-                this.setCenter(newCenterLonLat, null, options.dragging);
-            }    
-        }
+            // adjust
+            var newCenterPx = centerPx.add(dx, dy);
 
+            if (forceSetCenter || !newCenterPx.equals(centerPx)) {
+                var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx);
+                if (options.animate) {
+                    this.panTo(newCenterLonLat);
+                } else {
+                    this.setCenter(newCenterLonLat, null, options.dragging);
+                }    
+            }
+        }        
+
    },
    
    /** 
@@ -1551,14 +1597,14 @@
      * If the new lonlat is in the current extent the map will slide smoothly
      * 
      * Parameters:
-     * lonlat - {<OpenLayers.Lonlat>}
+     * lonlat - {<OpenLayers.LonLat>}
      */
     panTo: function(lonlat) {
         if (this.panMethod && this.getExtent().scale(this.panRatio).containsLonLat(lonlat)) {
             if (!this.panTween) {
                 this.panTween = new OpenLayers.Tween(this.panMethod);
             }
-            var center = this.getCenter();
+            var center = this.getCachedCenter();
 
             // center will not change, don't do nothing
             if (lonlat.lon == center.lon &&
@@ -1566,31 +1612,25 @@
                 return;
             }
 
-            var from = {
-                lon: center.lon,
-                lat: center.lat
-            };
-            var to = {
-                lon: lonlat.lon,
-                lat: lonlat.lat
-            };
-            this.panTween.start(from, to, this.panDuration, {
+            var from = this.getPixelFromLonLat(center);
+            var to = this.getPixelFromLonLat(lonlat);
+            var vector = { x: to.x - from.x, y: to.y - from.y };
+            var last = { x: 0, y: 0 };
+
+            this.panTween.start( { x: 0, y: 0 }, vector, this.panDuration, {
                 callbacks: {
-                    start: OpenLayers.Function.bind(function(lonlat) {
+                    start: OpenLayers.Function.bind(function() {
                         this.events.triggerEvent("movestart");
                     }, this),
-                    eachStep: OpenLayers.Function.bind(function(lonlat) {
-                        lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
-                        this.moveTo(lonlat, this.zoom, {
-                            'dragging': true,
-                            'noEvent': true
-                        });
+                    eachStep: OpenLayers.Function.bind(function(px) {
+                        var x = px.x - last.x,
+                            y = px.y - last.y;
+                        this.moveByPx(x, y);
+                        last.x = Math.round(px.x);
+                        last.y = Math.round(px.y);
                     }, this),
-                    done: OpenLayers.Function.bind(function(lonlat) {
-                        lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
-                        this.moveTo(lonlat, this.zoom, {
-                            'noEvent': true
-                        });
+                    done: OpenLayers.Function.bind(function(px) {
+                        this.moveTo(lonlat, this.zoom, {noEvent: true});
                         this.events.triggerEvent("moveend");
                     }, this)
                 }
@@ -1621,6 +1661,71 @@
             'caller': 'setCenter'
         });
     },
+    
+    /** 
+     * Method: moveByPx
+     * Drag the map by pixels.
+     *
+     * Parameters:
+     * dx - {Number}
+     * dy - {Number}
+     */
+    moveByPx: function(dx, dy) {
+        dx = Math.round(dx);
+        dy = Math.round(dy);
+        var hw = this.size.w / 2;
+        var hh = this.size.h / 2;
+        var x = hw + dx;
+        var y = hh + dy;
+        var wrapDateLine = this.baseLayer.wrapDateLine;
+        var xRestriction = yRestriction = 0;
+        if (this.restrictedExtent) {
+            xRestriction = hw;
+            yRestriction = hh;
+            // wrapping the date line makes no sense for restricted extents
+            wrapDateLine = false;
+        }
+        var valid = y <= this.maxPx.y - yRestriction &&
+                    y >= this.minPx.y + yRestriction;
+        var minX = this.minPx.x, maxX = this.maxPx.x;
+        if (!wrapDateLine) {
+            valid = valid &&
+                    x <= this.maxPx.x - xRestriction &&
+                    x >= this.minPx.x + xRestriction;
+        }
+        if (valid) {
+            this.center = null;
+            if (dx) {
+                this.layerContainerDiv.style.left =
+                    parseInt(this.layerContainerDiv.style.left) - dx + "px";
+                this.minPx.x -= dx;
+                this.maxPx.x -= dx;
+                if (wrapDateLine) {
+                    if (this.maxPx.x > maxX) {
+                        this.maxPx.x -= (maxX - minX);
+                    };
+                    if (this.minPx.x < minX) {
+                        this.minPx.x += (maxX - minX);
+                    };
+                }
+            }
+            if (dy) {
+                this.layerContainerDiv.style.top =
+                    parseInt(this.layerContainerDiv.style.top) - dy + "px";
+                this.minPx.y -= dy;
+                this.maxPx.y -= dy;
+            }
+            var layer, i, len;
+            for (i=0, len=this.layers.length; i<len; ++i) {
+                layer = this.layers[i];
+                if (layer.visibility) {
+                    layer.moveByPx(dx, dy);
+                    layer.events.triggerEvent("move");
+                }
+            }
+            this.events.triggerEvent("move");
+        }
+    },
 
     /**
      * Method: moveTo
@@ -1651,14 +1756,14 @@
             this.panTween.stop();
         }    
              
-        if (!this.center && !this.isValidLonLat(lonlat)) {
+        if (!this.getCachedCenter() && !this.isValidLonLat(lonlat)) {
             lonlat = this.maxExtent.getCenterLonLat();
         }
 
         if(this.restrictedExtent != null) {
             // In 3.0, decide if we want to change interpretation of maxExtent.
             if(lonlat == null) { 
-                lonlat = this.getCenter(); 
+                lonlat = this.center; 
             }
             if(zoom == null) { 
                 zoom = this.getZoom(); 
@@ -1705,7 +1810,7 @@
             }
 
             if (centerChanged) {
-                if ((!zoomChanged) && (this.center)) { 
+                if (!zoomChanged && this.center) { 
                     // if zoom hasnt changed, just slide layerContainer
                     //  (must be done before setting this.center to new value)
                     this.centerLayerContainer(lonlat);
@@ -1713,16 +1818,28 @@
                 this.center = lonlat.clone();
             }
 
+            var res = zoomChanged ?
+                this.getResolutionForZoom(zoom) : this.getResolution();
             // (re)set the layerContainerDiv's location
-            if ((zoomChanged) || (this.layerContainerOrigin == null)) {
-                this.layerContainerOrigin = this.center.clone();
+            if (zoomChanged || this.layerContainerOrigin == null) {
+                this.layerContainerOrigin = this.getCachedCenter();
                 this.layerContainerDiv.style.left = "0px";
                 this.layerContainerDiv.style.top  = "0px";
+                var maxExtent = this.getMaxExtent({restricted: true});
+                var maxExtentCenter = maxExtent.getCenterLonLat();
+                var lonDelta = this.center.lon - maxExtentCenter.lon;
+                var latDelta = maxExtentCenter.lat - this.center.lat;
+                var extentWidth = Math.round(maxExtent.getWidth() / res);
+                var extentHeight = Math.round(maxExtent.getHeight() / res);
+                var left = (this.size.w - extentWidth) / 2 - lonDelta / res;
+                var top = (this.size.h - extentHeight) / 2 - latDelta / res;
+                this.minPx = new OpenLayers.Pixel(left, top);
+                this.maxPx = new OpenLayers.Pixel(left + extentWidth, top + extentHeight);
             }
 
             if (zoomChanged) {
                 this.zoom = zoom;
-                this.resolution = this.getResolutionForZoom(zoom);
+                this.resolution = res;
                 // zoom level has changed, increment viewRequestID.
                 this.viewRequestID++;
             }    
@@ -1804,14 +1921,23 @@
      * lonlat - {<OpenLayers.LonLat>}
      */
     centerLayerContainer: function (lonlat) {
-
         var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
         var newPx = this.getViewPortPxFromLonLat(lonlat);
 
         if ((originPx != null) && (newPx != null)) {
-            this.layerContainerDiv.style.left = Math.round(originPx.x - newPx.x) + "px";
-            this.layerContainerDiv.style.top  = Math.round(originPx.y - newPx.y) + "px";
-        }
+            var oldLeft = parseInt(this.layerContainerDiv.style.left);
+            var oldTop = parseInt(this.layerContainerDiv.style.top);
+            var newLeft = Math.round(originPx.x - newPx.x);
+            var newTop = Math.round(originPx.y - newPx.y);
+            this.layerContainerDiv.style.left = newLeft + "px";
+            this.layerContainerDiv.style.top  = newTop + "px";
+            var dx = oldLeft - newLeft;
+            var dy = oldTop - newTop;
+            this.minPx.x -= dx;
+            this.maxPx.x -= dx;
+            this.minPx.y -= dy;
+            this.maxPx.y -= dy;
+        }        
     },
 
     /**
@@ -2130,8 +2256,6 @@
     /**
      * APIMethod: zoomIn
      * 
-     * Parameters:
-     * zoom - {int}
      */
     zoomIn: function() {
         this.zoomTo(this.getZoom() + 1);
@@ -2140,8 +2264,6 @@
     /**
      * APIMethod: zoomOut
      * 
-     * Parameters:
-     * zoom - {int}
      */
     zoomOut: function() {
         this.zoomTo(this.getZoom() - 1);
@@ -2225,7 +2347,7 @@
         var size = this.getSize();
         var w_deg = size.w * res;
         var h_deg = size.h * res;
-        var center = this.getCenter();
+        var center = this.getCachedCenter();
 
         var extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
                                            center.lat - h_deg / 2,
@@ -2337,8 +2459,8 @@
      * {<OpenLayers.Size>} The geodesic size of the pixel in kilometers.
      */
     getGeodesicPixelSize: function(px) {
-        var lonlat = px ? this.getLonLatFromPixel(px) : (this.getCenter() ||
-            new OpenLayers.LonLat(0, 0));
+        var lonlat = px ? this.getLonLatFromPixel(px) : (
+            this.getCachedCenter() || new OpenLayers.LonLat(0, 0));
         var res = this.getResolution();
         var left = lonlat.add(-res / 2, 0);
         var right = lonlat.add(res / 2, 0);

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Popup.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Popup.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Popup.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -431,7 +431,7 @@
      * Makes the popup visible.
      */
     show: function() {
-        OpenLayers.Element.show(this.div);
+        this.div.style.display = '';
 
         if (this.panMapIfOutOfView) {
             this.panIntoView();
@@ -443,7 +443,7 @@
      * Makes the popup invisible.
      */
     hide: function() {
-        OpenLayers.Element.hide(this.div);
+        this.div.style.display = 'none';
     },
 
     /**

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Projection.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Projection.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Projection.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -30,7 +30,7 @@
     
     /**
      * Property: titleRegEx
-     * {RegEx} regular expression to strip the title from a proj4js definition
+     * {RegExp} regular expression to strip the title from a proj4js definition
      */
     titleRegEx: /\+title=[^\+]*/,
 
@@ -174,10 +174,10 @@
  *     the input point is transformed in place.
  * 
  * Parameters:
- * point - {{OpenLayers.Geometry.Point> | Object} An object with x and y
+ * point - {<OpenLayers.Geometry.Point> | Object} An object with x and y
  *     properties representing coordinates in those dimensions.
- * sourceProj - {OpenLayers.Projection} Source map coordinate system
- * destProj - {OpenLayers.Projection} Destination map coordinate system
+ * source - {OpenLayers.Projection} Source map coordinate system
+ * dest - {OpenLayers.Projection} Destination map coordinate system
  *
  * Returns:
  * point - {object} A transformed coordinate.  The original point is modified.

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -250,7 +250,7 @@
      *     is used.
      *
      * Parameters:
-     * features - {Array(<OpenLayers.Feature.Vector>}
+     * features - {Array(<OpenLayers.Feature.Vector>)}
      *
      * Returns:
      * {<OpenLayers.Protocol.Response>} A response object with a features

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Elements.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Elements.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Elements.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -390,7 +390,7 @@
     BACKGROUND_ID_SUFFIX: "_background",
     
     /**
-     * Constant: BACKGROUND_ID_SUFFIX
+     * Constant: LABEL_ID_SUFFIX
      * {String}
      */
     LABEL_ID_SUFFIX: "_label",

Copied: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js (from rev 11617, trunk/openlayers/lib/OpenLayers/Renderer/NG.js)
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,141 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for 
+ * full list of contributors). Published under the Clear BSD license.  
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Renderer/Elements.js
+ */
+
+/**
+ * Class: OpenLayers.Renderer.NG
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Renderer.Elements>
+ */
+OpenLayers.Renderer.NG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
+    
+    /**
+     * Constant: labelNodeType
+     * {String} The node type for text label containers. To be defined by
+     * subclasses.
+     */
+    labelNodeType: null,
+    
+    /**
+     * Constructor: OpenLayers.Renderer.NG
+     * 
+     * Parameters:
+     * containerID - {String}
+     * options - {Object} options for this renderer. Supported options are:
+     *     * yOrdering - {Boolean} Whether to use y-ordering
+     *     * zIndexing - {Boolean} Whether to use z-indexing. Will be ignored
+     *         if yOrdering is set to true.
+     */
+    initialize: function(containerID, options) {
+        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, arguments);
+    },
+
+    /**
+     * Method: destroy
+     */
+    destroy: function() {
+        OpenLayers.Renderer.Elements.prototype.destroy.apply(this, arguments);
+    },
+
+    /**
+     * Method: updateDimensions
+     * To be extended by subclasses - here we set positioning related styles
+     * on HTML elements, subclasses have to do the same for renderer specific
+     * elements (e.g. viesBox, width and height of the rendererRoot)
+     */
+    updateDimensions: function() {
+        var mapExtent = this.map.getExtent();
+        var renderExtent = this.map.getMaxExtent();
+        this.setExtent(renderExtent, true);
+        var res = this.getResolution();
+        var div = this.rendererRoot.parentNode;
+        var layerLeft = parseFloat(div.parentNode.style.left);
+        var layerTop = parseFloat(div.parentNode.style.top);
+        div.style.left = ((renderExtent.left - mapExtent.left) / res - layerLeft) + "px";
+        div.style.top = ((mapExtent.top - renderExtent.top) / res - layerTop) + "px";
+    },
+    
+    /**
+     * Method: resize
+     */
+    setSize: function() {
+        this.map.getExtent() && this.updateDimensions();
+    },
+
+    /**
+     * Method: drawFeature
+     * Draw the feature.  The optional style argument can be used
+     * to override the feature's own style.  This method should only
+     * be called from layer.drawFeature().
+     *
+     * Parameters:
+     * feature - {<OpenLayers.Feature.Vector>} 
+     * style - {<Object>}
+     * 
+     * Returns:
+     * {Boolean} true if the feature has been drawn completely, false if not,
+     *     undefined if the feature had no geometry
+     */
+    drawFeature: function(feature, style) {
+        if(style == null) {
+            style = feature.style;
+        }
+        if (feature.geometry) {
+            var rendered = this.drawGeometry(feature.geometry, style, feature.id);
+            if(rendered !== false && style.label) {
+                var location = feature.geometry.getCentroid(); 
+                this.drawText(feature.id, style, location);
+            } else {
+                this.removeText(feature.id);
+            }
+            return rendered;
+        }
+    },
+    
+    /**
+     * Method: drawText
+     * Function for drawing text labels.
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * featureId - {String|DOMElement}
+     * style - {Object}
+     * location - {<OpenLayers.Geometry.Point>}, will be modified inline
+     *
+     * Returns:
+     * {DOMElement} container holding the text label (to be populated by
+     * subclasses)
+     */
+    drawText: function(featureId, style, location) {
+        var label;
+        if (typeof featureId !== "string") {
+            label = featureId;
+        } else {
+            label = this.nodeFactory(featureId + this.LABEL_ID_SUFFIX, this.labelNodeType);
+            label._featureId = featureId;
+        }
+        label._style = style;
+        label._x = location.x;
+        label._y = location.y;
+        if(style.labelXOffset || style.labelYOffset) {
+            xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
+            yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
+            var res = this.getResolution();
+            location.move(xOffset*res, yOffset*res);
+        }
+
+        if(label.parentNode !== this.textRoot) {
+            this.textRoot.appendChild(label);
+        }   
+
+        return label;
+    },
+
+    CLASS_NAME: "OpenLayers.Renderer.NG"
+});
\ No newline at end of file

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -260,6 +260,10 @@
                 
                 if (style.graphicTitle) {
                     node.setAttributeNS(null, "title", style.graphicTitle);
+                    //Standards-conformant SVG
+                    var label = this.nodeFactory(null, "title");
+                    label.textContent = style.graphicTitle;
+                    node.appendChild(label);
                 }
                 if (style.graphicWidth && style.graphicHeight) {
                   node.setAttributeNS(null, "preserveAspectRatio", "none");
@@ -281,6 +285,7 @@
                 node.setAttributeNS(null, "height", height);
                 node.setAttributeNS(this.xlinkns, "href", style.externalGraphic);
                 node.setAttributeNS(null, "style", "opacity: "+opacity);
+                node.onclick = OpenLayers.Renderer.SVG.preventDefault;
             } else if (this.isComplexSymbol(style.graphicName)) {
                 // the symbol viewBox is three times as large as the symbol
                 var offset = style.pointRadius * 3;
@@ -795,9 +800,9 @@
      * inside the valid range.
      * 
      * Parameters:
-     * badComponent - {<OpenLayers.Geometry.Point>)} original geometry of the
+     * badComponent - {<OpenLayers.Geometry.Point>} original geometry of the
      *     invalid point
-     * goodComponent - {<OpenLayers.Geometry.Point>)} original geometry of the
+     * goodComponent - {<OpenLayers.Geometry.Point>} original geometry of the
      *     valid point
      * Returns
      * {String} the SVG coordinate pair of the clipped point (like
@@ -979,3 +984,12 @@
     "t": "-70%",
     "b": "0"    
 };
+
+/**
+ * Function: OpenLayers.Renderer.SVG.preventDefault
+ * Used to prevent default events (especially opening images in a new tab on
+ * ctrl-click) from being executed for externalGraphic symbols
+ */
+OpenLayers.Renderer.SVG.preventDefault = function(e) {
+    e.preventDefault && e.preventDefault();
+};

Copied: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js (from rev 11617, trunk/openlayers/lib/OpenLayers/Renderer/SVG2.js)
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,769 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for 
+ * full list of contributors). Published under the Clear BSD license.  
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Renderer/NG.js
+ */
+
+/**
+ * Class: OpenLayers.Renderer.SVG2
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Renderer.NG>
+ */
+OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
+
+    /** 
+     * Property: xmlns
+     * {String}
+     */
+    xmlns: "http://www.w3.org/2000/svg",
+    
+    /**
+     * Property: xlinkns
+     * {String}
+     */
+    xlinkns: "http://www.w3.org/1999/xlink",
+
+    /**
+     * Property: symbolMetrics
+     * {Object} Cache for symbol metrics according to their svg coordinate
+     *     space. This is an object keyed by the symbol's id, and values are
+     *     an object with size, x and y properties.
+     */
+    symbolMetrics: null,
+    
+    /**
+     * Constant: labelNodeType
+     * {String} The node type for text label containers.
+     */
+    labelNodeType: "g",
+
+    /**
+     * Constructor: OpenLayers.Renderer.SVG
+     * 
+     * Parameters:
+     * containerID - {String}
+     */
+    initialize: function(containerID) {
+        if (!this.supported()) { 
+            return; 
+        }
+        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
+                                                                arguments);
+        
+        this.symbolMetrics = {};
+    },
+
+    /**
+     * APIMethod: destroy
+     */
+    destroy: function() {
+        OpenLayers.Renderer.Elements.prototype.destroy.apply(this, arguments);
+    },
+    
+    /**
+     * APIMethod: supported
+     * 
+     * Returns:
+     * {Boolean} Whether or not the browser supports the SVG renderer
+     */
+    supported: function() {
+        var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
+        return (document.implementation && 
+           (document.implementation.hasFeature("org.w3c.svg", "1.0") || 
+            document.implementation.hasFeature(svgFeature + "SVG", "1.1") || 
+            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
+    },    
+
+    /**
+     * Method: updateDimensions
+     */
+    updateDimensions: function() {
+        OpenLayers.Renderer.NG.prototype.updateDimensions.apply(this, arguments);
+        
+        var res = this.getResolution();
+        
+        var width = this.extent.getWidth();
+        var height = this.extent.getHeight();
+        
+        var extentString = [
+            this.extent.left,
+            -this.extent.top,
+            width,
+            height
+        ].join(" ");
+        this.rendererRoot.setAttributeNS(null, "viewBox", extentString);
+        this.rendererRoot.setAttributeNS(null, "width", width / res);
+        this.rendererRoot.setAttributeNS(null, "height", height / res);
+
+        // update styles for the new resolution
+        var nodes = this.vectorRoot.childNodes;
+        for (var i=0, len=nodes.length; i<len; ++i) {
+            this.setStyle(nodes[i]);
+        }
+        var textNodes = this.textRoot.childNodes;
+        var label;
+        for (var i=0, len=textNodes.length; i<len; ++i) {
+            var label = textNodes[i];
+            this.drawText(label, label._style,
+                new OpenLayers.Geometry.Point(label._x, label._y)
+            );
+        }
+    },
+    
+    /** 
+     * Method: getNodeType
+     * 
+     * Parameters:
+     * geometry - {<OpenLayers.Geometry>}
+     * style - {Object}
+     * 
+     * Returns:
+     * {String} The corresponding node type for the specified geometry
+     */
+    getNodeType: function(geometry, style) {
+        var nodeType = null;
+        switch (geometry.CLASS_NAME) {
+            case "OpenLayers.Geometry.Point":
+                if (style.externalGraphic) {
+                    nodeType = "image";
+                } else if (this.isComplexSymbol(style.graphicName)) {
+                    nodeType = "svg";
+                } else {
+                    nodeType = "circle";
+                }
+                break;
+            case "OpenLayers.Geometry.Rectangle":
+                nodeType = "rect";
+                break;
+            case "OpenLayers.Geometry.LineString":
+                nodeType = "polyline";
+                break;
+            case "OpenLayers.Geometry.LinearRing":
+                nodeType = "polygon";
+                break;
+            case "OpenLayers.Geometry.Polygon":
+            case "OpenLayers.Geometry.Curve":
+            case "OpenLayers.Geometry.Surface":
+                nodeType = "path";
+                break;
+            default:
+                break;
+        }
+        return nodeType;
+    },
+
+    /** 
+     * Method: setStyle
+     * Use to set all the style attributes to a SVG node.
+     * 
+     * Takes care to adjust stroke width and point radius to be
+     * resolution-relative
+     *
+     * Parameters:
+     * node - {SVGDomElement} An SVG element to decorate
+     * style - {Object}
+     * options - {Object} Currently supported options include 
+     *                              'isFilled' {Boolean} and
+     *                              'isStroked' {Boolean}
+     */
+    setStyle: function(node, style, options) {
+        style = style  || node._style;
+        options = options || node._options;
+        var resolution = this.getResolution();
+        var r = node._radius;
+        var widthFactor = resolution;
+        if (node._geometryClass == "OpenLayers.Geometry.Point" && r) {
+            node.style.visibility = "";
+            if (style.graphic === false) {
+                node.style.visibility = "hidden";
+            } else if (style.externalGraphic) {
+                
+                if (style.graphicTitle) {
+                    node.setAttributeNS(null, "title", style.graphicTitle);
+                    //Standards-conformant SVG 
+                    var label = this.nodeFactory(null, "title"); 
+                    label.textContent = style.graphicTitle; 
+                    node.appendChild(label); 
+                }
+                if (style.graphicWidth && style.graphicHeight) {
+                    node.setAttributeNS(null, "preserveAspectRatio", "none");
+                }
+                var width = style.graphicWidth || style.graphicHeight;
+                var height = style.graphicHeight || style.graphicWidth;
+                width = width ? width : style.pointRadius*2;
+                height = height ? height : style.pointRadius*2;
+                width *= resolution;
+                height *= resolution;
+                
+                var xOffset = (style.graphicXOffset != undefined) ?
+                    style.graphicXOffset * resolution : -(0.5 * width);
+                var yOffset = (style.graphicYOffset != undefined) ?
+                    style.graphicYOffset * resolution : -(0.5 * height);
+
+                var opacity = style.graphicOpacity || style.fillOpacity;
+                
+                node.setAttributeNS(null, "x", node._x + xOffset);
+                node.setAttributeNS(null, "y", node._y + yOffset);
+                node.setAttributeNS(null, "width", width);
+                node.setAttributeNS(null, "height", height);
+                node.setAttributeNS(this.xlinkns, "href", style.externalGraphic);
+                node.setAttributeNS(null, "style", "opacity: "+opacity);
+                node.onclick = OpenLayers.Renderer.SVG2.preventDefault;
+            } else if (this.isComplexSymbol(style.graphicName)) {
+                // the symbol viewBox is three times as large as the symbol
+                var offset = style.pointRadius * 3 * resolution;
+                var size = offset * 2;
+                var id = this.importSymbol(style.graphicName);
+                widthFactor = this.symbolMetrics[id].size * 3 / size * resolution;
+                
+                // remove the node from the dom before we modify it. This
+                // prevents various rendering issues in Safari and FF
+                var parent = node.parentNode;
+                var nextSibling = node.nextSibling;
+                if(parent) {
+                    parent.removeChild(node);
+                }
+                
+                // The more appropriate way to implement this would be use/defs, 
+                // but due to various issues in several browsers, it is safer to 
+                // copy the symbols instead of referencing them.  
+                // See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985  
+                // and this email thread 
+                // http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html 
+                var src = document.getElementById(id); 
+                node.firstChild && node.removeChild(node.firstChild); 
+                node.appendChild(src.firstChild.cloneNode(true)); 
+                node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox")); 
+
+                node.setAttributeNS(null, "width", size);
+                node.setAttributeNS(null, "height", size);
+                node.setAttributeNS(null, "x", node._x - offset);
+                node.setAttributeNS(null, "y", node._y - offset);
+                
+                // now that the node has all its new properties, insert it
+                // back into the dom where it was
+                if(nextSibling) {
+                    parent.insertBefore(node, nextSibling);
+                } else if(parent) {
+                    parent.appendChild(node);
+                }
+            } else {
+                node.setAttributeNS(null, "r", style.pointRadius * resolution);
+            }
+
+            var rotation = style.rotation;
+            if (rotation !== undefined || node._rotation !== undefined) {
+                node._rotation = rotation;
+                rotation |= 0;
+                if (node.nodeName !== "svg") { 
+                    node.setAttributeNS(null, "transform", 
+                        ["rotate(", rotation, node._x, node._y, ")"].join(" ")
+                    ); 
+                } else {
+                    var metrics = this.symbolMetrics[id]; 
+                    node.firstChild.setAttributeNS(null, "transform",
+                        ["rotate(", rotation, metrics.x, metrics.y, ")"].join(" ")
+                    );
+                }
+            }
+        }
+        
+        if (options.isFilled) {
+            node.setAttributeNS(null, "fill", style.fillColor);
+            node.setAttributeNS(null, "fill-opacity", style.fillOpacity);
+        } else {
+            node.setAttributeNS(null, "fill", "none");
+        }
+
+        if (options.isStroked) {
+            node.setAttributeNS(null, "stroke", style.strokeColor);
+            node.setAttributeNS(null, "stroke-opacity", style.strokeOpacity);
+            node.setAttributeNS(null, "stroke-width", style.strokeWidth * widthFactor);
+            node.setAttributeNS(null, "stroke-linecap", style.strokeLinecap || "round");
+            // Hard-coded linejoin for now, to make it look the same as in VML.
+            // There is no strokeLinejoin property yet for symbolizers.
+            node.setAttributeNS(null, "stroke-linejoin", "round");
+            style.strokeDashstyle && node.setAttributeNS(null,
+                "stroke-dasharray", this.dashStyle(style, widthFactor));
+        } else {
+            node.setAttributeNS(null, "stroke", "none");
+        }
+        
+        if (style.pointerEvents) {
+            node.setAttributeNS(null, "pointer-events", style.pointerEvents);
+        }
+                
+        if (style.cursor != null) {
+            node.setAttributeNS(null, "cursor", style.cursor);
+        }
+        
+        return node;
+    },
+
+    /** 
+     * Method: dashStyle
+     * 
+     * Parameters:
+     * style - {Object}
+     * widthFactor - {Number}
+     * 
+     * Returns:
+     * {String} A SVG compliant 'stroke-dasharray' value
+     */
+    dashStyle: function(style, widthFactor) {
+        var w = style.strokeWidth * widthFactor;
+        var str = style.strokeDashstyle;
+        switch (str) {
+            case 'solid':
+                return 'none';
+            case 'dot':
+                return [widthFactor, 4 * w].join();
+            case 'dash':
+                return [4 * w, 4 * w].join();
+            case 'dashdot':
+                return [4 * w, 4 * w, widthFactor, 4 * w].join();
+            case 'longdash':
+                return [8 * w, 4 * w].join();
+            case 'longdashdot':
+                return [8 * w, 4 * w, widthFactor, 4 * w].join();
+            default:
+                var parts = OpenLayers.String.trim(str).split(/\s+/g);
+                for (var i=0, ii=parts.length; i<ii; i++) {
+                    parts[i] = parts[i] * widthFactor;
+                }
+                return parts.join();            
+        }
+    },
+    
+    /** 
+     * Method: createNode
+     * 
+     * Parameters:
+     * type - {String} Kind of node to draw
+     * id - {String} Id for node
+     * 
+     * Returns:
+     * {DOMElement} A new node of the given type and id
+     */
+    createNode: function(type, id) {
+        var node = document.createElementNS(this.xmlns, type);
+        if (id) {
+            node.setAttributeNS(null, "id", id);
+        }
+        return node;    
+    },
+    
+    /** 
+     * Method: nodeTypeCompare
+     * 
+     * Parameters:
+     * node - {SVGDomElement} An SVG element
+     * type - {String} Kind of node
+     * 
+     * Returns:
+     * {Boolean} Whether or not the specified node is of the specified type
+     */
+    nodeTypeCompare: function(node, type) {
+        return (type == node.nodeName);
+    },
+   
+    /**
+     * Method: createRenderRoot
+     * 
+     * Returns:
+     * {DOMElement} The specific render engine's root element
+     */
+    createRenderRoot: function() {
+        return this.nodeFactory(this.container.id + "_svgRoot", "svg");
+    },
+
+    /**
+     * Method: createRoot
+     * 
+     * Parameter:
+     * suffix - {String} suffix to append to the id
+     * 
+     * Returns:
+     * {DOMElement}
+     */
+    createRoot: function(suffix) {
+        return this.nodeFactory(this.container.id + suffix, "g");
+    },
+
+    /**
+     * Method: createDefs
+     *
+     * Returns:
+     * {DOMElement} The element to which we'll add the symbol definitions
+     */
+    createDefs: function() {
+        var defs = this.nodeFactory(this.container.id + "_defs", "defs");
+        this.rendererRoot.appendChild(defs);
+        return defs;
+    },
+
+    /**************************************
+     *                                    *
+     *     GEOMETRY DRAWING FUNCTIONS     *
+     *                                    *
+     **************************************/
+
+    /**
+     * Method: drawPoint
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the point
+     */ 
+    drawPoint: function(node, geometry) {
+        return this.drawCircle(node, geometry, 1);
+    },
+
+    /**
+     * Method: drawCircle
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * radius - {Float}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the circle
+     */
+    drawCircle: function(node, geometry, radius) {
+        var x = geometry.x;
+        var y = -geometry.y;
+        node.setAttributeNS(null, "cx", x);
+        node.setAttributeNS(null, "cy", y);
+        node._x = x;
+        node._y = y;
+        node._radius = radius;
+        return node;
+    },
+    
+    /**
+     * Method: drawLineString
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or null if the renderer could not draw all components of
+     *     the linestring, or false if nothing could be drawn
+     */ 
+    drawLineString: function(node, geometry) {
+        var path = this.getComponentsString(geometry.components);
+        node.setAttributeNS(null, "points", path);
+        return node;
+    },
+    
+    /**
+     * Method: drawLinearRing
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or null if the renderer could not draw all components
+     *     of the linear ring, or false if nothing could be drawn
+     */ 
+    drawLinearRing: function(node, geometry) {
+        var path = this.getComponentsString(geometry.components);
+        node.setAttributeNS(null, "points", path);
+        return node;
+    },
+    
+    /**
+     * Method: drawPolygon
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or null if the renderer could not draw all components
+     *     of the polygon, or false if nothing could be drawn
+     */ 
+    drawPolygon: function(node, geometry) {
+        var d = [];
+        var draw = true;
+        var complete = true;
+        var linearRingResult, path;
+        for (var j=0, len=geometry.components.length; j<len; j++) {
+            d.push("M");
+            path = this.getComponentsString(
+                geometry.components[j].components, " ");
+            d.push(path);
+        }
+        d.push("z");
+        node.setAttributeNS(null, "d", d.join(" "));
+        node.setAttributeNS(null, "fill-rule", "evenodd");
+        return node;
+    },
+    
+    /**
+     * Method: drawRectangle
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the rectangle
+     */ 
+    drawRectangle: function(node, geometry) {
+        node.setAttributeNS(null, "x", geometry.x);
+        node.setAttributeNS(null, "y", -geometry.y);
+        node.setAttributeNS(null, "width", geometry.width);
+        node.setAttributeNS(null, "height", geometry.height);
+        return node;
+    },
+    
+    /**
+     * Method: drawSurface
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * node - {DOMElement}
+     * geometry - {<OpenLayers.Geometry>}
+     * 
+     * Returns:
+     * {DOMElement} or false if the renderer could not draw the surface
+     */ 
+    drawSurface: function(node, geometry) {
+
+        // create the svg path string representation
+        var d = [];
+        var draw = true;
+        for (var i=0, len=geometry.components.length; i<len; i++) {
+            if ((i%3) == 0 && (i/3) == 0) {
+                var component = this.getShortString(geometry.components[i]);
+                d.push("M", component);
+            } else if ((i%3) == 1) {
+                var component = this.getShortString(geometry.components[i]);
+                d.push("C", component);
+            } else {
+                var component = this.getShortString(geometry.components[i]);
+                d.push(component);
+            }
+        }
+        d.push("Z");
+        node.setAttributeNS(null, "d", d.join(" "));
+        return node;
+    },
+    
+    /**
+     * Method: drawText
+     * Function for drawing text labels.
+     * This method is only called by the renderer itself.
+     * 
+     * Parameters: 
+     * featureId - {String|DOMElement}
+     * style - {Object}
+     * location - {<OpenLayers.Geometry.Point>}, will be modified inline
+     *
+     * Returns:
+     * {DOMElement} container holding the text label
+     */
+    drawText: function(featureId, style, location) {
+        var g = OpenLayers.Renderer.NG.prototype.drawText.apply(this, arguments);
+        var text = g.firstChild ||
+            this.nodeFactory(featureId + this.LABEL_ID_SUFFIX + "_text", "text");
+        var tspan = text.firstChild ||
+            this.nodeFactory(featureId + this.LABEL_ID_SUFFIX + "_tspan", "tspan");
+
+        var res = this.getResolution();
+        text.setAttributeNS(null, "x", location.x / res);
+        text.setAttributeNS(null, "y", - location.y / res);
+        g.setAttributeNS(null, "transform", "scale(" + res + ")");
+        
+        if (style.fontColor) {
+            text.setAttributeNS(null, "fill", style.fontColor);
+        }
+        if (style.fontOpacity) {
+            text.setAttributeNS(null, "opacity", style.fontOpacity);
+        }
+        if (style.fontFamily) {
+            text.setAttributeNS(null, "font-family", style.fontFamily);
+        }
+        if (style.fontSize) {
+            text.setAttributeNS(null, "font-size", style.fontSize);
+        }
+        if (style.fontWeight) {
+            text.setAttributeNS(null, "font-weight", style.fontWeight);
+        }
+        if(style.labelSelect === true) {
+            text.setAttributeNS(null, "pointer-events", "visible");
+            text._featureId = featureId;
+            tspan._featureId = featureId;
+        } else {
+            text.setAttributeNS(null, "pointer-events", "none");
+        }
+        var align = style.labelAlign || "cm";
+        text.setAttributeNS(null, "text-anchor",
+            OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]] || "middle");
+
+        if (OpenLayers.IS_GECKO === true) {
+            text.setAttributeNS(null, "dominant-baseline",
+                OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]] || "central");
+        } else {
+            tspan.setAttributeNS(null, "baseline-shift",
+                OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]] || "-35%");
+        }
+
+        tspan.textContent = style.label;
+        
+        if(!text.parentNode) {
+            text.appendChild(tspan);
+            g.appendChild(text);
+        }
+        
+        return g;
+    },
+    
+    /** 
+     * Method: getComponentString
+     * 
+     * Parameters:
+     * components - {Array(<OpenLayers.Geometry.Point>)} Array of points
+     * separator - {String} character between coordinate pairs. Defaults to ","
+     * 
+     * Returns:
+     * {Object} hash with properties "path" (the string created from the
+     *     components and "complete" (false if the renderer was unable to
+     *     draw all components)
+     */
+    getComponentsString: function(components, separator) {
+        var len = components.length;
+        var strings = new Array(len);
+        for(var i=0; i<len; i++) {
+            component = components[i];
+            strings[i] = this.getShortString(component);
+        }
+
+        return strings.join(separator || ",");
+    },
+    
+    /** 
+     * Method: getShortString
+     * 
+     * Parameters:
+     * point - {<OpenLayers.Geometry.Point>}
+     * 
+     * Returns:
+     * {String} or false if point is outside the valid range
+     */
+    getShortString: function(point) {
+        return point.x + "," + (-point.y);
+    },
+    
+    /**
+     * Method: importSymbol
+     * add a new symbol definition from the rendererer's symbol hash
+     * 
+     * Parameters:
+     * graphicName - {String} name of the symbol to import
+     * 
+     * Returns:
+     * {String} - id of the imported symbol
+     */      
+    importSymbol: function (graphicName)  {
+        if (!this.defs) {
+            // create svg defs tag
+            this.defs = this.createDefs();
+        }
+        var id = this.container.id + "-" + graphicName;
+        
+        // check if symbol already exists in the defs
+        if (document.getElementById(id) != null) {
+            return id;
+        }
+        
+        var symbol = OpenLayers.Renderer.symbol[graphicName];
+        if (!symbol) {
+            throw new Error(graphicName + ' is not a valid symbol name');
+        }
+
+        var symbolNode = this.nodeFactory(id, "symbol");
+        var node = this.nodeFactory(null, "polygon");
+        symbolNode.appendChild(node);
+        var symbolExtent = new OpenLayers.Bounds(
+                                    Number.MAX_VALUE, Number.MAX_VALUE, 0, 0);
+
+        var points = [];
+        var x,y;
+        for (var i=0, len=symbol.length; i<len; i=i+2) {
+            x = symbol[i];
+            y = symbol[i+1];
+            symbolExtent.left = Math.min(symbolExtent.left, x);
+            symbolExtent.bottom = Math.min(symbolExtent.bottom, y);
+            symbolExtent.right = Math.max(symbolExtent.right, x);
+            symbolExtent.top = Math.max(symbolExtent.top, y);
+            points.push(x, ",", y);
+        }
+        
+        node.setAttributeNS(null, "points", points.join(" "));
+        
+        var width = symbolExtent.getWidth();
+        var height = symbolExtent.getHeight();
+        // create a viewBox three times as large as the symbol itself,
+        // to allow for strokeWidth being displayed correctly at the corners.
+        var viewBox = [symbolExtent.left - width,
+                        symbolExtent.bottom - height, width * 3, height * 3];
+        symbolNode.setAttributeNS(null, "viewBox", viewBox.join(" "));
+        this.symbolMetrics[id] = {
+            size: Math.max(width, height),
+            x: symbolExtent.getCenterLonLat().lon,
+            y: symbolExtent.getCenterLonLat().lat
+        };
+        
+        this.defs.appendChild(symbolNode);
+        return symbolNode.id;
+    },
+    
+    /**
+     * Method: getFeatureIdFromEvent
+     * 
+     * Parameters:
+     * evt - {Object} An <OpenLayers.Event> object
+     *
+     * Returns:
+     * {<OpenLayers.Geometry>} A geometry from an event that 
+     *     happened on a layer.
+     */
+    getFeatureIdFromEvent: function(evt) {
+        var featureId = OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this, arguments);
+        if(!featureId) {
+            var target = evt.target;
+            featureId = target.parentNode && target != this.rendererRoot &&
+                target.parentNode._featureId;
+        }
+        return featureId;
+    },
+
+    CLASS_NAME: "OpenLayers.Renderer.SVG2"
+});
+
+/** 
+ * Function: OpenLayers.Renderer.SVG2.preventDefault 
+ * Used to prevent default events (especially opening images in a new tab on 
+ * ctrl-click) from being executed for externalGraphic and graphicName symbols 
+ */ 
+OpenLayers.Renderer.SVG2.preventDefault = function(e) { 
+    e.preventDefault && e.preventDefault(); 
+};
\ No newline at end of file

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -90,6 +90,14 @@
                 "refresh": this.update,
                 scope: this
             });
+            if(this.layer.visibility == true) {
+                this.update();
+            } else {
+                this.layer.events.on({
+                    "visibilitychanged": this.update,
+                    scope: this
+                });
+            }
         }
         return activated;
     },
@@ -106,10 +114,8 @@
         if(deactivated) {
             this.layer.events.un({
                 "moveend": this.update,
-                scope: this
-            });
-            this.layer.events.un({
                 "refresh": this.update,
+                "visibilitychanged": this.update,
                 scope: this
             });
         }
@@ -127,7 +133,8 @@
      */
     update: function(options) {
         var mapBounds = this.getMapBounds();
-        if ((options && options.force) || this.invalidBounds(mapBounds)) {
+        if (mapBounds !== null && ((options && options.force) ||
+                                   this.invalidBounds(mapBounds))) {
             this.calculateBounds(mapBounds);
             this.resolution = this.layer.map.getResolution(); 
             this.triggerRead();
@@ -142,8 +149,12 @@
      * {<OpenLayers.Bounds>} Map bounds in the projection of the layer.
      */
     getMapBounds: function() {
+        if (this.layer.map === null) {
+            return null;
+        }
         var bounds = this.layer.map.getExtent();
-        if(!this.layer.projection.equals(this.layer.map.getProjectionObject())) {
+        if(bounds && !this.layer.projection.equals(
+                this.layer.map.getProjectionObject())) {
             bounds = bounds.clone().transform(
                 this.layer.map.getProjectionObject(), this.layer.projection
             );

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Util.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Util.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Util.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -22,6 +22,11 @@
 /** 
  * Function: getElement
  * This is the old $() from prototype
+ *
+ * Parameters:
+ * e - {String or DOMElement or Window}
+ * Return:
+ * {Array(DOMElement)}
  */
 OpenLayers.Util.getElement = function() {
     var elements = [];
@@ -105,7 +110,7 @@
  * 
  * Parameters:
  * array - {Array}
- * obj - {Object}
+ * obj - {*}
  * 
  * Returns:
  * {Integer} The index at, which the first object was found in the array.
@@ -134,6 +139,7 @@
  * null to an individual parameter will avoid setting the attribute.
  *
  * Parameters:
+ * element - {DOMElement} DOM element to modify.
  * id - {String} The element id attribute to set.
  * px - {<OpenLayers.Pixel>} The left and top style position.
  * sz - {<OpenLayers.Size>}  The width and height style attributes.
@@ -404,6 +410,7 @@
 /** 
  * Function: modifyAlphaImageDiv
  * 
+ * Parameters:
  * div - {DOMElement} Div containing Alpha-adjusted Image
  * id - {String}
  * px - {<OpenLayers.Pixel>}
@@ -411,7 +418,7 @@
  * imgURL - {String}
  * position - {String}
  * border - {String}
- * sizing {String} 'crop', 'scale', or 'image'. Default is "scale"
+ * sizing - {String} 'crop', 'scale', or 'image'. Default is "scale"
  * opacity - {Float} Fractional value (0.0 - 1.0)
  */ 
 OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL, 
@@ -452,6 +459,7 @@
 /** 
  * Function: createAlphaImageDiv
  * 
+ * Parameters:
  * id - {String}
  * px - {<OpenLayers.Pixel>}
  * sz - {<OpenLayers.Size>}
@@ -938,7 +946,7 @@
  * lonlat  - {<OpenLayers.LonLat>} (or any object with both .lat, .lon
  *     properties) The start point.
  * brng     - {Float} The bearing (degrees).
- * distance - {Float} The ground distance (meters).
+ * dist     - {Float} The ground distance (meters).
  *
  * Returns:
  * {<OpenLayers.LonLat>} The destination point.
@@ -1663,6 +1671,8 @@
  *     useful in the case where we have a limit in one dimension and must 
  *     therefore meaure the flow in the other dimension.
  * options - {Object}
+ *
+ * Allowed Options:
  *     displayClass - {String} Optional parameter.  A CSS class name(s) string
  *         to provide the CSS context of the rendered content.
  *     containerElement - {DOMElement} Optional parameter. Insert the HTML to 

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers.js	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -182,6 +182,7 @@
                 "OpenLayers/Control/ZoomToMaxExtent.js",
                 "OpenLayers/Control/DragPan.js",
                 "OpenLayers/Control/Navigation.js",
+                "OpenLayers/Control/PinchZoom.js",
                 "OpenLayers/Control/TouchNavigation.js",
                 "OpenLayers/Control/MouseDefaults.js",
                 "OpenLayers/Control/MousePosition.js",
@@ -222,7 +223,9 @@
                 "OpenLayers/Geometry/Surface.js",
                 "OpenLayers/Renderer.js",
                 "OpenLayers/Renderer/Elements.js",
+                "OpenLayers/Renderer/NG.js",
                 "OpenLayers/Renderer/SVG.js",
+                "OpenLayers/Renderer/SVG2.js",
                 "OpenLayers/Renderer/Canvas.js",
                 "OpenLayers/Renderer/VML.js",
                 "OpenLayers/Layer/Vector.js",

Modified: sandbox/cmoullet/openlayers/tests/Control/Measure.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/Measure.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Control/Measure.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -96,6 +96,10 @@
                     measure: function(evt){
                         log.push(evt);
                     }
+                },
+                handlerOptions: {
+                    pixelTolerance: 0,
+                    dblclickTolerance: 0
                 }
             }
         );
@@ -131,8 +135,8 @@
             // wait for delay then confirm event was logged
             delay, function() {
                 t.eq(log.length, 1, "a) event logged")
-                t.ok(log[0] && log[0].type == "measurepartial", "a) event logged");
-                t.ok(log[0] && log[0].measure == 10, "a) correct measure");
+                t.eq(log[0] && log[0].type, "measurepartial", "a) event logged");
+                t.eq(log[0] && log[0].measure, 10, "a) correct measure");
                 
                 // b) move 10 pixels and click
                 trigger("mousemove", 0, 20);
@@ -145,8 +149,8 @@
             },
             delay, function() {
                 t.eq(log.length, 2, "b) event logged");
-                t.ok(log[1] && log[1].type == "measurepartial", "b) correct type");
-                t.ok(log[1] && log[1].measure == 20, "b) correct measure");
+                t.eq(log[1] && log[1].type, "measurepartial", "b) correct type");
+                t.eq(log[1] && log[1].measure, 20, "b) correct measure");
 
                 // c) move 10 pixels and click
                 trigger("mousemove", 0, 30);
@@ -161,8 +165,8 @@
             // wait for rest of delay and confirm event logged
             delay / 2, function() {
                 t.eq(log.length, 3, "c) event logged");
-                t.ok(log[2] && log[2].type == "measurepartial", "c) correct type");
-                t.ok(log[2] && log[2].measure == 30, "c) correct measure");
+                t.eq(log[2] && log[2].type, "measurepartial", "c) correct type");
+                t.eq(log[2] && log[2].measure, 30, "c) correct measure");
                 
                 // d) move 10 pixels and click
                 trigger("mousemove", 0, 40);
@@ -176,8 +180,8 @@
                 trigger("dblclick", 0, 40);
 
                 t.eq(log.length, 4, "e) event logged");
-                t.ok(log[3] && log[3].type == "measure", "e) correct type");
-                t.ok(log[3] && log[3].measure == 40, "e) correct measure");                
+                t.eq(log[3] && log[3].type, "measure", "e) correct type");
+                t.eq(log[3] && log[3].measure, 40, "e) correct measure");                
             },
             // wait for rest of delay and confirm no measurepartial logged
             delay, function() {
@@ -198,22 +202,22 @@
                 trigger("mousemove", 10, 0);
 
                 t.eq(log.length, 1, "g) event logged");
-                t.ok(log[0] && log[0].type == "measurepartial", "g) correct type");
-                t.ok(log[0] && log[0].measure == 10, "g) correct measure");
+                t.eq(log[0] && log[0].type, "measurepartial", "g) correct type");
+                t.eq(log[0] && log[0].measure, 10, "g) correct measure");
                 
                 // h) move 10 pixels
                 trigger("mousemove", 20, 0);
 
                 t.eq(log.length, 2, "h) event logged");
-                t.ok(log[1] && log[1].type == "measurepartial", "h) correct type");
-                t.ok(log[1] && log[1].measure == 20, "h) correct measure");
+                t.eq(log[1] && log[1].type, "measurepartial", "h) correct type");
+                t.eq(log[1] && log[1].measure, 20, "h) correct measure");
 
                 // i) mouse up to finish
                 trigger("mouseup", 20, 0);
 
                 t.eq(log.length, 3, "i) event logged");
-                t.ok(log[2] && log[2].type == "measure", "i) correct type");
-                t.ok(log[2] && log[2].measure == 20, "i) correct measure");
+                t.eq(log[2] && log[2].type, "measure", "i) correct type");
+                t.eq(log[2] && log[2].measure, 20, "i) correct measure");
 
                 // j) clean up
                 log = [];
@@ -254,6 +258,10 @@
                     measure: function(evt){
                         log.push(evt);
                     }
+                },
+                handlerOptions: {
+                    pixelTolerance: 0,
+                    dblclickTolerance: 0
                 }
             }
         );
@@ -296,10 +304,10 @@
 
                 // confirm measurepartial is fired 2 times
                 t.eq(log.length, 3, "b) event logged");
-                t.ok(log[1] && log[1].type == "measurepartial", "b) correct type");
-                t.ok(log[1] && log[1].measure == 20, "b) correct measure");
-                t.ok(log[2] && log[2].type == "measurepartial", "c) correct type");
-                t.ok(log[2] && log[2].measure == 30, "c) correct measure");
+                t.eq(log[1] && log[1].type, "measurepartial", "b) correct type");
+                t.eq(log[1] && log[1].measure, 20, "b) correct measure");
+                t.eq(log[2] && log[2].type, "measurepartial", "c) correct type");
+                t.eq(log[2] && log[2].measure, 30, "c) correct measure");
 
                 // d) switch immediate measurement off
                 control.setImmediate(false);
@@ -346,23 +354,23 @@
                 t.eq(log.length, 7, "i) no event fired yet");
             },
             delay, function() {
-                t.eq(log.length, 8, "i) event logged");
-                t.eq(log[7] && log[7].type, "measurepartial", "i) correct type");
-                t.eq(log[7] && log[7].measure, 60, "i) correct measure");
+                t.eq(log.length, 8, "j) event logged");
+                t.eq(log[7] && log[7].type, "measurepartial", "j) correct type");
+                t.eq(log[7] && log[7].measure, 60, "j) correct measure");
 
                 trigger("dblclick", 0, 60);
-                t.eq(log.length, 9, "i) event logged");
-                t.eq(log[8] && log[8].type, "measure", "i) correct type");
-                t.eq(log[8] && log[8].measure, 60, "i) correct measure");
+                t.eq(log.length, 9, "k) event logged");
+                t.eq(log[8] && log[8].type, "measure", "k) correct type");
+                t.eq(log[8] && log[8].measure, 60, "k) correct measure");
                 // clear log
                 log = [];
 
-                // j) clean up
+                // l) clean up
                 map.destroy();
                 // wait for delay and confirm event not logged
             },
             delay, function() {
-                t.eq(log.length, 0, "j) no event fired after destroy");
+                t.eq(log.length, 0, "l) no event fired after destroy");
             }
         );
     }

Modified: sandbox/cmoullet/openlayers/tests/Control/Navigation.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/Navigation.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Control/Navigation.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -118,6 +118,27 @@
         t.eq(nav.zoomWheelEnabled, true, "mouse wheel activated");
         t.eq(wheel.active, true, "mouse wheel handler activated");
     }
+
+    function test_touches_zoom(t) {
+        t.plan(3);
+        var nav = new OpenLayers.Control.Navigation({zoomWheelEnabled: false});
+        var map = new OpenLayers.Map({
+            div: "map",
+            controls: [nav],
+            layers: [
+                new OpenLayers.Layer(null, {isBaseLayer: true})
+            ],
+            center: new OpenLayers.LonLat(0, 0),
+            zoom: 3
+        });
+        t.eq(map.getZoom(), 3, "map zoom starts at 3");
+        nav.handlers.click.callback("click", [{lastTouches: ["foo", "bar"]}]);
+        t.eq(map.getZoom(), 2, "map zooms out with a two touch tap");
+        nav.handlers.click.callback("click", [{}]);
+        t.eq(map.getZoom(), 2, "map doesn't do anything with click");
+        
+        map.destroy();
+    }
     
     function test_documentDrag(t) {
         
@@ -149,5 +170,6 @@
   </script>
 </head>
 <body>
+    <div id="map" style="width: 256px; height: 256px"></div>
 </body>
 </html>

Copied: sandbox/cmoullet/openlayers/tests/Control/PinchZoom.html (from rev 11617, trunk/openlayers/tests/Control/PinchZoom.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/PinchZoom.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/Control/PinchZoom.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,87 @@
+<html>
+<head>
+  <script src="../OLLoader.js"></script>
+  <script type="text/javascript">
+
+    function test_constructor(t) {
+        t.plan(2);
+        var control = new OpenLayers.Control.PinchZoom();
+        t.ok(control instanceof OpenLayers.Control.PinchZoom, "got an instance");
+        t.ok(control.handler instanceof OpenLayers.Handler.Pinch, "control has pinch handler");
+        control.destroy();
+    }
+
+    function test_destroy(t) {
+        t.plan(1);
+        var control = new OpenLayers.Control.PinchZoom();
+        control.destroy();
+        t.ok(!control.handler, "handler destroyed");
+    }
+    
+    function test_activate(t) {
+        t.plan(3);
+        var control = new OpenLayers.Control.PinchZoom();
+        t.ok(!control.active, "control not activated after construction");
+        
+        var map = new OpenLayers.Map({
+            div: "map",
+            controls: [control]
+        });
+        t.ok(control.active, "control activated after being added to the map");
+        
+        control.deactivate();
+        t.ok(!control.active, "control deactivated");
+        
+        map.destroy();
+    }
+
+    function test_pinchMove(t) {
+
+        var control = new OpenLayers.Control.PinchZoom();
+
+        var map = new OpenLayers.Map({
+            div: "map",
+            controls: [control]
+        });
+        
+        var log = [];
+        control.applyTransform = function(transform) {
+            log.push(transform);
+        }
+        
+        control.containerOrigin = {
+            x: 0, y: 0
+        };
+
+        control.pinchOrigin = {
+            x: 100, y: 50
+        };
+
+        var cases = [
+            {x: 100, y: 60, scale: 1, transform: "translate(0px, 10px) scale(1)"},
+            {x: 150, y: 60, scale: 1, transform: "translate(50px, 10px) scale(1)"},
+            {x: 150, y: 60, scale: 2, transform: "translate(-50px, -40px) scale(2)"},
+            {x: 50, y: 20, scale: 2.5, transform: "translate(-200px, -105px) scale(2.5)"},
+            {x: 150, y: 60, scale: 2, transform: "translate(-50px, -40px) scale(2)"},
+            {x: 50, y: 20, scale: 0.25, transform: "translate(25px, 8px) scale(0.25)"}
+        ];
+        
+        var len = cases.length;
+        t.plan(len*2);
+        
+        var c;
+        for (var i=0; i<len; ++i) {
+            c = cases[i];
+            control.pinchMove({xy: {x: c.x, y: c.y}}, {scale: c.scale});
+            t.eq(log.length, i+1, i + " called once");
+            t.eq(log[i], c.transform, i + " correct transform");
+        }
+        
+    }
+
+  </script>
+</head>
+<body>
+    <div id="map" style="width: 256px; height: 256px;"></div>
+</body>
+</html>

Modified: sandbox/cmoullet/openlayers/tests/Events.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Events.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Events.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -318,8 +318,8 @@
                    touches: [{clientX: 1, clientY: 1}, {clientX: 2, clientY: 2}]
                   };
         events.handleBrowserEvent(evt);
-        t.eq(evt.clientX, 1, "evt.clientX value is correct");
-        t.eq(evt.clientY, 1, "evt.clientY value is correct");
+        t.eq(evt.clientX, 1.5, "evt.clientX value is correct");
+        t.eq(evt.clientY, 1.5, "evt.clientY value is correct");
     }
 
     function test_Events_destroy (t) {

Modified: sandbox/cmoullet/openlayers/tests/Format/GeoRSS.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/GeoRSS.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Format/GeoRSS.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -73,6 +73,15 @@
             t.xml_eq(out, expected_result, "Output gave expected value");
         }
     }
+
+    function test_leading_space(t) {
+        t.plan(2);
+        
+        var parser = new OpenLayers.Format.GeoRSS();
+        var items = parser.read('<rss version="2.0" xmlns:georss="http://www.georss.org/georss"><item><description>  <![CDATA[foo]]></description></item></rss>');
+        t.eq(items.length, 1, "item created");
+        t.eq(items[0].attributes.description, "  foo", "description value is ok");
+    }
              
     var shell_start = '<feed xmlns="http://www.w3.org/2005/Atom" \n              xmlns:georss="http://www.georss.org/georss">\n              <title>scribble</title>\n              <id>http://featureserver.org/featureserver.cgi/scribble?format=atom</id>\n              <author><name>FeatureServer</name></author>\n';             
     var shell_end = '</feed>'; 

Modified: sandbox/cmoullet/openlayers/tests/Handler/Click.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Click.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Handler/Click.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -2,6 +2,11 @@
 <head>
   <script src="../OLLoader.js"></script>
   <script type="text/javascript">
+  
+    function px(x, y) {
+        return new OpenLayers.Pixel(x, y);
+    }
+  
     function test_Handler_Click_constructor(t) {
         t.plan(3);
         var control = new OpenLayers.Control();
@@ -94,140 +99,182 @@
         handler.activate();
 
     }
+    
+    var callbackMap;
+    function callbackSetup(log, options) {
+        callbackMap = new OpenLayers.Map('map', {controls: []});
 
-    function test_Handler_Click_callbacks(t) {
-        t.plan(13);
-        
-        var map = new OpenLayers.Map('map', {controls: []});
-
         var control = {
-            map: map
+            map: callbackMap
         };
 
-        var handler = new OpenLayers.Handler.Click(control, {});
+        var callbacks = {
+            "click": function(evt) {
+                log.push({callback: "click", evt: evt});
+            },
+            "dblclick": function(evt) {
+                log.push({callback: "dblclick", evt: evt});
+            }
+        };
+        var handler = new OpenLayers.Handler.Click(control, callbacks, options);
         handler.activate();
         
-        
-        // set up for single click - three tests here
         var timers = {};
-        var sto = window.setTimeout;
+        window._setTimeout = window.setTimeout;
         window.setTimeout = function(func, delay) {
-            var key = Math.random();
+            log.push({method: "setTimeout", func: func, delay: delay});
+            var key = (new Date).getTime() + "-" + Math.random();
             timers[key] = true;
-            t.ok(typeof func == "function",
-                 "setTimeout called with a function");
-            t.eq(delay, handler.delay,
-                 "setTimeout called with proper delay");
             // execute function that is supposed to be delayed
             func();
             return key;
         }
-        var cto = window.clearTimeout;
+        window._clearTimeout = window.clearTimeout;
         window.clearTimeout = function(key) {
-            if(timers[key] === true) {
-                delete timers[key];
-            } else {
-                t.fail("clearTimeout called with non-existent timerId");
-            }
+            log.push({
+                method: "clearTimeout",
+                keyExists: (key in timers)
+            });
+            delete timers[key];
         }
+        return handler;    
+    }
+    
+    function callbackTeardown() {
+        window.setTimeout = window._setTimeout;
+        window.clearTimeout = window._clearTimeout;
+        callbackMap.destroy();
+        callbackMap = null;
+    }
+
+    function test_callbacks_click_default(t) {
+        t.plan(6);
+
+        var log = [];
+        var handler = callbackSetup(log);
+        
+        // set up for single click - three tests here
         var testEvt = {id: Math.random()};
-        handler.callbacks = {
-            "click": function(evt) {
-                t.eq(evt.id, testEvt.id,
-                     "(click w/ single true) click callback called with correct evt");
-            },
-            "dblclick": function(evt) {
-                t.fail("(click w/ single true) dblclick should not be called here");
-            }
-        };
-        map.events.triggerEvent("click", testEvt);
+        handler.map.events.triggerEvent("click", testEvt);
+        t.eq(log.length, 2, "(click w/ single true) two items logged");
+
+        // first item logged is setTimeout call
+        t.eq(log[0].method, "setTimeout", "setTimeout called");
+        t.eq(typeof log[0].func, "function", "setTimeout called with a function");
+        t.eq(log[0].delay, handler.delay, "setTimeout called with proper delay");
         
-        // set up for double click with double false - no tests here (only failures)
-        handler.callbacks = {
-            "click": function(evt) {
-                t.fail("(dblclick w/ double false) click should not be called here");
-            },
-            "dblclick": function(evt) {
-                t.fail("(dblclick w/ double false) dblclick should not be called here");
-            }
-        };
-        testEvt = Math.random();
-        map.events.triggerEvent("dblclick", testEvt);
+        // second item logged is from click callback
+        t.eq(log[1].callback, "click", "click callback called");
+        t.eq(log[1].evt.id, testEvt.id, "got correct event");
+        
+        callbackTeardown();
+    }
+    
+    function test_callbacks_dblclick_default(t) {
+        t.plan(1);
 
-        // set up for double click with double true - one test here
-        handler.double = true;
-        handler.callbacks = {
-            "click": function(evt) {
-                t.fail("(dblclick w/ double true) click should not be called here");
-            },
-            "dblclick": function(evt) {
-                t.eq(evt, testEvt,
-                     "(dblclick w/ double true) dblclick called with correct evt");
-            }
-        };
-        testEvt = Math.random();
-        map.events.triggerEvent("dblclick", testEvt);
+        var log = [];
+        var handler = callbackSetup(log);
+        var testEvt = {id: Math.random()};
+        handler.map.events.triggerEvent("dblclick", testEvt);
         
-        // set up for two clicks with double true - 6 tests here (with timeout ones from above)
-        handler.double = true;
-        handler.callbacks = {
-            "click": function(evt) {
-                t.ok(evt != null, "(two clicks w/ double true) click will not be called here if next three tests pass");
-            },
-            "dblclick": function(evt) {
-                t.eq(evt, testEvt,
-                     "(two clicks w/ double true) dblclick called with correct evt");
-            }
-        };
-        testEvt = Math.random();
-        map.events.triggerEvent("click", testEvt);
-        t.ok(handler.timerId != null,
-             "(two clicks w/ double true) timer is set to call click");
-        map.events.triggerEvent("click", testEvt);
-        t.ok(handler.timerId == null,
-             "(two clicks w/ double true) timer is cleared to call click");
-        map.events.triggerEvent("dblclick", testEvt);
-        handler.destroy();
+        t.eq(log.length, 0, "nothing happens by default with dblclick (double is false)");
         
-        // set up to tests pixelTolerance - three tests here (2 from setTimeout above)
-        handler = new OpenLayers.Handler.Click(control, {}, {
-            pixelTolerance: 2
-        });
-        handler.activate();
-        var downEvt = {
-            xy: new OpenLayers.Pixel(0, 0)
+        callbackTeardown();
+        
+    }
+
+    function test_callbacks_dblclick_double(t) {
+        t.plan(3);
+
+        var log = [];
+        var handler = callbackSetup(log, {"double": true});
+        var testEvt = {id: Math.random()};
+        handler.map.events.triggerEvent("dblclick", testEvt);
+        
+        t.eq(log.length, 1, "one item logged");
+        t.eq(log[0].callback, "dblclick", "dblclick callback called")
+        t.eq(log[0].evt.id, testEvt.id, "dblclick callback called with event");
+        
+        callbackTeardown();
+        
+    }
+
+    function test_callbacks_dblclick_sequence(t) {
+        t.plan(8);
+
+        var log = [];
+        var handler = callbackSetup(log, {"double": true});
+        var testEvt = {id: Math.random()};
+
+        // first click - set timer for next
+        handler.map.events.triggerEvent("click", testEvt);
+        t.ok(handler.timerId != null, "timer is set");
+        log.pop(); // because the test setTimeout is synchronous we get the click callback immediately
+        t.eq(log.length, 1, "one item logged (after pop due to synchronous setTimeout call in our tests");
+        t.eq(log[0].method, "setTimeout", "setTimeout called first");
+
+        // second click - timer cleared
+        handler.map.events.triggerEvent("click", testEvt);
+        t.ok(handler.timerId == null, "timer is cleared");
+        t.eq(log.length, 2, "two items logged after second click");
+        t.eq(log[1].method, "clearTimeout", "clearTimeout called second");
+
+        // dblclick event - callback called
+        handler.map.events.triggerEvent("dblclick", testEvt);        
+        t.eq(log.length, 3, "three items logged");
+        t.eq(log[2].callback, "dblclick", "dblclick callback called third");
+        
+        callbackTeardown();
+        
+    }
+
+    function test_callbacks_within_pixelTolerance(t) {
+        t.plan(1);
+
+        var log = [];
+        var handler = callbackSetup(log, {"double": true, pixelTolerance: 2});
+
+        var down = {
+            xy: px(0, 0)
         };
-        map.events.triggerEvent("mousedown", downEvt);
-        var clickEvt = {
-            xy: new OpenLayers.Pixel(0, 1)
+        var up = {
+            xy: px(0, 1)
         };
-        // mouse moves one pixel, click should be called
-        handler.callbacks = {
-            "click": function(evt) {
-                t.ok(evt.xy == clickEvt.xy, "(pixelTolerance met) click called");
-            }
-        };
-        map.events.triggerEvent("click", clickEvt);
-        handler.clearTimer();
+
+        handler.map.events.triggerEvent("mousedown", down);
+        handler.map.events.triggerEvent("mouseup", up);
+        handler.map.events.triggerEvent("click", up);
         
-        // mouse moves 3x3 pixels, click should not be called
-        map.events.triggerEvent("mousedown", downEvt);
-        var clickEvt = {
-            xy: new OpenLayers.Pixel(3, 3)
+        t.eq(log[log.length-1].callback, "click", "click callback called");
+        
+        callbackTeardown();
+        
+    }
+
+    function test_callbacks_outside_pixelTolerance(t) {
+        t.plan(2);
+
+        var log = [];
+        var handler = callbackSetup(log, {pixelTolerance: 2});
+
+        var down = {
+            xy: px(0, 0)
         };
-        // mouse moves one pixel, click should be called
-        handler.callbacks = {
-            "click": function(evt) {
-                t.fail("(pixelTolerance not met) click should not be called");
-            }
+        var up = {
+            xy: px(2, 3)
         };
-        map.events.triggerEvent("click", clickEvt); // no test run
-        handler.clearTimer();
+
+        handler.map.events.triggerEvent("mousedown", down);
+        t.ok(handler.down && handler.down.xy.equals(down.xy), "down position set");
+
+        handler.map.events.triggerEvent("mouseup", up);
+        handler.map.events.triggerEvent("click", up);
         
-        window.setTimeout = sto;
-        window.clearTimeout = cto;
+        t.eq(log.length, 0, "nothing logged - event outside tolerance");
         
-
+        callbackTeardown();
+        
     }
 
     function test_Handler_Click_deactivate(t) {
@@ -253,42 +300,60 @@
     }
 
     function test_Handler_Click_mouseup(t) {
-        t.plan(4);
-        g_Propagate = {};
-        g_evt = {};
-                
-      //no modifiers, no handlerightclicks, no isrightclick        
+        t.plan(11);
+
+        var map = new OpenLayers.Map("map");
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+        var handler = new OpenLayers.Handler.Click(control);
+
+        var testEvent = {id: Math.random()};
+        var propagate = true;
+        var log, got, modMatch, rightClick;
+
+        // override methods to log what is called
         var temp = OpenLayers.Event.isRightClick;
         OpenLayers.Event.isRightClick = function(e) { 
-            t.ok(e == g_evt, 'correct event passed in to checkModifiers');
-            return false; 
+            log.push({method: "isRightClick", evt: e});
+            return rightClick; 
         };
-
-        var h = {
-            'checkModifiers': function(e) {
-                t.ok(e == g_evt, 'correct event passed in to checkModifiers');
-                return false;
-            },
-            'control': {
-                'handleRightClicks': false
-            },
-            'rightclick': function(e) {
-                t.ok(e == g_evt, 'correct event passed in to checkModifiers');
-                return g_Propagate;
-            }
+        handler.checkModifiers = function(e) {
+            log.push({method: "checkModifiers", evt: e});
+            return modMatch;
         };
-        var propagate = OpenLayers.Handler.Click.prototype.mouseup.apply(h, [g_evt]);
-        t.ok(propagate, "default propagate is true when no modifiers, no handlerightclicks, no isrightclick")
+        handler.rightclick = function(e) {
+            log.push({method: "rightclick", evt: e});
+            return propagate;
+        };
 
-      //modifiers, handlerightclicks, and isrightclick
-        h.checkModifiers = function() { return true; };
-        h.control.handleRightClicks = true;        
-        OpenLayers.Event.isRightClick = function(e) { return true; };
-        propagate = OpenLayers.Handler.Click.prototype.mouseup.apply(h, [g_evt]);
+        
+        // simulate an event with non-matching modifiers
+        log = [];
+        modMatch = false;
+        rightClick = false;
+        got = handler.mouseup(testEvent);
+        t.eq(log.length, 1, "one item logged");
+        t.eq(log[0] && log[0].method, "checkModifiers", "a) checkModifiers called first");
+        t.eq(log[0] && log[0].evt, testEvent, "a) first method called with correct event");
 
-        t.ok(propagate == g_Propagate, "return from handler's rightClick() returned from mouseup");
 
+        // modifiers, handlerightclicks, and isrightclick
+        log = [];
+        rightClick = true;
+        modMatch = true;
+        handler.control.handleRightClicks = true;
+        got = handler.mouseup(testEvent);
+        t.eq(log.length, 3, "three items logged");
+        t.eq(log[0] && log[0].method, "checkModifiers", "b) checkModifiers called first");
+        t.eq(log[0] && log[0].evt, testEvent, "b) first method called with correct event");
+        t.eq(log[1] && log[1].method, "isRightClick", "b) isRightClick called second");
+        t.eq(log[1] && log[1].evt, testEvent, "b) second method called with correct event");
+        t.eq(log[2] && log[2].method, "rightclick", "b) rightclick called third");
+        t.eq(log[2] && log[2].evt, testEvent, "b) third method called with correct event");
+        t.eq(got, propagate, "b) return from handler's rightclick returned from mouseup");
+
         OpenLayers.Event.isRightClick = temp;
+        map.destroy();
     }
 
     function test_touch_click(t) {
@@ -315,7 +380,7 @@
         // test
 
         log = null;
-        handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
+        handler.touchstart({xy: px(1, 1), touches: ["foo"]});
         handler.touchend({touches: ["foo"]});
 
         t.delay_call(1, function() {
@@ -354,9 +419,9 @@
         // test
 
         log = {};
-        handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
+        handler.touchstart({xy: px(1, 1), touches: ["foo"]});
         handler.touchend({});
-        handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
+        handler.touchstart({xy: px(1, 1), touches: ["foo"]});
         handler.touchend({type: "click"});
 
         t.eq(!!handler.down.touches, true, "Handler down touches property should be truthy");
@@ -395,9 +460,9 @@
         // test
 
         log = {};
-        handler.touchstart({xy: {x: 1, y: 1}, touches: [{clientX:0, clientY:10}]});
+        handler.touchstart({xy: px(1, 1), touches: [{clientX:0, clientY:10}]});
         handler.touchend({});
-        handler.touchstart({xy: {x: 1, y: 1}, touches: [{clientX:0, clientY:10}]});
+        handler.touchstart({xy: px(1, 1), touches: [{clientX:0, clientY:10}]});
         handler.touchend({});
 
         t.eq(log.click, undefined, "click callback not called");

Modified: sandbox/cmoullet/openlayers/tests/Handler/Path.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Path.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Handler/Path.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -145,6 +145,10 @@
             cancel: function() {
                 logs.push({type: "cancel", args: arguments});
             }
+        },
+        {
+            pixelTolerance: 0,
+            dblclickTolerance: 0
         });
         control.handler = handler;
         map.addControl(control);
@@ -642,7 +646,11 @@
         });
         map.addLayer(layer);
         var control = new OpenLayers.Control({});
-        var handler = new OpenLayers.Handler.Path(control, {});
+        var handler = new OpenLayers.Handler.Path(control, {},
+        {
+            pixelTolerance: 0,
+            dblclickTolerance: 0
+        });
         control.handler = handler;
         map.addControl(control);
         map.setCenter(new OpenLayers.LonLat(0, 0), 0);
@@ -741,6 +749,97 @@
             ]), "geometry is correct after mousemove");
     }
 
+    function test_sequence_touch_1(t) {
+        t.plan(19);
+        
+        log = [];
+        var map = new OpenLayers.Map("map", { // 300 x 150
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-100, -100, 100, 100),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control, {
+            "done": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+        handler.activate();
+
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(49, 75)});
+        t.eq(log.length, 0, "touch start 1");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(50, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        t.geom_eq(handler.line.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-100, 0)
+            ]), "geometry is correct");
+
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch start 2");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        t.geom_eq(handler.line.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-100, 0)
+            ]), "geometry is correct");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch start 3");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        t.geom_eq(handler.line.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-50, 0),
+                new OpenLayers.Geometry.Point(-50, 0)
+            ]), "geometry is correct");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(252, 100)});
+        t.eq(log.length, 0, "touch start 4");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(252, 100)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(250, 100)});
+        t.eq(log.length, 1, "touch start");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 100)});
+        t.eq(log.length, 1, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 1, "touch end");
+        t.geom_eq(log[0].geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-50, 0),
+                new OpenLayers.Geometry.Point(102, -25)
+            ]), "geometry is correct");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/cmoullet/openlayers/tests/Handler/Point.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Point.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Handler/Point.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -75,7 +75,7 @@
     }
 
     function test_Handler_Point_events(t) {
-        t.plan(34);
+        t.plan(49);
         var log = [];
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
@@ -97,7 +97,7 @@
 
         // list below events that should be handled (events) and those
         // that should not be handled (nonevents) by the handler
-        var events = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout"];
+        var events = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout", "touchstart", "touchmove", "touchend"];
         var nonevents = ["resize", "focus", "blur"];
         map.events.registerPriority = function(type, obj, func) {
             var r = func();
@@ -166,6 +166,10 @@
             cancel: function() {
                 logs.push({type: "cancel", args: arguments});
             }
+        },
+        {
+            pixelTolerance: 0,
+            dblclickTolerance: 0
         });
         control.handler = handler;
         map.addControl(control);
@@ -379,8 +383,49 @@
              "handler.point is null after destroy");
     }
     
+    function test_sequence_touch_1(t) {
+        t.plan(7);
 
+        log = [];
+        var map = new OpenLayers.Map("map", { // 300 x 150
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-100, -100, 100, 100),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Point(control, {
+            "done": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+        handler.activate();
+        
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(50, 75)});
+        t.eq(log.length, 0, "touch start 1");
+        
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
+        t.eq(log.length, 0, "touch move");
 
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(99, 75)});
+        t.eq(log.length, 0, "touch start 2");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 1, "touch end");
+        t.geom_eq(log[0].geometry, new OpenLayers.Geometry.Point(-50, 0), "geometry is correct");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/cmoullet/openlayers/tests/Handler/Polygon.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Polygon.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Handler/Polygon.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -142,6 +142,10 @@
             cancel: function() {
                 logs.push({type: "cancel", args: arguments});
             }
+        },
+        {
+            pixelTolerance: 0,
+            dblclickTolerance: 0
         });
         control.handler = handler;
         map.addControl(control);
@@ -531,7 +535,11 @@
         var draw = new OpenLayers.Control.DrawFeature(
             map.layers[0],
             OpenLayers.Handler.Polygon,
-            {handlerOptions: {holeModifier: "altKey"}}
+            {handlerOptions: {
+                holeModifier: "altKey",
+                pixelTolerance: 0,
+                dblclickTolerance: 0
+            }}
         );
         map.addControl(draw);
         draw.activate();
@@ -745,7 +753,8 @@
         var control = new OpenLayers.Control({});
         var handler = new OpenLayers.Handler.Polygon(control,
             {done: function(g) { log.geometry = g; }},
-            {stopDown: true, stopUp: true}
+            {stopDown: true, stopUp: true,
+            pixelTolerance: 0, dblclickTolerance: 0}
         );
         control.handler = handler;
         map.addControl(control);
@@ -816,7 +825,8 @@
         var control = new OpenLayers.Control({});
         var handler = new OpenLayers.Handler.Polygon(control,
             {done: function(g) { log.geometry = g; }},
-            {stopDown: false, stopUp: false}
+            {stopDown: false, stopUp: false,
+            pixelTolerance: 0, dblclickTolerance: 0}
         );
         control.handler = handler;
         map.addControl(control);
@@ -868,6 +878,105 @@
             ]), "geometry is correct");
     }
 
+
+    function test_sequence_touch_1(t) {
+        t.plan(19);
+        
+        log = [];
+        var map = new OpenLayers.Map("map", { // 300 x 150
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-100, -100, 100, 100),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control, {
+            "done": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
+        control.layer = layer;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+        handler.activate();
+        
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(49, 75)});
+        t.eq(log.length, 0, "touch start 1");
+        var expectedRing = new OpenLayers.Geometry.LinearRing([
+            new OpenLayers.Geometry.Point(-100, 0),
+            new OpenLayers.Geometry.Point(-100, 0)
+        ]);
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(50, 75)});
+        t.eq(log.length, 0, "touch move");
+        
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        expectedRing.addComponent(new OpenLayers.Geometry.Point(-100,0), 1);
+
+        t.geom_eq(handler.polygon.geometry.components[0], expectedRing, "geometry is correct");
+
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch start 2");
+        var expectedRing = new OpenLayers.Geometry.LinearRing([
+            new OpenLayers.Geometry.Point(-100, 0),
+            new OpenLayers.Geometry.Point(-100, 0)
+        ]);
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        expectedRing.addComponent(new OpenLayers.Geometry.Point(-100,0), 1);
+        
+        t.geom_eq(handler.polygon.geometry.components[0], expectedRing, "geometry is correct");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch start 3");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(100, 75)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+        t.geom_eq(handler.polygon.geometry,
+            new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-50, 0),
+                new OpenLayers.Geometry.Point(-50, 0),
+                new OpenLayers.Geometry.Point(-100, 0)
+            ])]), "geometry is correct");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(252, 100)});
+        t.eq(log.length, 0, "touch start 4");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(252, 100)});
+        t.eq(log.length, 0, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 0, "touch end");
+            
+        handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(250, 100)});
+        t.eq(log.length, 1, "touch start");
+
+        handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 100)});
+        t.eq(log.length, 1, "touch move");
+
+        handler.touchend({type: "touchend"});
+        t.eq(log.length, 1, "touch end");
+        t.geom_eq(log[0].geometry,
+            new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([
+                new OpenLayers.Geometry.Point(-100, 0),
+                new OpenLayers.Geometry.Point(-50, 0),
+                new OpenLayers.Geometry.Point(102, -25),
+                new OpenLayers.Geometry.Point(-100, 0)
+            ])]), "geometry is correct");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/cmoullet/openlayers/tests/Layer/Vector.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Layer/Vector.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Layer/Vector.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -458,9 +458,7 @@
         t.plan(9);
         
         var map = new OpenLayers.Map("map");
-        var layer = new OpenLayers.Layer.Vector(null, {
-            drawn: true
-        });
+        var layer = new OpenLayers.Layer.Vector();
         map.addLayer(layer);
         var feature = new OpenLayers.Feature.Vector(
             new OpenLayers.Geometry.Point(10, 10)
@@ -477,6 +475,7 @@
         };
         
         // draw feature with no state
+        layer.drawn = true;
         layer.drawFeature(feature);
         t.ok(log.feature === feature, "[no state] drawFeature called with correct feature");
         t.ok(log.style.display !== "none", "[no state] drawFeature called with style display not none");
@@ -707,6 +706,54 @@
                         (-y + customStyle6.graphicYOffset).toFixed().toString(),
                         "graphicYOffset correctly set");
         }
+        if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.SVG2') {
+                feature.style = customStyle1;
+                layer.drawFeature(feature);
+                var resolution = map.getResolution();
+                t.eq(root.firstChild.getAttributeNS(null, 'width'),
+                             (2*customStyle1.pointRadius*resolution).toString(),
+                             "given a pointRadius, width equals 2*pointRadius");
+                t.eq(root.firstChild.getAttributeNS(null, 'height'),
+                             (2*customStyle1.pointRadius*resolution).toString(),
+                             "given a pointRadius, height equals 2*pointRadius");
+                feature.style = customStyle2;
+                layer.drawFeature(feature);
+                t.eq(root.firstChild.getAttributeNS(null, 'width'),
+                             root.firstChild.getAttributeNS(null, 'height'),
+                             "given a graphicWidth, width equals height");
+                t.eq(root.firstChild.getAttributeNS(null, 'width'),
+                             (customStyle2.graphicWidth*resolution).toString(),
+                             "width is set correctly");
+                feature.style = customStyle3;
+                layer.drawFeature(feature);
+                t.eq(root.firstChild.getAttributeNS(null, 'height'),
+                             root.firstChild.getAttributeNS(null, 'width'),
+                             "given a graphicHeight, height equals width");
+                t.eq(root.firstChild.getAttributeNS(null, 'height'),
+                             (customStyle3.graphicHeight*resolution).toString(),
+                             "height is set correctly");
+                feature.style = customStyle4;
+                layer.drawFeature(feature);
+                t.eq(root.firstChild.getAttributeNS(null, 'height'),
+                             (customStyle4.graphicHeight*resolution).toString(),
+                             "given graphicHeight and graphicWidth, both are set: height");
+                t.eq(root.firstChild.getAttributeNS(null, 'width'),
+                             (customStyle4.graphicWidth*resolution).toString(),
+                             "given graphicHeight and graphicWidth, both are set: width");
+                feature.style = customStyle5;
+                layer.drawFeature(feature);
+                t.eq(root.firstChild.getAttributeNS(null, 'style'),
+                             'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") ? "" : ';'),
+                             "graphicOpacity correctly set");
+                feature.style = customStyle6;
+                layer.drawFeature(feature);
+                t.eq(root.firstChild.getAttributeNS(null, 'x'),
+                        (geometryX + customStyle6.graphicXOffset*resolution).toString(),
+                        "graphicXOffset correctly set");
+                t.eq(root.firstChild.getAttributeNS(null, 'y'),
+                        (-geometryY + customStyle6.graphicYOffset*resolution).toString(),
+                        "graphicYOffset correctly set");
+        }
         if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.VML') {
                 feature.style = customStyle1;
                 layer.drawFeature(feature);

Modified: sandbox/cmoullet/openlayers/tests/Map.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Map.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Map.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1052,7 +1052,7 @@
     }
 
     function test_Map_restrictedExtent(t) {
-        t.plan(24);
+        t.plan(25);
         var extent = new OpenLayers.Bounds(-180, -90, 180, 90);
         var options = {
             maxResolution: "auto"
@@ -1147,8 +1147,28 @@
              "map extent not restricted with null restrictedExtent for se");
 
         map.destroy();
+
+        extent = new OpenLayers.Bounds(8, 44.5, 19, 50);
+        var options = {
+            restrictedExtent: extent
+        };
+        map = new OpenLayers.Map('map', options);
+
+        var wms = new OpenLayers.Layer.WMS(
+            "OpenLayers WMS", 
+            "http://vmap0.tiles.osgeo.org/wms/vmap0?",
+            {layers: 'basic'}
+        ); 
+
+        map.addLayers([wms]);
+        map.zoomToExtent(extent);
+        map.zoomIn();
+        map.setOptions({restrictedExtent: null});
+        map.pan(-250, -250);
+        t.ok((map.getExtent().bottom == 48.3486328125 && map.getExtent().left == 7.45751953125), "Expected extent when toggling restrictedExtent");
+        map.destroy();
     }
-    
+
     function test_Map_getResolutionForZoom(t) {
         t.plan(2);
         var map = new OpenLayers.Map("map");
@@ -1323,7 +1343,7 @@
         var m = {
             'baseLayer': { 'units': {} },
             'getSize': function() { return {'w': 10, 'h': 15}; },
-            'getCenter': function() { return {'lon': -5, 'lat': -25}; },
+            'getCachedCenter': function() { return {'lon': -5, 'lat': -25}; },
             'zoomToExtent': function(extent, closest) {
                 t.ok(extent.equals(g_ExpectedExtent), "extent correctly calculated for zoomToExtent()");
                 t.ok(closest == g_Closest, "closest correctly passed on to zoomToExtent()");
@@ -1701,6 +1721,41 @@
         map.destroy();
     }    
 
+    function test_moveByPx(t) {
+        t.plan(8);
+
+        var map = new OpenLayers.Map({
+            div: 'map',
+            maxExtent: new OpenLayers.Bounds(-50, -50, 50, 50),
+            restrictedExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            layers: [
+                new OpenLayers.Layer('name', {isBaseLayer: true})
+            ]
+        });
+        map.zoomToExtent(new OpenLayers.Bounds(-1, -1, 1, 1));
+
+        // check initial state
+        t.eq(map.layerContainerDiv.style.left, '0px', 'layer container left correct');
+        t.eq(map.layerContainerDiv.style.top, '0px', 'layer container top correct');
+
+        // move to a valid position
+        map.moveByPx(-455, 455);
+        t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct');
+        t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct');
+
+        // move outside the max extent
+        map.moveByPx(-4500, 4500);
+        t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct');
+        t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct');
+
+        // move outside the restricted extent
+        map.moveByPx(-500, 500);
+        t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct');
+        t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct');
+
+        map.destroy();
+    }
+
   </script>
 </head>
 <body>

Copied: sandbox/cmoullet/openlayers/tests/Renderer/SVG2.html (from rev 11617, trunk/openlayers/tests/Renderer/SVG2.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/Renderer/SVG2.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/Renderer/SVG2.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,424 @@
+<html>
+<head>
+<script src="../OLLoader.js"></script>
+  <script type="text/javascript">
+
+    var geometry = null, node = null;
+    
+    function test_SVG_constructor(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(1);
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        t.ok(r instanceof OpenLayers.Renderer.SVG2, "new OpenLayers.Renderer.SVG2 returns SVG object" );
+    }
+    
+    function test_SVG_destroy(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(1);
+        
+        var g_Destroy = false;
+        
+        OpenLayers.Renderer.Elements.prototype._destroy = 
+            OpenLayers.Renderer.Elements.prototype.destroy;
+            
+        OpenLayers.Renderer.prototype.destroy = function() {
+            g_Destroy = true;
+        }
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        r.destroy();
+        
+        t.eq(g_Destroy, true, "OpenLayers.Renderer.Elements.destroy() called");
+        
+        OpenLayers.Renderer.prototype.destroy = 
+            OpenLayers.Renderer.prototype._destroy;
+    }
+    
+    function test_SVG_updateDimensions(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(5);
+        
+        OpenLayers.Renderer.SVG2.prototype._setExtent =
+            OpenLayers.Renderer.SVG2.prototype.setExtent;
+        
+        var g_SetExtent = false;
+        OpenLayers.Renderer.SVG2.prototype.setExtent = function() {
+            g_SetExtent = true;
+            OpenLayers.Renderer.SVG2.prototype._setExtent.apply(this, arguments);
+        }
+                
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        var extent = new OpenLayers.Bounds(1,2,3,4);
+        r.map = {
+            getResolution: function() {
+                return 0.5;
+            },
+            getExtent: function() {
+                return extent;
+            },
+            getMaxExtent: function() {
+                return extent;
+            }
+        }
+        r.updateDimensions();
+        
+        t.eq(g_SetExtent, true, "Elements.setExtent() called");
+        
+        t.eq(r.rendererRoot.getAttributeNS(null, "width"), "4", "width is correct");
+        t.eq(r.rendererRoot.getAttributeNS(null, "height"), "4", "height is correct");
+        t.eq(r.rendererRoot.getAttributeNS(null, "viewBox"), "1 -4 2 2", "rendererRoot viewBox is correct");
+        
+        // test extent changes
+        extent = new OpenLayers.Bounds(2,3,5,6);
+        r.updateDimensions();
+        t.eq(r.rendererRoot.getAttributeNS(null, "viewBox"), "2 -6 3 3", "rendererRoot viewBox is correct after a new setExtent");
+
+        OpenLayers.Renderer.SVG2.prototype.setExtent =
+            OpenLayers.Renderer.SVG2.prototype._setExtent;
+    }
+    
+    function test_SVG_drawpoint(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+    
+        t.plan(1);
+
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        
+        var properDraw = false;
+        var g_Radius = null;
+        r.drawCircle = function(n, g, r) {
+            properDraw = true;
+            g_Radius = 1;
+        }
+        r.drawPoint();
+        
+        t.ok(properDraw && g_Radius == 1, "drawPoint called drawCircle with radius set to 1");
+    }
+    
+    function test_SVG_drawcircle(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(5);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        r.resolution = 0.5;
+        r.left = 0;
+        r.top = 0;
+        
+        var node = document.createElement('div');
+        
+        var geometry = {
+            x: 1,
+            y: 2
+        }
+        
+        r.drawCircle(node, geometry, 3);
+        
+        t.eq(node.getAttributeNS(null, 'cx'), '1', "cx is correct");
+        t.eq(node.getAttributeNS(null, 'cy'), '-2', "cy is correct");
+        t.eq(node._radius, 3, "radius preset is correct");
+       
+        // #1274: out of bound node fails when first added
+        var geometry = {
+            x: 10000000,
+            y: 200000000,
+            CLASS_NAME: "OpenLayers.Geometry.Point",
+            id: "foo",
+            getBounds: function() {return {bottom: 0}}
+        }
+        node.id = geometry.id;
+        r.root.appendChild(node);
+
+        var drawCircleCalled = false;
+        r.drawCircle = function() {
+            drawCircleCalled = true;
+            return OpenLayers.Renderer.SVG2.prototype.drawCircle.apply(r, arguments);
+        }
+        
+        r.drawGeometry(geometry, {pointRadius: 3}, "blah_4000");
+        t.eq(drawCircleCalled, true, "drawCircle called on drawGeometry for a point geometry.")
+        t.ok(node.parentNode != r.root, "circle will not be drawn when coordinates are outside the valid range");
+    }
+    
+    function test_SVG_drawlinestring(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(2);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        
+        var node = document.createElement('div');
+        
+        var geometry = {
+            components: "foo"
+        }
+        g_GetString = false;
+        g_Components = null;
+        r.getComponentsString = function(c) {
+            g_GetString = true;
+            g_Components = c;
+            return "bar";
+        }
+        
+        r.drawLineString(node, geometry);
+        
+        t.ok(g_GetString && g_Components == "foo", "getComponentString is called with valid arguments");
+        t.eq(node.getAttributeNS(null, "points"), "bar", "points attribute is correct");
+    }
+    
+    function test_SVG_drawlinearring(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(2);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        
+        var node = document.createElement('div');
+        
+        var geometry = {
+            components: "foo"
+        }
+        g_GetString = false;
+        g_Components = null;
+        r.getComponentsString = function(c) {
+            g_GetString = true;
+            g_Components = c;
+            return "bar";
+        }
+        
+        r.drawLinearRing(node, geometry);
+        
+        t.ok(g_GetString, "getComponentString is called with valid arguments");
+        t.eq(node.getAttributeNS(null, "points"), "bar", "points attribute is correct");
+    }
+
+    function test_SVG_drawpolygon(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(3);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        
+        var node = document.createElement('div');
+        
+        var linearRings = [{
+            components: ["foo"]
+        },{
+            components: ["bar"]
+        }]
+        
+        var geometry = {
+            components: linearRings
+        }
+        g_GetString = false;
+        r.getShortString = function(c) {
+            g_GetString = true;
+            return c;
+        }
+        
+        r.drawPolygon(node, geometry);
+        
+        t.ok(g_GetString, "getShortString is called");
+        t.eq(node.getAttributeNS(null, "d"), "M foo M bar z", "d attribute is correctly set");
+        t.eq(node.getAttributeNS(null, "fill-rule"), "evenodd", "fill-rule attribute is correctly set");
+    }
+
+    function test_SVG_drawrectangle(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(4);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        r.resolution = 0.5;
+        r.left = 0;
+        r.top = 0;
+        
+        var node = document.createElement('div');
+        
+        var geometry = {
+            x: 1,
+            y: 2,
+            width: 3,
+            height: 4
+        }
+        
+        r.drawRectangle(node, geometry);
+        
+        t.eq(node.getAttributeNS(null, "x"), "1", "x attribute is correctly set");
+        t.eq(node.getAttributeNS(null, "y"), "-2", "y attribute is correctly set");
+        t.eq(node.getAttributeNS(null, "width"), "3", "width attribute is correctly set");
+        t.eq(node.getAttributeNS(null, "height"), "4", "height attribute is correctly set");
+    }
+    
+    function test_SVG_drawsurface(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(2);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        
+        var node = document.createElement('div');
+        
+        var geometry = {
+            components: ['foo', 'bar', 'dude']
+        }
+        g_GetString = false;
+        r.getShortString = function(c) {
+            g_GetString = true;
+            return c;
+        }
+        
+        r.drawSurface(node, geometry);
+        
+        t.ok(g_GetString, "getShortString is called");
+        
+        t.eq(node.getAttributeNS(null, "d"), "M foo C bar dude Z", "d attribute is correctly set");
+    }
+    
+    function test_SVG_getcomponentsstring(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(1);
+        
+        var components = ['foo', 'bar'];
+        
+        OpenLayers.Renderer.SVG2.prototype._getShortString = 
+            OpenLayers.Renderer.SVG2.prototype.getShortString;
+            
+        OpenLayers.Renderer.SVG2.prototype.getShortString = function(p) {
+            return p;
+        };
+        
+        var string = OpenLayers.Renderer.SVG2.prototype.getComponentsString(components);
+        t.eq(string, "foo,bar", "returned string is correct");
+        
+        OpenLayers.Renderer.SVG2.prototype.getShortString = 
+            OpenLayers.Renderer.SVG2.prototype._getShortString;
+    }
+    
+    
+    
+    function test_SVG_getshortstring(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+        
+        t.plan(1);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+        r.resolution = 0.5;
+        r.left = 0;
+        r.top = 0;
+        
+        var point = {
+            x: 1,
+            y: 2
+        };
+        
+        var string = r.getShortString(point);
+        t.eq(string, "1,-2", "returned string is correct");
+    }
+    
+    function test_svg_getnodetype(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+
+        t.plan(1);
+         
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+
+        var g = {CLASS_NAME: "OpenLayers.Geometry.Point"}
+        var s = {graphicName: "square"};
+        
+        t.eq(r.getNodeType(g, s), "svg", "Correct node type for well known symbols");
+    }
+        
+    function test_svg_importsymbol(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+
+        t.plan(2);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+
+        r.importSymbol("square");
+
+        var polygon = document.getElementById(r.container.id + "_defs").firstChild.firstChild;
+        
+        var pass = false;
+        for (var i = 0; i < polygon.points.numberOfItems; i++) {
+            var p = polygon.points.getItem(i);
+            pass = p.x === OpenLayers.Renderer.symbol.square[2*i] && 
+                   p.y === OpenLayers.Renderer.symbol.square[2*i+1];
+            if (!pass) {
+                break;
+            }
+        }
+        t.ok(pass, "Square symbol rendered correctly");
+        t.ok(r.symbolMetrics["-square"], "Symbol metrics cached correctly.");
+    }
+        
+    function test_svg_dashstyle(t) {
+        if (!OpenLayers.Renderer.SVG2.prototype.supported()) {
+            t.plan(0);
+            return;
+        }
+
+        t.plan(5);
+        
+        var r = new OpenLayers.Renderer.SVG2(document.body);
+
+        t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dot"}, 1), "1,4", "dot dasharray created correctly");
+        t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dash"}, 1), "4,4", "dash dasharray created correctly");
+        t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "longdash"}, 1), "8,4", "longdash dasharray created correctly");
+        t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dashdot"}, 1), "4,4,1,4", "dashdot dasharray created correctly");
+        t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "longdashdot"}, 1), "8,4,1,4", "dashdot dasharray created correctly");
+    }
+
+  </script>
+</head>
+<body>
+<div id="map" style="width:500px;height:550px"></div>
+</body>
+</html>

Modified: sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -270,6 +270,38 @@
         
     }
 
+    // Test fix for Ticket #3142
+    function test_layerLoadedAfterBeingAdded(t) {
+        t.plan(1);
+
+        var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
+
+        var strategy = new OpenLayers.Strategy.BBOX({
+            ratio: 1 // makes for easier comparison to map bounds
+        });
+        var layer = new OpenLayers.Layer.Vector(null, {
+            protocol: new OpenLayers.Protocol(),
+            strategies: [strategy]
+        });
+
+        // Make sure to test the case of a vector layer needing to be 
+        // reprojected while the map is not yet centered
+        var layerReproject = new OpenLayers.Layer.Vector(null, {
+            protocol: new OpenLayers.Protocol(),
+            strategies: [new OpenLayers.Strategy.BBOX()],
+            projection: 'EPSG:900913'
+        });
+
+        var map = new OpenLayers.Map("map");
+        map.addLayer(dummy);
+        map.addLayer(layerReproject);
+        map.setCenter(new OpenLayers.LonLat(0, 0));
+        map.addLayer(layer);
+
+        // test that the strategy bounds were set
+        t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/cmoullet/openlayers/tests/list-tests.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/list-tests.html	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tests/list-tests.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -32,6 +32,7 @@
     <li>Control/PanZoom.html</li>
     <li>Control/PanZoomBar.html</li>
     <li>Control/Permalink.html</li>
+    <li>Control/PinchZoom.html</li>
     <li>Control/Scale.html</li>
     <li>Control/ScaleLine.html</li>
     <li>Control/SelectFeature.html</li>
@@ -184,6 +185,7 @@
     <li>Renderer/Canvas.html</li>
     <li>Renderer/Elements.html</li>
     <li>Renderer/SVG.html</li>
+    <li>Renderer/SVG2.html</li>
     <li>Renderer/VML.html</li>
     <li>Request.html</li>
     <li>Request/XMLHttpRequest.html</li>

Deleted: sandbox/cmoullet/openlayers/tests/node.js/mockdom.js
===================================================================
--- trunk/openlayers/tests/node.js/mockdom.js	2011-03-05 23:34:44 UTC (rev 11617)
+++ sandbox/cmoullet/openlayers/tests/node.js/mockdom.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1,106 +0,0 @@
-XMLHttpRequest = function() { 
-    return { 
-    'open': function() {  },
-    'send': function() {  }
-    }
-};
-
-alert = print;
-
-navigator = {
-  'appName': 'mockdom',
-  'userAgent': 'mockdom',
-  'appVersion': '0.1',
-  'language': 'en',
-  'userLanguage': 'en'
-}  
-
-element = function(type) {
-    type = type || "";
-
-    return {
-        'childNodes': [],
-        'className': '',
-        'tagName': type.toUpperCase(),
-        'style': {},
-        'setAttribute': function(attr, value) {
-            this[attr] = value;
-        },    
-        'appendChild': function(element) {
-            if (this.childNodes.length) {
-                this.childNodes[this.childNodes.length - 1].nextSibling = element;
-            }  else {
-                this.firstChild = element;
-            }    
-            element.parentNode = this;
-            this.childNodes.push(element);
-
-        }, 
-        'removeChild': function(element) {
-            var i = this.childNodes.indexOf(element);
-            this.childNodes.splice(i, 1);
-        },    
-        'addEventListener': function() {
-        },
-        'removeEventListener': function() {
-        },
-        'getElementsByTagName': function(name, externalList) {
-            var uc = name.toUpperCase();
-            var list = externalList || [];
-            for(var i = 0; i < this.childNodes.length; i++) {
-                if (this.childNodes[i].tagName == uc) {
-                    list.push(this.childNodes[i]);
-                }
-                this.childNodes[i].getElementsByTagName(name, list);
-            }
-            return list;
-        },
-        'getElementById': function(id) {
-            for(var i = 0; i < this.childNodes.length; i++) {
-                if (this.childNodes[i].id == id) {
-                    return this.childNodes[i];
-                } else {
-                    var elem = this.childNodes[i].getElementById(id);
-                    if (elem) { 
-                        return elem
-                    }
-                }
-            }
-        }
-    }
-};
-
-document = element();
-document.createElement = function(type) {
-     return element(type);
-};
-document.createTextNode = function(text) {
-    var e = element("Text");
-    e.innerHTML = text;
-}
-
-document.appendChild(element("head"));
-document.body = element("body");
-document.appendChild(document.body);
-
-window = {
-    'addEventListener': function() {
-    },
-    'getSelection': function() {
-        return {
-            collapseToStart: function() {}
-        }
-    },
-    document: document,
-    navigator: navigator,
-    location: {
-        href: '#',
-        port: '',
-        hostname: 'openlayers.org',
-        host: 'openlayers.org',
-        proto: 'https'
-    }    
-};
-document.location = window.location;
-
-window.Function = Function;

Copied: sandbox/cmoullet/openlayers/tests/node.js/mockdom.js (from rev 11617, trunk/openlayers/tests/node.js/mockdom.js)
===================================================================
--- sandbox/cmoullet/openlayers/tests/node.js/mockdom.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/node.js/mockdom.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,106 @@
+XMLHttpRequest = function() { 
+    return { 
+    'open': function() {  },
+    'send': function() {  }
+    }
+};
+
+alert = print;
+
+navigator = {
+  'appName': 'mockdom',
+  'userAgent': 'mockdom',
+  'appVersion': '0.1',
+  'language': 'en',
+  'userLanguage': 'en'
+}  
+
+element = function(type) {
+    type = type || "";
+
+    return {
+        'childNodes': [],
+        'className': '',
+        'tagName': type.toUpperCase(),
+        'style': {},
+        'setAttribute': function(attr, value) {
+            this[attr] = value;
+        },    
+        'appendChild': function(element) {
+            if (this.childNodes.length) {
+                this.childNodes[this.childNodes.length - 1].nextSibling = element;
+            }  else {
+                this.firstChild = element;
+            }    
+            element.parentNode = this;
+            this.childNodes.push(element);
+
+        }, 
+        'removeChild': function(element) {
+            var i = this.childNodes.indexOf(element);
+            this.childNodes.splice(i, 1);
+        },    
+        'addEventListener': function() {
+        },
+        'removeEventListener': function() {
+        },
+        'getElementsByTagName': function(name, externalList) {
+            var uc = name.toUpperCase();
+            var list = externalList || [];
+            for(var i = 0; i < this.childNodes.length; i++) {
+                if (this.childNodes[i].tagName == uc) {
+                    list.push(this.childNodes[i]);
+                }
+                this.childNodes[i].getElementsByTagName(name, list);
+            }
+            return list;
+        },
+        'getElementById': function(id) {
+            for(var i = 0; i < this.childNodes.length; i++) {
+                if (this.childNodes[i].id == id) {
+                    return this.childNodes[i];
+                } else {
+                    var elem = this.childNodes[i].getElementById(id);
+                    if (elem) { 
+                        return elem
+                    }
+                }
+            }
+        }
+    }
+};
+
+document = element();
+document.createElement = function(type) {
+     return element(type);
+};
+document.createTextNode = function(text) {
+    var e = element("Text");
+    e.innerHTML = text;
+}
+
+document.appendChild(element("head"));
+document.body = element("body");
+document.appendChild(document.body);
+
+window = {
+    'addEventListener': function() {
+    },
+    'getSelection': function() {
+        return {
+            collapseToStart: function() {}
+        }
+    },
+    document: document,
+    navigator: navigator,
+    location: {
+        href: '#',
+        port: '',
+        hostname: 'openlayers.org',
+        host: 'openlayers.org',
+        proto: 'https'
+    }    
+};
+document.location = window.location;
+
+window.Function = Function;

Deleted: sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg
===================================================================
--- trunk/openlayers/tests/node.js/node-tests.cfg	2011-03-05 23:34:44 UTC (rev 11617)
+++ sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1,12 +0,0 @@
-# This build config is supposed to be used for the units tests with "mode=build"
-
-[first]
-mockdom.js
-[last]
-node.js
-
-[include]
-
-[exclude]
-OpenLayers.js
-Firebug/firebug.js

Copied: sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg (from rev 11617, trunk/openlayers/tests/node.js/node-tests.cfg)
===================================================================
--- sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/node.js/node-tests.cfg	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,12 @@
+# This build config is supposed to be used for the units tests with "mode=build"
+
+[first]
+mockdom.js
+[last]
+node.js
+
+[include]
+
+[exclude]
+OpenLayers.js
+Firebug/firebug.js

Deleted: sandbox/cmoullet/openlayers/tests/node.js/node.js
===================================================================
--- trunk/openlayers/tests/node.js/node.js	2011-03-05 23:34:44 UTC (rev 11617)
+++ sandbox/cmoullet/openlayers/tests/node.js/node.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1 +0,0 @@
-exports.OpenLayers = OpenLayers;

Copied: sandbox/cmoullet/openlayers/tests/node.js/node.js (from rev 11617, trunk/openlayers/tests/node.js/node.js)
===================================================================
--- sandbox/cmoullet/openlayers/tests/node.js/node.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/node.js/node.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1 @@
+exports.OpenLayers = OpenLayers;

Deleted: sandbox/cmoullet/openlayers/tests/node.js/run-test.js
===================================================================
--- trunk/openlayers/tests/node.js/run-test.js	2011-03-05 23:34:44 UTC (rev 11617)
+++ sandbox/cmoullet/openlayers/tests/node.js/run-test.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1,26 +0,0 @@
-// Requires:
-/// 0. nodejs
-//  1. jsdom installed (npm install jsdom)
-//  2. A build profile with mockdom.js included in [first], and node.js 
-//     inclded in [last], at ../../build/OpenLayers.js , like node-tests.js.
-//  3. Run with node run-tests.js
-//
-//  Missing: integration with a solid node.js testrunner.
-var jsdom = require('jsdom'); 
-jsdom.env('<html><body></body></html>', function(errors, window) { 
-    for (var i in window) { 
-        if (i == "console") {
-            continue;
-        }    
-        eval(i+"=window['"+i+"'];"); 
-    }
-    OpenLayers = require("../../build/OpenLayers.js")['OpenLayers'];
-    var map = new OpenLayers.Map(document.createElement("map"));
-    map.addLayer(new OpenLayers.Layer("", {isBaseLayer:true}));
-    map.setCenter(new OpenLayers.LonLat(-71,42), 10);
-    var px = map.getPixelFromLonLat(map.getLonLatFromPixel(new OpenLayers.Pixel(100,100)));
-    console.log(px);
-    var px = map.getLonLatFromPixel(map.getPixelFromLonLat(new OpenLayers.LonLat(10,10)));
-    console.log(px);
-    
-});

Copied: sandbox/cmoullet/openlayers/tests/node.js/run-test.js (from rev 11617, trunk/openlayers/tests/node.js/run-test.js)
===================================================================
--- sandbox/cmoullet/openlayers/tests/node.js/run-test.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/node.js/run-test.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,26 @@
+// Requires:
+/// 0. nodejs
+//  1. jsdom installed (npm install jsdom)
+//  2. A build profile with mockdom.js included in [first], and node.js 
+//     inclded in [last], at ../../build/OpenLayers.js , like node-tests.js.
+//  3. Run with node run-tests.js
+//
+//  Missing: integration with a solid node.js testrunner.
+var jsdom = require('jsdom'); 
+jsdom.env('<html><body></body></html>', function(errors, window) { 
+    for (var i in window) { 
+        if (i == "console") {
+            continue;
+        }    
+        eval(i+"=window['"+i+"'];"); 
+    }
+    OpenLayers = require("../../build/OpenLayers.js")['OpenLayers'];
+    var map = new OpenLayers.Map(document.createElement("map"));
+    map.addLayer(new OpenLayers.Layer("", {isBaseLayer:true}));
+    map.setCenter(new OpenLayers.LonLat(-71,42), 10);
+    var px = map.getPixelFromLonLat(map.getLonLatFromPixel(new OpenLayers.Pixel(100,100)));
+    console.log(px);
+    var px = map.getLonLatFromPixel(map.getPixelFromLonLat(new OpenLayers.LonLat(10,10)));
+    console.log(px);
+    
+});

Deleted: sandbox/cmoullet/openlayers/tests/node.js/run.sh
===================================================================
--- trunk/openlayers/tests/node.js/run.sh	2011-03-05 23:34:44 UTC (rev 11617)
+++ sandbox/cmoullet/openlayers/tests/node.js/run.sh	2011-03-06 03:50:10 UTC (rev 11619)
@@ -1,10 +0,0 @@
-#!/bin/sh
-cp mockdom.js node.js ../../lib
-cp node-tests.cfg ../../build
-cd ../../build
-python build.py -c none node-tests
-cd ../tests/node.js/
-
-node run-test.js
-rm ../../lib/mockdom.js
-rm ../../lib/node.js

Copied: sandbox/cmoullet/openlayers/tests/node.js/run.sh (from rev 11617, trunk/openlayers/tests/node.js/run.sh)
===================================================================
--- sandbox/cmoullet/openlayers/tests/node.js/run.sh	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/node.js/run.sh	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,10 @@
+#!/bin/sh
+cp mockdom.js node.js ../../lib
+cp node-tests.cfg ../../build
+cd ../../build
+python build.py -c none node-tests
+cd ../tests/node.js/
+
+node run-test.js
+rm ../../lib/mockdom.js
+rm ../../lib/node.js

Copied: sandbox/cmoullet/openlayers/tests/speed/vector-renderers.html (from rev 11617, trunk/openlayers/tests/speed/vector-renderers.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/speed/vector-renderers.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/speed/vector-renderers.html	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Vector Features Performance Test</title>
+    <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js#startOpened=true"></script>
+    <link rel="stylesheet" href="../../theme/default/style.css" type="text/css" />
+    <link rel="stylesheet" href="../../examples/style.css" type="text/css" />
+  </head>
+  <body>
+    <h1 id="title">Vector Rendering Performance</h1>
+    <div id="map" class="smallmap"></div>
+    <p>
+    This is a benchmark for vector rendering performance. Test results are
+    written to the debug console.
+    Select a renderer here:
+    <br/>
+    <select id="renderers"></select>
+    </p><p>
+    The benchmark shows the time needed to render the features, and how long a
+    move (drag or zoom) takes. Drag and zoom around to produce move results.
+    </p>
+    <script src="../../lib/OpenLayers.js"></script>
+    <script src="vector-renderers.js"></script>
+  </body>
+</html>
\ No newline at end of file

Copied: sandbox/cmoullet/openlayers/tests/speed/vector-renderers.js (from rev 11617, trunk/openlayers/tests/speed/vector-renderers.js)
===================================================================
--- sandbox/cmoullet/openlayers/tests/speed/vector-renderers.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/tests/speed/vector-renderers.js	2011-03-06 03:50:10 UTC (rev 11619)
@@ -0,0 +1,70 @@
+var map, vectorLayer, drawFeature, features
+
+map = new OpenLayers.Map('map', {
+    eventListeners: {
+        movestart: function() {
+            console.time("move");
+        },
+        moveend: function() {
+            console.timeEnd("move");
+        }
+    }
+});
+
+// allow testing of specific renderers via "?renderer=Canvas", etc
+var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
+vectorLayer = new OpenLayers.Layer.Vector("Vector Layer", {
+    isBaseLayer: true,
+    renderers: renderer,
+    eventListeners: {
+        beforefeaturesadded: function() {
+            console.time("addFeatures");
+        },
+        featuresadded: function() {
+            console.timeEnd("addFeatures");
+        }
+    }
+});
+
+map.addLayers([vectorLayer]);
+map.addControl(new OpenLayers.Control.MousePosition());
+map.setCenter(new OpenLayers.LonLat(0, 0), 2);
+
+features = new Array(500);
+var x, y, points
+for (var i = 0; i < 500; i++) {
+    x = 90-Math.random()*180;
+    y = 45-Math.random()*90;
+    var pointList = [];
+    for(var p=0; p<19; ++p) {
+        var a = p * (2 * Math.PI) / 20;
+        var r = Math.random() * 3 + 1;
+        var newPoint = new OpenLayers.Geometry.Point(x + (r * Math.cos(a)),
+                                                     y + (r * Math.sin(a)));
+        pointList.push(newPoint);
+    }
+    pointList.push(pointList[0]);
+    features[i] = new OpenLayers.Feature.Vector(
+        new OpenLayers.Geometry.LinearRing(pointList));
+        
+}
+vectorLayer.addFeatures(features);
+
+var select = document.getElementById("renderers");
+var renderers = OpenLayers.Layer.Vector.prototype.renderers;
+var option;
+for (var i=0, len=renderers.length; i<len; i++) {
+    if (OpenLayers.Renderer[renderers[i]].prototype.supported()) {
+        option = document.createElement("option");
+        option.textContent = renderers[i];
+        option.value = renderers[i];
+        option.selected = renderers[i] == vectorLayer.renderer.CLASS_NAME.split(".").pop();
+        select.appendChild(option);
+    }
+}
+select.onchange = function() {
+    window.location.href = window.location.href.split("?")[0] +
+        "?renderer=" + select.options[select.selectedIndex].value;
+}

Modified: sandbox/cmoullet/openlayers/tools/update_dev_dir.sh
===================================================================
--- sandbox/cmoullet/openlayers/tools/update_dev_dir.sh	2011-03-06 03:47:26 UTC (rev 11618)
+++ sandbox/cmoullet/openlayers/tools/update_dev_dir.sh	2011-03-06 03:50:10 UTC (rev 11619)
@@ -19,14 +19,18 @@
     python exampleparser.py
     cd /osgeo/openlayers/docs/dev/build
     ./build.py -c closure tests.cfg
+    ./build.py -c closure mobile.cfg OpenLayers.mobile.js
     
     cp OpenLayers.js ..
+    cp OpenLayers.mobile.js ..
+
     cd ..
     for i in google ie6-style style; do
         csstidy theme/default/$i.css --template=highest theme/default/$i.tidy.css
         cp theme/default/$i.tidy.css theme/default/$i.css
     done
 
+    sed -i -e 's!../lib/OpenLayers.js?mobile!../OpenLayers.mobile.js!' examples/*.html
     sed -i -e 's!../lib/OpenLayers.js!../OpenLayers.js!' examples/*.html
     naturaldocs -i /osgeo/openlayers/docs/dev/lib -o HTML /osgeo/openlayers/dev/apidocs -p /osgeo/openlayers/docs/dev/apidoc_config -s Default OL >/dev/null
     naturaldocs -i /osgeo/openlayers/docs/dev/lib -o HTML /osgeo/openlayers/dev/docs -p /osgeo/openlayers/docs/dev/doc_config -s Default OL >/dev/null



More information about the Commits mailing list