[OpenLayers-Commits] r11877 - in sandbox/cmoullet/openlayers: . examples lib/OpenLayers/Control lib/OpenLayers/Format lib/OpenLayers/Format/WMC lib/OpenLayers/Handler lib/OpenLayers/Layer lib/OpenLayers/Renderer tests/Control tests/Format tests/Format/WMC tests/Handler tests/Layer tests/Renderer theme/default

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Apr 5 07:38:14 EDT 2011


Author: cmoullet
Date: 2011-04-05 04:38:13 -0700 (Tue, 05 Apr 2011)
New Revision: 11877

Modified:
   sandbox/cmoullet/openlayers/
   sandbox/cmoullet/openlayers/examples/editingtoolbar-outside.html
   sandbox/cmoullet/openlayers/examples/editingtoolbar.html
   sandbox/cmoullet/openlayers/examples/highlight-feature.html
   sandbox/cmoullet/openlayers/examples/intersects.html
   sandbox/cmoullet/openlayers/examples/mobile-drawing.js
   sandbox/cmoullet/openlayers/examples/mobile-sencha.html
   sandbox/cmoullet/openlayers/examples/multimap-mercator.html
   sandbox/cmoullet/openlayers/examples/protocol-gears.html
   sandbox/cmoullet/openlayers/examples/snap-split.html
   sandbox/cmoullet/openlayers/examples/snapping.html
   sandbox/cmoullet/openlayers/examples/spherical-mercator.html
   sandbox/cmoullet/openlayers/examples/vector-formats.html
   sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.html
   sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.js
   sandbox/cmoullet/openlayers/examples/wfs-snap-split.html
   sandbox/cmoullet/openlayers/examples/wmc.html
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseDefaults.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseToolbar.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Panel.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Context.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_0_0.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Hover.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js
   sandbox/cmoullet/openlayers/tests/Control/Panel.html
   sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html
   sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html
   sandbox/cmoullet/openlayers/tests/Format/WMC.html
   sandbox/cmoullet/openlayers/tests/Format/WMC/v1.html
   sandbox/cmoullet/openlayers/tests/Handler/Box.html
   sandbox/cmoullet/openlayers/tests/Handler/Drag.html
   sandbox/cmoullet/openlayers/tests/Layer/WMS.html
   sandbox/cmoullet/openlayers/tests/Layer/XYZ.html
   sandbox/cmoullet/openlayers/tests/Renderer/Canvas.html
   sandbox/cmoullet/openlayers/theme/default/ie6-style.css
   sandbox/cmoullet/openlayers/theme/default/style.css
Log:
Merge with trunk



Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11775,11777-11853
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11775,11777-11876

Modified: sandbox/cmoullet/openlayers/examples/editingtoolbar-outside.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/editingtoolbar-outside.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/editingtoolbar-outside.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -9,16 +9,9 @@
     <style type="text/css">
         .olControlEditingToolbar  {
             float:left;
-            width: auto;
+            width: 116px;
         }
     </style>
-    <!--[if lte IE 6]>
-        <style type="text/css">
-            .olControlEditingToolbar {
-                width: 150px;
-            }
-        </style>
-    <![endif]-->
     <script src="../lib/Firebug/firebug.js"></script>
     <script src="../lib/OpenLayers.js"></script>
     <script type="text/javascript">

Modified: sandbox/cmoullet/openlayers/examples/editingtoolbar.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/editingtoolbar.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/editingtoolbar.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -6,6 +6,9 @@
         <title>OpenLayers Editing Toolbar Example</title>
         
         <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+        <!--[if lte IE 6]>
+            <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+        <![endif]-->
         <link rel="stylesheet" href="style.css" type="text/css" />
         <script src="../lib/OpenLayers.js"></script>
         <script src="../lib/Firebug/debug.js"></script>

Modified: sandbox/cmoullet/openlayers/examples/highlight-feature.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/highlight-feature.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/highlight-feature.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>SelectFeature Control for Select and Highlight</title> 
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         #controlToggle li {

Modified: sandbox/cmoullet/openlayers/examples/intersects.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/intersects.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/intersects.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>Geometry Intersections</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         html, body {

Modified: sandbox/cmoullet/openlayers/examples/mobile-drawing.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-drawing.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/mobile-drawing.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -35,6 +35,9 @@
         })
     ]);
 
