diff --git a/src/ol/index.js b/src/ol/index.js index e5e1c70048..d2924a56a8 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -11,13 +11,6 @@ import webgl from './webgl.js'; export var DEFAULT_WMS_VERSION = '1.3.0'; -/** - * @type {boolean} Enable integration with the Proj4js library. Default is - * `true`. - */ -export var ENABLE_PROJ4JS = true; - - /** * @type {boolean} Enable automatic reprojection of raster sources. Default is * `true`. @@ -143,7 +136,6 @@ export default { inherits: inherits, VERSION: VERSION, DEFAULT_WMS_VERSION: DEFAULT_WMS_VERSION, - ENABLE_PROJ4JS: ENABLE_PROJ4JS, ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION, DEBUG_WEBGL: DEBUG_WEBGL, HAS_WEBGL: HAS_WEBGL, diff --git a/src/ol/proj.js b/src/ol/proj.js index d28c2616d1..dd5a47e98f 100644 --- a/src/ol/proj.js +++ b/src/ol/proj.js @@ -1,7 +1,6 @@ /** * @module ol/proj */ -import {ENABLE_PROJ4JS} from './index.js'; import _ol_Sphere_ from './Sphere.js'; import _ol_extent_ from './extent.js'; import _ol_math_ from './math.js'; @@ -32,23 +31,21 @@ _ol_proj_.METERS_PER_UNIT = _ol_proj_Units_.METERS_PER_UNIT; _ol_proj_.SPHERE_ = new _ol_Sphere_(_ol_Sphere_.DEFAULT_RADIUS); -if (ENABLE_PROJ4JS) { - /** - * Register proj4. If not explicitly registered, it will be assumed that - * proj4js will be loaded in the global namespace. For example in a - * browserify ES6 environment you could use: - * - * import ol from 'openlayers'; - * import proj4 from 'proj4'; - * ol.proj.setProj4(proj4); - * - * @param {Proj4} proj4 Proj4. - * @api - */ - _ol_proj_.setProj4 = function(proj4) { - _ol_proj_proj4_.set(proj4); - }; -} +/** + * Register proj4. If not explicitly registered, it will be assumed that + * proj4js will be loaded in the global namespace. For example in a + * browserify ES6 environment you could use: + * + * import ol from 'openlayers'; + * import proj4 from 'proj4'; + * ol.proj.setProj4(proj4); + * + * @param {Proj4} proj4 Proj4. + * @api + */ +_ol_proj_.setProj4 = function(proj4) { + _ol_proj_proj4_.set(proj4); +}; /** @@ -311,7 +308,7 @@ _ol_proj_.get = function(projectionLike) { } else if (typeof projectionLike === 'string') { var code = projectionLike; projection = _ol_proj_projections_.get(code); - if (ENABLE_PROJ4JS && !projection) { + if (!projection) { var proj4js = _ol_proj_proj4_.get(); if (typeof proj4js == 'function' && proj4js.defs(code) !== undefined) { @@ -380,7 +377,7 @@ _ol_proj_.getTransformFromProjections = function(sourceProjection, destinationPr var sourceCode = sourceProjection.getCode(); var destinationCode = destinationProjection.getCode(); var transform = _ol_proj_transforms_.get(sourceCode, destinationCode); - if (ENABLE_PROJ4JS && !transform) { + if (!transform) { var proj4js = _ol_proj_proj4_.get(); if (typeof proj4js == 'function') { var sourceDef = proj4js.defs(sourceCode); diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 6a08d1a8ac..6e925544ed 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -1,7 +1,6 @@ /** * @module ol/proj/Projection */ -import {ENABLE_PROJ4JS} from '../index.js'; import _ol_proj_Units_ from '../proj/Units.js'; import _ol_proj_proj4_ from '../proj/proj4.js'; @@ -108,20 +107,18 @@ var _ol_proj_Projection_ = function(options) { this.metersPerUnit_ = options.metersPerUnit; var code = options.code; - if (ENABLE_PROJ4JS) { - var proj4js = _ol_proj_proj4_.get(); - if (typeof proj4js == 'function') { - var def = proj4js.defs(code); - if (def !== undefined) { - if (def.axis !== undefined && options.axisOrientation === undefined) { - this.axisOrientation_ = def.axis; - } - if (options.metersPerUnit === undefined) { - this.metersPerUnit_ = def.to_meter; - } - if (options.units === undefined) { - this.units_ = def.units; - } + var proj4js = _ol_proj_proj4_.get(); + if (typeof proj4js == 'function') { + var def = proj4js.defs(code); + if (def !== undefined) { + if (def.axis !== undefined && options.axisOrientation === undefined) { + this.axisOrientation_ = def.axis; + } + if (options.metersPerUnit === undefined) { + this.metersPerUnit_ = def.to_meter; + } + if (options.units === undefined) { + this.units_ = def.units; } } }