Separate load requests from feature requests

This separates the action of requesting an extent to be loaded from the action of requesting cached features.  The renderer (or any other consumer of a vector source) calls load to request a data extent.  A `featureload` event fires when new features are loaded.  The renderer (or any other consumer) separately asks for cached features given an extent.  This vector source only loads features once, but this separation will also work with sources that make multiple requests for data in different extents.

This also removes the `data` option from the vector source in favor of a `features` option.  Since we no longer have shared data structures for geometries, people can manually create features and pass them to a vector source.  The `addFeatures` method is exported as well.  This is used to add features to a source that don't have a representation on the "remote" (or server).
This commit is contained in:
Tim Schaub
2013-11-18 17:54:04 -07:00
parent ec02e09ce8
commit 8cc4ae8dbd
10 changed files with 214 additions and 326 deletions
+7 -4
View File
@@ -718,16 +718,19 @@
/**
* @typedef {Object} ol.source.VectorOptions
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
* @property {Object|string|undefined} data Data to parse.
* @property {Array.<ol.Feature>|undefined} features Any features to be added
* to the source. Providing features is an alternative to providing
* `url` and `parser` options.
* @property {ol.Extent|undefined} extent Extent.
* @property {string|undefined} logo Logo.
* @property {ol.parser.Parser} parser Parser instance to parse data
* provided as `data` or fetched from `url`.
* @property {ol.parser.Parser|undefined} parser Parser instance to parse data
* fetched from `url`.
* @property {ol.proj.ProjectionLike|undefined} projection Projection. Usually the
* projection is provided by the parser, so this only needs to be set if
* the parser does not know the SRS (e.g. in some GML flavors), or if the
* projection determined by the parser needs to be overridden.
* @property {string|undefined} url Server url providing the vector data.
* @property {string|undefined} url Server url providing the vector data. If
* provided, the `parser` option must also be supplied.
* @todo stability experimental
*/