+    var osm = new OpenLayers.Layer.OSM();
+    osm.wrapDateLine = false;
+
     map = new OpenLayers.Map({
         div: 'map',
         projection: 'EPSG:900913',
@@ -53,7 +56,7 @@
             new OpenLayers.Control.ZoomPanel(),
             toolbar
         ],
-        layers: [new OpenLayers.Layer.OSM(), vector],
+        layers: [osm, vector],
         center: new OpenLayers.LonLat(0, 0),
         zoom: 1,
         theme: null

Modified: sandbox/cmoullet/openlayers/examples/mobile-sencha.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-sencha.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/mobile-sencha.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -7,8 +7,8 @@
         <title>OpenLayers with Sencha Touch</title>
         <script src="../lib/OpenLayers.js?mobile"></script>
         <link rel="stylesheet" href="style.mobile.css" type="text/css">
-        <link rel="stylesheet" href="http://dev.sencha.com/deploy/touch/resources/css/sencha-touch.css">
-        <script src="http://dev.sencha.com/deploy/touch/sencha-touch.js"></script>
+        <link rel="stylesheet" href="http://192.168.1.42/sencha/resources/css/sencha-touch.css">
+        <script src="http://192.168.1.42/sencha/sencha-touch-debug-w-comments.js"></script>
         <script src="mobile-sencha.js"></script>
         <script src="mobile-base.js"></script>
         <style>

Modified: sandbox/cmoullet/openlayers/examples/multimap-mercator.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/multimap-mercator.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/multimap-mercator.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>MultiMap SphericalMercator</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         #map {

Modified: sandbox/cmoullet/openlayers/examples/protocol-gears.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/protocol-gears.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/protocol-gears.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -3,6 +3,9 @@
     <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" />
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         .float-left {

Modified: sandbox/cmoullet/openlayers/examples/snap-split.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/snap-split.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/snap-split.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>Snapping & Splitting</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         .olControlEditingToolbar .olControlModifyFeatureItemInactive { 

Modified: sandbox/cmoullet/openlayers/examples/snapping.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/snapping.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/snapping.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>Snapping</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         .olControlEditingToolbar .olControlModifyFeatureItemInactive { 

Modified: sandbox/cmoullet/openlayers/examples/spherical-mercator.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/spherical-mercator.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/spherical-mercator.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>OpenLayers: Spherical Mercator</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         .olControlAttribution { bottom: 0px!important }

Modified: sandbox/cmoullet/openlayers/examples/vector-formats.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/vector-formats.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/vector-formats.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,6 +4,9 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <title>Vector Formats</title>
     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+    <!--[if lte IE 6]>
+        <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />
+    <![endif]-->
     <link rel="stylesheet" href="style.css" type="text/css" />
     <style type="text/css">
         input, select, textarea {

Modified: sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -6,12 +6,18 @@
     <link rel="stylesheet" href="style.css" type="text/css" />
     <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
     <script src="../lib/OpenLayers.js"></script>
+    <!--[if lte IE 6]>
+        <style>
+            .customEditingToolbar {
+                width: 200px;
+            }
+        </style>
+    <![endif]-->   
     <style>
         .customEditingToolbar {
             float: right;
             right: 0px;
             height: 30px; 
-            width: 200px;
         }
         .customEditingToolbar div {
             float: right;

Modified: sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/wfs-protocol-transactions.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -29,14 +29,19 @@
 });
 
 function init() {
+
+    var extent = new OpenLayers.Bounds(
+        -11593508, 5509847, -11505759, 5557774
+    );
+
+
     map = new OpenLayers.Map('map', {
         projection: new OpenLayers.Projection("EPSG:900913"),
         displayProjection: new OpenLayers.Projection("EPSG:4326"),
         units: "m",
-        maxResolution: 156543.0339,
-        maxExtent: new OpenLayers.Bounds(
-            -11593508, 5509847, -11505759, 5557774
-        ),
+        maxResolution: 20037508.34 / 128,
+        maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
+        restrictedExtent: extent,
         controls: [
             new OpenLayers.Control.PanZoom()
         ]
@@ -47,7 +52,7 @@
     );
 
     var saveStrategy = new OpenLayers.Strategy.Save();
-
+    
     wfs = new OpenLayers.Layer.Vector("Editable Features", {
         strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
         projection: new OpenLayers.Projection("EPSG:4326"),
@@ -102,6 +107,6 @@
     panel.addControls([navigate, save, del, edit, draw]);
     panel.defaultControl = navigate;
     map.addControl(panel);
-    map.zoomToMaxExtent();
+    map.zoomToExtent(extent, true);
 }
 

Modified: sandbox/cmoullet/openlayers/examples/wfs-snap-split.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/wfs-snap-split.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/wfs-snap-split.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -5,12 +5,18 @@
     <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"></script>
+    <!--[if lte IE 6]>
+        <style>
+            .customEditingToolbar {
+                width: 200px;
+            }
+        </style>
+    <![endif]--> 
     <style>
         .customEditingToolbar {
             float: right;
             right: 0px;
             height: 30px; 
-            width: 200px;
         }
         .customEditingToolbar div {
             float: right;

Modified: sandbox/cmoullet/openlayers/examples/wmc.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/wmc.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/examples/wmc.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -26,21 +26,12 @@
         var doc, context, map;
         
         function init() {
-            var options = {
-                maxExtent: new OpenLayers.Bounds(-130, 14, -60, 55)
-            };
-            map = new OpenLayers.Map("map", options);
+            map = new OpenLayers.Map("map");
 
-            var jpl = new OpenLayers.Layer.WMS(
-                "NASA Global Mosaic",
-                "http://t1.hypercube.telascience.org/cgi-bin/landsat7", 
-                {layers: "landsat7"},
-                {
-                    maxExtent: new OpenLayers.Bounds(-130, 14, -60, 55),
-                    maxResolution: 0.1,
-                    numZoomLevels: 4,
-                    minResolution: 0.02
-                }
+            var gwc = new OpenLayers.Layer.WMS(
+                "Global Imagery",
+                "http://maps.opengeo.org/geowebcache/service/wms",
+                {layers: "bluemarble"}
             );
 
             var vmap = new OpenLayers.Layer.WMS(
@@ -90,9 +81,9 @@
                 }
             );
 
-            map.addLayers([jpl, vmap, roads, nexrad]);
+            map.addLayers([gwc, vmap, roads, nexrad]);
             map.addControl(new OpenLayers.Control.LayerSwitcher());
-            map.setCenter(new OpenLayers.LonLat(-95, 34.5), 1);
+            map.setCenter(new OpenLayers.LonLat(-95, 34.5), 4);
         };
         
         function readWMC(merge) {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseDefaults.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseDefaults.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseDefaults.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -238,7 +238,7 @@
      */
     defaultMouseOut: function (evt) {
         if (this.mouseDragStart != null && 
-            OpenLayers.Util.mouseLeft(evt, this.map.div)) {
+            OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
             if (this.zoomBox) {
                 this.removeZoomBox();
             }

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseToolbar.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseToolbar.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MouseToolbar.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -374,7 +374,7 @@
      */
     defaultMouseOut: function (evt) {
         if (this.mouseDragStart != null
-            && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
+            && OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
             if (this.zoomBox) {
                 this.removeZoomBox();
                 if (this.startViaKeyboard) {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Panel.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Panel.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Panel.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -96,16 +96,16 @@
      */
     destroy: function() {
         OpenLayers.Control.prototype.destroy.apply(this, arguments);
-        for(var i = this.controls.length - 1 ; i >= 0; i--) {
-            if(this.controls[i].events) {
-                this.controls[i].events.un({
-                    "activate": this.redraw,
-                    "deactivate": this.redraw,
-                    scope: this
+        for (var ctl, i = this.controls.length - 1; i >= 0; i--) {
+            ctl = this.controls[i];
+            if (ctl.events) {
+                ctl.events.un({
+                    activate: this.iconOn,
+                    deactivate: this.iconOff
                 });
             }
-            OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);
-            this.controls[i].panel_div = null;
+            OpenLayers.Event.stopObservingElement(ctl.panel_div);
+            ctl.panel_div = null;
         }
         this.activeState = null;
     },
@@ -172,13 +172,7 @@
         this.div.innerHTML = "";
         if (this.active) {
             for (var i=0, len=this.controls.length; i<len; i++) {
-                var element = this.controls[i].panel_div;
-                if (this.controls[i].active) {
-                    element.className = this.controls[i].displayClass + "ItemActive";
-                } else {    
-                    element.className = this.controls[i].displayClass + "ItemInactive";
-                }    
-                this.div.appendChild(element);
+                this.div.appendChild(this.controls[i].panel_div);
             }
         }
     },
@@ -195,7 +189,6 @@
         if (!this.active) { return false; }
         if (control.type == OpenLayers.Control.TYPE_BUTTON) {
             control.trigger();
-            this.redraw();
             return;
         }
         if (control.type == OpenLayers.Control.TYPE_TOGGLE) {
@@ -239,6 +232,7 @@
         // since they need to pass through.
         for (var i=0, len=controls.length; i<len; i++) {
             var element = document.createElement("div");
+            element.className = controls[i].displayClass + "ItemInactive";
             controls[i].panel_div = element;
             if (controls[i].title != "") {
                 controls[i].panel_div.title = controls[i].title;
@@ -277,14 +271,31 @@
                 control.deactivate();
             }
             control.events.on({
-                "activate": this.redraw,
-                "deactivate": this.redraw,
-                scope: this
+                activate: this.iconOn,
+                deactivate: this.iconOff
             });
         }  
     },
 
     /**
+     * Method: iconOn
+     * Internal use, for use only with "controls[i].events.on/un".
+     */
+     iconOn: function() {
+        var d = this.panel_div; // "this" refers to a control on panel!
+        d.className = d.className.replace(/ItemInactive$/, "ItemActive");
+    },
+
+    /**
+     * Method: iconOff
+     * Internal use, for use only with "controls[i].events.on/un".
+     */
+     iconOff: function() {
+        var d = this.panel_div; // "this" refers to a control on panel!
+        d.className = d.className.replace(/ItemActive$/, "ItemInactive");
+    },
+
+    /**
      * Method: onClick
      */
     onClick: function (ctrl, evt) {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -55,6 +55,14 @@
      */
     clickCallback: "click",
     
+    /** APIProperty: output
+     *  {String} Either "features" or "object". When triggering a 
+     *      getfeatureinfo request should we pass on an array of features
+     *      or an object with with a "features" property and other properties
+     *      (such as the url of the WMS). Default is "features".
+     */
+    output: "features",
+    
     /**
      * Property: layers
      * {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
@@ -387,7 +395,7 @@
             url: url,
             params: OpenLayers.Util.upperCaseObject(params),
             callback: function(request) {
-                this.handleResponse(clickPosition, request);
+                this.handleResponse(clickPosition, request, url);
             },
             scope: this
         };
@@ -487,7 +495,9 @@
      * request - {XMLHttpRequest} The request object
      * xy - {<OpenLayers.Pixel>} The position on the map where the
      *     mouse event occurred.
-     * features - {Array(<OpenLayers.Feature.Vector>)}
+     * features - {Array(<OpenLayers.Feature.Vector>)} or
+     *     {Array({Object}) when output is "object". The object has a url and a
+     *     features property which contains an array of features.
      */
     triggerGetFeatureInfo: function(request, xy, features) {
         this.events.triggerEvent("getfeatureinfo", {
@@ -509,8 +519,9 @@
      * xy - {<OpenLayers.Pixel>} The position on the map where the
      *     mouse event occurred.
      * request - {XMLHttpRequest} The request object.
+     * url - {String} The url which was used for this request.
      */
-    handleResponse: function(xy, request) {
+    handleResponse: function(xy, request, url) {
         
         var doc = request.responseXML;
         if(!doc || !doc.documentElement) {
@@ -521,7 +532,13 @@
             this.triggerGetFeatureInfo(request, xy, features);
         } else {
             this._requestCount++;
+            if (this.output === "object") {
+                this._features = (this._features || []).concat(
+                    {url: url, features: features}
+                );
+            } else {
             this._features = (this._features || []).concat(features);
+            }
             if (this._requestCount === this._numRequests) {
                 this.triggerGetFeatureInfo(request, xy, this._features.concat()); 
                 delete this._features;

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Context.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Context.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Context.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -122,7 +122,11 @@
             visibility: layerContext.visibility,
             maxExtent: layerContext.maxExtent,
             metadata: OpenLayers.Util.applyDefaults(layerContext.metadata, 
-                {styles: layerContext.styles}),
+            {styles: layerContext.styles,
+             formats: layerContext.formats,
+             "abstract": layerContext["abstract"],
+             dataURL: layerContext.dataURL
+            }),
             numZoomLevels: layerContext.numZoomLevels,
             units: layerContext.units,
             isBaseLayer: layerContext.isBaseLayer,
@@ -135,7 +139,10 @@
                     layerContext.tileSize.height
                 ) : undefined,
             minScale: layerContext.minScale || layerContext.maxScaleDenominator,
-            maxScale: layerContext.maxScale || layerContext.minScaleDenominator
+            maxScale: layerContext.maxScale || layerContext.minScaleDenominator,
+            srs: layerContext.srs,
+            dimensions: layerContext.dimensions,
+            metadataURL: layerContext.metadataURL
         };
         if (this.layerOptions) {
             OpenLayers.Util.applyDefaults(options, this.layerOptions);
@@ -273,10 +280,22 @@
             projection: context.projection,
             units:      context.units
         }, options);
+
         if (options.maxExtent) {
             options.maxResolution = 
                 options.maxExtent.getWidth() / OpenLayers.Map.TILE_WIDTH;
         }
+
+        var metadata = {
+            contactInformation: context.contactInformation,
+            "abstract":         context["abstract"],
+            keywords:           context.keywords,
+            logo:               context.logo,
+            descriptionURL:     context.descriptionURL
+        }
+
+        options.metadata = metadata;
+
         var map = new OpenLayers.Map(options);
         map.addLayers(this.getLayersFromContext(context.layersContext));
         map.setCenter(

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -495,16 +495,16 @@
            var code = parseInt(proj.substring(proj.indexOf(":") + 1));
            if (code == 4326) {
                crs = {
-                   "type": "OGC",
+                   "type": "name",
                    "properties": {
-                       "urn": "urn:ogc:def:crs:OGC:1.3:CRS84"
+                       "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
                    }
                };
            } else {    
                crs = {
-                   "type": "EPSG",
+                   "type": "name",
                    "properties": {
-                       "code": code 
+                       "name": "EPSG:" + code
                    }
                };
            }    

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -171,7 +171,8 @@
             visibility: (node.getAttribute("hidden") != "1"),
             queryable: (node.getAttribute("queryable") == "1"),
             formats: [],
-            styles: []
+             styles: [],
+             metadata: {}
         };
 
         this.runChildNodes(layerContext, node);
@@ -259,12 +260,8 @@
      */
     read_wmc_Server: function(layerContext, node) {
         layerContext.version = node.getAttribute("version");
-        var server = {};
-        var links = node.getElementsByTagName("OnlineResource");
-        if(links.length > 0) {
-            this.read_wmc_OnlineResource(server, links[0]);
-        }
-        layerContext.url = server.href;
+         layerContext.url = this.getOnlineResource_href(node);
+         layerContext.metadata.servertitle = node.getAttribute("title");
     },
 
     /**
@@ -323,6 +320,14 @@
     },
 
     /**
+      * Method: read_sld_FeatureTypeStyle
+      */
+     read_sld_FeatureTypeStyle: function(sld, node) {
+         var xml = OpenLayers.Format.XML.prototype.write.apply(this, [node]);
+         sld.body = xml;
+     },
+
+     /**
      * Method: read_wmc_OnlineResource
      */
     read_wmc_OnlineResource: function(obj, node) {
@@ -355,16 +360,25 @@
      * Method: read_wmc_MetadataURL
      */
     read_wmc_MetadataURL: function(layerContext, node) {
-        var metadataURL = {};
-        var links = node.getElementsByTagName("OnlineResource");
-        if(links.length > 0) {
-            this.read_wmc_OnlineResource(metadataURL, links[0]);
-        }
-        layerContext.metadataURL = metadataURL.href;
+         layerContext.metadataURL = this.getOnlineResource_href(node);
+     },
 
+     /**
+      * Method: read_wmc_KeywordList
+      */
+     read_wmc_KeywordList: function(context, node) {
+         context.keywords = [];
+         this.runChildNodes(context.keywords, node);
     },
 
     /**
+      * Method: read_wmc_Keyword
+      */
+     read_wmc_Keyword: function(keywords, node) {
+         keywords.push(this.getChildValue(node));
+     },
+
+     /**
      * Method: read_wmc_Abstract
      */
     read_wmc_Abstract: function(obj, node) {
@@ -375,21 +389,221 @@
     },
     
     /**
+      * Method: read_wmc_LogoURL
+      */
+     read_wmc_LogoURL: function(context, node) {
+         context.logo = {
+             width:  node.getAttribute("width"),
+             height: node.getAttribute("height"),
+             format: node.getAttribute("format"),
+             href:   this.getOnlineResource_href(node)
+         };
+     },
+
+     /**
+      * Method: read_wmc_DescriptionURL
+      */
+     read_wmc_DescriptionURL: function(context, node) {
+         context.descriptionURL = this.getOnlineResource_href(node);
+     },
+
+     /**
+      * Method: read_wmc_ContactInformation
+     */
+     read_wmc_ContactInformation: function(obj, node) {
+         var contact = {};
+         this.runChildNodes(contact, node);
+         obj.contactInformation = contact;
+     },
+
+     /**
+      * Method: read_wmc_ContactPersonPrimary
+      */
+     read_wmc_ContactPersonPrimary: function(contact, node) {
+         var personPrimary = {};
+         this.runChildNodes(personPrimary, node);
+         contact.personPrimary = personPrimary;
+     },
+
+     /**
+      * Method: read_wmc_ContactPerson
+      */
+     read_wmc_ContactPerson: function(primaryPerson, node) {
+         var person = this.getChildValue(node);
+         if (person) {
+             primaryPerson.person = person;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactOrganization
+      */
+     read_wmc_ContactOrganization: function(primaryPerson, node) {
+         var organization = this.getChildValue(node);
+         if (organization) {
+             primaryPerson.organization = organization;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactPosition
+      */
+     read_wmc_ContactPosition: function(contact, node) {
+         var position = this.getChildValue(node);
+         if (position) {
+             contact.position = position;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactAddress
+      */
+     read_wmc_ContactAddress: function(contact, node) {
+         var contactAddress = {};
+         this.runChildNodes(contactAddress, node);
+         contact.contactAddress = contactAddress;
+     },
+
+     /**
+      * Method: read_wmc_AddressType
+      */
+     read_wmc_AddressType: function(contactAddress, node) {
+         var type = this.getChildValue(node);
+         if (type) {
+             contactAddress.type = type;
+         }
+     },
+
+     /**
+      * Method: read_wmc_Address
+      */
+     read_wmc_Address: function(contactAddress, node) {
+         var address = this.getChildValue(node);
+         if (address) {
+             contactAddress.address = address;
+         }
+     },
+
+     /**
+      * Method: read_wmc_City
+      */
+     read_wmc_City: function(contactAddress, node) {
+         var city = this.getChildValue(node);
+         if (city) {
+             contactAddress.city = city;
+         }
+     },
+
+     /**
+      * Method: read_wmc_StateOrProvince
+      */
+     read_wmc_StateOrProvince: function(contactAddress, node) {
+         var stateOrProvince = this.getChildValue(node);
+         if (stateOrProvince) {
+             contactAddress.stateOrProvince = stateOrProvince;
+         }
+     },
+
+     /**
+      * Method: read_wmc_PostCode
+      */
+     read_wmc_PostCode: function(contactAddress, node) {
+         var postcode = this.getChildValue(node);
+         if (postcode) {
+             contactAddress.postcode = postcode;
+         }
+     },
+
+     /**
+      * Method: read_wmc_Country
+      */
+     read_wmc_Country: function(contactAddress, node) {
+         var country = this.getChildValue(node);
+         if (country) {
+             contactAddress.country = country;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactVoiceTelephone
+      */
+     read_wmc_ContactVoiceTelephone: function(contact, node) {
+         var phone = this.getChildValue(node);
+         if (phone) {
+             contact.phone = phone;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactFacsimileTelephone
+      */
+     read_wmc_ContactFacsimileTelephone: function(contact, node) {
+         var fax = this.getChildValue(node);
+         if (fax) {
+             contact.fax = fax;
+         }
+     },
+
+     /**
+      * Method: read_wmc_ContactElectronicMailAddress
+      */
+     read_wmc_ContactElectronicMailAddress: function(contact, node) {
+         var email = this.getChildValue(node);
+         if (email) {
+             contact.email = email;
+         }
+     },
+
+     /**
+      * Method: read_wmc_DataURL
+      */
+     read_wmc_DataURL: function(layerContext, node) {
+         layerContext.dataURL = this.getOnlineResource_href(node);
+     },
+
+     /**
      * Method: read_wmc_LegendURL
      */
     read_wmc_LegendURL: function(style, node) {
         var legend = {
             width: node.getAttribute('width'),
-            height: node.getAttribute('height')
+             height: node.getAttribute('height'),
+             format: node.getAttribute('format'),
+             href:   this.getOnlineResource_href(node)
         };
-        var links = node.getElementsByTagName("OnlineResource");
-        if(links.length > 0) {
-            this.read_wmc_OnlineResource(legend, links[0]);
-        }
         style.legend = legend;
     },
     
     /**
+      * Method: read_wmc_DimensionList
+      */
+     read_wmc_DimensionList: function(layerContext, node) {
+         layerContext.dimensions = {};
+         this.runChildNodes(layerContext.dimensions, node);
+     },
+     /**
+      * Method: read_wmc_Dimension
+      */
+     read_wmc_Dimension: function(dimensions, node) {
+         var name = node.getAttribute("name").toLowerCase();
+
+         var dim = {
+             name:           name,
+             units:          node.getAttribute("units")          ||  "",
+             unitSymbol:     node.getAttribute("unitSymbol")     ||  "",
+             userValue:      node.getAttribute("userValue")      ||  "",
+             nearestValue:   node.getAttribute("nearestValue")   === "1",
+             multipleValues: node.getAttribute("multipleValues") === "1",
+             current:        node.getAttribute("current")        === "1",
+             "default":      node.getAttribute("default")        ||  ""
+         };
+         var values = this.getChildValue(node);
+         dim.values = values.split(",");
+
+         dimensions[dim.name] = dim;
+     },
+
+     /**
      * Method: write
      *
      * Parameters:
@@ -514,6 +728,33 @@
             "Title", context.title
         ));
         
+         // optional KeywordList element
+         if (context.keywords) {
+             node.appendChild(this.write_wmc_KeywordList(context.keywords));
+         }
+
+         // optional Abstract element
+         if (context["abstract"]) {
+             node.appendChild(this.createElementDefaultNS(
+                 "Abstract", context["abstract"]
+             ));
+         }
+
+         // Optional LogoURL element
+         if (context.logo) {
+             node.appendChild(this.write_wmc_URLType("LogoURL", context.logo.href, context.logo));
+         }
+
+         // Optional DescriptionURL element
+         if (context.descriptionURL) {
+             node.appendChild(this.write_wmc_URLType("DescriptionURL", context.descriptionURL));
+         }
+
+         // Optional ContactInformation element
+         if (context.contactInformation) {
+             node.appendChild(this.write_wmc_ContactInformation(context.contactInformation));
+         }
+
         // OpenLayers specific map properties
         node.appendChild(this.write_ol_MapExtension(context));
         
@@ -521,6 +762,110 @@
     },
     
     /**
+      * Method: write_wmc_KeywordList
+      */
+     write_wmc_KeywordList: function(keywords) {
+         var node = this.createElementDefaultNS("KeywordList");
+
+         for (var i=0, len=keywords.length; i<len; i++) {
+             node.appendChild(this.createElementDefaultNS(
+                 "Keyword", keywords[i]
+             ));
+         }
+         return node;
+     },
+     /**
+      * Method: write_wmc_ContactInformation
+      */
+     write_wmc_ContactInformation: function(contact) {
+         var node = this.createElementDefaultNS("ContactInformation");
+
+         if (contact.personPrimary) {
+             node.appendChild(this.write_wmc_ContactPersonPrimary(contact.personPrimary));
+         }
+         if (contact.position) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactPosition", contact.position
+             ));
+         }
+         if (contact.contactAddress) {
+             node.appendChild(this.write_wmc_ContactAddress(contact.contactAddress));
+         }
+         if (contact.phone) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactVoiceTelephone", contact.phone
+             ));
+         }
+         if (contact.fax) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactFacsimileTelephone", contact.fax
+             ));
+         }
+         if (contact.email) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactElectronicMailAddress", contact.email
+             ));
+         }
+         return node;
+     },
+
+     /**
+      * Method: write_wmc_ContactPersonPrimary
+      */
+     write_wmc_ContactPersonPrimary: function(personPrimary) {
+         var node = this.createElementDefaultNS("ContactPersonPrimary");
+         if (personPrimary.person) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactPerson", personPrimary.person
+             ));
+         }
+         if (personPrimary.organization) {
+             node.appendChild(this.createElementDefaultNS(
+                 "ContactOrganization", personPrimary.organization
+             ));
+         }
+         return node;
+     },
+
+     /**
+      * Method: write_wmc_ContactAddress
+      */
+     write_wmc_ContactAddress: function(contactAddress) {
+         var node = this.createElementDefaultNS("ContactAddress");
+         if (contactAddress.type) {
+             node.appendChild(this.createElementDefaultNS(
+                 "AddressType", contactAddress.type
+             ));
+         }
+         if (contactAddress.address) {
+             node.appendChild(this.createElementDefaultNS(
+                 "Address", contactAddress.address
+             ));
+         }
+         if (contactAddress.city) {
+             node.appendChild(this.createElementDefaultNS(
+                 "City", contactAddress.city
+             ));
+         }
+         if (contactAddress.stateOrProvince) {
+             node.appendChild(this.createElementDefaultNS(
+                 "StateOrProvince", contactAddress.stateOrProvince
+             ));
+         }
+         if (contactAddress.postcode) {
+             node.appendChild(this.createElementDefaultNS(
+                 "PostCode", contactAddress.postcode
+             ));
+         }
+         if (contactAddress.country) {
+             node.appendChild(this.createElementDefaultNS(
+                 "Country", contactAddress.country
+             ));
+         }
+         return node;
+     },
+
+     /**
      * Method: write_ol_MapExtension
      */
     write_ol_MapExtension: function(context) {
@@ -594,9 +939,21 @@
             "Title", context.title
         ));
 
+         // optional Abstract element
+         if (context["abstract"]) {
+             node.appendChild(this.createElementDefaultNS(
+                 "Abstract", context["abstract"]
+             ));
+         }
+
+         // optional DataURL element
+         if (context.dataURL) {
+             node.appendChild(this.write_wmc_URLType("DataURL", context.dataURL));
+         }
+
         // optional MetadataURL element
         if (context.metadataURL) {
-            node.appendChild(this.write_wmc_MetadataURL(context.metadataURL));
+             node.appendChild(this.write_wmc_URLType("MetadataURL", context.metadataURL));
         }
         
         return node;
@@ -682,34 +1039,79 @@
      * {Element} A WMC Server element node.
      */
     write_wmc_Server: function(context) {
+         var server = context.server;
         var node = this.createElementDefaultNS("Server");
-        this.setAttributes(node, {
+         var attributes = {
             service: "OGC:WMS",
-            version: context.version
-        });
+             version: server.version
+         };
+         if (server.title) {
+             attributes.title = server.title
+         }
+         this.setAttributes(node, attributes);
         
         // required OnlineResource element
-        node.appendChild(this.write_wmc_OnlineResource(context.url));
+         node.appendChild(this.write_wmc_OnlineResource(server.url));
         
         return node;
     },
 
     /**
-     * Method: write_wmc_MetadataURL
-     * Create a MetadataURL node given a metadataURL string.
+      * Method: write_wmc_URLType
+      * Create a LogoURL/DescriptionURL/MetadataURL/DataURL/LegendURL node given a object and elementName.
      *
      * Parameters:
-     * metadataURL - {String} MetadataURL string value.
-     *
+      * elName - {String} Name of element (LogoURL/DescriptionURL/MetadataURL/LegendURL)
+      * url - {String} URL string value
+      * attr - {Object} Optional attributes (width, height, format)
      * Returns:
-     * {Element} A WMC metadataURL element node.
+      * {Element} A WMC element node.
      */
-    write_wmc_MetadataURL: function(metadataURL) {
-        var node = this.createElementDefaultNS("MetadataURL");
+     write_wmc_URLType: function(elName, url, attr) {
+         var node = this.createElementDefaultNS(elName);
+         node.appendChild(this.write_wmc_OnlineResource(url));
+         if (attr) {
+             var optionalAttributes = ["width", "height", "format"];
+             for (var i=0; i<optionalAttributes.length; i++) {
+                 if (optionalAttributes[i] in attr) {
+                     node.setAttribute(optionalAttributes[i], attr[optionalAttributes[i]]);
+                 }
+             }
+         }
+         return node;
+     },
 
-        // required OnlineResource element
-        node.appendChild(this.write_wmc_OnlineResource(metadataURL));
+     /**
+      * Method: write_wmc_DimensionList
+      */
+     write_wmc_DimensionList: function(context) {
+         var node = this.createElementDefaultNS("DimensionList");
+         var required_attributes = {
+             name: true,
+             units: true,
+             unitSymbol: true,
+             userValue: true
+         };
+         for (var dim in context.dimensions) {
+             var attributes = {};
+             var dimension = context.dimensions[dim];
+             for (var name in dimension) {
+                 if (typeof dimension[name] == "boolean") {
+                     attributes[name] = Number(dimension[name]);
+                 } else {
+                     attributes[name] = dimension[name];
+                 }
+             }
+             var values = "";
+             if (attributes.values) {
+                 values = attributes.values.join(",");
+                 delete attributes.values;
+             }
 
+             node.appendChild(this.createElementDefaultNS(
+                 "Dimension", values, attributes
+             ));
+         }
         return node;
     },
 
@@ -769,17 +1171,37 @@
                 );
                 if(s.href) { // [1]
                     sld = this.createElementDefaultNS("SLD");
-                    var link = this.write_wmc_OnlineResource(s.href);
-                    sld.appendChild(link);
-                    // Name is required.
+                     // Name is optional.
+                     if (s.name) {
                     sld.appendChild(this.createElementDefaultNS("Name", s.name));
+                     }
                     // Title is optional.
                     if (s.title) {
                         sld.appendChild(this.createElementDefaultNS("Title", s.title));
                     }
+                     // LegendURL is optional
+                     if (s.legend) {
+                         sld.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
+                     }
+
+                     var link = this.write_wmc_OnlineResource(s.href);
+                     sld.appendChild(link);
                     style.appendChild(sld);
                 } else if(s.body) { // [2]
                     sld = this.createElementDefaultNS("SLD");
+                     // Name is optional.
+                     if (s.name) {
+                         sld.appendChild(this.createElementDefaultNS("Name", s.name));
+                     }
+                     // Title is optional.
+                     if (s.title) {
+                         sld.appendChild(this.createElementDefaultNS("Title", s.title));
+                     }
+                     // LegendURL is optional
+                     if (s.legend) {
+                         sld.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
+                     }
+
                     // read in body as xml doc - assume proper namespace declarations
                     var doc = OpenLayers.Format.XML.prototype.read.apply(this, [s.body]);
                     // append to StyledLayerDescriptor node
@@ -788,12 +1210,6 @@
                         imported = sld.ownerDocument.importNode(imported, true);
                     }
                     sld.appendChild(imported);
-                    // Name is required.
-                    sld.appendChild(this.createElementDefaultNS("Name", s.name));
-                    // Title is optional.
-                    if (s.title) {
-                        sld.appendChild(this.createElementDefaultNS("Title", s.title));
-                    }
                     style.appendChild(sld);            
                 } else { // [3]
                     // both Name and Title are required.
@@ -805,7 +1221,11 @@
                             "Abstract", s['abstract']
                         ));
                     }
+                     // LegendURL is optional
+                     if (s.legend) {
+                         style.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
                 }
+                 }
                 node.appendChild(style);
             }
         }
@@ -830,6 +1250,19 @@
         return node;
     },
 
+     /**
+      * Method: getOnlineResource_href
+      */
+     getOnlineResource_href: function(node) {
+         var object = {};
+         var links = node.getElementsByTagName("OnlineResource");
+         if(links.length > 0) {
+             this.read_wmc_OnlineResource(object, links[0]);
+         }
+         return object.href;
+     },
+
+
     CLASS_NAME: "OpenLayers.Format.WMC.v1" 
 
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_0_0.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_0_0.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_0_0.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -46,6 +46,20 @@
     },
 
     /**
+     * Method: read_wmc_SRS
+     */
+    read_wmc_SRS: function(layerContext, node) {
+        var srs    = this.getChildValue(node);
+        if (typeof layerContext.projections != "object") {
+            layerContext.projections = {};
+        }
+        var values = srs.split(/ +/);
+        for (var i=0, len=values.length; i<len; i++) {
+            layerContext.projections[values[i]] = true;
+        }
+    },
+
+    /**
      * Method: write_wmc_Layer
      * Create a Layer node given a layer context object. This method adds
      *     elements specific to version 1.0.0.
@@ -61,12 +75,26 @@
             this, [context]
         );
     
+        // optional SRS element(s)
+        if (context.srs) {
+            var projections = [];
+            for(var name in context.srs) {
+                projections.push(name);
+            }
+            node.appendChild(this.createElementDefaultNS("SRS", projections.join(" ")));
+        }
+
         // optional FormatList element
         node.appendChild(this.write_wmc_FormatList(context));
 
         // optional StyleList element
         node.appendChild(this.write_wmc_StyleList(context));
         
+        // optional DimensionList element
+        if (context.dimensions) {
+            node.appendChild(this.write_wmc_DimensionList(layer));
+        }
+
         // OpenLayers specific properties go in an Extension element
         node.appendChild(this.write_wmc_LayerExtension(context));
     },    

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -77,6 +77,16 @@
     },
 
     /**
+     * Method: read_wmc_SRS
+     */
+    read_wmc_SRS: function(layerContext, node) {
+        if (! ("srs" in layerContext)) {
+            layerContext.srs = {};
+        }
+        layerContext.srs[this.getChildValue(node)] = true;
+    },
+
+    /**
      * Method: write_wmc_Layer
      * Create a Layer node given a layer context object. This method adds
      *     elements specific to version 1.1.0.
@@ -109,12 +119,24 @@
             node.appendChild(maxSD);
         }
 
+        // optional SRS element(s)
+        if (context.srs) {
+            for(var name in context.srs) {
+                node.appendChild(this.createElementDefaultNS("SRS", name));
+            }
+        }
+
         // optional FormatList element
         node.appendChild(this.write_wmc_FormatList(context));
 
         // optional StyleList element
         node.appendChild(this.write_wmc_StyleList(context));
         
+        // optional DimensionList element
+        if (context.dimensions) {
+            node.appendChild(this.write_wmc_DimensionList(context));
+        }
+
         // OpenLayers specific properties go in an Extension element
         node.appendChild(this.write_wmc_LayerExtension(context));
         

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -74,9 +74,13 @@
             visibility: layer.visibility,
             name: layer.params["LAYERS"],
             title: layer.name,
+            "abstract": layer.metadata["abstract"],
+            dataURL: layer.metadata.dataURL,
             metadataURL: layer.metadataURL,
+            server: {
             version: layer.params["VERSION"],
-            url: layer.url,
+                url: layer.url
+            },
             maxExtent: layer.maxExtent,
             transparent: layer.params["TRANSPARENT"],
             numZoomLevels: layer.numZoomLevels,
@@ -97,18 +101,54 @@
                         layer.options.minResolution || 
                         layer.options.maxScale) ? 
                         layer.maxScale : undefined,
-            formats: [{
+            formats: [],
+            styles: [],
+            srs: layer.srs,
+            dimensions: layer.dimensions
+        };
+
+
+        if (layer.metadata.servertitle) {
+            layerContext.server.title = layer.metadata.servertitle;
+        }
+
+        if (layer.metadata.formats && layer.metadata.formats.length > 0) {
+            for (var i=0, len=layer.metadata.formats.length; i<len; i++) {
+                var format = layer.metadata.formats[i];
+                layerContext.formats.push({
+                    value: format.value,
+                    current: (format.value == layer.params["FORMAT"])
+                });
+            }
+        } else {
+            layerContext.formats.push({
                 value: layer.params["FORMAT"],
                 current: true
-            }],
-            styles: [{
+            });
+        }
+
+        if (layer.metadata.styles && layer.metadata.styles.length > 0) {
+            for (var i=0, len=layer.metadata.styles.length; i<len; i++) {
+                var style = layer.metadata.styles[i];
+                if ((style.href == layer.params["SLD"]) ||
+                    (style.body == layer.params["SLD_BODY"]) ||
+                    (style.name == layer.params["STYLES"])) {
+                    style.current = true;
+                } else {
+                    style.current = false;
+                }
+                layerContext.styles.push(style);
+            }
+        } else {
+            layerContext.styles.push({
                 href: layer.params["SLD"],
                 body: layer.params["SLD_BODY"],
                 name: layer.params["STYLES"] || parser.defaultStyleName,
                 title: parser.defaultStyleTitle,
                 current: true
-            }]
-        };
+            });
+        }
+
         return layerContext;
     },
     
@@ -126,16 +166,22 @@
     toContext: function(obj) {
         var context = {};
         var layers = obj.layers;
-        if(obj.CLASS_NAME == "OpenLayers.Map") {
+        if (obj.CLASS_NAME == "OpenLayers.Map") {
+            var metadata = obj.metadata || {};
+            context.size = obj.getSize();
             context.bounds = obj.getExtent();
+            context.projection = obj.projection;
+            context.title = obj.title;
+            context.keywords = metadata.keywords;
+            context["abstract"] = metadata["abstract"];
+            context.logo = metadata.logo;
+            context.descriptionURL = metadata.descriptionURL;
+            context.contactInformation = metadata.contactInformation;
             context.maxExtent = obj.maxExtent;
-            context.projection = obj.projection;
-            context.size = obj.getSize();
-        }
-        else {
+        } else {
             // copy all obj properties except the "layers" property
             OpenLayers.Util.applyDefaults(context, obj);
-            if(context.layers != undefined) {
+            if (context.layers != undefined) {
                 delete(context.layers);
             }
         }
@@ -148,7 +194,7 @@
         if (layers != undefined && layers instanceof Array) {
             for (var i=0, len=layers.length; i<len; i++) {
                 var layer = layers[i];
-                if(layer instanceof OpenLayers.Layer.WMS) {
+                if (layer instanceof OpenLayers.Layer.WMS) {
                     context.layersContext.push(this.layerToContext(layer));
                 }
             }

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -442,7 +442,7 @@
      * {Boolean} Let the event propagate.
      */
     mouseout: function (evt) {
-        if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
+        if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
             if(this.documentDrag === true) {
                 this.addDocumentEvents();
             } else {

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Hover.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Hover.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Hover.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -110,7 +110,7 @@
      * {Boolean} Continue propagating this event.
      */
     mouseout: function(evt) {
-        if (OpenLayers.Util.mouseLeft(evt, this.map.div)) {
+        if (OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
             this.clearTimer();
             this.callback('move', [evt]);
         }

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -563,7 +563,7 @@
      * evt - {Event} The browser event
      */
     mouseout: function(evt) {
-        if(OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
+        if(OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
             this.stoppedDown = this.stopDown;
             this.mouseDown = false;
         }

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/WMS.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -237,7 +237,7 @@
      */
     getFullRequestString:function(newParams, altUrl) {
         var mapProjection = this.map.getProjectionObject();
-        var projectionCode = this.projection.equals(mapProjection) ?
+        var projectionCode = this.projection && this.projection.equals(mapProjection) ?
             this.projection.getCode() :
             mapProjection.getCode();
         var value = (projectionCode == "none") ? null : projectionCode;

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/XYZ.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -148,6 +148,12 @@
             OpenLayers.Util.indexOf(this.serverResolutions, res) :
             this.map.getZoom() + this.zoomOffset;
 
+        var limit = Math.pow(2, z);
+        if (this.wrapDateLine)
+        {
+           x = ((x % limit) + limit) % limit;
+        }
+
         return {'x': x, 'y': y, 'z': z};
     },
     
@@ -199,5 +205,6 @@
          obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
          return obj;
      },
+     wrapDateLine: true,
      CLASS_NAME: "OpenLayers.Layer.OSM"
 });

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js	2011-04-05 11:38:13 UTC (rev 11877)
@@ -42,9 +42,16 @@
      * Property: features
      * {Object} Internal object of feature/style pairs for use in redrawing the layer.
      */
-    features: null, 
-   
+    features: null,
+    
     /**
+     * Property: pendingRedraw
+     * {Boolean} The renderer needs a redraw call to render features added while
+     *     the renderer was locked.
+     */
+    pendingRedraw: false,
+    
+    /**
      * Constructor: OpenLayers.Renderer.Canvas
      *
      * Parameters:
@@ -60,8 +67,6 @@
         if (this.hitDetection) {
             this.hitCanvas = document.createElement("canvas");
             this.hitContext = this.hitCanvas.getContext("2d");
-            this.hitGraphicCanvas = document.createElement("canvas");
-            this.hitGraphicContext = this.hitGraphicCanvas.getContext("2d");
         }
     },
     
@@ -113,11 +118,6 @@
             hitCanvas.style.height = size.h + "px";
             hitCanvas.width = size.w;
             hitCanvas.height = size.h;
-            var hitGraphicCanvas = this.hitGraphicCanvas;
-            hitGraphicCanvas.style.width = size.w + "px";
-            hitGraphicCanvas.style.height = size.h + "px";
-            hitGraphicCanvas.width = size.w;
-            hitGraphicCanvas.height = size.h;
         }
     },
     
@@ -141,10 +141,14 @@
             style = style || feature.style;
             style = this.applyDefaultSymbolizer(style);  
 
-            this.features[feature.id] = [feature, style]; 
-            this.redraw();
+            this.features[feature.id] = [feature, style];
             rendered = true;
+            this.pendingRedraw = true;
         }
+        if (this.pendingRedraw && !this.locked) {
+            this.redraw();
+            this.pendingRedraw = false;
+        }
         return rendered;
     },
 
@@ -214,44 +218,25 @@
         var x = pt[0] + xOffset;
         var y = pt[1] + yOffset;
 
-        var numRows = this.root.width;
-        var numCols = this.root.height;
-
         var opacity = style.graphicOpacity || style.fillOpacity;
         
-        var rgb = this.featureIdToRGB(featureId);
-        var red = rgb[0];
-        var green = rgb[1];
-        var blue = rgb[2];
-        
         var onLoad = function() {
             // TODO: check that we haven't moved
             var canvas = this.canvas;
             canvas.globalAlpha = opacity;
+            var factor = OpenLayers.Renderer.Canvas.drawImageScaleFactor ||
+                (OpenLayers.Renderer.Canvas.drawImageScaleFactor =
+                    /android 2.1/.test(navigator.userAgent.toLowerCase()) ?
+                        // 320 is the screen width of the G1 phone, for which
+                        // drawImage works out of the box.
+                        320 / window.screen.width : 1
+                );
             canvas.drawImage(
-                img, x, y, width, height
+                img, x*factor, y*factor, width*factor, height*factor
             );
             if (this.hitDetection) {
-                var hitGraphicContext = this.hitGraphicContext;
-                var hitContext = this.hitContext;
-                hitGraphicContext.clearRect(0, 0, numRows, numCols);
-                hitGraphicContext.drawImage(
-                    img, 0, 0, width, height
-                );
-                var imagePixels = hitGraphicContext.getImageData(0, 0, width, height).data;
-                var indexData = hitContext.createImageData(width, height);
-                var indexPixels = indexData.data;
-                var pixelIndex;
-                for (var i=0, len=imagePixels.length; i<len; i+=4) {
-                    // look for visible pixels
-                    if (imagePixels[i+3] > 0) {
-                        indexData[i] = red;
-                        indexPixels[i+1] = green;
-                        indexPixels[i+2] = blue;
-                        indexPixels[i+3] = 255;
-                    }
-                }
-                hitContext.putImageData(indexData, x, y);
+                this.setHitContextStyle("fill", featureId);
+                this.hitContext.fillRect(x, y, width, height);
             }
         };
 
@@ -304,25 +289,6 @@
     },
     
     /**
-     * Method: featureIdToRGB
-     * Convert a feature ID string into an RGB array.
-     *
-     * Parameters:
-     * featureId - {String} Feature id
-     *
-     * Returns:
-     * {Array} RGB values.
-     */
-    featureIdToRGB: function(featureId) {
-        var hex = this.featureIdToHex(featureId);
-        return [
-            parseInt(hex.substring(1, 3), 16),
-            parseInt(hex.substring(3, 5), 16),
-            parseInt(hex.substring(5, 7), 16)
-        ];
-    },
-
-    /**
      * Method: setHitContextStyle
      * Prepare the hit canvas for drawing by setting various global settings.
      *
@@ -582,7 +548,7 @@
         }
         this.setCanvasStyle("reset");
     },
-
+    
     /**
      * Method: getLocalXY
      * transform geographic xy into pixel xy
@@ -684,7 +650,6 @@
                 if (!this.features.hasOwnProperty(id)) { continue; }
                 feature = this.features[id][0];
                 style = this.features[id][1];
-                if (!feature.geometry) { continue; }
                 this.drawGeometry(feature.geometry, style, feature.id);
                 if(style.label) {
                     labelMap.push([feature, style]);
@@ -722,3 +687,11 @@
     "t": 0,
     "b": -1
 };
+
+/**
+ * Constant: OpenLayers.Renderer.Canvas.drawImageScaleFactor
+ * {Number} Scale factor to apply to the canvas drawImage arguments. This
+ *     is always 1 except for Android 2.1 devices, to work around
+ *     http://code.google.com/p/android/issues/detail?id=5141.
+ */
+OpenLayers.Renderer.Canvas.drawImageScaleFactor = null;

Modified: sandbox/cmoullet/openlayers/tests/Control/Panel.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/Panel.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Control/Panel.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -10,7 +10,7 @@
         t.eq( control.displayClass,  "olControlPanel", "displayClass is correct" );
     }
     function test_Control_Panel_constructor2 (t) {
-        t.plan(16);
+        t.plan(19);
         var map = new OpenLayers.Map('map');
         var toolControl = new OpenLayers.Control.ZoomBox();
         var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
@@ -22,53 +22,68 @@
               CLASS_NAME: 'mbControl.TestToggle',
               type: OpenLayers.Control.TYPE_TOGGLE
         });
-        
+
         var toggleControl = new ToggleControl();
         var buttonControl = new OpenLayers.Control.Button({
             trigger: function () {
-                t.ok(true, "trigger function of button is called.");     
+                t.ok(true, "trigger function of button is called.");
             }
         });
 
         var panel = new OpenLayers.Control.Panel(
             {defaultControl: anotherToolControl});
-        t.ok(panel instanceof OpenLayers.Control.Panel, 
+        t.ok(panel instanceof OpenLayers.Control.Panel,
               "new OpenLayers.Control.Panel returns object");
         panel.redraw = function(){
-            panel.redrawsCount++;            
+            panel.redrawsCount++;
+            OpenLayers.Control.Panel.prototype.redraw.apply(this, arguments);
         };
 
+        // To get length of events.listeners error-free
+        var getListenerLength= function(events,key){
+            if(!events) {
+                return -2; // events is destroyed
+            } else if(!events.listeners) {
+                return -1; // events is destroyed
+            } else if(!events.listeners[key]) {
+                return 0; // no listener in event
+            } else {
+                return events.listeners[key].length;
+            }
+        };
+        var toolEventListenerLength = getListenerLength(toolControl.events,"activate");
         panel.addControls([toolControl, anotherToolControl, toggleControl]);
         t.eq(panel.controls.length, 3,
               "added three controls to the panel");
         panel.addControls([buttonControl]);
 
-        panel.redrawsCount = 0;              
+        panel.redrawsCount = 0;
         map.addControl(panel);
-        t.ok((panel.redrawsCount > 0), "Redraw called on add panel to map " + 
-            panel.redrawsCount + " times.");        
-        t.ok((panel.active),"Panel is active after add panel to map.");        
-        
-        panel.redrawsCount = 0;              
+        t.eq(getListenerLength(toolControl.events,"activate"), toolEventListenerLength+1,
+            "toolControl additional listener for \"activate\" after adding Panel to the map.");
+        t.ok((panel.redrawsCount > 0), "Redraw called on add panel to map " +
+            panel.redrawsCount + " times.");
+        t.ok((panel.active),"Panel is active after add panel to map.");
+
+        panel.redrawsCount = 0;
         panel.addControls(new AnotherToolControl());
         t.ok((panel.redrawsCount > 0),
             "Redraw called on add control to panel after add panel to map " +
-            panel.redrawsCount + " times."); 
+            panel.redrawsCount + " times.");
 
         panel.deactivate();
-        panel.redrawsCount = 0;                      
-        panel.activate();        
+        panel.redrawsCount = 0;
+        panel.activate();
         t.ok((panel.redrawsCount > 0),"Redraw called on activate panel " +
-            panel.redrawsCount + " times."); 
+            panel.redrawsCount + " times.");
 
         panel.activateControl(toolControl);
         t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active && !buttonControl.active,
               "activated one tool control, the other one is inactive and the toggle & button controls also.");
 
-        panel.redrawsCount = 0;              
         panel.activateControl(toggleControl);
-        t.eq(panel.redrawsCount, 1, "Redraw called on activated toggle " +
-            panel.redrawsCount + " times.");
+        t.eq(toggleControl.panel_div.className,"mbControlTestToggleItemActive",
+            "className of icon div for toggle control is active.");
         t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
               "activated the toggle control, which has no influence on the tool & togggle controls.");
         panel.activateControl(buttonControl);
@@ -79,16 +94,21 @@
         buttonControl.activate();
         t.ok(buttonControl.active && toolControl.active && !anotherToolControl.active && toggleControl.active,
               "activated the button control, which has no influence on the tool & togggle controls.");
-              
-        panel.redrawsCount = 0; 
+
         panel.activateControl(anotherToolControl);
-        t.ok((panel.redrawsCount > 0),
-            "Redraw called on activated tool control " + panel.redrawsCount + 
-            " times.");
+        t.eq(anotherToolControl.panel_div.className,"mbControlTestToolItemActive",
+            "className of icon div for anotherToolControl is active.");
+        t.eq(toolControl.panel_div.className,"olControlZoomBoxItemInactive",
+            "className of icon div for toolControl is inactive.");
         t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
               "activated the other tool control, the first one is inactive and the toggle control still active.");
         t.ok(buttonControl.active,
               "activated the other tool control, the button control still active.");
+
+        panel.destroy();
+        t.eq(getListenerLength(toolControl.events,"activate"), toolEventListenerLength,
+            "toolControl additional listeners removed after destroy Panel.");
+        map.destroy();
     }
     function test_Control_Panel_titles (t) { 
         t.plan(2); 

Modified: sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -115,6 +115,61 @@
         control.getInfoForHover({xy: {x: 50, y: 50}});
     }
 
+    function test_getfeatureinfo_event(t) {
+
+        t.plan(5);
+
+        var text =
+            '<?xml version="1.0" encoding="UTF-8" ?>' +
+            '<FeatureInfoResponse>' +
+            '  <FIELDS OBJECTID="1188" HECTARES="1819.734" ZONENR="5854" NULZONES=" " AREA="18197340.1426" PERIMETER="19177.4073627" SHAPE="NULL" SE_ANNO_CAD_DATA="NULL" SHAPE.AREA="0" SHAPE.LEN="0"/>' +
+            '</FeatureInfoResponse>';
+
+        var map = new OpenLayers.Map('map');
+
+        var xy;
+        var url = "http://foo";
+
+        // mock up a control with output "object" and drillDown true
+        var control = new OpenLayers.Control.WMSGetFeatureInfo({
+            output: "object",
+            drillDown: true,
+            request: function(position) {},
+            eventListeners: {
+                getfeatureinfo: function(evt) {
+                    t.ok(evt.features[0].url === url, "features is an object with a property url when output is object");
+                    var features = evt.features[0].features;
+                    t.ok(features.length === 1, "features properties has a length of 1");
+                    t.ok(features[0] instanceof OpenLayers.Feature.Vector, "Feature array contains 1 feature");
+                }
+            }
+        });
+
+        // mock up a control with output "features" and drillDown true
+        var control2 = new OpenLayers.Control.WMSGetFeatureInfo({
+            autoActivate: true,
+            drillDown: true,
+            request: function(position) {},
+            eventListeners: {
+                getfeatureinfo: function(evt) {
+                    var features = evt.features;
+                    t.ok(features.length === 1, "features properties has a length of 1");
+                    t.ok(features[0] instanceof OpenLayers.Feature.Vector, "Feature array contains 1 feature");
+                }
+            }
+        });
+
+        map.addControls([control, control2]);
+        control.activate();
+
+        xy = {x: 50, y: 50};
+        control._requestCount = control2._requestCount = 0;
+        control._numRequests = control2._numRequests = 1;
+        control.handleResponse({xy: xy}, {responseText: text}, url);
+        control2.handleResponse({xy: xy}, {responseText: text}, url);
+        map.destroy();
+    }
+
     function test_beforegetfeatureinfo_event(t) {
         t.plan(2);
         var map = new OpenLayers.Map('map');

Modified: sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -251,7 +251,7 @@
         t.plan(2);
         var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(1,2));
         feature.fid = 0;
-        var output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}';
+        var output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}';
         var layer = new OpenLayers.Layer.Vector();
         layer.projection = "EPSG:4326";
         feature.layer = layer;
@@ -259,7 +259,7 @@
         var test_out = parser.write(feature);
         t.eq(test_out, output, "Output is equal for vector with layer in EPSG:4326 ");
         feature.layer.projection = "EPSG:2805";
-        output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"EPSG","properties":{"code":2805}}}';
+        output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"name","properties":{"name":"EPSG:2805"}}}';
         test_out = parser.write(feature);
         t.eq(test_out, output, "Output is equal for vector with point");
     }    

