Point, linestring, and linearring coordinates as Float32Array

This commit is contained in:
Tim Schaub
2013-01-18 15:57:48 -07:00
parent 278d32061f
commit fd0a5f3622
13 changed files with 372 additions and 18 deletions

View File

@@ -1,5 +1,8 @@
goog.provide('ol.geom.Point');
goog.require('goog.asserts');
goog.require('goog.vec.Float32Array');
goog.require('ol.geom.Coordinate');
goog.require('ol.geom.Geometry');
@@ -7,13 +10,19 @@ goog.require('ol.geom.Geometry');
/**
* @constructor
* @implements {ol.geom.Geometry}
* @param {Array} coordinates Coordinates array.
* @param {ol.geom.Coordinate} coordinates Coordinates array (e.g. [x, y]).
*/
ol.geom.Point = function(coordinates) {
/**
* @type {Array}
* @type {Float32Array}
*/
this.coordinates = coordinates;
this.coordinates = new Float32Array(coordinates);
/**
* @type {number}
*/
this.dimension = coordinates.length;
goog.asserts.assert(this.dimension >= 2);
};