[OpenLayers-Commits] r4761 - in trunk/openlayers: lib/OpenLayers/Layer/MapServer lib/OpenLayers/Layer/WMS tests/Layer

commits at openlayers.org commits at openlayers.org
Tue Oct 2 21:39:10 EDT 2007


Author: euzuro
Date: 2007-10-02 21:39:08 -0400 (Tue, 02 Oct 2007)
New Revision: 4761

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js
   trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js
   trunk/openlayers/tests/Layer/test_MapServer.html
   trunk/openlayers/tests/Layer/test_WMS.html
Log:
Even though we're deprecating them, we can't go back. WMS.Untiled and MapServer.Untiled both need to be able to clone correctly. Patch with tests. (See #1013)

Modified: trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js	2007-10-03 01:23:35 UTC (rev 4760)
+++ trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js	2007-10-03 01:39:08 UTC (rev 4761)
@@ -40,5 +40,29 @@
         OpenLayers.Console.warn(msg);
     },    
 
+    /**
+     * Method: clone
+     * Create a clone of this layer
+     *
+     * Returns:
+     * {<OpenLayers.Layer.MapServer.Untiled>} An exact clone of this layer
+     */
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer.MapServer.Untiled(this.name,
+                                                         this.url,
+                                                         this.params,
+                                                         this.options);
+        }
+
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.MapServer.prototype.clone.apply(this, [obj]);
+
+        // copy/set any non-init, non-simple values here
+
+        return obj;
+    }, 
+
     CLASS_NAME: "OpenLayers.Layer.MapServer.Untiled"
 });

Modified: trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js	2007-10-03 01:23:35 UTC (rev 4760)
+++ trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js	2007-10-03 01:39:08 UTC (rev 4761)
@@ -40,5 +40,29 @@
         OpenLayers.Console.warn(msg);
     },    
 
+    /**
+     * Method: clone
+     * Create a clone of this layer
+     *
+     * Returns:
+     * {<OpenLayers.Layer.WMS.Untiled>} An exact clone of this layer
+     */
+    clone: function (obj) {
+        
+        if (obj == null) {
+            obj = new OpenLayers.Layer.WMS.Untiled(this.name,
+                                                   this.url,
+                                                   this.params,
+                                                   this.options);
+        }
+
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.WMS.prototype.clone.apply(this, [obj]);
+
+        // copy/set any non-init, non-simple values here
+
+        return obj;
+    }, 
+
     CLASS_NAME: "OpenLayers.Layer.WMS.Untiled"
 });

Modified: trunk/openlayers/tests/Layer/test_MapServer.html
===================================================================
--- trunk/openlayers/tests/Layer/test_MapServer.html	2007-10-03 01:23:35 UTC (rev 4760)
+++ trunk/openlayers/tests/Layer/test_MapServer.html	2007-10-03 01:39:08 UTC (rev 4761)
@@ -399,6 +399,17 @@
         t.eq(parseFloat(tLayer.div.firstChild.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
 
     }    
+
+    // DEPRECATED -- REMOVE IN 3.0
+    function test_Layer_Untiled_MapServer(t) { 
+        t.plan(1);
+        
+        var layer = new OpenLayers.Layer.MapServer.Untiled();
+        
+        var clone = layer.clone();
+        
+        t.ok(clone.singleTile, "regression test: clone works. this is for #1013");
+    }
     
     function test_99_Layer_MapServer_Untiled_destroy (t) {
 

Modified: trunk/openlayers/tests/Layer/test_WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/test_WMS.html	2007-10-03 01:23:35 UTC (rev 4760)
+++ trunk/openlayers/tests/Layer/test_WMS.html	2007-10-03 01:39:08 UTC (rev 4761)
@@ -352,6 +352,17 @@
         map.destroy();
 
     }
+
+    // DEPRECATED -- REMOVE IN 3.0
+    function test_Layer_Untiled_WMS(t) { 
+        t.plan(1);
+        
+        var layer = new OpenLayers.Layer.WMS.Untiled();
+        
+        var clone = layer.clone();
+        
+        t.ok(clone.singleTile, "regression test: clone works. this is for #1013");
+    }
     
     function test_99_Layer_WMS_destroy (t) {
 



More information about the Commits mailing list