Add ol.geom.MultiLineString#getLineStrings
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user