From 3f49a4ce734bd3dbac3f52b8a8b663b05ec729c5 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 26 Nov 2013 18:58:19 +0100 Subject: [PATCH] Add ol.geom.LineString#getLength --- src/ol/geom/linestring.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index 6fde2a37e7..0a76be1014 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -27,6 +27,15 @@ ol.geom.LineString.prototype.getCoordinates = function() { }; +/** + * @return {number} Length. + */ +ol.geom.LineString.prototype.getLength = function() { + return ol.geom.flat.lineStringLength( + this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); +}; + + /** * @inheritDoc */