OpenLayers OpenLayers

Ticket #831 (closed feature: fixed)

Opened 1 year ago

Last modified 1 year ago

Integrate Untiled Functionality into Grid

Reported by: euzuro Assigned to:
Priority: major Milestone: 2.5 Release
Component: Layer.Grid Version: 2.4
Keywords: Cc:
State:

Description

The moniker "Untiled" has always seemed slightly off, since the untiled layers actually do use a tile.

The functionality of the untiled layers is different, but really only slightly different, from that of the gridded layers.

So!

I have successfully merged the two functionalities together into the Grid.js layer.

Now, instead of instantiating OpenLayers.Layer.WMS.Untiled, you can just instantiate an OpenLayers.Layer.WMS, passing the option "singleTile: true".

The primary benefit of this is that we no longer have to maintain two distinct layers which follow the same WMS rules. The amount of copied code between the WMS/Grid and the WMS.Untiled layers was significant, and copied code is always a risk.

A secondary benefit that comes with this patch is that the events defined on layer (loadstart, loadend) are now implemented for both untiled and tiled layers (this used to be only available on the untiled layer). Tiles now have events as well (loadstart, loadend, reload), which are used by the Grid layer to fire its own events. In addition the grid layer has a "tileloaded" event which notifies that another tile has been loaded. This can be used in conjunction with the new numTilesLoading property on the grid layer to easily keep track of loading progress

Attachments

untiled.patch (56.6 kB) - added by euzuro on 07/11/07 13:26:43.
This patch contains the singleTile functionality, as well as the events improvements/triggering in the Grid and Tile Layers. All new functionality includes a thorough test.
untiled.2.patch (55.1 kB) - added by euzuro on 07/11/07 13:49:13.
tim had snuck a test change into trunk before i created this patch.
untiled.3.patch (59.3 kB) - added by euzuro on 07/12/07 18:38:09.
Brought back getGridBounds() as deprecated and marked WMS.Untiled deprecated as well.

Change History

07/11/07 13:26:43 changed by euzuro

  • attachment untiled.patch added.

This patch contains the singleTile functionality, as well as the events improvements/triggering in the Grid and Tile Layers. All new functionality includes a thorough test.

07/11/07 13:29:23 changed by euzuro

forgot to mention that there are two examples which clearly show the new functionality:

http://dev.openlayers.org/sandbox/euzuro/untiled3/examples/notile.html Shows the OpenLayers.Layer.WMS.Untiled and OpenLayers.Layer.WMS (with singleTile: true) working back to back

http://dev.openlayers.org/sandbox/euzuro/untiled3/examples/layerLoadMonitoring.html Shows the tile loading events as exhibited in grid layers of different buffer size, and the singletile.

07/11/07 13:30:07 changed by euzuro

  • keywords set to review.

all tests pass in ff & ie6.

I know this is a whopper, so if I can help in any way to get this reviewed as soon as possible, it would be greatly appreciated.

07/11/07 13:34:02 changed by euzuro

of worthy note, the diffstat for the changes to the lib directory:

$ svn diff lib > diff.js; cat diff.js | diffstat
 Layer/Grid.js        |  344 ++++++++++++++++++++++++++++++++++++++-------------

 Layer/KaMap.js       |    4
 Layer/WMS/Untiled.js |  271 +---------------------------------------
 Tile.js              |   24 +++
 Tile/Image.js        |   26 +++
 5 files changed, 322 insertions(+), 347 deletions(-)

(net reduction 25 lines of core code)


and the diffstat for changes to the tests directory

$ svn diff tests/ > diff.js; cat diff.js | diffstat
 Layer/test_Grid.html  |  383 +++++++++++++++++++++++++++++++++++++++++++++++---

 Layer/test_KaMap.html |    2
 Layer/test_TMS.html   |    2
 Tile/test_Image.html  |   16 +-
 test_Handler.html     |   25 ---
 test_Tile.html        |   29 +++
 6 files changed, 410 insertions(+), 47 deletions(-)

(net gain 363 lines of tests)

07/11/07 13:49:13 changed by euzuro

  • attachment untiled.2.patch added.

tim had snuck a test change into trunk before i created this patch.

07/11/07 13:51:17 changed by euzuro

updated diffstat for tests directory for new patch:

$ svn diff tests/ | diffstat
 Layer/test_Grid.html  |  383 +++++++++++++++++++++++++++++++++++++++++++++++---

 Layer/test_KaMap.html |    2
 Layer/test_TMS.html   |    2
 Tile/test_Image.html  |   16 +-
 test_Tile.html        |   29 +++
 5 files changed, 406 insertions(+), 26 deletions(-)

(net gain 380 lines of tests)

07/11/07 13:52:09 changed by euzuro

  • owner changed.
  • component changed from Layer to Layer.Grid.

07/11/07 15:30:09 changed by tschaub

This is really slick work. Thanks for all your effort ripping in to this.

I approve - but know it is big enough that others might want to weigh in first.

07/11/07 15:40:59 changed by tschaub

  • keywords changed from review to commit.

please commit and mark Untiled subclasses as deprecated

07/12/07 17:29:51 changed by crschmidt

The name of getGridBounds changed to getTilesBounds. In general, I'm fine with this, but I don't like that we don't maintain backwards compatibility. (I understand that getGridBounds was not an APIMethod, but I consider it important enough to be worth keeping backwards compatibility for.)

Other than that, patch looks just fine, and I'm ready to commit if that gets changed.

07/12/07 18:38:09 changed by euzuro

  • attachment untiled.3.patch added.

Brought back getGridBounds() as deprecated and marked WMS.Untiled deprecated as well.

07/12/07 18:39:48 changed by euzuro

the main differences in the 3rd patch are the following:

+    /**
      * Method: getGridBounds
+     * Deprecated. This function will be removed in 3.0. Please use 
+     *     getTilesBounds() instead.
+     * 
+     * Return:
+     * {<OpenLayers.Bounds>} A Bounds object representing the bounds of all the
+     * currently loaded tiles (including those partially or not at all seen 
+     * onscreen)
+     */
+    getGridBounds: function() {
+        var msg = "The getGridBounds() function is deprecated. It will be " +
+                  "removed in 3.0. Please use getTilesBounds() instead.";
+        OpenLayers.Console.warn(msg);
+        return getTilesBounds();
+    },
+

and

 /**
- * @requires OpenLayers/Layer/HTTPRequest.js
  * @requires OpenLayers/Layer/WMS.js
  *
  * Class: OpenLayers.Layer.WMS
+ * Deprecated, to be removed in 3.0 - instead use OpenLayers.Layer.WMS and 
+ *     pass the option 'singleTile' as true.
  * 
  * Inherits from: 
- *  - <OpenLayers.Layer.HTTPRequest>
+ *  - <OpenLayers.Layer.WMS>
  */

and

+        var msg = "The OpenLayers.Layer.WMS.Untiled class is deprecated and " +
+                  "will be removed in 3.0. Instead, you should use the " +
+                  "normal OpenLayers.Layer.WMS class, passing it the option " +
+                  "'singleTile' as true.";
+        OpenLayers.Console.warn(msg);
     },    

07/12/07 18:42:53 changed by euzuro

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

committed with r3725