Add ol.geom.MultiLineString#getLineString
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@exportProperty ol.geom.MultiLineString.prototype.clone
|
||||
@exportProperty ol.geom.MultiLineString.prototype.getCoordinateAtM
|
||||
@exportProperty ol.geom.MultiLineString.prototype.getCoordinates
|
||||
@exportProperty ol.geom.MultiLineString.prototype.getLineString
|
||||
@exportProperty ol.geom.MultiLineString.prototype.getLineStrings
|
||||
@exportProperty ol.geom.MultiLineString.prototype.getType
|
||||
@exportProperty ol.geom.MultiLineString.prototype.setCoordinates
|
||||
|
||||
@@ -131,6 +131,22 @@ ol.geom.MultiLineString.prototype.getEnds = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} index Index.
|
||||
* @return {ol.geom.LineString} LineString.
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getLineString = function(index) {
|
||||
goog.asserts.assert(0 <= index && index < this.ends_.length);
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
|
||||
index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]));
|
||||
return lineString;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<ol.geom.LineString>} LineStrings.
|
||||
* @todo stability experimental
|
||||
|
||||
Reference in New Issue
Block a user