[OpenLayers-Commits] r4766 - in sandbox/ahocevar/sldRenderer: examples lib/OpenLayers lib/OpenLayers/Geometry lib/OpenLayers/Layer lib/OpenLayers/Layer/MapServer lib/OpenLayers/Layer/WMS lib/OpenLayers/Renderer lib/OpenLayers/Tile tests tests/Geometry tests/Layer

commits at openlayers.org commits at openlayers.org
Tue Oct 2 23:09:59 EDT 2007


Author: ahocevar
Date: 2007-10-02 23:09:58 -0400 (Tue, 02 Oct 2007)
New Revision: 4766

Modified:
   sandbox/ahocevar/sldRenderer/examples/editingtoolbar.html
   sandbox/ahocevar/sldRenderer/examples/panel.html
   sandbox/ahocevar/sldRenderer/examples/spherical-mercator.html
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Control.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Geometry/Collection.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/Grid.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/MapServer/Untiled.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/TMS.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WFS.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WMS/Untiled.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Map.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Renderer/VML.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/Image.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/WFS.js
   sandbox/ahocevar/sldRenderer/tests/Geometry/test_Collection.html
   sandbox/ahocevar/sldRenderer/tests/Layer/test_MapServer.html
   sandbox/ahocevar/sldRenderer/tests/Layer/test_TMS.html
   sandbox/ahocevar/sldRenderer/tests/Layer/test_WMS.html
   sandbox/ahocevar/sldRenderer/tests/test_Control.html
   sandbox/ahocevar/sldRenderer/tests/test_Layer.html
   sandbox/ahocevar/sldRenderer/tests/test_Map.html
   sandbox/ahocevar/sldRenderer/tests/test_Tile.html
Log:
Merging from r4483 to HEAD

Modified: sandbox/ahocevar/sldRenderer/examples/editingtoolbar.html
===================================================================
--- sandbox/ahocevar/sldRenderer/examples/editingtoolbar.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/examples/editingtoolbar.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -8,8 +8,8 @@
             border: 1px solid black;
         }
     </style>
+    <script src="../lib/Firebug/firebug.js"></script>
     <script src="../lib/OpenLayers.js"></script>
-    <script src="../lib/Firebug/debug.js"></script>
     <script type="text/javascript">
         <!--
         var lon = 5;

Modified: sandbox/ahocevar/sldRenderer/examples/panel.html
===================================================================
--- sandbox/ahocevar/sldRenderer/examples/panel.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/examples/panel.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -51,8 +51,8 @@
         }
         
     </style>
+    <script src="../lib/Firebug/firebug.js"></script>
     <script src="../lib/OpenLayers.js"></script>
-    <script src="../lib/Firebug/debug.js"></script>
     <script type="text/javascript">
         var lon = 5;
         var lat = 40;

Modified: sandbox/ahocevar/sldRenderer/examples/spherical-mercator.html
===================================================================
--- sandbox/ahocevar/sldRenderer/examples/spherical-mercator.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/examples/spherical-mercator.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -99,7 +99,7 @@
             var vector = new OpenLayers.Layer.Vector("Editable Vectors");
             
             map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb,
