Add ol.geom.Polygon#getInteriorPoint

This commit is contained in:
Tom Payne
2013-12-01 17:48:05 +01:00
parent e7bf44688d
commit 3d35ce75e4

View File

@@ -54,6 +54,17 @@ ol.geom.Polygon.prototype.getEnds = function() {
};
/**
* @return {ol.Coordinate} Interior point.
*/
ol.geom.Polygon.prototype.getInteriorPoint = function() {
var extent = this.getExtent();
var y = (extent[1] + extent[3]) / 2;
return ol.geom.flat.linearRingsGetInteriorPoint(
this.flatCoordinates, 0, this.ends_, this.stride, y);
};
/**
* @return {Array.<ol.geom.LinearRing>} Linear rings.
*/