Skip to content

Commit

Permalink
Use forEachFeatureInExtentAtResolution in ol.renderer.canvas.VectorLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 3, 2014
1 parent 3a8504b commit ed586ba
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/ol/renderer/canvas/canvasvectorlayerrenderer.js
Expand Up @@ -222,11 +222,20 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
this.dirty_ = this.dirty_ || dirty;
};
if (!goog.isNull(vectorLayerRenderOrder)) {
var features = vectorSource.getFeaturesInExtent(extent);
/** @type {Array.<ol.Feature>} */
var features = [];
vectorSource.forEachFeatureInExtentAtResolution(extent, resolution,
/**
* @param {ol.Feature} feature Feature.
*/
function(feature) {
features.push(feature);
}, this);
goog.array.sort(features, vectorLayerRenderOrder);
goog.array.forEach(features, renderFeature, this);
} else {
vectorSource.forEachFeatureInExtent(extent, renderFeature, this);
vectorSource.forEachFeatureInExtentAtResolution(
extent, resolution, renderFeature, this);
}
replayGroup.finish();

Expand Down

0 comments on commit ed586ba

Please sign in to comment.