Add ol.geom.Polygon#getLinearRings
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user