From 9feac717c88d2c6ae38d07143027774c1835093a Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 14 Aug 2014 17:41:29 +0200 Subject: [PATCH 1/2] Add ol.geom.Polygon#getLinearRingCount function --- src/ol/geom/polygon.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 4c5b266539..39d4c08227 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -191,6 +191,18 @@ ol.geom.Polygon.prototype.getInteriorPoint = function() { }; +/** + * Return the number of rings of the polygon, this includes the exterior + * ring and any interior rings. + * + * @return {number} Number of rings. + * @api + */ +ol.geom.Polygon.prototype.getLinearRingCount = function() { + return this.ends_.length; +}; + + /** * @param {number} index Index. * @return {ol.geom.LinearRing} Linear ring. From 5602ae65211d3645212555a45e44d647fa8e4022 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 21 Aug 2014 09:07:08 +0200 Subject: [PATCH 2/2] Document ol.geom.Polygon#getLinearRing function --- src/ol/geom/polygon.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 39d4c08227..1249e227f3 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -204,6 +204,11 @@ ol.geom.Polygon.prototype.getLinearRingCount = function() { /** + * Return the Nth linear ring of the polygon geometry. Return `null` if the + * given index is out of range. + * The exterior linear ring is available at index `0` and the interior rings + * at index `1` and beyond. + * * @param {number} index Index. * @return {ol.geom.LinearRing} Linear ring. * @api stable