Keep track of max extent for replay
This commit is contained in:
@@ -47,10 +47,11 @@ ol.render.canvas.Instruction = {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @implements {ol.render.IVectorContext}
|
* @implements {ol.render.IVectorContext}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Maximum extent.
|
||||||
* @protected
|
* @protected
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.Replay = function(tolerance) {
|
ol.render.canvas.Replay = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
@@ -58,6 +59,12 @@ ol.render.canvas.Replay = function(tolerance) {
|
|||||||
*/
|
*/
|
||||||
this.tolerance = tolerance;
|
this.tolerance = tolerance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @protected
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
this.maxExtent = maxExtent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<*>}
|
* @type {Array.<*>}
|
||||||
@@ -582,12 +589,13 @@ ol.render.canvas.Replay.prototype.setTextStyle = goog.abstractMethod;
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.render.canvas.Replay}
|
* @extends {ol.render.canvas.Replay}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Maximum extent.
|
||||||
* @protected
|
* @protected
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.ImageReplay = function(tolerance) {
|
ol.render.canvas.ImageReplay = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
goog.base(this, tolerance);
|
goog.base(this, tolerance, maxExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -810,12 +818,13 @@ ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.render.canvas.Replay}
|
* @extends {ol.render.canvas.Replay}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Maximum extent.
|
||||||
* @protected
|
* @protected
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.LineStringReplay = function(tolerance) {
|
ol.render.canvas.LineStringReplay = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
goog.base(this, tolerance);
|
goog.base(this, tolerance, maxExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -1027,12 +1036,13 @@ ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle =
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.render.canvas.Replay}
|
* @extends {ol.render.canvas.Replay}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Maximum extent.
|
||||||
* @protected
|
* @protected
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.PolygonReplay = function(tolerance) {
|
ol.render.canvas.PolygonReplay = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
goog.base(this, tolerance);
|
goog.base(this, tolerance, maxExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -1360,12 +1370,13 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.render.canvas.Replay}
|
* @extends {ol.render.canvas.Replay}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Maximum extent.
|
||||||
* @protected
|
* @protected
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.TextReplay = function(tolerance) {
|
ol.render.canvas.TextReplay = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
goog.base(this, tolerance);
|
goog.base(this, tolerance, maxExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -1659,9 +1670,10 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @implements {ol.render.IReplayGroup}
|
* @implements {ol.render.IReplayGroup}
|
||||||
* @param {number} tolerance Tolerance.
|
* @param {number} tolerance Tolerance.
|
||||||
|
* @param {ol.Extent} maxExtent Max extent.
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.ReplayGroup = function(tolerance) {
|
ol.render.canvas.ReplayGroup = function(tolerance, maxExtent) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -1669,6 +1681,12 @@ ol.render.canvas.ReplayGroup = function(tolerance) {
|
|||||||
*/
|
*/
|
||||||
this.tolerance_ = tolerance;
|
this.tolerance_ = tolerance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
this.maxExtent_ = maxExtent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Object.<string,
|
* @type {Object.<string,
|
||||||
@@ -1866,9 +1884,9 @@ ol.render.canvas.ReplayGroup.prototype.getReplay =
|
|||||||
}
|
}
|
||||||
var replay = replays[replayType];
|
var replay = replays[replayType];
|
||||||
if (!goog.isDef(replay)) {
|
if (!goog.isDef(replay)) {
|
||||||
var constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType];
|
var Constructor = ol.render.canvas.BATCH_CONSTRUCTORS_[replayType];
|
||||||
goog.asserts.assert(goog.isDef(constructor));
|
goog.asserts.assert(goog.isDef(Constructor));
|
||||||
replay = new constructor(this.tolerance_);
|
replay = new Constructor(this.tolerance_, this.maxExtent_);
|
||||||
replays[replayType] = replay;
|
replays[replayType] = replay;
|
||||||
}
|
}
|
||||||
return replay;
|
return replay;
|
||||||
@@ -1887,7 +1905,7 @@ ol.render.canvas.ReplayGroup.prototype.isEmpty = function() {
|
|||||||
* @const
|
* @const
|
||||||
* @private
|
* @private
|
||||||
* @type {Object.<ol.render.ReplayType,
|
* @type {Object.<ol.render.ReplayType,
|
||||||
* function(new: ol.render.canvas.Replay, number)>}
|
* function(new: ol.render.canvas.Replay, number, ol.Extent)>}
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.BATCH_CONSTRUCTORS_ = {
|
ol.render.canvas.BATCH_CONSTRUCTORS_ = {
|
||||||
'Image': ol.render.canvas.ImageReplay,
|
'Image': ol.render.canvas.ImageReplay,
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
styleFunction = ol.feature.defaultStyleFunction;
|
styleFunction = ol.feature.defaultStyleFunction;
|
||||||
}
|
}
|
||||||
var tolerance = frameStateResolution / (2 * pixelRatio);
|
var tolerance = frameStateResolution / (2 * pixelRatio);
|
||||||
var replayGroup = new ol.render.canvas.ReplayGroup(tolerance);
|
var replayGroup = new ol.render.canvas.ReplayGroup(tolerance, extent);
|
||||||
vectorSource.forEachFeatureInExtent(extent,
|
vectorSource.forEachFeatureInExtent(extent,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ ol.source.ImageVector.prototype.canvasFunctionInternal_ =
|
|||||||
function(extent, resolution, pixelRatio, size, projection) {
|
function(extent, resolution, pixelRatio, size, projection) {
|
||||||
|
|
||||||
var tolerance = resolution / (2 * pixelRatio);
|
var tolerance = resolution / (2 * pixelRatio);
|
||||||
var replayGroup = new ol.render.canvas.ReplayGroup(tolerance);
|
var replayGroup = new ol.render.canvas.ReplayGroup(tolerance, extent);
|
||||||
|
|
||||||
var loading = false;
|
var loading = false;
|
||||||
this.source_.forEachFeatureInExtent(extent,
|
this.source_.forEachFeatureInExtent(extent,
|
||||||
|
|||||||
Reference in New Issue
Block a user