Introduce clear event on vector source
Three seconds speed up when clearing 100'000 features. Clearing is now around 350ms.
This commit is contained in:
@@ -90,13 +90,17 @@ describe('ol.source.Vector', function() {
|
||||
goog.events.listen(vectorSource, 'change', changeSpy);
|
||||
var removeFeatureSpy = sinon.spy();
|
||||
goog.events.listen(vectorSource, 'removefeature', removeFeatureSpy);
|
||||
var clearSourceSpy = sinon.spy();
|
||||
goog.events.listen(vectorSource, 'clear', clearSourceSpy);
|
||||
vectorSource.clear();
|
||||
expect(vectorSource.getFeatures()).to.eql([]);
|
||||
expect(vectorSource.isEmpty()).to.be(true);
|
||||
expect(changeSpy).to.be.called();
|
||||
expect(changeSpy.callCount).to.be(1);
|
||||
expect(removeFeatureSpy).to.be.called();
|
||||
expect(removeFeatureSpy.callCount).to.be(features.length);
|
||||
expect(removeFeatureSpy).not.to.be.called();
|
||||
expect(removeFeatureSpy.callCount).to.be(0);
|
||||
expect(clearSourceSpy).to.be.called();
|
||||
expect(clearSourceSpy.callCount).to.be(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user