Ticket #831 (closed feature: fixed)

Opened 6 years ago

Last modified 6 years ago

Integrate Untiled Functionality into Grid

Reported by: euzuro Owned by:
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 Download (56.6 KB) - added by euzuro 6 years ago.
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 Download (55.1 KB) - added by euzuro 6 years ago.
tim had snuck a test change into trunk before i created this patch.
untiled.3.patch Download (59.3 KB) - added by euzuro 6 years ago.
Brought back getGridBounds() as deprecated and marked WMS.Untiled deprecated as well.

Change History

Changed 6 years ago by euzuro

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.

Changed 6 years ago 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.

Changed 6 years ago by euzuro

  • keywords review added

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.

Changed 6 years ago 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)

Changed 6 years ago by euzuro

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

Changed 6 years ago 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)

Changed 6 years ago by euzuro

  • component changed from Layer to Layer.Grid

Changed 6 years ago 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.

Changed 6 years ago by tschaub

  • keywords commit added; review removed

please commit and mark Untiled subclasses as deprecated

Changed 6 years ago 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.

Changed 6 years ago by euzuro

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

Changed 6 years ago 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);
     },    

Changed 6 years ago by euzuro

  • keywords commit removed
  • status changed from new to closed
  • resolution set to fixed

committed with r3725

Note: See TracTickets for help on using tickets.