Modified: sandbox/cmoullet/openlayers/tests/Format/WMC/v1.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/WMC/v1.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Format/WMC/v1.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,7 +4,7 @@
     <script type="text/javascript">
     
     function test_write_wmc_StyleList(t) {
-        t.plan(3);
+        t.plan(4);
         
         var layer, layerContext, got, expected;
         
@@ -39,10 +39,10 @@
             "<StyleList xmlns='http://www.opengis.net/context'>" +
                 "<Style current='1'>" +
                     "<SLD>" + 
+                        "<Title>Default</Title>" +
                         "<OnlineResource xmlns:xlink='http://www.w3.org/1999/xlink' "+
                                         "xlink:type='simple' " +
                                         "xlink:href='http://linked.sld' />" +
-                        "<Name></Name><Title>Default</Title>" +
                     "</SLD>" + 
                 "</Style>" +
             "</StyleList>";
@@ -88,6 +88,7 @@
             "<StyleList xmlns='http://www.opengis.net/context'>" +
                 "<Style current='1'>" +
                     "<SLD>" + 
+                        "<Title>Default</Title>" +
                         "<sld:StyledLayerDescriptor version='1.0.0' " +
                             "xmlns:sld='http://www.opengis.net/sld' " +
                             "xmlns:ogc='http://www.opengis.net/ogc' " +
@@ -115,13 +116,71 @@
                                 "</sld:UserStyle>" +
                             "</sld:NamedLayer>" +
                         "</sld:StyledLayerDescriptor>" +
-                        "<Name></Name><Title>Default</Title>" +
                     "</SLD>" +
                 "</Style>" + 
             "</StyleList>";
         
         t.xml_eq(got, expected, "inline style correctly written");
         layer.destroy();
+
+        // test inline FeatureTypeStyle
+        layer = new OpenLayers.Layer.WMS(name, url, {
+            sld_body:
+                "<sld:FeatureTypeStyle version='1.0.0' " +
+                            "xmlns:sld='http://www.opengis.net/sld' " +
+                            "xmlns:ogc='http://www.opengis.net/ogc' " +
+                            "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
+                            "xsi:schemaLocation='http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd'>" +
+                    "<sld:Rule>" +
+                        "<sld:TextSymbolizer>" +
+                            "<sld:Label>" +
+                                "<ogc:PropertyName>ZONENR</ogc:PropertyName>" +
+                            "</sld:Label>" +
+                            "<sld:Font>" +
+                                "<sld:CssParameter name='font-family'>Arial</sld:CssParameter>" +
+                                "<sld:CssParameter name='font-size'>10</sld:CssParameter>" +
+                            "</sld:Font>" +
+                            "<sld:Fill>" +
+                                "<sld:CssParameter name='fill'>#FF9900</sld:CssParameter>" +
+                            "</sld:Fill>" +
+                        "</sld:TextSymbolizer>" +
+                    "</sld:Rule>" +
+                "</sld:FeatureTypeStyle>"
+        });
+
+        layerContext = format.layerToContext(layer);
+        got = parser.write_wmc_StyleList(layerContext);
+        expected =
+            "<StyleList xmlns='http://www.opengis.net/context'>" +
+                "<Style current='1'>" +
+                    "<SLD>" +
+                        "<Title>Default</Title>" +
+                        "<sld:FeatureTypeStyle version='1.0.0' " +
+                            "xmlns:sld='http://www.opengis.net/sld' " +
+                            "xmlns:ogc='http://www.opengis.net/ogc' " +
+                            "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
+                            "xsi:schemaLocation='http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd'>" +
+                            "<sld:Rule>" +
+                                "<sld:TextSymbolizer>" +
+                                    "<sld:Label>" +
+                                        "<ogc:PropertyName>ZONENR</ogc:PropertyName>" +
+                                    "</sld:Label>" +
+                                    "<sld:Font>" +
+                                        "<sld:CssParameter name='font-family'>Arial</sld:CssParameter>" +
+                                        "<sld:CssParameter name='font-size'>10</sld:CssParameter>" +
+                                    "</sld:Font>" +
+                                    "<sld:Fill>" +
+                                        "<sld:CssParameter name='fill'>#FF9900</sld:CssParameter>" +
+                                    "</sld:Fill>" +
+                                    "</sld:TextSymbolizer>" +
+                            "</sld:Rule>" +
+                        "</sld:FeatureTypeStyle>" +
+                    "</SLD>" +
+                "</Style>" +
+            "</StyleList>";
+
+        t.xml_eq(got, expected, "inline FeatureTypeStyle correctly written");
+        layer.destroy();
     }
     
     function test_read_wmc_StyleList(t) {

Modified: sandbox/cmoullet/openlayers/tests/Format/WMC.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/WMC.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Format/WMC.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -6,9 +6,10 @@
     var v1_0_0 = '<ViewContext xmlns="http://www.opengis.net/context" version="1.0.0" id="OpenLayers_Context_233" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.0.0/context.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><General><Window width="512" height="256"/><BoundingBox minx="-109.9709708" miny="27.01451459" maxx="-80.02902918" maxy="41.98548541" SRS="EPSG:4326"/><Title/><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/></Extension></General><LayerList><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://t1.hypercube.telascience.org/cgi-bin/landsat7"/></Server><Name>landsat7</Name><Title>NASA Global Mosaic</Title><FormatList><Format current="1">image/jpeg</Format></FormatList><StyleList><Style current="1"><N
 ame/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">true</ol:isBaseLayer><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile><ol:tileSize xmlns:ol="http://openlayers.org/context" width="512" height="1024"/></Extension></Layer><Layer queryable="1" hidden="1"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://labs.metacarta.com/wms/vmap0"/></Server><Name>basic</Name><Title>OpenLayers WMS</Title><FormatList><Format current="1">im
 age/jpeg</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">true</ol:isBaseLayer><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile></Extension></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://lioapp.lrc.gov.on.ca/cubeserv/cubeserv.pl"/></Server><Name>na_road:CCRS</Name><Title>Transportation Network</Title><FormatList><Format curre
 nt="1">image/png</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-166.5320000" miny="4.050460000" maxx="-0.2068180000" maxy="70.28700000"/><ol:transparent xmlns:ol="http://openlayers.org/context">TRUE</ol:transparent><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer><ol:opacity xmlns:ol="http://openlayers.org/context">0.6</ol:opacity><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">false</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile></Extension></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" x
 link:href="http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/AccuWeather_Maps.wms"/></Server><Name>3:1</Name><Title>Radar 3:1</Title><FormatList><Format current="1">image/png</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-131.0294952" miny="14.56289673" maxx="-61.02950287" maxy="54.56289673"/><ol:transparent xmlns:ol="http://openlayers.org/context">TRUE</ol:transparent><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer><ol:opacity xmlns:ol="http://openlayers.org/context">0.8</ol:opacity><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">false</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">true</ol:singleTile></Extension
 ></Layer></LayerList></ViewContext>';
     var v1_1_0 = '<ViewContext xmlns="http://www.opengis.net/context" version="1.1.0" id="OpenLayers_Context_232" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><General><Window width="512" height="256"/><BoundingBox minx="-109.9709708" miny="27.01451459" maxx="-80.02902918" maxy="41.98548541" SRS="EPSG:4326"/><Title/><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/></Extension></General><LayerList><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://t1.hypercube.telascience.org/cgi-bin/landsat7"/></Server><Name>landsat7</Name><Title>NASA Global Mosaic</Title><sld:MinScaleDenominator xmlns:sld="http://www.opengis.net/sld">6299645.760</sld:MinScaleDenomin
 ator><sld:MaxScaleDenominator xmlns:sld="http://www.opengis.net/sld">31498228.80</sld:MaxScaleDenominator><FormatList><Format current="1">image/jpeg</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/><ol:tileSize xmlns:ol="http://openlayers.org/context" width="512" height="1024"/><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">true</ol:isBaseLayer><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile></Extension></Layer><Layer queryable="1" hidden="1"><Server service="OGC:WMS" version="1.1.1"><OnlineResource x
 link:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://labs.metacarta.com/wms/vmap0"/></Server><Name>basic</Name><Title>OpenLayers WMS</Title><sld:MinScaleDenominator xmlns:sld="http://www.opengis.net/sld">6299645.760</sld:MinScaleDenominator><sld:MaxScaleDenominator xmlns:sld="http://www.opengis.net/sld">31498228.80</sld:MaxScaleDenominator><FormatList><Format current="1">image/jpeg</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-130.0000000" miny="14.00000000" maxx="-60.00000000" maxy="55.00000000"/><ol:tileSize xmlns:ol="http://openlayers.org/context" width="512" height="1024"/><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">true</ol:isBaseLayer><ol:displayInLayerSwitch
 er xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile></Extension></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://lioapp.lrc.gov.on.ca/cubeserv/cubeserv.pl"/></Server><Name>na_road:CCRS</Name><Title>Transportation Network</Title><sld:MinScaleDenominator xmlns:sld="http://www.opengis.net/sld">6200000.000</sld:MinScaleDenominator><sld:MaxScaleDenominator xmlns:sld="http://www.opengis.net/sld">32000000.00</sld:MaxScaleDenominator><FormatList><Format current="1">image/png</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-166.5320000" miny="4.050460000" maxx="-0.2068180000" maxy="70.28700000"/><ol:tileSize xmlns:ol="http://openlayer
 s.org/context" width="512" height="1024"/><ol:transparent xmlns:ol="http://openlayers.org/context">TRUE</ol:transparent><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer><ol:opacity xmlns:ol="http://openlayers.org/context">0.6</ol:opacity><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">false</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile></Extension></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1"><OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://columbo.nrlssc.navy.mil/ogcwms/servlet/WMSServlet/AccuWeather_Maps.wms"/></Server><Name>3:1</Name><Title>Radar 3:1</Title><sld:MinScaleDenominator xmlns:sld="http://www.opengis.net/sld">6299645.760</sld:
 MinScaleDenominator><sld:MaxScaleDenominator xmlns:sld="http://www.opengis.net/sld">31498228.80</sld:MaxScaleDenominator><FormatList><Format current="1">image/png</Format></FormatList><StyleList><Style current="1"><Name/><Title>Default</Title></Style></StyleList><Extension><ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-131.0294952" miny="14.56289673" maxx="-61.02950287" maxy="54.56289673"/><ol:transparent xmlns:ol="http://openlayers.org/context">TRUE</ol:transparent><ol:numZoomLevels xmlns:ol="http://openlayers.org/context">4</ol:numZoomLevels><ol:units xmlns:ol="http://openlayers.org/context">degrees</ol:units><ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer><ol:opacity xmlns:ol="http://openlayers.org/context">0.8</ol:opacity><ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher><ol:singleTile xmlns:ol="http://openlayers.org/context">true</ol:singleTile></Extension></Layer></LayerList
 ></ViewContext>';
     var polar = '<ViewContext xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:default="http://www.opengis.net/context" xmlns:ol="http://openlayers.org/context" xmlns="http://www.opengis.net/context" xmlns:wms="http://www.opengis.net/wms" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1.0" id="OpenLayers_Context_466" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd"><General><BoundingBox minx="-3000000" miny="-3000000" maxx="7000000" maxy="7000000" SRS="EPSG:32661"/><Title>WMS viewer</Title><Extension><ol:maxExtent minx="-3000000" miny="-3000000" maxx="7000000" maxy="7000000"/><ol:units>m</ol:units></Extension></General><LayerList xmlns="http://www.opengis.net/context"><Layer queryable="0" hidden="0"><Server service="OGC:WMS" version="1.1.1" foo="bar"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://wms.met.no/maps/northpole.map"/></Server><Name>world</Na
 me><Title>The World</Title><FormatList><Format>image/jpeg</Format><Format current="1">image/png</Format></FormatList></Layer></LayerList></ViewContext>';
+    var fulldoc = '<ViewContext xmlns="http://www.opengis.net/context" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sld="http://www.opengis.net/sld" version="1.1.0" id="eos_data_gateways" xsi:schemaLocation="http://www.opengis.net/context context.xsd"><General><Window width="500" height="300"/><BoundingBox SRS="EPSG:4326" minx="-180.000000" miny="-90.000000" maxx="180.000000" maxy="90.000000"/><Title>EOS Data Gateways</Title><KeywordList><Keyword>EOS</Keyword><Keyword>EOSDIS</Keyword><Keyword>NASA</Keyword><Keyword>CCRS</Keyword><Keyword>CEOS</Keyword><Keyword>OGC</Keyword></KeywordList><Abstract>Map View of EOSDIS partners locations</Abstract><LogoURL width="130" height="74" format="image/gif"><OnlineResource xlink:type="simple" xlink:href="http://redhook.gsfc.nasa.gov/~imswww/pub/icons/logo.gif"/></LogoURL><DescriptionURL format="text/html"><OnlineResource xlink:type="simple" xlink:href="http://eos.nasa.gov/imswelco
 me"/></DescriptionURL><ContactInformation><ContactPersonPrimary><ContactPerson>Tom Kralidis</ContactPerson><ContactOrganization>Environment Canada</ContactOrganization></ContactPersonPrimary><ContactPosition>Systems Scientist</ContactPosition><ContactAddress><AddressType>postal</AddressType><Address>867 Lakeshore Road</Address><City>Burlington</City><StateOrProvince>Ontario</StateOrProvince><PostCode>L7R 4A6</PostCode><Country>Canada</Country></ContactAddress><ContactVoiceTelephone>+01-905-336-4409</ContactVoiceTelephone><ContactFacsimileTelephone>+01-905-336-4499</ContactFacsimileTelephone><ContactElectronicMailAddress>tom.kralidis at ec.gc.ca</ContactElectronicMailAddress></ContactInformation></General><LayerList><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1" title="ESA CubeSERV"><OnlineResource xlink:type="simple" xlink:href="http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi"/></Server><Name>WORLD_MODIS_1KM:MapAdmin</Name><Title>WORLD_MOD
 IS_1KM</Title><Abstract>Global maps derived from various Earth Observation sensors / WORLD_MODIS_1KM:MapAdmin</Abstract><SRS>EPSG:4326</SRS><FormatList><Format current="1">image/png</Format><Format>image/gif</Format><Format>image/jpeg</Format></FormatList><StyleList><Style current="1"><Name>default</Name><Title>default</Title><LegendURL width="16" height="16" format="image/gif"><OnlineResource xlink:type="simple" xlink:href="http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi?version=1.1.1&amp;request=GetLegendGraphic&amp;layer=WORLD_MODIS_1KM:MapAdmin&amp;style=default&amp;format=image/gif"/></LegendURL></Style></StyleList></Layer><Layer queryable="0" hidden="0"><Server service="OGC:WMS" version="1.1.1" title="The GLOBE Program Visualization Server"><OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/viz-bin/wmt.cgi"/></Server><Name>COASTLINES</Name><Title>Coastlines</Title><Abstract>Context layer: Coastlines</Abstract><SRS>EPSG:4326</SRS><
 SRS>EPSG:900913</SRS><FormatList><Format current="1">image/gif</Format><Format>image/png</Format></FormatList><StyleList><Style current="1"><Name>default</Name><Title>Default</Title><LegendURL width="180" format="image/gif" height="50"><OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/globe/en/icons/colorbars/COASTLINES.gif"/></LegendURL></Style></StyleList><DimensionList><Dimension name="time" units="ISO8601" nearestValue="1">2011-03-31,2011-04-01</Dimension></DimensionList></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1" title="The GLOBE Program Visualization Server"><OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/viz-bin/wmt.cgi"/></Server><Name>NATIONAL</Name><Title>National Boundaries</Title><Abstract>Context layer: National Boundaries</Abstract><DataURL><OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/data/national.gml"/></DataURL><MetadataURL><Online
 Resource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/metadata/national.txt"/></MetadataURL><SRS>EPSG:4326</SRS><FormatList><Format current="1">image/gif</Format><Format>image/png</Format></FormatList><StyleList><Style current="1"><Name>default</Name><Title>Default</Title><LegendURL width="180" format="image/gif" height="50"><OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/globe/en/icons/colorbars/NATIONAL.gif"/></LegendURL></Style></StyleList></Layer><Layer queryable="1" hidden="0"><Server service="OGC:WMS" version="1.1.1" title="Canada Centre for Remote Sensing Web Map Service"><OnlineResource xlink:type="simple" xlink:href="http://ceoware2.ccrs.nrcan.gc.ca/cubewerx/cubeserv/cubeserv.cgi"/></Server><Name>EOS_DATA_GATEWAYS:CEOWARE2</Name><Title>EOS Data Gateways</Title><Abstract>Locations of EOS Data Gateway Locations. The same services and data are available through each gateway location.</Abstract><sld:MinScaleDenominator>1000
 </sld:MinScaleDenominator><sld:MaxScaleDenominator>500000</sld:MaxScaleDenominator><SRS>EPSG:4326</SRS><FormatList><Format current="1">image/gif</Format><Format>image/png</Format><Format>image/jpeg</Format></FormatList><StyleList><Style current="1"><Name>default</Name><Title>default</Title><LegendURL width="16" height="16" format="image/gif"><OnlineResource xlink:type="simple" xlink:href="http://ceoware2.ccrs.nrcan.gc.ca/cubewerx/cubeserv/cubeserv.cgi?version=1.1.1&amp;request=GetLegendGraphic&amp;layer=EOS_DATA_GATEWAYS:CEOWARE2&amp;style=default&amp;format=image/gif"/></LegendURL></Style><Style><SLD><Title>Default</Title><sld:StyledLayerDescriptor xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"><sld:NamedLayer><sld:Name>AAA212</sld:Name><sld:UserStyle><sld:Fe
 atureTypeStyle><sld:Rule><sld:TextSymbolizer><sld:Label><ogc:PropertyName>ZONENR</ogc:PropertyName></sld:Label><sld:Font><sld:CssParameter name="font-family">Arial</sld:CssParameter><sld:CssParameter name="font-size">10</sld:CssParameter></sld:Font><sld:Fill><sld:CssParameter name="fill">#FF9900</sld:CssParameter></sld:Fill></sld:TextSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor></SLD></Style><Style><SLD><Title>Default</Title><sld:FeatureTypeStyle xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"><sld:Rule><sld:TextSymbolizer><sld:Label><PropertyName>ZONENR</PropertyName></sld:Label><sld:Font><sld:CssParameter name="font-family">Arial</sld:CssParameter><sld:CssParameter name="font-size">10</sld:CssParame
 ter></sld:Font><sld:Fill><sld:CssParameter name="fill">#FF9900</sld:CssParameter></sld:Fill></sld:TextSymbolizer></sld:Rule></sld:FeatureTypeStyle></SLD></Style></StyleList></Layer></LayerList></ViewContext>';
 
     function test_Format_WMC_read(t) {
-        t.plan(37);
+        t.plan(64);
 
         var format = new OpenLayers.Format.WMC();        
         var map, layer;
@@ -104,6 +105,89 @@
             "mapOptions correctly passed to the created map object");
         map.destroy();
         
+        map = format.read(fulldoc, {map: "map"});
+
+        var meta = map.metadata;
+
+        // Check if ContextInformation is set properly
+        var cinfo = meta.contactInformation;
+
+        t.eq(cinfo.personPrimary.person,       "Tom Kralidis",       "got correct person");
+        t.eq(cinfo.personPrimary.organization, "Environment Canada", "got correct organization");
+
+        t.eq(cinfo.contactAddress.address,     "867 Lakeshore Road", "got correct address");
+        t.eq(cinfo.contactAddress.city,        "Burlington",         "got correct city");
+        t.eq(cinfo.contactAddress.country,     "Canada",             "got correct country");
+        t.eq(cinfo.contactAddress.postcode,    "L7R 4A6",            "got correct postcode");
+        t.eq(cinfo.contactAddress.stateOrProvince, "Ontario",        "got correct stateOrProvince");
+        t.eq(cinfo.contactAddress.type,        "postal",             "got correct address type");
+
+        t.eq(cinfo.email,    "tom.kralidis at ec.gc.ca", "got correct email");
+        t.eq(cinfo.fax,      "+01-905-336-4499",      "got correct fax number");
+        t.eq(cinfo.phone,    "+01-905-336-4409",      "got correct phone number");
+        t.eq(cinfo.position, "Systems Scientist",     "got correct position");
+
+        // Check if LogoURL is read properly
+        var logo = meta.logo;
+        t.eq(logo, {
+                href: "http://redhook.gsfc.nasa.gov/~imswww/pub/icons/logo.gif",
+                width: "130",
+                height: "74",
+                format: "image/gif"},
+            "got currect logo");
+
+        t.eq(meta.descriptionURL, "http://eos.nasa.gov/imswelcome", "got correct descriptionURL");
+
+        t.eq(meta.keywords,
+             ["EOS", "EOSDIS", "NASA", "CCRS", "CEOS", "OGC"],
+             "got correct keywords");
+
+        layer = map.layers[1];
+
+        t.eq(layer.metadata.servertitle,
+             "The GLOBE Program Visualization Server",
+             "got correct title for server");
+
+        t.eq(layer.srs,
+             {"EPSG:4326": true, "EPSG:900913": true},
+             "SRS read correctly");
+
+        t.eq(layer.metadata.formats,
+             [{value: "image/gif", current: true},
+              {value: "image/png"}],
+             "formats read correctly");
+
+        var style = layer.metadata.styles[0];
+        t.eq(style.legend, {
+                href: "http://globe.digitalearth.gov/globe/en/icons/colorbars/COASTLINES.gif",
+                width: "180",
+                height: "50",
+                format: "image/gif"},
+            "got currect legend");
+
+
+        var dim = layer.dimensions["time"];
+        t.eq(dim.name, "time", "got correct name of dimension");
+        t.eq(dim.units, "ISO8601", "got correct units for dimension");
+        t.eq(dim.nearestValue, true, "got correct value for nearestValue");
+        t.eq(dim.values, ["2011-03-31", "2011-04-01"], "got correct values for dimension");
+
+        layer = map.layers[2];
+        t.eq(layer.metadata.dataURL,
+             "http://globe.digitalearth.gov/data/national.gml",
+             "got correct dataURL");
+        t.eq(layer.metadataURL,
+             "http://globe.digitalearth.gov/metadata/national.txt",
+             "got correct metadataURL");
+
+        layer = map.layers[3];
+        var sld_body = '<sld:StyledLayerDescriptor xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"><sld:NamedLayer><sld:Name>AAA212</sld:Name><sld:UserStyle><sld:FeatureTypeStyle><sld:Rule><sld:TextSymbolizer><sld:Label><ogc:PropertyName>ZONENR</ogc:PropertyName></sld:Label><sld:Font><sld:CssParameter name="font-family">Arial</sld:CssParameter><sld:CssParameter name="font-size">10</sld:CssParameter></sld:Font><sld:Fill><sld:CssParameter name="fill">#FF9900</sld:CssParameter></sld:Fill></sld:TextSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
+        var styles = layer.metadata.styles;
+        t.xml_eq(styles[1].body, sld_body, "StyledLayerDescriptor body read correctly");
+
+        sld_body = '<sld:FeatureTypeStyle xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"><sld:Rule><sld:TextSymbolizer><sld:Label><PropertyName xmlns="http://www.opengis.net/context">ZONENR</PropertyName></sld:Label><sld:Font><sld:CssParameter name="font-family">Arial</sld:CssParameter><sld:CssParameter name="font-size">10</sld:CssParameter></sld:Font><sld:Fill><sld:CssParameter name="fill">#FF9900</sld:CssParameter></sld:Fill></sld:TextSymbolizer></sld:Rule></sld:FeatureTypeStyle>';
+        t.xml_eq(styles[2].body, sld_body, "FeatureTypeStyle body read correctly");
+
     }
     
     function test_Format_WMC_write(t) {
@@ -141,7 +225,7 @@
             t.plan(0);
             t.debug_print("WMC writing works but is not tested in Opera");
         } else {
-            t.plan(1);
+            t.plan(11);
 
             map = format.read(v1_1_0, {map: "map"});
             wmc = format.write(map);
@@ -149,7 +233,78 @@
                  "(v1.1.0) write gives what read got");
             map.destroy();
 
