Merge pull request #7800 from tschaub/named-exports

More named exports
This commit is contained in:
Tim Schaub
2018-02-09 21:43:24 -07:00
committed by GitHub
55 changed files with 427 additions and 473 deletions

View File

@@ -9,7 +9,7 @@ import {get as getProjection, getTransformFromProjections} from '../proj.js';
import SourceState from '../source/State.js';
import TileImage from '../source/TileImage.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -129,10 +129,10 @@ BingMaps.prototype.handleImageryMetadataResponse = function(response) {
const maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
const sourceProjection = this.getProjection();
const extent = _ol_tilegrid_.extentFromProjection(sourceProjection);
const extent = extentFromProjection(sourceProjection);
const tileSize = resource.imageWidth == resource.imageHeight ?
resource.imageWidth : [resource.imageWidth, resource.imageHeight];
const tileGrid = _ol_tilegrid_.createXYZ({
const tileGrid = createXYZ({
extent: extent,
minZoom: resource.zoomMin,
maxZoom: maxZoom,

View File

@@ -5,7 +5,7 @@
import {getUid, inherits} from '../index.js';
import {assert} from '../asserts.js';
import Feature from '../Feature.js';
import _ol_coordinate_ from '../coordinate.js';
import {scale as scaleCoordinate, add as addCoordinate} from '../coordinate.js';
import EventType from '../events/EventType.js';
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
import Point from '../geom/Point.js';
@@ -184,12 +184,12 @@ Cluster.prototype.createCluster = function(features) {
for (let i = features.length - 1; i >= 0; --i) {
const geometry = this.geometryFunction(features[i]);
if (geometry) {
_ol_coordinate_.add(centroid, geometry.getCoordinates());
addCoordinate(centroid, geometry.getCoordinates());
} else {
features.splice(i, 1);
}
}
_ol_coordinate_.scale(centroid, 1 / features.length);
scaleCoordinate(centroid, 1 / features.length);
const cluster = new Feature(new Point(centroid));
cluster.set('features', features);

View File

@@ -11,7 +11,7 @@ import EventType from '../events/EventType.js';
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
import {assign} from '../obj.js';
import {get as getProjection, transform} from '../proj.js';
import _ol_reproj_ from '../reproj.js';
import {calculateSourceResolution} from '../reproj.js';
import ImageSource from '../source/Image.js';
import WMSServerType from '../source/WMSServerType.js';
import {compareVersions} from '../string.js';
@@ -141,7 +141,7 @@ ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, proje
const sourceProjectionObj = this.getProjection();
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
resolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
resolution = calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
}

View File

@@ -9,7 +9,7 @@ import {equivalent} from '../proj.js';
import {toSize, scale as scaleSize} from '../size.js';
import Source from '../source/Source.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -215,7 +215,7 @@ TileSource.prototype.getTileGrid = function() {
*/
TileSource.prototype.getTileGridForProjection = function(projection) {
if (!this.tileGrid) {
return _ol_tilegrid_.getForProjection(projection);
return getTileGridForProjection(projection);
} else {
return this.tileGrid;
}
@@ -281,7 +281,7 @@ TileSource.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_pr
opt_projection : this.getProjection();
const tileGrid = this.getTileGridForProjection(projection);
if (this.getWrapX() && projection.isGlobal()) {
tileCoord = _ol_tilegrid_.wrapX(tileGrid, tileCoord, projection);
tileCoord = wrapX(tileGrid, tileCoord, projection);
}
return _ol_tilecoord_.withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
};

View File

@@ -12,7 +12,7 @@ import {equivalent, get as getProjection} from '../proj.js';
import ReprojTile from '../reproj/Tile.js';
import UrlTile from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -174,7 +174,7 @@ TileImage.prototype.getTileGridForProjection = function(projection) {
const projKey = getUid(projection).toString();
if (!(projKey in this.tileGridForProjection)) {
this.tileGridForProjection[projKey] =
_ol_tilegrid_.getForProjection(projection);
getTileGridForProjection(projection);
}
return /** @type {!ol.tilegrid.TileGrid} */ (this.tileGridForProjection[projKey]);
}

View File

@@ -15,7 +15,7 @@ import {jsonp as requestJSONP} from '../net.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js';
import SourceState from '../source/State.js';
import TileImage from '../source/TileImage.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -126,8 +126,8 @@ TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
const minZoom = tileJSON.minzoom || 0;
const maxZoom = tileJSON.maxzoom || 22;
const tileGrid = _ol_tilegrid_.createXYZ({
extent: _ol_tilegrid_.extentFromProjection(sourceProjection),
const tileGrid = createXYZ({
extent: extentFromProjection(sourceProjection),
maxZoom: maxZoom,
minZoom: minZoom
});

View File

@@ -14,7 +14,7 @@ import {get as getProjection, getTransformFromProjections} from '../proj.js';
import SourceState from '../source/State.js';
import TileSource from '../source/Tile.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -176,8 +176,8 @@ UTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
const minZoom = tileJSON.minzoom || 0;
const maxZoom = tileJSON.maxzoom || 22;
const tileGrid = _ol_tilegrid_.createXYZ({
extent: _ol_tilegrid_.extentFromProjection(sourceProjection),
const tileGrid = createXYZ({
extent: extentFromProjection(sourceProjection),
maxZoom: maxZoom,
minZoom: minZoom
});

View File

@@ -9,7 +9,7 @@ import {buffer, createEmpty} from '../extent.js';
import {assign} from '../obj.js';
import {modulo} from '../math.js';
import {get as getProjection, transform, transformExtent} from '../proj.js';
import _ol_reproj_ from '../reproj.js';
import {calculateSourceResolution} from '../reproj.js';
import {toSize, buffer as bufferSize, scale as scaleSize} from '../size.js';
import TileImage from '../source/TileImage.js';
import WMSServerType from '../source/WMSServerType.js';
@@ -135,7 +135,7 @@ TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projec
}
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
tileResolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, tileResolution);
tileResolution = calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, tileResolution);
tileExtent = transformExtent(tileExtent, projectionObj, sourceProjectionObj);
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
}

View File

@@ -8,7 +8,7 @@ import VectorTile from '../VectorTile.js';
import {toSize} from '../size.js';
import UrlTile from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -29,9 +29,9 @@ import _ol_tilegrid_ from '../tilegrid.js';
const VectorTileSource = function(options) {
const projection = options.projection || 'EPSG:3857';
const extent = options.extent || _ol_tilegrid_.extentFromProjection(projection);
const extent = options.extent || extentFromProjection(projection);
const tileGrid = options.tileGrid || _ol_tilegrid_.createXYZ({
const tileGrid = options.tileGrid || createXYZ({
extent: extent,
maxZoom: options.maxZoom || 22,
minZoom: options.minZoom,
@@ -143,7 +143,7 @@ VectorTileSource.prototype.getTileGridForProjection = function(projection) {
// A tile grid that matches the tile size of the source tile grid is more
// likely to have 1:1 relationships between source tiles and rendered tiles.
const sourceTileGrid = this.tileGrid;
tileGrid = this.tileGrids_[code] = _ol_tilegrid_.createForProjection(projection, undefined,
tileGrid = this.tileGrids_[code] = createForProjection(projection, undefined,
sourceTileGrid ? sourceTileGrid.getTileSize(sourceTileGrid.getMinZoom()) : undefined);
}
return tileGrid;

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import TileImage from '../source/TileImage.js';
import _ol_tilegrid_ from '../tilegrid.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @classdesc
@@ -33,8 +33,8 @@ const XYZ = function(opt_options) {
options.projection : 'EPSG:3857';
const tileGrid = options.tileGrid !== undefined ? options.tileGrid :
_ol_tilegrid_.createXYZ({
extent: _ol_tilegrid_.extentFromProjection(projection),
createXYZ({
extent: extentFromProjection(projection),
maxZoom: options.maxZoom,
minZoom: options.minZoom,
tileSize: options.tileSize