-                           yahoo, yahoosat, yahoohyb, mapnik, wms]);
+                           yahoo, yahoosat, yahoohyb, mapnik, wms, vector]);
             map.addControl(new OpenLayers.Control.LayerSwitcher());
             map.addControl(new OpenLayers.Control.EditingToolbar(vector));
             map.zoomToMaxExtent()

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Control.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Control.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Control.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -130,8 +130,12 @@
         // eliminate circular references
         if (this.handler) {
             this.handler.destroy();
-        }    
-        this.map = null;
+            this.handler = null;
+        }
+        if (this.map) {
+            this.map.removeControl(this);
+            this.map = null;
+        }
     },
 
     /** 
@@ -166,8 +170,7 @@
      */
     draw: function (px) {
         if (this.div == null) {
-            this.div = OpenLayers.Util.createDiv();
-            this.div.id = this.id;
+            this.div = OpenLayers.Util.createDiv(this.id);
             this.div.className = this.displayClass;
         }
         if (px != null) {

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Geometry/Collection.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Geometry/Collection.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Geometry/Collection.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -288,7 +288,8 @@
      */
     equals: function(geometry) {
         var equivalent = true;
-        if(!geometry.CLASS_NAME || (this.CLASS_NAME != geometry.CLASS_NAME)) {
+        if(!geometry || !geometry.CLASS_NAME ||
+           (this.CLASS_NAME != geometry.CLASS_NAME)) {
             equivalent = false;
         } else if(!(geometry.components instanceof Array) ||
                   (geometry.components.length != this.components.length)) {

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/Grid.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/Grid.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -458,7 +458,7 @@
         
         // now we go through and draw the tiles in forward order
         for(var i=0; i < tileQueue.length; i++) {
-            var tile = tileQueue[i]
+            var tile = tileQueue[i];
             tile.draw();
             //mark tile as unqueued for the next time (since tiles are reused)
             tile.queued = false;       
@@ -548,18 +548,6 @@
                 break;
             }
         };
-        if (this.buffer == 0) {
-            for (var r=0, rl=this.grid.length; r<rl; r++) {
-                var row = this.grid[r];
-                for (var c=0, cl=row.length; c<cl; c++) {
-                    var tile = row[c];
-                    if (!tile.drawn && 
-                         tile.bounds.intersectsBounds(bounds, false)) {
-                        tile.draw();
-                    }
-                }
-            }
-        }
     },
 
     /**
@@ -621,7 +609,7 @@
             bounds.right = bounds.right + deltaLon;
             position.x = position.x + deltaX;
 
-            var tile = prepend ? this.grid[i].pop() : this.grid[i].shift()
+            var tile = prepend ? this.grid[i].pop() : this.grid[i].shift();
             tile.moveTo(bounds, position);
             if (prepend) {
                 this.grid[i].unshift(tile);
@@ -647,7 +635,7 @@
             var row = this.grid.pop();
             for (var i=0, l=row.length; i<l; i++) {
                 var tile = row[i];
-                this.removeTileMonitoringHooks(tile)
+                this.removeTileMonitoringHooks(tile);
                 tile.destroy();
             }
         }

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/MapServer/Untiled.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/MapServer/Untiled.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/MapServer/Untiled.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -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: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/TMS.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/TMS.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -14,6 +14,12 @@
 OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
 
     /**
+     * APIProperty: serviceVersion
+     * {String}
+     */
+    serviceVersion: "1.0.0",
+
+    /**
      * APIProperty: isBaseLayer
      * {Boolean}
      */
@@ -91,7 +97,7 @@
         var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
         var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
         var z = this.map.getZoom();
-        var path = "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; 
+        var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; 
         var url = this.url;
         if (url instanceof Array) {
             url = this.selectUrl(path, url);

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WFS.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WFS.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WFS.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -255,6 +255,7 @@
                 this.tile = null;
                 this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds, 
                                                      url, tileSize);
+                this.addTileMonitoringHooks(this.tile);
                 this.tile.draw();
             } 
         }

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WMS/Untiled.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WMS/Untiled.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer/WMS/Untiled.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -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: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Layer.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -32,10 +32,10 @@
      * Constant: EVENT_TYPES
      * {Array(String)} Supported application event types
      */
-    EVENT_TYPES: [ "loadstart", "loadend", "loadcancel", "visibilitychanged"],
+    EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged"],
         
     /**
-     * APIProperty: events``
+     * APIProperty: events
      * {<OpenLayers.Events>}
      */
     events: null,
@@ -238,10 +238,9 @@
 
             this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
 
-            this.div = OpenLayers.Util.createDiv();
+            this.div = OpenLayers.Util.createDiv(this.id);
             this.div.style.width = "100%";
             this.div.style.height = "100%";
-            this.div.id = this.id;
 
             this.events = new OpenLayers.Events(this, this.div, 
                                                 this.EVENT_TYPES);

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Map.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Map.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Map.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -110,6 +110,12 @@
     center: null,
 
     /**
+     * Property: resolution
+     * {Float} The resolution of the map.
+     */
+    resolution: null,
+
+    /**
      * Property: zoom
      * {Integer} The current zoom level of the map
      */
@@ -703,7 +709,11 @@
                 if (center != null) {
                     if (oldExtent == null) {
                         // simply set center but force zoom change
-                        this.setCenter(center, this.getZoom(), false, true);
+                        this.setCenter(
+                            center,
+                            this.getZoomForResolution(this.resolution),
+                            false, true
+                        );
                     } else {
                         // zoom to oldExtent *and* force zoom change
                         this.setCenter(oldExtent.getCenterLonLat(), 
@@ -797,8 +807,8 @@
     removeControl: function (control) {
         //make sure control is non-null and actually part of our map
         if ( (control) && (control == this.getControl(control.id)) ) {
-            if (!control.outsideViewport) {
-                this.viewPortDiv.removeChild(control.div)
+            if (!control.outsideViewport && control.div) {
+                this.viewPortDiv.removeChild(control.div);
             }
             OpenLayers.Util.removeItem(this.controls, control);
         }
@@ -1121,6 +1131,7 @@
 
             if (zoomChanged) {
                 this.zoom = zoom;
+                this.resolution = this.baseLayer.getResolution();
                 // zoom level has changed, increment viewRequestID.
                 this.viewRequestID++;
             }    

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Renderer/VML.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Renderer/VML.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Renderer/VML.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -35,7 +35,7 @@
         if (!this.supported()) { 
             return; 
         } 
-        document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
+        document.namespaces.add("v", this.xmlns);
         var style = document.createStyleSheet();
         style.addRule('v\\:*', "behavior: url(#default#VML); " +
                                "position: relative; display: inline-block;");

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/Image.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/Image.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -123,7 +123,6 @@
             OpenLayers.Util.modifyDOMElement(this.imgDiv,
                     null, null, imageSize) ;
         }
-        this.drawn = true;
         return true;
     },
 
@@ -133,7 +132,6 @@
      *   be reused in a new location.
      */
     clear: function() {
-        OpenLayers.Tile.prototype.clear.apply(this, arguments);
         if(this.imgDiv) {
             this.imgDiv.style.display = "none";
         }

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/WFS.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/WFS.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile/WFS.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -65,7 +65,6 @@
      *   be reused in a new location.
      */
     clear: function() {
-        OpenLayers.Tile.prototype.clear.apply(this, arguments);
         this.destroyAllFeatures();
     },
     

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile.js	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Tile.js	2007-10-03 03:09:58 UTC (rev 4766)
@@ -72,12 +72,6 @@
      */    
     position: null,
 
-    /** 
-     * Property: drawn 
-     * {Boolean} false
-     */
-    drawn: false,
-
     /**
      * Property: isLoading
      * {Boolean} Is the tile loading?
@@ -99,10 +93,10 @@
      */   
     initialize: function(layer, position, bounds, url, size) {
         this.layer = layer;
-        this.position = position;
-        this.bounds = bounds;
+        this.position = position.clone();
+        this.bounds = bounds.clone();
         this.url = url;
-        this.size = size;
+        this.size = size.clone();
 
         //give the tile a unique id based on its BBOX.
         this.id = OpenLayers.Util.createUniqueID("Tile_");
@@ -144,20 +138,9 @@
         var withinMaxExtent = (maxExtent &&
                                this.bounds.intersectsBounds(maxExtent, false));
  
-        var mapExtent = this.layer.map.getExtent();
-        var withinMapExtent = (mapExtent &&
-                               this.bounds.intersectsBounds(mapExtent, false));
-         
-        // There are two cases where we *wouldn't* want to draw the tile:
-        //  
-        // 1) If the tile is outside its layer's maxExtent
-        // 2) When the layer's buffer is 0, if the tile is outside the map's 
-        //    extent (out of view)
-        //
-        // ...what we return is the opposite of the above conditions :-)
-        //
-        return ( (withinMaxExtent || this.layer.displayOutsideMaxExtent) &&
-                 (withinMapExtent || (this.layer.buffer != 0)) );
+        // The only case where we *wouldn't* want to draw the tile is if the 
+        // tile is outside its layer's maxExtent.
+        return (withinMaxExtent || this.layer.displayOutsideMaxExtent);
     },
     
     /** 
@@ -175,7 +158,6 @@
             redraw = true;
         }
 
-        this.clear();
         this.bounds = bounds.clone();
         this.position = position.clone();
         if (redraw) {
@@ -186,10 +168,10 @@
     /** 
      * Method: clear
      * Clear the tile of any bounds/position-related data so that it can 
-     *     be reused in a new location.
+     *     be reused in a new location. To be implemented by subclasses.
      */
     clear: function() {
-        this.drawn = false;
+        // to be implemented by subclasses
     },
     
     /**   

Modified: sandbox/ahocevar/sldRenderer/tests/Geometry/test_Collection.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/Geometry/test_Collection.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/Geometry/test_Collection.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -132,6 +132,12 @@
         t.eq(coll.bounds.top, 70, "good top bounds");
     }
     
+    function test_Collection_equals(t) {
+        t.plan(1);
+        var geom = new OpenLayers.Geometry.Collection();
+        t.ok(!geom.equals(), "collection.equals() returns false for undefined");
+    }
+
     function test_07_Collection_addComponent(t)   {
         t.plan(10);
         

Modified: sandbox/ahocevar/sldRenderer/tests/Layer/test_MapServer.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/Layer/test_MapServer.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/Layer/test_MapServer.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -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: sandbox/ahocevar/sldRenderer/tests/Layer/test_TMS.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/Layer/test_TMS.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/Layer/test_TMS.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -119,7 +119,7 @@
      */
     function test_10_Layer_TMS_getURL(t) {
 
-        t.plan(2);
+        t.plan(3);
         
         var map = new OpenLayers.Map('map', options);
         var options = {'layername':'basic', 'type':'png'}; 
@@ -128,6 +128,12 @@
         map.setCenter(new OpenLayers.LonLat(0,0), 9);
         var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
         t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
+    
+        var layer2 = layer.clone();
+        layer2.serviceVersion = "1.2.3";
+        map.addLayer(layer2);
+        tileurl = layer2.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
+        t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.2.3/basic/9/261/192.png", "TMS serviceVersion is correct");
 
         layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
         tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));

Modified: sandbox/ahocevar/sldRenderer/tests/Layer/test_WMS.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/Layer/test_WMS.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/Layer/test_WMS.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -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) {
 

Modified: sandbox/ahocevar/sldRenderer/tests/test_Control.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/test_Control.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/test_Control.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -2,14 +2,40 @@
 <head>
   <script src="../lib/OpenLayers.js"></script>
   <script type="text/javascript">
-    var map; 
-    function test_01_Control_constructor (t) {
-        t.plan( 1 );
+    function test_Control_constructor(t) {
+        t.plan(2);
     
-        control = new OpenLayers.Control();
-        t.ok( control instanceof OpenLayers.Control, "new OpenLayers.Control returns object" );
+        var control = new OpenLayers.Control();
+
+        t.ok(control instanceof OpenLayers.Control, "new OpenLayers.Control returns object");
+        t.eq(control.displayClass, "olControl", "displayClass set correctly");
     }
 
+    function test_Control_addControl(t) {
+        t.plan(2);
+    
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+
+        t.ok(control.map === map, "Control.map is set to the map object" );
+        t.ok(map.controls[map.controls.length - 1] === control, "map.controls contains control");
+    }
+
+    function test_Control_destroy(t) {
+        t.plan(3);
+    
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+
+        control.destroy();
+        t.ok(map.controls[map.controls.length - 1] != control, "map.controls doesn't contains control");
+
+        t.ok(control.map == null, "Control.map is null");
+        t.ok(control.handler == null, "Control.handler is null");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/ahocevar/sldRenderer/tests/test_Layer.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/test_Layer.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/test_Layer.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -5,7 +5,7 @@
     var layer; 
 
     function test_01_Layer_constructor (t) {
-        t.plan( 13 );
+        t.plan( 15 );
         
         var options = { chicken: 151, foo: "bar", projection: "none" };
         var layer = new OpenLayers.Layer('Test Layer', options);
@@ -19,6 +19,9 @@
         t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
         t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
 
+        t.ok( typeof layer.div == "object" , "layer.div is created" );
+        t.eq( layer.div.id, layer.id, "layer.div.id is correct" );
+
         options.chicken = 552;
         
         t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" );

Modified: sandbox/ahocevar/sldRenderer/tests/test_Map.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/test_Map.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/test_Map.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -277,6 +277,35 @@
         t.ok(map.baseLayer == wmslayer2, "setbaselayer correctly sets 'baseLayer' property");
     }
 
+    function test_Map_removeLayer_res(t) {
+        t.plan(2);
+        
+        map = new OpenLayers.Map('map');
+
+        var layer0 = new OpenLayers.Layer.WMS(
+            'Test Layer 0', 
+            "http://octo.metacarta.com/cgi-bin/mapserv", 
+            {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}, 
+            {resolutions: [4, 2, 1]}
+        );
+
+        var layer1 = new OpenLayers.Layer.WMS(
+            'Test Layer 1', 
+            "http://octo.metacarta.com/cgi-bin/mapserv", 
+            {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}, 
+            {resolutions: [4, 2]}
+        );
+
+        map.addLayers([layer0, layer1]);
+        map.zoomToMaxExtent();
+        map.zoomTo(2);
+        t.eq(map.getResolution(), layer0.resolutions[2],
+             "correct resolution before removal");
+        map.removeLayer(layer0);
+        t.eq(map.getResolution(), layer0.resolutions[1],
+             "correct resolution after removal");
+    }
+
     function test_13_Map_setBaseLayer_after_pan (t) {
         t.plan(1);
 

Modified: sandbox/ahocevar/sldRenderer/tests/test_Tile.html
===================================================================
--- sandbox/ahocevar/sldRenderer/tests/test_Tile.html	2007-10-03 03:04:33 UTC (rev 4765)
+++ sandbox/ahocevar/sldRenderer/tests/test_Tile.html	2007-10-03 03:09:58 UTC (rev 4766)
@@ -5,7 +5,7 @@
     var tile; 
     
     function test_01_Tile_constructor (t) {
-        t.plan( 9 );
+        t.plan( 12 );
      
         var layer = {}; // bogus layer
         var position = new OpenLayers.Pixel(10,20);
@@ -18,9 +18,12 @@
         t.ok( tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object" );
         t.eq( tile.layer, layer, "tile.layer set correctly");
         t.ok( tile.position.equals(position), "tile.position set correctly");
+        t.ok( tile.position != position, "tile.position set not by reference");
         t.ok( tile.bounds.equals(bounds), "tile.bounds set correctly");
+        t.ok( tile.bounds != bounds, "tile.bounds set not by reference");
         t.eq( tile.url, url, "tile.url set correctly");        
         t.ok( tile.size.equals(size), "tile.size is set correctly" );
+        t.ok( tile.size != size, "tile.size set not by reference");
 
         t.ok( tile.id != null, "tile is given an id");
         t.ok(OpenLayers.String.startsWith(tile.id, "Tile_"),



More information about the Commits mailing list