+            var parser = format.getParser("1.1.0");
+            map = format.read(fulldoc, {map: "map"});
+            var context = format.toContext(map);
+
+            // KeywordList
+            var expected = '<KeywordList xmlns="http://www.opengis.net/context"><Keyword>EOS</Keyword><Keyword>EOSDIS</Keyword><Keyword>NASA</Keyword><Keyword>CCRS</Keyword><Keyword>CEOS</Keyword><Keyword>OGC</Keyword></KeywordList>';
+            t.xml_eq(parser.write_wmc_KeywordList(context.keywords),
+                     expected,
+                     "keywordlist written correctly");
+
+            // ContactInformation
+            expected = '<ContactInformation xmlns="http://www.opengis.net/context"><ContactPersonPrimary><ContactPerson>Tom Kralidis</ContactPerson><ContactOrganization>Environment Canada</ContactOrganization></ContactPersonPrimary><ContactPosition>Systems Scientist</ContactPosition><ContactAddress><AddressType>postal</AddressType><Address>867 Lakeshore Road</Address><City>Burlington</City><StateOrProvince>Ontario</StateOrProvince><PostCode>L7R 4A6</PostCode><Country>Canada</Country></ContactAddress><ContactVoiceTelephone>+01-905-336-4409</ContactVoiceTelephone><ContactFacsimileTelephone>+01-905-336-4499</ContactFacsimileTelephone><ContactElectronicMailAddress>tom.kralidis at ec.gc.ca</ContactElectronicMailAddress></ContactInformation>';
+            t.xml_eq(parser.write_wmc_ContactInformation(context.contactInformation),
+                     expected,
+                     "contactInformation written correctly");
+
+            // LogoURL
+            expected = '<LogoURL xmlns="http://www.opengis.net/context" width="130" height="74" format="image/gif"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://redhook.gsfc.nasa.gov/~imswww/pub/icons/logo.gif"/></LogoURL>';
+            t.xml_eq(parser.write_wmc_URLType("LogoURL", context.logo.href, context.logo),
+                     expected,
+                     "LogoURL written correctly");
+
+            // DescriptionURL
+            expected = '<DescriptionURL xmlns="http://www.opengis.net/context"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://eos.nasa.gov/imswelcome"/></DescriptionURL>';
+            t.xml_eq(parser.write_wmc_URLType("DescriptionURL", context.descriptionURL),
+                     expected,
+                     "DescriptionURL written correctly");
+
+
+            var layerContext = context.layersContext[1];
+
+            // Server
+            expected = '<Server xmlns="http://www.opengis.net/context" service="OGC:WMS" version="1.1.1" title="The GLOBE Program Visualization Server"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://globe.digitalearth.gov/viz-bin/wmt.cgi"/></Server>';
+            t.xml_eq(parser.write_wmc_Server(layerContext),
+                     expected,
+                     "Server written correctly");
+
+            // FormatList
+            expected = '<FormatList xmlns="http://www.opengis.net/context"><Format current="1">image/gif</Format><Format>image/png</Format></FormatList>';
+            t.xml_eq(parser.write_wmc_FormatList(layerContext),
+                     expected,
+                     "FormatList written correctly");
+
+            // DimensionList
+            expected = '<DimensionList xmlns="http://www.opengis.net/context"><Dimension name="time" units="ISO8601" nearestValue="1" unitSymbol="" userValue="" multipleValues="0" current="0" default="">2011-03-31,2011-04-01</Dimension></DimensionList>';
+            t.xml_eq(parser.write_wmc_DimensionList(layerContext),
+                     expected,
+                     "DimensionList written correctly");
+
+            // LegendURL
+            var legend = layerContext.styles[0].legend;
+            expected = '<LegendURL xmlns="http://www.opengis.net/context" width="180" format="image/gif" height="50"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://globe.digitalearth.gov/globe/en/icons/colorbars/COASTLINES.gif"/></LegendURL>';
+            t.xml_eq(parser.write_wmc_URLType("LegendURL", legend.href, legend),
+                     expected,
+                     "LegendURL written correctly");
+
+            layerContext = context.layersContext[2];
+
+            // DataURL
+            expected = '<DataURL xmlns="http://www.opengis.net/context"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://globe.digitalearth.gov/data/national.gml" /></DataURL>';
+            t.xml_eq(parser.write_wmc_URLType("DataURL", layerContext.dataURL),
+                     expected,
+                     "DataURL written correctly");
+
+            // MetadataURL
+            expected = '<MetadataURL xmlns="http://www.opengis.net/context"><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://globe.digitalearth.gov/metadata/national.txt" /></MetadataURL>';
+            t.xml_eq(parser.write_wmc_URLType("MetadataURL", layerContext.metadataURL),
+                     expected,
+                     "MetadataURL written correctly");
+
         }
