Remove ENABLE_PROJ4JS

This commit is contained in:
Tim Schaub
2017-12-12 17:26:01 -07:00
parent 9e34c145c3
commit ee5507cae8
3 changed files with 29 additions and 43 deletions

View File

@@ -11,13 +11,6 @@ import webgl from './webgl.js';
export var DEFAULT_WMS_VERSION = '1.3.0'; 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 * @type {boolean} Enable automatic reprojection of raster sources. Default is
* `true`. * `true`.
@@ -143,7 +136,6 @@ export default {
inherits: inherits, inherits: inherits,
VERSION: VERSION, VERSION: VERSION,
DEFAULT_WMS_VERSION: DEFAULT_WMS_VERSION, DEFAULT_WMS_VERSION: DEFAULT_WMS_VERSION,
ENABLE_PROJ4JS: ENABLE_PROJ4JS,
ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION, ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION,
DEBUG_WEBGL: DEBUG_WEBGL, DEBUG_WEBGL: DEBUG_WEBGL,
HAS_WEBGL: HAS_WEBGL, HAS_WEBGL: HAS_WEBGL,

View File

@@ -1,7 +1,6 @@
/** /**
* @module ol/proj * @module ol/proj
*/ */
import {ENABLE_PROJ4JS} from './index.js';
import _ol_Sphere_ from './Sphere.js'; import _ol_Sphere_ from './Sphere.js';
import _ol_extent_ from './extent.js'; import _ol_extent_ from './extent.js';
import _ol_math_ from './math.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); _ol_proj_.SPHERE_ = new _ol_Sphere_(_ol_Sphere_.DEFAULT_RADIUS);
if (ENABLE_PROJ4JS) { /**
/** * Register proj4. If not explicitly registered, it will be assumed that
* Register proj4. If not explicitly registered, it will be assumed that * proj4js will be loaded in the global namespace. For example in a
* proj4js will be loaded in the global namespace. For example in a * browserify ES6 environment you could use:
* browserify ES6 environment you could use: *
* * import ol from 'openlayers';
* import ol from 'openlayers'; * import proj4 from 'proj4';
* import proj4 from 'proj4'; * ol.proj.setProj4(proj4);
* ol.proj.setProj4(proj4); *
* * @param {Proj4} proj4 Proj4.
* @param {Proj4} proj4 Proj4. * @api
* @api */
*/ _ol_proj_.setProj4 = function(proj4) {
_ol_proj_.setProj4 = function(proj4) { _ol_proj_proj4_.set(proj4);
_ol_proj_proj4_.set(proj4); };
};
}
/** /**
@@ -311,7 +308,7 @@ _ol_proj_.get = function(projectionLike) {
} else if (typeof projectionLike === 'string') { } else if (typeof projectionLike === 'string') {
var code = projectionLike; var code = projectionLike;
projection = _ol_proj_projections_.get(code); projection = _ol_proj_projections_.get(code);
if (ENABLE_PROJ4JS && !projection) { if (!projection) {
var proj4js = _ol_proj_proj4_.get(); var proj4js = _ol_proj_proj4_.get();
if (typeof proj4js == 'function' && if (typeof proj4js == 'function' &&
proj4js.defs(code) !== undefined) { proj4js.defs(code) !== undefined) {
@@ -380,7 +377,7 @@ _ol_proj_.getTransformFromProjections = function(sourceProjection, destinationPr
var sourceCode = sourceProjection.getCode(); var sourceCode = sourceProjection.getCode();
var destinationCode = destinationProjection.getCode(); var destinationCode = destinationProjection.getCode();
var transform = _ol_proj_transforms_.get(sourceCode, destinationCode); var transform = _ol_proj_transforms_.get(sourceCode, destinationCode);
if (ENABLE_PROJ4JS && !transform) { if (!transform) {
var proj4js = _ol_proj_proj4_.get(); var proj4js = _ol_proj_proj4_.get();
if (typeof proj4js == 'function') { if (typeof proj4js == 'function') {
var sourceDef = proj4js.defs(sourceCode); var sourceDef = proj4js.defs(sourceCode);

View File

@@ -1,7 +1,6 @@
/** /**
* @module ol/proj/Projection * @module ol/proj/Projection
*/ */
import {ENABLE_PROJ4JS} from '../index.js';
import _ol_proj_Units_ from '../proj/Units.js'; import _ol_proj_Units_ from '../proj/Units.js';
import _ol_proj_proj4_ from '../proj/proj4.js'; import _ol_proj_proj4_ from '../proj/proj4.js';
@@ -108,20 +107,18 @@ var _ol_proj_Projection_ = function(options) {
this.metersPerUnit_ = options.metersPerUnit; this.metersPerUnit_ = options.metersPerUnit;
var code = options.code; var code = options.code;
if (ENABLE_PROJ4JS) { var proj4js = _ol_proj_proj4_.get();
var proj4js = _ol_proj_proj4_.get(); if (typeof proj4js == 'function') {
if (typeof proj4js == 'function') { var def = proj4js.defs(code);
var def = proj4js.defs(code); if (def !== undefined) {
if (def !== undefined) { if (def.axis !== undefined && options.axisOrientation === undefined) {
if (def.axis !== undefined && options.axisOrientation === undefined) { this.axisOrientation_ = def.axis;
this.axisOrientation_ = def.axis; }
} if (options.metersPerUnit === undefined) {
if (options.metersPerUnit === undefined) { this.metersPerUnit_ = def.to_meter;
this.metersPerUnit_ = def.to_meter; }
} if (options.units === undefined) {
if (options.units === undefined) { this.units_ = def.units;
this.units_ = def.units;
}
} }
} }
} }