[OpenLayers-Trac] [OpenLayers] #744: Vector Layers need doneLoading callback

OpenLayers trac at openlayers.org
Fri Jun 8 12:03:31 EDT 2007


#744: Vector Layers need doneLoading callback
------------------------+---------------------------------------------------
 Reporter:  openlayers  |       Owner:     
     Type:  feature     |      Status:  new
 Priority:  minor       |   Milestone:     
Component:  Layer       |     Version:  2.4
 Keywords:              |  
------------------------+---------------------------------------------------
 The vector layer (and layers that inherit from layer) provide
 preFeatureInsert() and onFeatureInsert() callbacks, that are called before
 and after each individual feature is added to the map.

 But there isn't a callback to indicate when all of the features have been
 added.  We don't know, on a given call to onFeatureInsert(), whether there
 will be more features added later.

 This means that something simple, like doing a zoomToExtent() on the
 bounding box of all the features, becomes difficult.

 We can't do it when we create the layer, or when we add the layer to the
 map, because the features won't exist until the Ajax call returns with
 them.  But the return from the Ajax call only gives hooks on a feature-by-
 feature basis, and doesn't give us a hook on completion.

 So we either do a zoomToExtent() on every feature - which is expensive, or
 we derive a new layer class that provides our own addFeatures() function -
 which is fragile.

 Adding a doneLoading() callback to the end of Vector.addFeatures() seems
 like a reasonable fix.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/744>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list