Add ol.geom.MultiLineString#getLineStrings

This commit is contained in:
Tom Payne
2013-12-01 17:15:40 +01:00
parent 984cac3832
commit 2caf6307d4
2 changed files with 17 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.MultiLineString
@exportProperty ol.geom.MultiLineString.prototype.getCoordinates
@exportProperty ol.geom.MultiLineString.prototype.getLineStrings
@exportProperty ol.geom.MultiLineString.prototype.getType
@exportProperty ol.geom.MultiLineString.prototype.setCoordinates

View File

@@ -1,6 +1,7 @@
goog.provide('ol.geom.MultiLineString');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.LineString');
goog.require('ol.geom.flat');
@@ -44,6 +45,21 @@ ol.geom.MultiLineString.prototype.getEnds = function() {
};
/**
* @return {Array.<ol.geom.LineString>} LineStrings.
*/
ol.geom.MultiLineString.prototype.getLineStrings = function() {
// FIXME we should construct the line strings from the flat coordinates
var coordinates = this.getCoordinates();
var lineStrings = [];
var i, ii;
for (i = 0, ii = coordinates.length; i < ii; ++i) {
lineStrings.push(new ol.geom.LineString(coordinates[i]));
}
return lineStrings;
};
/**
* @inheritDoc
*/