Add ol.geom.LineString#appendCoordinate

This commit is contained in:
Tom Payne
2014-03-10 15:11:59 +01:00
parent 470790b811
commit 94cfb3205a
3 changed files with 24 additions and 0 deletions

View File

@@ -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

View File

@@ -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
*/