Rename _ol_proj_Units_ to Units
This commit is contained in:
@@ -20,7 +20,7 @@ import SimpleGeometry from './geom/SimpleGeometry.js';
|
||||
import {clamp, modulo} from './math.js';
|
||||
import _ol_obj_ from './obj.js';
|
||||
import {createProjection, METERS_PER_UNIT} from './proj.js';
|
||||
import _ol_proj_Units_ from './proj/Units.js';
|
||||
import Units from './proj/Units.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -1133,7 +1133,7 @@ _ol_View_.createResolutionConstraint_ = function(options) {
|
||||
var extent = projection.getExtent();
|
||||
var size = !extent ?
|
||||
// use an extent that can fit the whole world if need be
|
||||
360 * METERS_PER_UNIT[_ol_proj_Units_.DEGREES] /
|
||||
360 * METERS_PER_UNIT[Units.DEGREES] /
|
||||
projection.getMetersPerUnit() :
|
||||
Math.max(getWidth(extent), getHeight(extent));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import ScaleLineUnits from '../control/ScaleLineUnits.js';
|
||||
import {CLASS_UNSELECTABLE} from '../css.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {getPointResolution, METERS_PER_UNIT} from '../proj.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -172,8 +172,8 @@ ScaleLine.prototype.updateElement_ = function() {
|
||||
var projection = viewState.projection;
|
||||
var units = this.getUnits();
|
||||
var pointResolutionUnits = units == ScaleLineUnits.DEGREES ?
|
||||
_ol_proj_Units_.DEGREES :
|
||||
_ol_proj_Units_.METERS;
|
||||
Units.DEGREES :
|
||||
Units.METERS;
|
||||
var pointResolution =
|
||||
getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
||||
if (units != ScaleLineUnits.DEGREES) {
|
||||
@@ -183,8 +183,8 @@ ScaleLine.prototype.updateElement_ = function() {
|
||||
var nominalCount = this.minWidth_ * pointResolution;
|
||||
var suffix = '';
|
||||
if (units == ScaleLineUnits.DEGREES) {
|
||||
var metersPerDegree = METERS_PER_UNIT[_ol_proj_Units_.DEGREES];
|
||||
if (projection.getUnits() == _ol_proj_Units_.DEGREES) {
|
||||
var metersPerDegree = METERS_PER_UNIT[Units.DEGREES];
|
||||
if (projection.getUnits() == Units.DEGREES) {
|
||||
nominalCount *= metersPerDegree;
|
||||
} else {
|
||||
pointResolution /= metersPerDegree;
|
||||
|
||||
@@ -18,7 +18,7 @@ import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_proj_Projection_ from '../proj/Projection.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
import _ol_render_Feature_ from '../render/Feature.js';
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ var MVT = function(opt_options) {
|
||||
*/
|
||||
this.defaultDataProjection = new _ol_proj_Projection_({
|
||||
code: '',
|
||||
units: _ol_proj_Units_.TILE_PIXELS
|
||||
units: Units.TILE_PIXELS
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import {createEmpty, getHeight, returnOrUpdate} from '../extent.js';
|
||||
import {FALSE} from '../functions.js';
|
||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||
import {get as getProjection, getTransform} from '../proj.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
import _ol_transform_ from '../transform.js';
|
||||
|
||||
/**
|
||||
@@ -256,7 +256,7 @@ Geometry.prototype.translate = function(deltaX, deltaY) {};
|
||||
Geometry.prototype.transform = function(source, destination) {
|
||||
var tmpTransform = this.tmpTransform_;
|
||||
source = getProjection(source);
|
||||
var transformFn = source.getUnits() == _ol_proj_Units_.TILE_PIXELS ?
|
||||
var transformFn = source.getUnits() == Units.TILE_PIXELS ?
|
||||
function(inCoordinates, outCoordinates, stride) {
|
||||
var pixelExtent = source.getExtent();
|
||||
var projectedExtent = source.getWorldExtent();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import {cosh} from '../math.js';
|
||||
import _ol_proj_Projection_ from '../proj/Projection.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
var _ol_proj_EPSG3857_ = {};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ var _ol_proj_EPSG3857_ = {};
|
||||
_ol_proj_EPSG3857_.Projection_ = function(code) {
|
||||
_ol_proj_Projection_.call(this, {
|
||||
code: code,
|
||||
units: _ol_proj_Units_.METERS,
|
||||
units: Units.METERS,
|
||||
extent: _ol_proj_EPSG3857_.EXTENT,
|
||||
global: true,
|
||||
worldExtent: _ol_proj_EPSG3857_.WORLD_EXTENT,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_proj_Projection_ from '../proj/Projection.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
var _ol_proj_EPSG4326_ = {};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ var _ol_proj_EPSG4326_ = {};
|
||||
_ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) {
|
||||
_ol_proj_Projection_.call(this, {
|
||||
code: code,
|
||||
units: _ol_proj_Units_.DEGREES,
|
||||
units: Units.DEGREES,
|
||||
extent: _ol_proj_EPSG4326_.EXTENT,
|
||||
axisOrientation: opt_axisOrientation,
|
||||
global: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/proj/Projection
|
||||
*/
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import Units from '../proj/Units.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -153,7 +153,7 @@ _ol_proj_Projection_.prototype.getUnits = function() {
|
||||
* @api
|
||||
*/
|
||||
_ol_proj_Projection_.prototype.getMetersPerUnit = function() {
|
||||
return this.metersPerUnit_ || _ol_proj_Units_.METERS_PER_UNIT[this.units_];
|
||||
return this.metersPerUnit_ || Units.METERS_PER_UNIT[this.units_];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* `'us-ft'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
var _ol_proj_Units_ = {
|
||||
var Units = {
|
||||
DEGREES: 'degrees',
|
||||
FEET: 'ft',
|
||||
METERS: 'm',
|
||||
@@ -22,11 +22,11 @@ var _ol_proj_Units_ = {
|
||||
* @type {Object.<ol.proj.Units, number>}
|
||||
* @api
|
||||
*/
|
||||
_ol_proj_Units_.METERS_PER_UNIT = {};
|
||||
Units.METERS_PER_UNIT = {};
|
||||
// use the radius of the Normal sphere
|
||||
_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.DEGREES] =
|
||||
Units.METERS_PER_UNIT[Units.DEGREES] =
|
||||
2 * Math.PI * 6370997 / 360;
|
||||
_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.FEET] = 0.3048;
|
||||
_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.METERS] = 1;
|
||||
_ol_proj_Units_.METERS_PER_UNIT[_ol_proj_Units_.USFEET] = 1200 / 3937;
|
||||
export default _ol_proj_Units_;
|
||||
Units.METERS_PER_UNIT[Units.FEET] = 0.3048;
|
||||
Units.METERS_PER_UNIT[Units.METERS] = 1;
|
||||
Units.METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
|
||||
export default Units;
|
||||
|
||||
@@ -11,7 +11,7 @@ import rbush from 'rbush';
|
||||
import {buffer, containsCoordinate, equals, getIntersection, getTopLeft, intersects} from '../../extent.js';
|
||||
import _ol_layer_VectorTileRenderType_ from '../../layer/VectorTileRenderType.js';
|
||||
import {equivalent as equivalentProjection} from '../../proj.js';
|
||||
import _ol_proj_Units_ from '../../proj/Units.js';
|
||||
import Units from '../../proj/Units.js';
|
||||
import ReplayType from '../../render/ReplayType.js';
|
||||
import _ol_render_canvas_ from '../../render/canvas.js';
|
||||
import _ol_render_canvas_ReplayGroup_ from '../../render/canvas/ReplayGroup.js';
|
||||
@@ -226,7 +226,7 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(
|
||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||
feature = features[i];
|
||||
if (reproject) {
|
||||
if (tileProjection.getUnits() == _ol_proj_Units_.TILE_PIXELS) {
|
||||
if (tileProjection.getUnits() == Units.TILE_PIXELS) {
|
||||
// projected tile extent
|
||||
tileProjection.setWorldExtent(sourceTileExtent);
|
||||
// tile extent in tile pixel space
|
||||
|
||||
@@ -7,7 +7,7 @@ import {containsCoordinate, createOrUpdate, getCorner, getHeight, getWidth} from
|
||||
import Corner from './extent/Corner.js';
|
||||
import _ol_obj_ from './obj.js';
|
||||
import {get as getProjection, METERS_PER_UNIT} from './proj.js';
|
||||
import _ol_proj_Units_ from './proj/Units.js';
|
||||
import Units from './proj/Units.js';
|
||||
import TileGrid from './tilegrid/TileGrid.js';
|
||||
var _ol_tilegrid_ = {};
|
||||
|
||||
@@ -150,7 +150,7 @@ _ol_tilegrid_.extentFromProjection = function(projection) {
|
||||
projection = getProjection(projection);
|
||||
var extent = projection.getExtent();
|
||||
if (!extent) {
|
||||
var half = 180 * METERS_PER_UNIT[_ol_proj_Units_.DEGREES] /
|
||||
var half = 180 * METERS_PER_UNIT[Units.DEGREES] /
|
||||
projection.getMetersPerUnit();
|
||||
extent = createOrUpdate(-half, -half, half, half);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user