Rename getAllFeatures to getFeatures
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -193,7 +193,7 @@ ol.source.Vector.prototype.forEachFeatureInExtent =
|
||||
* @return {Array.<ol.Feature>} 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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user