+
     }
 
     </script> 

Modified: sandbox/cmoullet/openlayers/tests/Handler/Box.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Box.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Handler/Box.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -18,15 +18,6 @@
     }
 
     function test_Handler_Box_draw(t) {
-        var testAll = true;
-        if (document.defaultView && document.defaultView.getComputedStyle &&
-                    !document.defaultView.getComputedStyle(document.body)) {
-            // we don't get dimensions for hidden frames in FF4, and our test
-            // runs in a hidden frame.
-            testAll = false;
-        }
-        
-        t.plan(testAll ? 12 : 2);
 
         var map = new OpenLayers.Map('map');
         var control = new OpenLayers.Control();
@@ -35,9 +26,38 @@
             t.ok(e.equals(new OpenLayers.Bounds(5, 11, 11, 5)), "box result correct");
         }});
         handler.activate();
+
+        // determine whether we can test the box position, the hidden frame
+        // our tests run in causes us problem here in FF and IE:
+        // IE8: left is NaN
+        // FF3: left is NaN
+        // FF4; left is NaN
+        // Chromium 10: left is 0
+        var testdiv = OpenLayers.Util.createDiv('testdiv', new OpenLayers.Pixel(5, 5));
+        map.div.appendChild(testdiv);
+        var left = parseInt(OpenLayers.Element.getStyle(testdiv, 'border-left-width'));
+        map.div.removeChild(testdiv);
+        var testAll = !isNaN(left);
+
+        t.plan(testAll ? 12 : 2);
+
+        // we change NaN values to 0 values in the handler's
+        // boxOffsets object, this is to prevent "invalid
+        // "argument" errors in IE
+        if(!testAll) {
+            var offset = handler.getBoxOffsets();
+            offset.left = 0;
+            offset.right = 0;
+            offset.top = 0;
+            offset.bottom = 0;
+            offset.width = 0;
+            offset.height = 0;
+        }
+
+
         handler.dragHandler.start = {x: 5, y: 5};
