Remove static members from Units
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ import {modulo} from './math.js';
|
|||||||
import {toEPSG4326, fromEPSG4326, PROJECTIONS as EPSG3857_PROJECTIONS} from './proj/epsg3857.js';
|
import {toEPSG4326, fromEPSG4326, PROJECTIONS as EPSG3857_PROJECTIONS} from './proj/epsg3857.js';
|
||||||
import {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';
|
import {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';
|
||||||
import Projection from './proj/Projection.js';
|
import Projection from './proj/Projection.js';
|
||||||
import Units from './proj/Units.js';
|
import Units, {METERS_PER_UNIT} from './proj/Units.js';
|
||||||
import * as projections from './proj/projections.js';
|
import * as projections from './proj/projections.js';
|
||||||
import {add as addTransformFunc, clear as clearTransformFuncs, get as getTransformFunc} from './proj/transforms.js';
|
import {add as addTransformFunc, clear as clearTransformFuncs, get as getTransformFunc} from './proj/transforms.js';
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ import {add as addTransformFunc, clear as clearTransformFuncs, get as getTransfo
|
|||||||
* @type {Object.<ol.proj.Units, number>}
|
* @type {Object.<ol.proj.Units, number>}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export const METERS_PER_UNIT = Units.METERS_PER_UNIT;
|
export {METERS_PER_UNIT};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +147,7 @@ export function getPointResolution(projection, resolution, point, opt_units) {
|
|||||||
const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));
|
const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));
|
||||||
pointResolution = (width + height) / 2;
|
pointResolution = (width + height) / 2;
|
||||||
const metersPerUnit = opt_units ?
|
const metersPerUnit = opt_units ?
|
||||||
Units.METERS_PER_UNIT[opt_units] :
|
METERS_PER_UNIT[opt_units] :
|
||||||
projection.getMetersPerUnit();
|
projection.getMetersPerUnit();
|
||||||
if (metersPerUnit !== undefined) {
|
if (metersPerUnit !== undefined) {
|
||||||
pointResolution /= metersPerUnit;
|
pointResolution /= metersPerUnit;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/proj/Projection
|
* @module ol/proj/Projection
|
||||||
*/
|
*/
|
||||||
import Units from '../proj/Units.js';
|
import {METERS_PER_UNIT} from '../proj/Units.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -153,7 +153,7 @@ Projection.prototype.getUnits = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
Projection.prototype.getMetersPerUnit = function() {
|
Projection.prototype.getMetersPerUnit = function() {
|
||||||
return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_];
|
return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/proj/Units
|
* @module ol/proj/Units
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
|
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
|
||||||
* `'us-ft'`.
|
* `'us-ft'`.
|
||||||
@@ -22,11 +23,11 @@ const Units = {
|
|||||||
* @type {Object.<ol.proj.Units, number>}
|
* @type {Object.<ol.proj.Units, number>}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
Units.METERS_PER_UNIT = {};
|
export const METERS_PER_UNIT = {};
|
||||||
// use the radius of the Normal sphere
|
// use the radius of the Normal sphere
|
||||||
Units.METERS_PER_UNIT[Units.DEGREES] =
|
METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;
|
||||||
2 * Math.PI * 6370997 / 360;
|
METERS_PER_UNIT[Units.FEET] = 0.3048;
|
||||||
Units.METERS_PER_UNIT[Units.FEET] = 0.3048;
|
METERS_PER_UNIT[Units.METERS] = 1;
|
||||||
Units.METERS_PER_UNIT[Units.METERS] = 1;
|
METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
|
||||||
Units.METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
|
|
||||||
export default Units;
|
export default Units;
|
||||||
|
|||||||
Reference in New Issue
Block a user