From 333e4a96257e9d4276bc7b577fa489130ac3acf4 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 5 Mar 2014 12:29:24 -0700 Subject: [PATCH] Rename getAllFeatures to getFeatures --- src/ol/source/vectorsource.exports | 2 +- src/ol/source/vectorsource.js | 2 +- .../ol/interaction/drawinteraction.test.js | 20 +++++++++---------- test/spec/ol/source/vectorsource.test.js | 12 +++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ol/source/vectorsource.exports b/src/ol/source/vectorsource.exports index fc941919fb..d304a5031f 100644 --- a/src/ol/source/vectorsource.exports +++ b/src/ol/source/vectorsource.exports @@ -3,7 +3,7 @@ @exportProperty ol.source.Vector.prototype.addFeatures @exportProperty ol.source.Vector.prototype.forEachFeature @exportProperty ol.source.Vector.prototype.forEachFeatureInExtent -@exportProperty ol.source.Vector.prototype.getAllFeatures +@exportProperty ol.source.Vector.prototype.getFeatures @exportProperty ol.source.Vector.prototype.getAllFeaturesAtCoordinate @exportProperty ol.source.Vector.prototype.getClosestFeatureToCoordinate @exportProperty ol.source.Vector.prototype.getExtent diff --git a/src/ol/source/vectorsource.js b/src/ol/source/vectorsource.js index f5e4d64394..87b07965c9 100644 --- a/src/ol/source/vectorsource.js +++ b/src/ol/source/vectorsource.js @@ -193,7 +193,7 @@ ol.source.Vector.prototype.forEachFeatureInExtent = * @return {Array.} Features. * @todo stability experimental */ -ol.source.Vector.prototype.getAllFeatures = function() { +ol.source.Vector.prototype.getFeatures = function() { var features = this.rBush_.getAll(); if (!goog.object.isEmpty(this.nullGeometryFeatures_)) { goog.array.extend( diff --git a/test/spec/ol/interaction/drawinteraction.test.js b/test/spec/ol/interaction/drawinteraction.test.js index 5a783ef35d..7e28a0145a 100644 --- a/test/spec/ol/interaction/drawinteraction.test.js +++ b/test/spec/ol/interaction/drawinteraction.test.js @@ -85,7 +85,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mousedown', 10, 20); simulateEvent('mouseup', 10, 20); simulateEvent('click', 10, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.Point); @@ -98,7 +98,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mousemove', 15, 20); simulateEvent('mouseup', 15, 20); simulateEvent('click', 15, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(0); }); @@ -132,7 +132,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mousedown', 30, 15); simulateEvent('mouseup', 30, 15); simulateEvent('click', 30, 15); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.MultiPoint); @@ -170,7 +170,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 30, 20); simulateEvent('click', 30, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.LineString); @@ -203,7 +203,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 30, 20); simulateEvent('click', 30, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.LineString); @@ -267,7 +267,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 30, 20); simulateEvent('click', 30, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.MultiLineString); @@ -312,7 +312,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 10, 20); simulateEvent('click', 10, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.Polygon); @@ -346,7 +346,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 40, 10); simulateEvent('click', 40, 11); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.Polygon); @@ -426,7 +426,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 10, 20); simulateEvent('click', 10, 20); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.MultiPolygon); @@ -462,7 +462,7 @@ describe('ol.interaction.Draw', function() { simulateEvent('mouseup', 40, 10); simulateEvent('click', 40, 10); - var features = source.getAllFeatures(); + var features = source.getFeatures(); expect(features).to.have.length(1); var geometry = features[0].getGeometry(); expect(geometry).to.be.a(ol.geom.MultiPolygon); diff --git a/test/spec/ol/source/vectorsource.test.js b/test/spec/ol/source/vectorsource.test.js index 81611b0a4c..d9503dc373 100644 --- a/test/spec/ol/source/vectorsource.test.js +++ b/test/spec/ol/source/vectorsource.test.js @@ -91,7 +91,7 @@ describe('ol.source.Vector', function() { var removeFeatureSpy = sinon.spy(); goog.events.listen(vectorSource, 'removefeature', removeFeatureSpy); vectorSource.clear(); - expect(vectorSource.getAllFeatures()).to.eql([]); + expect(vectorSource.getFeatures()).to.eql([]); expect(vectorSource.isEmpty()).to.be(true); expect(changeSpy).to.be.called(); expect(changeSpy.callCount).to.be(1); @@ -209,28 +209,28 @@ describe('ol.source.Vector', function() { it('handles features with null geometries', function() { var feature = new ol.Feature(null); vectorSource.addFeature(feature); - expect(vectorSource.getAllFeatures()).to.eql([feature]); + expect(vectorSource.getFeatures()).to.eql([feature]); }); it('handles features with geometries changing from null', function() { var feature = new ol.Feature(null); vectorSource.addFeature(feature); - expect(vectorSource.getAllFeatures()).to.eql([feature]); + expect(vectorSource.getFeatures()).to.eql([feature]); feature.setGeometry(new ol.geom.Point([1, 1])); expect(vectorSource.getAllFeaturesInExtent([0, 0, 2, 2])). to.eql([feature]); - expect(vectorSource.getAllFeatures()).to.eql([feature]); + expect(vectorSource.getFeatures()).to.eql([feature]); }); it('handles features with geometries changing to null', function() { var feature = new ol.Feature(new ol.geom.Point([1, 1])); vectorSource.addFeature(feature); - expect(vectorSource.getAllFeatures()).to.eql([feature]); + expect(vectorSource.getFeatures()).to.eql([feature]); expect(vectorSource.getAllFeaturesInExtent([0, 0, 2, 2])). to.eql([feature]); feature.setGeometry(null); expect(vectorSource.getAllFeaturesInExtent([0, 0, 2, 2])).to.be.empty(); - expect(vectorSource.getAllFeatures()).to.eql([feature]); + expect(vectorSource.getFeatures()).to.eql([feature]); }); });