From 2c40daea22d3e6937606af444070f824d7b016eb Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 2 Dec 2013 14:47:32 +0100 Subject: [PATCH] Add ol.geom.LinearRing#getArea --- src/ol/geom/linearring.exports | 1 + src/ol/geom/linearring.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/ol/geom/linearring.exports b/src/ol/geom/linearring.exports index 59792c22b9..ab788b38a3 100644 --- a/src/ol/geom/linearring.exports +++ b/src/ol/geom/linearring.exports @@ -1,4 +1,5 @@ @exportSymbol ol.geom.LinearRing +@exportProperty ol.geom.LinearRing.prototype.getArea @exportProperty ol.geom.LinearRing.prototype.getCoordinates @exportProperty ol.geom.LinearRing.prototype.getType @exportProperty ol.geom.LinearRing.prototype.setCoordinates diff --git a/src/ol/geom/linearring.js b/src/ol/geom/linearring.js index 555c91d516..7c15fd53a4 100644 --- a/src/ol/geom/linearring.js +++ b/src/ol/geom/linearring.js @@ -18,6 +18,15 @@ ol.geom.LinearRing = function(coordinates, opt_layout) { goog.inherits(ol.geom.LinearRing, ol.geom.Geometry); +/** + * @return {number} Area. + */ +ol.geom.LinearRing.prototype.getArea = function() { + return ol.geom.flat.linearRingArea( + this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); +}; + + /** * @return {ol.geom.RawLinearRing} Coordinates. */