Add ol.geom.LineString#appendCoordinate
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@exportSymbol ol.geom.LineString
|
||||
@exportProperty ol.geom.LineString.prototype.appendCoordinate
|
||||
@exportProperty ol.geom.LineString.prototype.clone
|
||||
@exportProperty ol.geom.LineString.prototype.getCoordinateAtM
|
||||
@exportProperty ol.geom.LineString.prototype.getCoordinates
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
goog.provide('ol.geom.LineString');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
@@ -50,6 +52,20 @@ ol.geom.LineString = function(coordinates, opt_layout) {
|
||||
goog.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
*/
|
||||
ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
||||
goog.asserts.assert(coordinate.length == this.stride);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
this.flatCoordinates = coordinate.slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, coordinate);
|
||||
}
|
||||
this.dispatchChangeEvent();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user