Remove ol.sphere.WGS84

This commit is contained in:
Tim Schaub
2017-07-11 08:00:41 -06:00
parent aced192bcd
commit 2e903c0293
4 changed files with 32 additions and 31 deletions

View File

@@ -101,22 +101,26 @@
"openlayers-internal/requires-first": 2,
"openlayers-internal/valid-provide": 2,
"openlayers-internal/valid-requires": 2,
"indent": [2, 2, {
"VariableDeclarator": 2,
"SwitchCase": 1,
"MemberExpression": 2,
"FunctionDeclaration": {
"parameters": 2,
"body": 1
},
"FunctionExpression": {
"parameters": 2,
"body": 1
},
"CallExpression": {
"arguments": 2
"indent": [
2,
2,
{
"VariableDeclarator": 2,
"SwitchCase": 1,
"MemberExpression": 2,
"FunctionDeclaration": {
"parameters": 2,
"body": 1
},
"FunctionExpression": {
"parameters": 2,
"body": 1
},
"CallExpression": {
"arguments": 2
}
}
}]
]
}
},
"ext": [

View File

@@ -3,15 +3,16 @@
goog.provide('ol.Geolocation');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.GeolocationProperty');
goog.require('ol.Object');
goog.require('ol.Sphere');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.geom.Polygon');
goog.require('ol.has');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.sphere.WGS84');
goog.require('ol.proj.EPSG4326');
/**
@@ -59,6 +60,12 @@ ol.Geolocation = function(opt_options) {
*/
this.transform_ = ol.proj.identityTransform;
/**
* @private
* @type {ol.Sphere}
*/
this.sphere_ = new ol.Sphere(ol.proj.EPSG4326.RADIUS);
/**
* @private
* @type {number|undefined}
@@ -154,7 +161,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
this.set(ol.GeolocationProperty.SPEED,
coords.speed === null ? undefined : coords.speed);
var geometry = ol.geom.Polygon.circular(
ol.sphere.WGS84, this.position_, coords.accuracy);
this.sphere_, this.position_, coords.accuracy);
geometry.applyTransform(this.transform_);
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
this.changed();

View File

@@ -1,11 +0,0 @@
goog.provide('ol.sphere.WGS84');
goog.require('ol.Sphere');
/**
* A sphere with radius equal to the semi-major axis of the WGS84 ellipsoid.
* @const
* @type {ol.Sphere}
*/
ol.sphere.WGS84 = new ol.Sphere(6378137);

View File

@@ -4,8 +4,8 @@
goog.provide('ol.test.Sphere');
goog.require('ol.Sphere');
goog.require('ol.sphere.WGS84');
goog.require('ol.format.WKT');
goog.require('ol.proj.EPSG4326');
describe('ol.Sphere', function() {
@@ -102,7 +102,8 @@ describe('ol.Sphere', function() {
it('results match the expected area of Ilinois', function() {
var coords = geometry.getPolygon(0).getLinearRing(0).getCoordinates();
expect(ol.sphere.WGS84.geodesicArea(coords)).to.equal(145978332359.37125);
var sphere = new ol.Sphere(ol.proj.EPSG4326.RADIUS);
expect(sphere.geodesicArea(coords)).to.equal(145978332359.37125);
});
});