Add ol.geom.MultiPolygon#getPolygons
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@exportSymbol ol.geom.MultiPolygon
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getCoordinates
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getPolygons
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getType
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.setCoordinates
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.geom.MultiPolygon');
|
||||
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.geom.flat');
|
||||
|
||||
|
||||
@@ -53,6 +54,21 @@ ol.geom.MultiPolygon.prototype.getEndss = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<ol.geom.Polygon>} Polygons.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getPolygons = function() {
|
||||
// FIXME we should construct the polygons directly from the flat coordinates
|
||||
var coordinates = this.getCoordinates();
|
||||
var polygons = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
polygons.push(new ol.geom.Polygon(coordinates[i]));
|
||||
}
|
||||
return polygons;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user