[OpenLayers-Trac] Re: [OpenLayers] #2975: Bing layer with direct
tile access
OpenLayers
trac-20090302 at openlayers.org
Fri Dec 17 15:21:24 EST 2010
#2975: Bing layer with direct tile access
----------------------+-----------------------------------------------------
Reporter: ahocevar | Owner: euzuro
Type: feature | Status: new
Priority: minor | Milestone: 2.11 Release
Component: Layer | Version: 2.10
Keywords: | State: Review
----------------------+-----------------------------------------------------
Comment(by tschaub):
Thanks for the work on this. It will make a great addition to the layer
collection.
I came across a few things in my review. There are likely better ways to
handle these, but I've made changes in the patch that I'll describe below:
The OpenLayers.Layer.Bing.processMetadata function is called when the Bing
script loads. In the previous patch, this calls initLayer, which relies
on layer.resolutions being defined. Resolutions are initialized in
layer.setMap. So, if the script loads before the layer is added to a map,
layer.resolutions may not be defined. The tests weren't catching this
because the only test that constructs a layer without adding it to a map
overrides OpenLayers.Layer.Bing.processMetadata. I've modified the tests
so the original processMetadata method is still called (after logging the
metadata).
To make this updated test pass (and more importantly to make the layer
work in applications where it is constructed but not added to a map for a
while), I've added a initLayerAfterAdd method. If the layer is not added
to a map by the time the Bing script loads, the initLayer method is not
immediately called. Instead, initLayerAfterAdd is called when the layer
is added to a map. This method unregisters itself (and destroy
unregisters the same).
To support calling initLayerAfterAdd, I added an "added" even to the
layer. This would be useful for all layers. Instead of extending this
patch so it modifies Layer, I created #2983. When this ticket is closed,
the "added" method should be moved from the Bing layer to the base Layer.
Finally, this is trivial, but I wasn't just being crass when I said that
[http://lists.osgeo.org/pipermail/openlayers-
dev/2010-September/006502.html xhtml is dead]. The W3C officially stopped
working on it in [http://www.w3.org/News/2009#item119 July of 2009]. As
an effectively deprecated spec, I think we need to justify its use where
it is required (nowhere that I know of). I updated the example to use
HTML (and features of 5 where available).
--
Ticket URL: <http://trac.openlayers.org/ticket/2975#comment:5>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list