Add ol.geom.MultiPolygon#getOrientedFlatCoordinates
This commit is contained in:
@@ -50,6 +50,18 @@ ol.geom.MultiPolygon = function(coordinates, opt_layout) {
|
|||||||
*/
|
*/
|
||||||
this.maxDeltaRevision_ = -1;
|
this.maxDeltaRevision_ = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.orientedRevision_ = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<number>}
|
||||||
|
*/
|
||||||
|
this.orientedFlatCoordinates_ = null;
|
||||||
|
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(coordinates, opt_layout);
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -137,6 +149,26 @@ ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Array.<number>} Oriented flat coordinates.
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon.prototype.getOrientedFlatCoordinates = function() {
|
||||||
|
if (this.orientedRevision_ != this.getRevision()) {
|
||||||
|
var flatCoordinates = this.flatCoordinates;
|
||||||
|
if (ol.geom.flat.linearRingssAreOriented(
|
||||||
|
flatCoordinates, 0, this.endss_, this.stride)) {
|
||||||
|
this.orientedFlatCoordinates_ = flatCoordinates;
|
||||||
|
} else {
|
||||||
|
this.orientedFlatCoordinates_ = flatCoordinates.slice();
|
||||||
|
this.orientedFlatCoordinates_.length = ol.geom.flat.orientLinearRingss(
|
||||||
|
this.orientedFlatCoordinates_, 0, this.endss_, this.stride);
|
||||||
|
}
|
||||||
|
this.orientedRevision_ = this.getRevision();
|
||||||
|
}
|
||||||
|
return this.orientedFlatCoordinates_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user