Add ol.geom.MultiPoint#getPoint

This commit is contained in:
Tom Payne
2014-03-10 15:56:16 +01:00
parent 361d31b596
commit ddfce24f05
3 changed files with 28 additions and 0 deletions

View File

@@ -85,6 +85,24 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
};
/**
* @param {number} index Index.
* @return {ol.geom.Point} Point.
*/
ol.geom.MultiPoint.prototype.getPoint = function(index) {
var n = goog.isNull(this.flatCoordinates) ?
0 : this.flatCoordinates.length / this.stride;
goog.asserts.assert(0 <= index && index < n);
if (index < 0 || n <= index) {
return null;
}
var point = new ol.geom.Point(null);
point.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
index * this.stride, (index + 1) * this.stride));
return point;
};
/**
* @return {Array.<ol.geom.Point>} Points.
* @todo stability experimental