Cache coordinates for reuse on replay, not on geometry
This commit is contained in:
@@ -41,12 +41,6 @@ ol.geom.SimpleGeometry = function() {
|
|||||||
*/
|
*/
|
||||||
this.flatCoordinates = null;
|
this.flatCoordinates = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {Array.<number>|Array.<Array.<number>>|Array.<Array.<Array.<number>>>}
|
|
||||||
*/
|
|
||||||
this.renderCoordinates_ = null;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.geom.SimpleGeometry, ol.geom.Geometry);
|
ol.inherits(ol.geom.SimpleGeometry, ol.geom.Geometry);
|
||||||
|
|
||||||
@@ -147,18 +141,6 @@ ol.geom.SimpleGeometry.prototype.getLayout = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {Array.<number>|Array.<Array.<number>>|Array.<Array.<Array.<number>>>}
|
|
||||||
* Render coordinates.
|
|
||||||
*/
|
|
||||||
ol.geom.SimpleGeometry.prototype.getRenderCoordinates = function() {
|
|
||||||
if (!this.renderCoordinates_) {
|
|
||||||
this.renderCoordinates_ = [];
|
|
||||||
}
|
|
||||||
return this.renderCoordinates_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -88,6 +88,12 @@ ol.render.canvas.Replay = function(tolerance, maxExtent, resolution, overlaps) {
|
|||||||
*/
|
*/
|
||||||
this.coordinates = [];
|
this.coordinates = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>}
|
||||||
|
*/
|
||||||
|
this.coordinateCache_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {!ol.Transform}
|
* @type {!ol.Transform}
|
||||||
@@ -393,7 +399,10 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
var coords;
|
var coords;
|
||||||
if (instruction.length == 6) {
|
if (instruction.length == 6) {
|
||||||
var fn = instruction[5];
|
var fn = instruction[5];
|
||||||
coords = fn(pixelCoordinates, d, dd, 2, geometry.getRenderCoordinates());
|
if (!(d in this.coordinateCache_)) {
|
||||||
|
this.coordinateCache_[d] = [];
|
||||||
|
}
|
||||||
|
coords = fn(pixelCoordinates, d, dd, 2, this.coordinateCache_[d]);
|
||||||
} else {
|
} else {
|
||||||
coords = pixelCoordinates.slice(d, dd);
|
coords = pixelCoordinates.slice(d, dd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,6 @@ ol.render.Feature = function(type, flatCoordinates, ends, properties, id) {
|
|||||||
*/
|
*/
|
||||||
this.flatCoordinates_ = flatCoordinates;
|
this.flatCoordinates_ = flatCoordinates;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {Array.<number>|Array.<Array.<number>>|Array.<Array.<Array.<number>>>}
|
|
||||||
*/
|
|
||||||
this.renderCoordinates_ = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<number>|Array.<Array.<number>>}
|
* @type {Array.<number>|Array.<Array.<number>>}
|
||||||
@@ -117,18 +111,6 @@ ol.render.Feature.prototype.getOrientedFlatCoordinates = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {Array.<number>|Array.<Array.<number>>|Array.<Array.<Array.<number>>>}
|
|
||||||
* Render coordinates.
|
|
||||||
*/
|
|
||||||
ol.render.Feature.prototype.getRenderCoordinates = function() {
|
|
||||||
if (!this.renderCoordinates_) {
|
|
||||||
this.renderCoordinates_ = [];
|
|
||||||
}
|
|
||||||
return this.renderCoordinates_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array.<number>} Flat coordinates.
|
* @return {Array.<number>} Flat coordinates.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user