Add ol.geom.Polygon#getLinearRings

This commit is contained in:
Tom Payne
2013-11-30 19:29:56 +01:00
parent b2a93dcda7
commit c1c813e3fa
2 changed files with 16 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.Polygon
@exportProperty ol.geom.Polygon.prototype.getCoordinates
@exportProperty ol.geom.Polygon.prototype.getLinearRings
@exportProperty ol.geom.Polygon.prototype.getType
@exportProperty ol.geom.Polygon.prototype.setCoordinates

View File

@@ -1,6 +1,7 @@
goog.provide('ol.geom.Polygon');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.flat');
@@ -53,6 +54,20 @@ ol.geom.Polygon.prototype.getEnds = function() {
};
/**
* @return {Array.<ol.geom.LinearRing>} Linear rings.
*/
ol.geom.Polygon.prototype.getLinearRings = function() {
var linearRings = [];
var coordinates = this.getCoordinates();
var i, ii;
for (i = 0, ii = coordinates.length; i < ii; ++i) {
linearRings.push(new ol.geom.LinearRing(coordinates[i]));
}
return linearRings;
};
/**
* @inheritDoc
*/