-        handler.startBox({x: 5, y: 5});
-        var offset = handler.getBoxOffsets();
+        handler.startBox();
+        offset = handler.getBoxOffsets();
         if (testAll) {
             t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box correct");
             t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box correct");

Modified: sandbox/cmoullet/openlayers/tests/Handler/Drag.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Drag.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Handler/Drag.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -252,7 +252,7 @@
             t.ok(evt.xy.x == testEvents.done.xy.x &&
                  evt.xy.y == testEvents.done.xy.y,
                  "mouseout calls Util.mouseLeft with the correct event");
-            t.eq(element.id, map.viewPortDiv.id,
+            t.eq(element.id, map.eventsDiv.id,
                  "mouseout calls Util.mouseLeft with the correct element");
             return true;
         }

Modified: sandbox/cmoullet/openlayers/tests/Layer/WMS.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Layer/WMS.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Layer/WMS.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -229,7 +229,7 @@
     function test_Layer_WMS_getFullRequestString (t) {
 
 
-        t.plan( 3 );
+        t.plan( 4 );
         var map = new OpenLayers.Map('map');
         map.projection = "xx";
         var tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
@@ -271,8 +271,22 @@
              "getFullRequestString() uses the layer projection if it equals the map projection");
         map.destroy();
 
+        map = new OpenLayers.Map("map", {projection: "EPSG:4326"});
+        map.addLayer(new OpenLayers.Layer(null, {isBaseLayer: true}));
+        tLayer = new OpenLayers.Layer.WMS(name, tUrl);
+        tLayer.map = map;
+        var error;
+        try {
+            tLayer.getFullRequestString();
+            error = false;
+        } catch(err) {
+            error = true;
     }
+        t.ok(!error, "no error on getFullRequestString if layer has no projection");
+        map.destroy();
 
+    }
+
     function test_Layer_WMS_setOpacity (t) {
         t.plan( 5 );
 

Modified: sandbox/cmoullet/openlayers/tests/Layer/XYZ.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Layer/XYZ.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Layer/XYZ.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -108,7 +108,7 @@
      */
     function test_Layer_XYZ_getURL(t) {
 
-        t.plan(2);
+        t.plan(6);
         
         var map = new OpenLayers.Map('map');
         layer = new OpenLayers.Layer.XYZ(name, url);
@@ -120,6 +120,17 @@
         layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
         tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
         t.eq(tileurl, "http://tilecache1/", "Tile URL is deterministic");
+
+        layer.url = url;
+        tileurl = layer.getURL(new OpenLayers.Bounds(180.515625,45,181.21875,45.703125));
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/513/63.png", "Tile URL is correct");
+        tileurl = layer.getURL(new OpenLayers.Bounds(-181.515625,45,-180.21875,45.703125));
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/-2/63.png", "Tile URL is correct");
+        layer.wrapDateLine = true;
+        tileurl = layer.getURL(new OpenLayers.Bounds(180.515625,45,181.21875,45.703125));
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/1/63.png", "Tile URL is correct");
+        tileurl = layer.getURL(new OpenLayers.Bounds(-181.515625,45,-180.21875,45.703125));
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/510/63.png", "Tile URL is correct");
         map.destroy();
     }
     function test_Layer_XYZ_Rounding(t) {

Modified: sandbox/cmoullet/openlayers/tests/Renderer/Canvas.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Renderer/Canvas.html	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/tests/Renderer/Canvas.html	2011-04-05 11:38:13 UTC (rev 11877)
@@ -12,6 +12,7 @@
         
         t.ok(r instanceof OpenLayers.Renderer.Canvas, "new OpenLayers.Renderer.Canvas returns Renderer.Canvas object" );
         t.ok(r.container == el, "renderer container is correctly set");
+        r.destroy();
     }
     
     function test_Renderer_Canvas_setextent(t) {
@@ -26,6 +27,7 @@
         r.setExtent(extent, true);
         t.ok(r.extent.equals(extent), "extent is correctly set");
         t.eq(r.resolution, null, "resolution nullified");
+        r.destroy();
     }
     
     function test_Renderer_Canvas_setsize(t) {
@@ -40,6 +42,7 @@
         r.setSize(size);
         t.ok(r.size.equals(size), "size is correctly set");
         t.eq(r.resolution, null, "resolution nullified");
+        r.destroy();
     }
     
     function test_Renderer_Canvas_getresolution(t) {
@@ -54,42 +57,9 @@
         var resolution = r.getResolution();
         t.eq(resolution, map.getResolution(), "resolution matches the map resolution");
         t.eq(r.resolution, resolution, "resolution is correctly set");
+        map.destroy();
     }
 
-    function test_featureIdToRGB(t) {
-        if (!supported) {
-            t.plan(0); 
-            return;
-        }
-        t.plan(2);
-        var el = document.body;
-        el.id = "foo";
-        var renderer = new OpenLayers.Renderer.Canvas(el.id);
-        
-        var cases = [{
-            id: "foo_0", rgb: [0, 0, 1]
-        }, {
-            id: "foo_10", rgb: [0, 0, 11]
-        }, {
-            id: "foo_100", rgb: [0, 0, 101]
-        }, {
-            id: "foo_1000000", rgb: [15, 66, 65]
-        }, {
-            id: "foo_16777214", rgb: [255, 255, 255]
-        }, {
-            id: "foo_16777215", rgb: [0, 0, 1]
-        }];
-        t.plan(cases.length);
-        
-        var c;
-        for (var i=0; i<cases.length; ++i) {
-            c = cases[i];
-            t.eq(renderer.featureIdToRGB(c.id), c.rgb, c.id);
-        }
-        
-        renderer.destroy();
-    }
-
     function test_featureIdToHex(t) {
         if (!supported) {
             t.plan(0); 
@@ -146,6 +116,68 @@
         t.eq(r.resolution, null, "resolution nullified");
         t.eq(r.map, null, "map nullified");
     }
+
+    function test_pendingRedraw(t) {
+        if (!supported) {
+            t.plan(0); 
+            return; 
+        }
+        
+        t.plan(4);
+        var layer = new OpenLayers.Layer.Vector(null, {
+            isBaseLayer: true,
+            renderers: ["Canvas"]
+        });
+        
+        var map = new OpenLayers.Map({
+            div: "map",
+            controls: [],
+            layers: [layer],
+            center: new OpenLayers.LonLat(0, 0),
+            zoom: 0
+        });
+        
+        var count = 0;
+        var redraw = layer.renderer.redraw;
+        layer.renderer.redraw = function() {
+            ++count;
+            redraw.apply(this, arguments);
+        }
+        
+        // add one point feature and confirm redraw is called once
+        count = 0;
+        layer.addFeatures([
+            new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0, 0))
+        ]);
+        t.eq(count, 1, "redraw called once after adding one point feature");
+        
+        // add one feature with no geometry and confirm redraw is not called
+        count = 0;
+        layer.addFeatures([
+            new OpenLayers.Feature.Vector()
+        ]);
+        t.eq(count, 0, "redraw is not called when adding a feature with no geometry");
+        
+        // add one point feature, one feature with no geom, and one point feature and confirm redraw is called once
+        count = 0;
+        layer.addFeatures([
+            new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(1, 0)),
+            new OpenLayers.Feature.Vector(),
+            new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0, 1))
+        ]);
+        t.eq(count, 1, "redraw called once after adding three features where middle one has no geometry");
+
+        // add two point features and one feature with no geom, and confirm redraw is called once
+        count = 0;
+        layer.addFeatures([
+            new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(1, 0)),
+            new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0, 1)),
+            new OpenLayers.Feature.Vector()
+        ]);
+        t.eq(count, 1, "redraw called once after adding three features where last one has no geometry");
+        
+        map.destroy();
+    }
     
     function test_hitDetection(t) {
         if (!supported) {
@@ -224,6 +256,8 @@
             t.eq(feature && feature.id, c.id, c.msg);
         }
         
+        map.destroy();
+        
     }
 
   </script>

Modified: sandbox/cmoullet/openlayers/theme/default/ie6-style.css
===================================================================
--- sandbox/cmoullet/openlayers/theme/default/ie6-style.css	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/theme/default/ie6-style.css	2011-04-05 11:38:13 UTC (rev 11877)
@@ -4,4 +4,7 @@
 .olControlPanPanel div {
     background-image: url(img/pan-panel-NOALPHA.png);
 }
+.olControlEditingToolbar {
+    width: 200px;
+}
 

Modified: sandbox/cmoullet/openlayers/theme/default/style.css
===================================================================
--- sandbox/cmoullet/openlayers/theme/default/style.css	2011-04-05 07:07:01 UTC (rev 11876)
+++ sandbox/cmoullet/openlayers/theme/default/style.css	2011-04-05 11:38:13 UTC (rev 11877)
@@ -376,7 +376,6 @@
 .olControlEditingToolbar {
     right: 0;
     top: 0;
-    width: 200px; /* Only for IE6 or IE without DOCTYPE */
 }
 .olControlNavToolbar {
     top: 295px;



More information about the Commits mailing list