Merge pull request #7985 from fredj/tilegrid-types
Use path type instead of ol.tilegrid
This commit is contained in:
+3
-3
@@ -165,8 +165,8 @@ export function containsXY(extent, x, y) {
|
|||||||
* Get the relationship between a coordinate and extent.
|
* Get the relationship between a coordinate and extent.
|
||||||
* @param {module:ol/extent~Extent} extent The extent.
|
* @param {module:ol/extent~Extent} extent The extent.
|
||||||
* @param {module:ol/coordinate~Coordinate} coordinate The coordinate.
|
* @param {module:ol/coordinate~Coordinate} coordinate The coordinate.
|
||||||
* @return {number} The relationship (bitwise compare with
|
* @return {module:ol/extent/Relationship~Relationship} The relationship (bitwise compare with
|
||||||
* module:ol/extent~Extent.Relationship).
|
* module:ol/extent/Relationship~Relationship).
|
||||||
*/
|
*/
|
||||||
export function coordinateRelationship(extent, coordinate) {
|
export function coordinateRelationship(extent, coordinate) {
|
||||||
const minX = extent[0];
|
const minX = extent[0];
|
||||||
@@ -478,7 +478,7 @@ export function getCenter(extent) {
|
|||||||
/**
|
/**
|
||||||
* Get a corner coordinate of an extent.
|
* Get a corner coordinate of an extent.
|
||||||
* @param {module:ol/extent~Extent} extent Extent.
|
* @param {module:ol/extent~Extent} extent Extent.
|
||||||
* @param {module:ol/extent~Extent.Corner} corner Corner.
|
* @param {module:ol/extent/Corner~Corner} corner Corner.
|
||||||
* @return {module:ol/coordinate~Coordinate} Corner coordinate.
|
* @return {module:ol/coordinate~Coordinate} Corner coordinate.
|
||||||
*/
|
*/
|
||||||
export function getCorner(extent, corner) {
|
export function getCorner(extent, corner) {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ const Projection = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {module:ol/tilegrid/TileGrid~TileGrid}
|
||||||
*/
|
*/
|
||||||
this.defaultTileGrid_ = null;
|
this.defaultTileGrid_ = null;
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ Projection.prototype.setGlobal = function(global) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {ol.tilegrid.TileGrid} The default tile grid.
|
* @return {module:ol/tilegrid/TileGrid~TileGrid} The default tile grid.
|
||||||
*/
|
*/
|
||||||
Projection.prototype.getDefaultTileGrid = function() {
|
Projection.prototype.getDefaultTileGrid = function() {
|
||||||
return this.defaultTileGrid_;
|
return this.defaultTileGrid_;
|
||||||
@@ -236,7 +236,7 @@ Projection.prototype.getDefaultTileGrid = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.tilegrid.TileGrid} tileGrid The default tile grid.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid The default tile grid.
|
||||||
*/
|
*/
|
||||||
Projection.prototype.setDefaultTileGrid = function(tileGrid) {
|
Projection.prototype.setDefaultTileGrid = function(tileGrid) {
|
||||||
this.defaultTileGrid_ = tileGrid;
|
this.defaultTileGrid_ = tileGrid;
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ LayerRenderer.prototype.updateUsedTiles = function(usedTiles, tileSource, z, til
|
|||||||
* - enqueues missing tiles
|
* - enqueues missing tiles
|
||||||
* @param {module:ol/PluggableMap~FrameState} frameState Frame state.
|
* @param {module:ol/PluggableMap~FrameState} frameState Frame state.
|
||||||
* @param {ol.source.Tile} tileSource Tile source.
|
* @param {ol.source.Tile} tileSource Tile source.
|
||||||
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {module:ol/proj/Projection~Projection} projection Projection.
|
* @param {module:ol/proj/Projection~Projection} projection Projection.
|
||||||
* @param {module:ol/extent~Extent} extent Extent.
|
* @param {module:ol/extent~Extent} extent Extent.
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ import Triangulation from '../reproj/Triangulation.js';
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Tile}
|
* @extends {ol.Tile}
|
||||||
* @param {module:ol/proj/Projection~Projection} sourceProj Source projection.
|
* @param {module:ol/proj/Projection~Projection} sourceProj Source projection.
|
||||||
* @param {ol.tilegrid.TileGrid} sourceTileGrid Source tile grid.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} sourceTileGrid Source tile grid.
|
||||||
* @param {module:ol/proj/Projection~Projection} targetProj Target projection.
|
* @param {module:ol/proj/Projection~Projection} targetProj Target projection.
|
||||||
* @param {ol.tilegrid.TileGrid} targetTileGrid Target tile grid.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} targetTileGrid Target tile grid.
|
||||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Coordinate of the tile.
|
* @param {module:ol/tilecoord~TileCoord} tileCoord Coordinate of the tile.
|
||||||
* @param {module:ol/tilecoord~TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
|
* @param {module:ol/tilecoord~TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
@@ -64,13 +64,13 @@ const ReprojTile = function(sourceProj, sourceTileGrid,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {module:ol/tilegrid/TileGrid~TileGrid}
|
||||||
*/
|
*/
|
||||||
this.sourceTileGrid_ = sourceTileGrid;
|
this.sourceTileGrid_ = sourceTileGrid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {module:ol/tilegrid/TileGrid~TileGrid}
|
||||||
*/
|
*/
|
||||||
this.targetTileGrid_ = targetTileGrid;
|
this.targetTileGrid_ = targetTileGrid;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const TileSource = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {module:ol/tilegrid/TileGrid~TileGrid}
|
||||||
*/
|
*/
|
||||||
this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
|
this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ TileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) {};
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the tile grid of the tile source.
|
* Return the tile grid of the tile source.
|
||||||
* @return {ol.tilegrid.TileGrid} Tile grid.
|
* @return {module:ol/tilegrid/TileGrid~TileGrid} Tile grid.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
TileSource.prototype.getTileGrid = function() {
|
TileSource.prototype.getTileGrid = function() {
|
||||||
@@ -212,7 +212,7 @@ TileSource.prototype.getTileGrid = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/proj/Projection~Projection} projection Projection.
|
* @param {module:ol/proj/Projection~Projection} projection Projection.
|
||||||
* @return {!ol.tilegrid.TileGrid} Tile grid.
|
* @return {!module:ol/tilegrid/TileGrid~TileGrid} Tile grid.
|
||||||
*/
|
*/
|
||||||
TileSource.prototype.getTileGridForProjection = function(projection) {
|
TileSource.prototype.getTileGridForProjection = function(projection) {
|
||||||
if (!this.tileGrid) {
|
if (!this.tileGrid) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const TileImage = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {!Object.<string, ol.tilegrid.TileGrid>}
|
* @type {!Object.<string, module:ol/tilegrid/TileGrid~TileGrid>}
|
||||||
*/
|
*/
|
||||||
this.tileGridForProjection = {};
|
this.tileGridForProjection = {};
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ TileImage.prototype.getTileGridForProjection = function(projection) {
|
|||||||
if (!(projKey in this.tileGridForProjection)) {
|
if (!(projKey in this.tileGridForProjection)) {
|
||||||
this.tileGridForProjection[projKey] = getTileGridForProjection(projection);
|
this.tileGridForProjection[projKey] = getTileGridForProjection(projection);
|
||||||
}
|
}
|
||||||
return /** @type {!ol.tilegrid.TileGrid} */ (this.tileGridForProjection[projKey]);
|
return /** @type {!module:ol/tilegrid/TileGrid~TileGrid} */ (this.tileGridForProjection[projKey]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ TileImage.prototype.setRenderReprojectionEdges = function(render) {
|
|||||||
* for optimization reasons (custom tile size, resolutions, ...).
|
* for optimization reasons (custom tile size, resolutions, ...).
|
||||||
*
|
*
|
||||||
* @param {module:ol/proj~ProjectionLike} projection Projection.
|
* @param {module:ol/proj~ProjectionLike} projection Projection.
|
||||||
* @param {ol.tilegrid.TileGrid} tilegrid Tile grid to use for the projection.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} tilegrid Tile grid to use for the projection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
TileImage.prototype.setTileGridForProjection = function(projection, tilegrid) {
|
TileImage.prototype.setTileGridForProjection = function(projection, tilegrid) {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ const VectorTileSource = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Object.<string,ol.tilegrid.TileGrid>}
|
* @type {Object.<string, module:ol/tilegrid/TileGrid~TileGrid>}
|
||||||
*/
|
*/
|
||||||
this.tileGrids_ = {};
|
this.tileGrids_ = {};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const TierSizeCalculation = {
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.ImageTile}
|
* @extends {ol.ImageTile}
|
||||||
* @param {ol.tilegrid.TileGrid} tileGrid TileGrid that the tile belongs to.
|
* @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid TileGrid that the tile belongs to.
|
||||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.TileState} state State.
|
* @param {ol.TileState} state State.
|
||||||
* @param {string} src Image source URI.
|
* @param {string} src Image source URI.
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ export function quadKey(tileCoord) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {!module:ol/tilegrid~TileGrid} tileGrid Tile grid.
|
* @param {!module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid.
|
||||||
* @return {boolean} Tile coordinate is within extent and zoom level range.
|
* @return {boolean} Tile coordinate is within extent and zoom level range.
|
||||||
*/
|
*/
|
||||||
export function withinExtentAndZ(tileCoord, tileGrid) {
|
export function withinExtentAndZ(tileCoord, tileGrid) {
|
||||||
|
|||||||
+5
-10
@@ -53,15 +53,13 @@ export function wrapX(tileGrid, tileCoord, projection) {
|
|||||||
* DEFAULT_MAX_ZOOM).
|
* DEFAULT_MAX_ZOOM).
|
||||||
* @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses
|
* @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses
|
||||||
* DEFAULT_TILE_SIZE).
|
* DEFAULT_TILE_SIZE).
|
||||||
* @param {module:ol/extent~Extent.Corner=} opt_corner Extent corner (default is
|
* @param {module:ol/extent/Corner~Corner=} opt_corner Extent corner (default is `'top-left'`).
|
||||||
* module:ol/extent~Extent.Corner.TOP_LEFT).
|
|
||||||
* @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance.
|
* @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance.
|
||||||
*/
|
*/
|
||||||
export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
|
export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||||
const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT;
|
const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT;
|
||||||
|
|
||||||
const resolutions = resolutionsFromExtent(
|
const resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize);
|
||||||
extent, opt_maxZoom, opt_tileSize);
|
|
||||||
|
|
||||||
return new TileGrid({
|
return new TileGrid({
|
||||||
extent: extent,
|
extent: extent,
|
||||||
@@ -129,14 +127,12 @@ function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize) {
|
|||||||
* DEFAULT_MAX_ZOOM).
|
* DEFAULT_MAX_ZOOM).
|
||||||
* @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses
|
* @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses
|
||||||
* DEFAULT_TILE_SIZE).
|
* DEFAULT_TILE_SIZE).
|
||||||
* @param {module:ol/extent~Extent.Corner=} opt_corner Extent corner (default is
|
* @param {module:ol/extent/Corner~Corner=} opt_corner Extent corner (default is `'top-left'`).
|
||||||
* module:ol/extent~Extent.Corner.BOTTOM_LEFT).
|
|
||||||
* @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance.
|
* @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance.
|
||||||
*/
|
*/
|
||||||
export function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) {
|
export function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||||
const extent = extentFromProjection(projection);
|
const extent = extentFromProjection(projection);
|
||||||
return createForExtent(
|
return createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner);
|
||||||
extent, opt_maxZoom, opt_tileSize, opt_corner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,8 +146,7 @@ export function extentFromProjection(projection) {
|
|||||||
projection = getProjection(projection);
|
projection = getProjection(projection);
|
||||||
let extent = projection.getExtent();
|
let extent = projection.getExtent();
|
||||||
if (!extent) {
|
if (!extent) {
|
||||||
const half = 180 * METERS_PER_UNIT[Units.DEGREES] /
|
const half = 180 * METERS_PER_UNIT[Units.DEGREES] / projection.getMetersPerUnit();
|
||||||
projection.getMetersPerUnit();
|
|
||||||
extent = createOrUpdate(-half, -half, half, half);
|
extent = createOrUpdate(-half, -half, half, half);
|
||||||
}
|
}
|
||||||
return extent;
|
return extent;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import TileGrid from '../tilegrid/TileGrid.js';
|
|||||||
* Set the grid pattern for sources accessing WMTS tiled-image servers.
|
* Set the grid pattern for sources accessing WMTS tiled-image servers.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.tilegrid.TileGrid}
|
* @extends {module:ol/tilegrid/TileGrid~TileGrid}
|
||||||
* @param {olx.tilegrid.WMTSOptions} options WMTS options.
|
* @param {olx.tilegrid.WMTSOptions} options WMTS options.
|
||||||
* @struct
|
* @struct
|
||||||
* @api
|
* @api
|
||||||
@@ -67,7 +67,7 @@ export default WMTSTileGrid;
|
|||||||
* ranges the server provides.
|
* ranges the server provides.
|
||||||
* @param {Array.<Object>=} opt_matrixLimits An optional object representing
|
* @param {Array.<Object>=} opt_matrixLimits An optional object representing
|
||||||
* the available matrices for tileGrid.
|
* the available matrices for tileGrid.
|
||||||
* @return {ol.tilegrid.WMTS} WMTS tileGrid instance.
|
* @return {module:ol/tilegrid/WMTS~WMTSTileGrid} WMTS tileGrid instance.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export function createFromCapabilitiesMatrixSet(matrixSet, opt_extent, opt_matrixLimits) {
|
export function createFromCapabilitiesMatrixSet(matrixSet, opt_extent, opt_matrixLimits) {
|
||||||
|
|||||||
Reference in New Issue
Block a user