Remove static members from Units

This commit is contained in:
Tim Schaub
2018-02-25 08:41:48 -07:00
parent c5bf6f1c6f
commit ef92649017
3 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @module ol/proj/Projection
*/
import Units from '../proj/Units.js';
import {METERS_PER_UNIT} from '../proj/Units.js';
/**
* @classdesc
@@ -153,7 +153,7 @@ Projection.prototype.getUnits = function() {
* @api
*/
Projection.prototype.getMetersPerUnit = function() {
return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_];
return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];
};
+7 -6
View File
@@ -1,6 +1,7 @@
/**
* @module ol/proj/Units
*/
/**
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
* `'us-ft'`.
@@ -22,11 +23,11 @@ const Units = {
* @type {Object.<ol.proj.Units, number>}
* @api
*/
Units.METERS_PER_UNIT = {};
export const METERS_PER_UNIT = {};
// use the radius of the Normal sphere
Units.METERS_PER_UNIT[Units.DEGREES] =
2 * Math.PI * 6370997 / 360;
Units.METERS_PER_UNIT[Units.FEET] = 0.3048;
Units.METERS_PER_UNIT[Units.METERS] = 1;
Units.METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;
METERS_PER_UNIT[Units.FEET] = 0.3048;
METERS_PER_UNIT[Units.METERS] = 1;
METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
export default Units;