Add ol.geom.MultiPolygon
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
// FIXME add MultiPoint
|
// FIXME add MultiPoint
|
||||||
// FIXME add MultiPolygon
|
|
||||||
// FIXME add GeometryCollection
|
// FIXME add GeometryCollection
|
||||||
// FIXME add Z and M support
|
// FIXME add Z and M support
|
||||||
// FIXME use flat coordinate arrays
|
// FIXME use flat coordinate arrays
|
||||||
@@ -17,7 +16,8 @@ ol.geom.GeometryType = {
|
|||||||
POINT: 'Point',
|
POINT: 'Point',
|
||||||
LINE_STRING: 'LineString',
|
LINE_STRING: 'LineString',
|
||||||
POLYGON: 'Polygon',
|
POLYGON: 'Polygon',
|
||||||
MULTI_LINE_STRING: 'MultiLineString'
|
MULTI_LINE_STRING: 'MultiLineString',
|
||||||
|
MULTI_POLYGON: 'MultiPolygon'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
goog.provide('ol.geom.MultiPolygon');
|
||||||
|
|
||||||
|
goog.require('goog.asserts');
|
||||||
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.geom.Geometry');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @extends {ol.geom.Geometry}
|
||||||
|
* @param {Array.<Array.<Array.<ol.Coordinate>>>} ringss Ringss.
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon = function(ringss) {
|
||||||
|
|
||||||
|
goog.base(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<Array.<Array.<ol.Coordinate>>>}
|
||||||
|
*/
|
||||||
|
this.ringss_ = ringss;
|
||||||
|
|
||||||
|
};
|
||||||
|
goog.inherits(ol.geom.MultiPolygon, ol.geom.Geometry);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon.prototype.getExtent = function(opt_extent) {
|
||||||
|
if (this.extentRevision != this.revision) {
|
||||||
|
this.extent = ol.extent.createOrUpdateEmpty(this.extent);
|
||||||
|
var ringss = this.ringss_;
|
||||||
|
var i, ii;
|
||||||
|
for (i = 0, ii = ringss.length; i < ii; ++i) {
|
||||||
|
ol.extent.extendRings(this.extent, ringss[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goog.asserts.assert(goog.isDef(this.extent));
|
||||||
|
return ol.extent.returnOrUpdate(this.extent, opt_extent);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Array.<Array.<Array.<ol.Coordinate>>>} Ringss.
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon.prototype.getRingss = function() {
|
||||||
|
return this.ringss_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon.prototype.getType = function() {
|
||||||
|
return ol.geom.GeometryType.MULTI_POLYGON;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<Array.<Array.<ol.Coordinate>>>} ringss Ringss.
|
||||||
|
*/
|
||||||
|
ol.geom.MultiPolygon.prototype.setRingss = function(ringss) {
|
||||||
|
this.ringss_ = ringss;
|
||||||
|
this.dispatchChangeEvent();
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user