openlayers/ol3 — pull request #1282 by tschaub (2013-11-15 18:45:02+00:00)
Title: Vector layer/source refactor

Move the feature cache from ol.layer.Vector to ol.source.Vector.

Proposed API:

* `ol.source.Vector`
* `#getFeatures(opt_filter)` - Called by application code to get features from the local cache.
* `#addFeatures()` - Can be called by application code to add client generated features. These features don't have a representation on the remote source. A `featuresadded` event is fired. A transaction listener can listen for this event, maintain a reference to added features, and later issue a transaction to have them persisted.
* `#removeFeatures()` - Can be called by application code to remove features from the remote source. A `featuresremoved` event is fired. A transaction listener can listen for this event, maintain a reference to removed features, and later issue a transaction to have them deleted from the remote source.
* `#loadFeatures()` - This will typically be called internally by the source when features are received from the remote source. Note that this is different than "creating" features by calling `addFeatures` (the loaded features already have a representation on the remote source and do not need to be persisted).
* `#unloadFeatures()` - This will typically be called internally by the source when features are no longer needed in the local feature cache. Note that this is different than "deleting" features by calling `removeFeatures` (the unloaded features should not be deleted from the remote source).

We could also add methods like `getFeaturesForExtent` or `forEachFeatureInExtent` that can make use of the local index. These can be added separately.

Work in progress. Comments welcome.