From c218d5d4e885d498836c8a123e239ffc68786c60 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 29 Jan 2014 01:22:33 +0100 Subject: [PATCH] Add ol.geom.LineString#getCoordinateAtM --- src/ol/geom/linestring.exports | 1 + src/ol/geom/linestring.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ol/geom/linestring.exports b/src/ol/geom/linestring.exports index a258e088be..f5c50bdf5c 100644 --- a/src/ol/geom/linestring.exports +++ b/src/ol/geom/linestring.exports @@ -1,5 +1,6 @@ @exportSymbol ol.geom.LineString @exportProperty ol.geom.LineString.prototype.clone +@exportProperty ol.geom.LineString.prototype.getCoordinateAtM @exportProperty ol.geom.LineString.prototype.getCoordinates @exportProperty ol.geom.LineString.prototype.getLength @exportProperty ol.geom.LineString.prototype.getType diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index 8b8cfedc29..d97a316f6a 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -80,6 +80,18 @@ ol.geom.LineString.prototype.closestPointXY = }; +/** + * @param {number} m M. + * @param {boolean=} opt_extrapolate Extrapolate. + * @return {ol.Coordinate} Coordinate. + */ +ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) { + var extrapolate = goog.isDef(opt_extrapolate) ? opt_extrapolate : false; + return ol.geom.flat.lineStringCoordinateAtM(this.flatCoordinates, 0, + this.flatCoordinates.length, this.stride, this.layout, m, extrapolate); +}; + + /** * @return {ol.geom.RawLineString} Coordinates. * @todo stability experimental