Fix getInteriorPoint calculation to always return a point

This commit is contained in:
Tom Payne
2014-01-23 14:19:19 +01:00
parent 3c16e03ae2
commit a780936805
3 changed files with 32 additions and 42 deletions

View File

@@ -142,10 +142,10 @@ ol.geom.Polygon.prototype.getEnds = function() {
*/
ol.geom.Polygon.prototype.getFlatInteriorPoint = function() {
if (this.flatInteriorPointRevision_ != this.getRevision()) {
var extent = this.getExtent();
var y = (extent[1] + extent[3]) / 2;
var flatCenter = ol.extent.getCenter(this.getExtent());
this.flatInteriorPoint_ = ol.geom.flat.linearRingsGetInteriorPoint(
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, y);
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
flatCenter, 0);
this.flatInteriorPointRevision_ = this.getRevision();
}
return this.flatInteriorPoint_;