Point, linestring, and linearring coordinates as Float32Array
This commit is contained in:
@@ -1,19 +1,41 @@
|
||||
goog.provide('ol.geom.Polygon');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float32Array');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {ol.geom.Geometry}
|
||||
* @param {Array} coordinates Coordinates array.
|
||||
* @param {Array.<ol.geom.CoordinateArray>} coordinates Array of rings. First
|
||||
* is outer, any remaining are inner.
|
||||
*/
|
||||
ol.geom.Polygon = function(coordinates) {
|
||||
|
||||
var numRings = coordinates.length,
|
||||
dimension;
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
* @type {Array.<ol.geom.LinearRing>}
|
||||
*/
|
||||
this.coordinates = coordinates;
|
||||
this.rings = new Array(numRings);
|
||||
for (var i = 0; i < numRings; ++i) {
|
||||
this.rings[i] = new ol.geom.LinearRing(coordinates[i]);
|
||||
if (!goog.isDef(dimension)) {
|
||||
dimension = this.rings[i].dimension;
|
||||
} else {
|
||||
goog.asserts.assert(this.rings[i].dimension === dimension);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.dimension = dimension;
|
||||
goog.asserts.assert(this.dimension >= 2);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user