Add ol.geom.Polygon#appendLinearRing

This commit is contained in:
Tom Payne
2014-03-10 15:25:31 +01:00
parent 94cfb3205a
commit 03911e6c6b
3 changed files with 28 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
goog.provide('ol.geom.Polygon');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
@@ -71,6 +72,21 @@ ol.geom.Polygon = function(coordinates, opt_layout) {
goog.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
/**
* @param {ol.geom.LinearRing} linearRing Linear ring.
*/
ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
goog.asserts.assert(linearRing.getLayout() == this.layout);
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
} else {
goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
}
this.ends_.push(this.flatCoordinates.length);
this.dispatchChangeEvent();
};
/**
* @inheritDoc
*/