Getting the nanometer precision we deserve with web mercator
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.geom.LinearRing');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float32Array');
|
||||
goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.LineString');
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.geom.LineString');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float32Array');
|
||||
goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.Geometry');
|
||||
|
||||
@@ -21,9 +21,9 @@ ol.geom.LineString = function(coordinates) {
|
||||
length = count * dimension;
|
||||
|
||||
/**
|
||||
* @type {Float32Array}
|
||||
* @type {Float64Array}
|
||||
*/
|
||||
this.coordinates = new Float32Array(length);
|
||||
this.coordinates = new Float64Array(length);
|
||||
for (var i = 0; i < count; ++i) {
|
||||
goog.asserts.assert(coordinates[i].length === dimension);
|
||||
this.coordinates.set(coordinates[i], i * dimension);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.geom.Point');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float32Array');
|
||||
goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.geom.Coordinate');
|
||||
goog.require('ol.geom.Geometry');
|
||||
|
||||
@@ -15,9 +15,9 @@ goog.require('ol.geom.Geometry');
|
||||
ol.geom.Point = function(coordinates) {
|
||||
|
||||
/**
|
||||
* @type {Float32Array}
|
||||
* @type {Float64Array}
|
||||
*/
|
||||
this.coordinates = new Float32Array(coordinates);
|
||||
this.coordinates = new Float64Array(coordinates);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.geom.Polygon');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.vec.Float32Array');
|
||||
goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
|
||||
@@ -17,9 +17,9 @@ describe('ol.geom.LinearRing', function() {
|
||||
|
||||
describe('coordinates', function() {
|
||||
|
||||
it('is a Float32Array', function() {
|
||||
it('is a Float64Array', function() {
|
||||
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
|
||||
expect(ring.coordinates).toBeA(Float32Array);
|
||||
expect(ring.coordinates).toBeA(Float64Array);
|
||||
|
||||
expect(ring.coordinates.length).toBe(4);
|
||||
expect(ring.coordinates[0]).toBe(10);
|
||||
|
||||
@@ -17,9 +17,9 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
describe('coordinates', function() {
|
||||
|
||||
it('is a Float32Array', function() {
|
||||
it('is a Float64Array', function() {
|
||||
var line = new ol.geom.LineString([[10, 20], [30, 40]]);
|
||||
expect(line.coordinates).toBeA(Float32Array);
|
||||
expect(line.coordinates).toBeA(Float64Array);
|
||||
|
||||
expect(line.coordinates.length).toBe(4);
|
||||
expect(line.coordinates[0]).toBe(10);
|
||||
|
||||
@@ -17,9 +17,9 @@ describe('ol.geom.Point', function() {
|
||||
|
||||
describe('coordinates', function() {
|
||||
|
||||
it('is a Float32Array', function() {
|
||||
it('is a Float64Array', function() {
|
||||
var point = new ol.geom.Point([10, 20]);
|
||||
expect(point.coordinates).toBeA(Float32Array);
|
||||
expect(point.coordinates).toBeA(Float64Array);
|
||||
|
||||
expect(point.coordinates.length).toBe(2);
|
||||
expect(point.coordinates[0]).toBe(10);
|
||||
|
||||
Reference in New Issue
Block a user