From e1dffacdde5308476ddb6ca5b534eebe125e3e72 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 25 Feb 2012 17:33:32 -0700 Subject: [PATCH] Providing a method to get data from the layer. I think it should be the job of the layer to retrieve data for a given location (instead of the control). The first part of this change creates a `getData` method on the layer and updates the control to use this method. The second part of this change removes the assumption that the data returned will be an simple object representing feature attributes. The UTFGrid specification doesn't say anything about the structure of property values in the optional data member. The examples given in the spec use string values. The default callback previously assumed that the data could be rendered in a two column table. I think it would make more sense not to make this assumption. With this change, the user must always provide a callback to do anything with returned data. --- examples/utfgrid.html | 39 ++++++------- examples/utfgrid_twogrids.html | 72 ++++++++++++++--------- lib/OpenLayers/Control/UTFGrid.js | 97 +++++++------------------------ lib/OpenLayers/Layer/UTFGrid.js | 49 +++++++++++++++- 4 files changed, 130 insertions(+), 127 deletions(-) diff --git a/examples/utfgrid.html b/examples/utfgrid.html index 8b28cb8db8..1b578cfa85 100644 --- a/examples/utfgrid.html +++ b/examples/utfgrid.html @@ -8,7 +8,9 @@ @@ -22,7 +24,7 @@

- When the selected event is triggered, the underlying feature attributes are shown on the right. + When the selected event is triggered, the underlying feature attributes are shown below.