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

View File

@@ -18,7 +18,7 @@ var raster = new ol.layer.Tile({
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({parser: null}),
source: new ol.source.Vector(),
style: new ol.style.Style({
rules: [
new ol.style.Rule({