Add loader and strategy to ol.source.Vector

This commit is contained in:
Éric Lemoine
2015-04-03 20:13:50 +02:00
parent e86fd4afd4
commit 09b90c8424
7 changed files with 251 additions and 16 deletions

View File

@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","id":"01","properties":{},"geometry":{"type":"Point","coordinates":[-87.359296,35.001181]}}]}

View File

@@ -0,0 +1,30 @@
goog.provide('ol.test.featureloader');
describe('ol.featureloader', function() {
describe('ol.featureloader.xhr', function() {
var loader;
var source;
beforeEach(function() {
var url = 'spec/ol/data/point.json';
var format = new ol.format.GeoJSON();
loader = ol.featureloader.xhr(url, format);
source = new ol.source.Vector();
});
it('adds features to the source', function(done) {
source.on(ol.source.VectorEventType.ADDFEATURE, function(e) {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
});
loader.call(source, [], 1, 'EPSG:3857');
});
});
});
goog.require('ol.featureloader');
goog.require('ol.format.GeoJSON');
goog.require('ol.source.Vector');
goog.require('ol.source.VectorEventType');