Cache ol.geom.MultiPolygon interior points
This commit is contained in:
@@ -22,6 +22,18 @@ ol.geom.MultiPolygon = function(coordinates, opt_layout) {
|
|||||||
*/
|
*/
|
||||||
this.endss_ = [];
|
this.endss_ = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.interiorPointsRevision_ = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<ol.Coordinate>}
|
||||||
|
*/
|
||||||
|
this.interiorPoints_ = null;
|
||||||
|
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(coordinates, opt_layout);
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -58,10 +70,14 @@ ol.geom.MultiPolygon.prototype.getEndss = function() {
|
|||||||
* @return {Array.<ol.Coordinate>} Interior points.
|
* @return {Array.<ol.Coordinate>} Interior points.
|
||||||
*/
|
*/
|
||||||
ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
||||||
var ys = ol.geom.flat.linearRingssMidYs(
|
if (this.interiorPointsRevision_ != this.revision) {
|
||||||
this.flatCoordinates, 0, this.endss_, this.stride);
|
var ys = ol.geom.flat.linearRingssMidYs(
|
||||||
return ol.geom.flat.linearRingssGetInteriorPoints(
|
this.flatCoordinates, 0, this.endss_, this.stride);
|
||||||
this.flatCoordinates, 0, this.endss_, this.stride, ys);
|
this.interiorPoints_ = ol.geom.flat.linearRingssGetInteriorPoints(
|
||||||
|
this.flatCoordinates, 0, this.endss_, this.stride, ys);
|
||||||
|
this.interiorPointsRevision_ = this.revision;
|
||||||
|
}
|
||||||
|
return this.interiorPoints_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user