Named exports from ol/proj

This commit is contained in:
Tim Schaub
2017-12-13 22:14:27 -07:00
committed by Andreas Hocevar
parent fab77e8d37
commit 6f72ffe498
127 changed files with 853 additions and 882 deletions

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -32,7 +32,7 @@ var _ol_source_BingMaps_ = function(options) {
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
opaque: true,
projection: _ol_proj_.get('EPSG:3857'),
projection: getProjection('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: _ol_source_State_.LOADING,
tileLoadFunction: options.tileLoadFunction,
@@ -178,8 +178,8 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
}));
if (resource.imageryProviders) {
var transform = _ol_proj_.getTransformFromProjections(
_ol_proj_.get('EPSG:4326'), this.getProjection());
var transform = getTransformFromProjections(
getProjection('EPSG:4326'), this.getProjection());
this.setAttributions(function(frameState) {
var attributions = [];

View File

@@ -7,7 +7,7 @@ import _ol_ImageState_ from '../ImageState.js';
import _ol_array_ from '../array.js';
import _ol_events_Event_ from '../events/Event.js';
import {equals} from '../extent.js';
import _ol_proj_ from '../proj.js';
import {equivalent} from '../proj.js';
import _ol_reproj_Image_ from '../reproj/Image.js';
import _ol_source_Source_ from '../source/Source.js';
@@ -92,7 +92,7 @@ _ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio,
if (!ENABLE_RASTER_REPROJECTION ||
!sourceProjection ||
!projection ||
_ol_proj_.equivalent(sourceProjection, projection)) {
equivalent(sourceProjection, projection)) {
if (sourceProjection) {
projection = sourceProjection;
}
@@ -100,7 +100,7 @@ _ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio,
} else {
if (this.reprojectedImage_) {
if (this.reprojectedRevision_ == this.getRevision() &&
_ol_proj_.equivalent(
equivalent(
this.reprojectedImage_.getProjection(), projection) &&
this.reprojectedImage_.getResolution() == resolution &&
equals(this.reprojectedImage_.getExtent(), extent)) {

View File

@@ -8,7 +8,7 @@ import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import {intersects, getHeight, getWidth} from '../extent.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection} from '../proj.js';
import _ol_source_Image_ from '../source/Image.js';
/**
@@ -33,7 +33,7 @@ var _ol_source_ImageStatic_ = function(options) {
_ol_source_Image_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: _ol_proj_.get(options.projection)
projection: getProjection(options.projection)
});
/**

View File

@@ -10,7 +10,7 @@ import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, transform} from '../proj.js';
import _ol_reproj_ from '../reproj.js';
import _ol_source_Image_ from '../source/Image.js';
import _ol_source_WMSServerType_ from '../source/WMSServerType.js';
@@ -138,12 +138,12 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol
if (this.url_ === undefined) {
return undefined;
}
var projectionObj = _ol_proj_.get(projection);
var projectionObj = getProjection(projection);
var sourceProjectionObj = this.getProjection();
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
resolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
coordinate = _ol_proj_.transform(coordinate, projectionObj, sourceProjectionObj);
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
}
var extent = getForViewAndSize(coordinate, resolution, 0,

View File

@@ -3,7 +3,7 @@
*/
import {inherits, nullFunction} from '../index.js';
import _ol_Object_ from '../Object.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection} from '../proj.js';
import _ol_source_State_ from '../source/State.js';
/**
@@ -28,7 +28,7 @@ var _ol_source_Source_ = function(options) {
* @private
* @type {ol.proj.Projection}
*/
this.projection_ = _ol_proj_.get(options.projection);
this.projection_ = getProjection(options.projection);
/**
* @private

View File

@@ -5,7 +5,7 @@ import {inherits, nullFunction} from '../index.js';
import _ol_TileCache_ from '../TileCache.js';
import _ol_TileState_ from '../TileState.js';
import _ol_events_Event_ from '../events/Event.js';
import _ol_proj_ from '../proj.js';
import {equivalent} from '../proj.js';
import _ol_size_ from '../size.js';
import _ol_source_Source_ from '../source/Source.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -230,7 +230,7 @@ _ol_source_Tile_.prototype.getTileGridForProjection = function(projection) {
*/
_ol_source_Tile_.prototype.getTileCacheForProjection = function(projection) {
var thisProj = this.getProjection();
if (thisProj && !_ol_proj_.equivalent(thisProj, projection)) {
if (thisProj && !equivalent(thisProj, projection)) {
return null;
} else {
return this.tileCache;

View File

@@ -8,7 +8,7 @@ import _ol_TileCache_ from '../TileCache.js';
import _ol_TileState_ from '../TileState.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_proj_ from '../proj.js';
import {equivalent, get as getProjection} from '../proj.js';
import _ol_reproj_Tile_ from '../reproj/Tile.js';
import _ol_source_UrlTile_ from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -131,8 +131,7 @@ _ol_source_TileImage_.prototype.expireCache = function(projection, usedTiles) {
*/
_ol_source_TileImage_.prototype.getGutter = function(projection) {
if (ENABLE_RASTER_REPROJECTION &&
this.getProjection() && projection &&
!_ol_proj_.equivalent(this.getProjection(), projection)) {
this.getProjection() && projection && !equivalent(this.getProjection(), projection)) {
return 0;
} else {
return this.getGutterInternal();
@@ -154,8 +153,7 @@ _ol_source_TileImage_.prototype.getGutterInternal = function() {
*/
_ol_source_TileImage_.prototype.getOpaque = function(projection) {
if (ENABLE_RASTER_REPROJECTION &&
this.getProjection() && projection &&
!_ol_proj_.equivalent(this.getProjection(), projection)) {
this.getProjection() && projection && !equivalent(this.getProjection(), projection)) {
return false;
} else {
return _ol_source_UrlTile_.prototype.getOpaque.call(this, projection);
@@ -171,8 +169,7 @@ _ol_source_TileImage_.prototype.getTileGridForProjection = function(projection)
return _ol_source_UrlTile_.prototype.getTileGridForProjection.call(this, projection);
}
var thisProj = this.getProjection();
if (this.tileGrid &&
(!thisProj || _ol_proj_.equivalent(thisProj, projection))) {
if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {
return this.tileGrid;
} else {
var projKey = getUid(projection).toString();
@@ -192,8 +189,7 @@ _ol_source_TileImage_.prototype.getTileCacheForProjection = function(projection)
if (!ENABLE_RASTER_REPROJECTION) {
return _ol_source_UrlTile_.prototype.getTileCacheForProjection.call(this, projection);
}
var thisProj = this.getProjection();
if (!thisProj || _ol_proj_.equivalent(thisProj, projection)) {
var thisProj = this.getProjection(); if (!thisProj || equivalent(thisProj, projection)) {
return this.tileCache;
} else {
var projKey = getUid(projection).toString();
@@ -241,8 +237,7 @@ _ol_source_TileImage_.prototype.createTile_ = function(z, x, y, pixelRatio, proj
_ol_source_TileImage_.prototype.getTile = function(z, x, y, pixelRatio, projection) {
var sourceProjection = /** @type {!ol.proj.Projection} */ (this.getProjection());
if (!ENABLE_RASTER_REPROJECTION ||
!sourceProjection || !projection ||
_ol_proj_.equivalent(sourceProjection, projection)) {
!sourceProjection || !projection || equivalent(sourceProjection, projection)) {
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection);
} else {
var cache = this.getTileCacheForProjection(projection);
@@ -356,7 +351,7 @@ _ol_source_TileImage_.prototype.setRenderReprojectionEdges = function(render) {
*/
_ol_source_TileImage_.prototype.setTileGridForProjection = function(projection, tilegrid) {
if (ENABLE_RASTER_REPROJECTION) {
var proj = _ol_proj_.get(projection);
var proj = getProjection(projection);
if (proj) {
var projKey = getUid(proj).toString();
if (!(projKey in this.tileGridForProjection)) {

View File

@@ -12,7 +12,7 @@ import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
import _ol_asserts_ from '../asserts.js';
import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_tilegrid_ from '../tilegrid.js';
@@ -38,7 +38,7 @@ var _ol_source_TileJSON_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
projection: _ol_proj_.get('EPSG:3857'),
projection: getProjection('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: _ol_source_State_.LOADING,
tileLoadFunction: options.tileLoadFunction,
@@ -114,12 +114,12 @@ _ol_source_TileJSON_.prototype.getTileJSON = function() {
*/
_ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) {
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
var epsg4326Projection = getProjection('EPSG:4326');
var sourceProjection = this.getProjection();
var extent;
if (tileJSON.bounds !== undefined) {
var transform = _ol_proj_.getTransformFromProjections(
var transform = getTransformFromProjections(
epsg4326Projection, sourceProjection);
extent = applyTransform(tileJSON.bounds, transform);
}

View File

@@ -10,7 +10,7 @@ import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -27,7 +27,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
*/
var _ol_source_TileUTFGrid_ = function(options) {
_ol_source_Tile_.call(this, {
projection: _ol_proj_.get('EPSG:3857'),
projection: getProjection('EPSG:3857'),
state: _ol_source_State_.LOADING
});
@@ -166,12 +166,12 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONError = function() {
*/
_ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) {
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
var epsg4326Projection = getProjection('EPSG:4326');
var sourceProjection = this.getProjection();
var extent;
if (tileJSON.bounds !== undefined) {
var transform = _ol_proj_.getTransformFromProjections(
var transform = getTransformFromProjections(
epsg4326Projection, sourceProjection);
extent = applyTransform(tileJSON.bounds, transform);
}

View File

@@ -8,7 +8,7 @@ import _ol_asserts_ from '../asserts.js';
import {buffer, createEmpty} from '../extent.js';
import _ol_obj_ from '../obj.js';
import _ol_math_ from '../math.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, transform, transformExtent} from '../proj.js';
import _ol_reproj_ from '../reproj.js';
import _ol_size_ from '../size.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
@@ -110,7 +110,7 @@ inherits(_ol_source_TileWMS_, _ol_source_TileImage_);
* @api
*/
_ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
var projectionObj = _ol_proj_.get(projection);
var projectionObj = getProjection(projection);
var sourceProjectionObj = this.getProjection();
var tileGrid = this.getTileGrid();
@@ -137,8 +137,8 @@ _ol_source_TileWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolu
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
tileResolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, tileResolution);
tileExtent = _ol_proj_.transformExtent(tileExtent, projectionObj, sourceProjectionObj);
coordinate = _ol_proj_.transform(coordinate, projectionObj, sourceProjectionObj);
tileExtent = transformExtent(tileExtent, projectionObj, sourceProjectionObj);
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
}
var baseParams = {

View File

@@ -6,7 +6,7 @@ import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
import _ol_array_ from '../array.js';
import {containsExtent} from '../extent.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import {get as getProjection, equivalent, transformExtent} from '../proj.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_source_WMTSRequestEncoding_ from '../source/WMTSRequestEncoding.js';
import _ol_tilegrid_WMTS_ from '../tilegrid/WMTS.js';
@@ -330,11 +330,11 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
return el['Identifier'] == elt['TileMatrixSet'];
});
var supportedCRS = tileMatrixSet['SupportedCRS'];
var proj1 = _ol_proj_.get(supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
_ol_proj_.get(supportedCRS);
var proj2 = _ol_proj_.get(config['projection']);
var proj1 = getProjection(supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
getProjection(supportedCRS);
var proj2 = getProjection(config['projection']);
if (proj1 && proj2) {
return _ol_proj_.equivalent(proj1, proj2);
return equivalent(proj1, proj2);
} else {
return supportedCRS == config['projection'];
}
@@ -392,13 +392,13 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
var projection;
var code = matrixSetObj['SupportedCRS'];
if (code) {
projection = _ol_proj_.get(code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
_ol_proj_.get(code);
projection = getProjection(code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
getProjection(code);
}
if ('projection' in config) {
var projConfig = _ol_proj_.get(config['projection']);
var projConfig = getProjection(config['projection']);
if (projConfig) {
if (!projection || _ol_proj_.equivalent(projConfig, projection)) {
if (!projection || equivalent(projConfig, projection)) {
projection = projConfig;
}
}
@@ -407,10 +407,10 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
var wgs84BoundingBox = l['WGS84BoundingBox'];
var extent, wrapX;
if (wgs84BoundingBox !== undefined) {
var wgs84ProjectionExtent = _ol_proj_.get('EPSG:4326').getExtent();
var wgs84ProjectionExtent = getProjection('EPSG:4326').getExtent();
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);
extent = _ol_proj_.transformExtent(
extent = transformExtent(
wgs84BoundingBox, 'EPSG:4326', projection);
var projectionExtent = projection.getExtent();
if (projectionExtent) {