Buffer batch group extent
This commit is contained in:
@@ -106,13 +106,22 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
|
|
||||||
var vectorLayer = this.getVectorLayer();
|
var vectorLayer = this.getVectorLayer();
|
||||||
var vectorSource = vectorLayer.getVectorSource();
|
var vectorSource = vectorLayer.getVectorSource();
|
||||||
|
var frameStateExtent = frameState.extent;
|
||||||
|
|
||||||
if (this.renderedResolution_ == frameState.view2DState.resolution &&
|
if (this.renderedResolution_ == frameState.view2DState.resolution &&
|
||||||
this.renderedRevision_ == vectorSource.getRevision() &&
|
this.renderedRevision_ == vectorSource.getRevision() &&
|
||||||
ol.extent.containsExtent(this.renderedExtent_, frameState.extent)) {
|
ol.extent.containsExtent(this.renderedExtent_, frameStateExtent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var extent = this.renderedExtent_;
|
||||||
|
var xBuffer = ol.extent.getWidth(frameStateExtent) / 4;
|
||||||
|
var yBuffer = ol.extent.getHeight(frameStateExtent) / 4;
|
||||||
|
extent[0] = frameStateExtent[0] - xBuffer;
|
||||||
|
extent[1] = frameStateExtent[1] - yBuffer;
|
||||||
|
extent[2] = frameStateExtent[2] + xBuffer;
|
||||||
|
extent[3] = frameStateExtent[3] + yBuffer;
|
||||||
|
|
||||||
// FIXME dispose of old batchGroup in post render
|
// FIXME dispose of old batchGroup in post render
|
||||||
goog.dispose(this.batchGroup_);
|
goog.dispose(this.batchGroup_);
|
||||||
this.batchGroup = null;
|
this.batchGroup = null;
|
||||||
@@ -122,14 +131,13 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
styleFunction = ol.style.DefaultStyleFunction;
|
styleFunction = ol.style.DefaultStyleFunction;
|
||||||
}
|
}
|
||||||
var batchGroup = new ol.replay.canvas.BatchGroup();
|
var batchGroup = new ol.replay.canvas.BatchGroup();
|
||||||
vectorSource.forEachFeatureInExtent(frameState.extent, function(feature) {
|
vectorSource.forEachFeatureInExtent(extent, function(feature) {
|
||||||
var style = styleFunction(feature);
|
var style = styleFunction(feature);
|
||||||
ol.renderer.vector.renderFeature(batchGroup, feature, style);
|
ol.renderer.vector.renderFeature(batchGroup, feature, style);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.renderedResolution_ = frameState.view2DState.resolution;
|
this.renderedResolution_ = frameState.view2DState.resolution;
|
||||||
this.renderedRevision_ = vectorSource.getRevision();
|
this.renderedRevision_ = vectorSource.getRevision();
|
||||||
this.renderedExtent_ = frameState.extent;
|
|
||||||
if (!batchGroup.isEmpty()) {
|
if (!batchGroup.isEmpty()) {
|
||||||
this.batchGroup_ = batchGroup;
|
this.batchGroup_ = batchGroup;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user