Order functions alphabetically
This commit is contained in:
@@ -103,32 +103,6 @@ ol.TileGrid.prototype.getExtent = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} z Z.
|
||||
* @return {ol.TileBounds} Tile bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileBoundsForExtentAndZ = function(extent, z) {
|
||||
var resolution = this.getResolution(z);
|
||||
return this.getTileBoundsForExtentAndResolution(extent, resolution);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {ol.TileBounds} Tile bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileBoundsForExtentAndResolution = function(
|
||||
extent, resolution) {
|
||||
var min = this.getTileCoordForCoordAndResolution(
|
||||
new ol.Coordinate(extent.minX, extent.minY), resolution);
|
||||
var max = this.getTileCoordForCoordAndResolution(
|
||||
new ol.Coordinate(extent.maxX, extent.maxY), resolution);
|
||||
return new ol.TileBounds(min.x, min.y, max.x, max.y);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @return {ol.Coordinate} Origin.
|
||||
@@ -144,6 +118,26 @@ ol.TileGrid.prototype.getOrigin = function(z) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {ol.PixelBounds} Pixel bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getPixelBoundsForTileCoordAndResolution = function(
|
||||
tileCoord, resolution) {
|
||||
var scale = resolution / this.getResolution(tileCoord.z);
|
||||
var tileSize = this.getTileSize();
|
||||
tileSize = new ol.Size(tileSize.width / scale,
|
||||
tileSize.height / scale);
|
||||
var minX, maxX, minY, maxY;
|
||||
minX = Math.round(tileCoord.x * tileSize.width);
|
||||
maxX = Math.round((tileCoord.x + 1) * tileSize.width);
|
||||
minY = Math.round(tileCoord.y * tileSize.height);
|
||||
maxY = Math.round((tileCoord.y + 1) * tileSize.height);
|
||||
return new ol.PixelBounds(minX, minY, maxX, maxY);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @return {number} Resolution.
|
||||
@@ -163,13 +157,75 @@ ol.TileGrid.prototype.getResolutions = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {number} z Z.
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
* @param {ol.TileBounds} tileBounds Tile bounds.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z) {
|
||||
ol.TileGrid.prototype.getTileBoundsExtent = function(z, tileBounds) {
|
||||
var origin = this.getOrigin(z);
|
||||
var resolution = this.getResolution(z);
|
||||
return this.getTileCoordForCoordAndResolution(coordinate, resolution);
|
||||
var tileSize = this.tileSize_;
|
||||
var minX = origin.x + tileBounds.minX * tileSize.width * resolution;
|
||||
var minY = origin.y + tileBounds.minY * tileSize.height * resolution;
|
||||
var maxX = origin.x + (tileBounds.maxX + 1) * tileSize.width * resolution;
|
||||
var maxY = origin.y + (tileBounds.maxY + 1) * tileSize.height * resolution;
|
||||
return new ol.Extent(minX, minY, maxX, maxY);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {ol.TileBounds} Tile bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileBoundsForExtentAndResolution = function(
|
||||
extent, resolution) {
|
||||
var min = this.getTileCoordForCoordAndResolution(
|
||||
new ol.Coordinate(extent.minX, extent.minY), resolution);
|
||||
var max = this.getTileCoordForCoordAndResolution(
|
||||
new ol.Coordinate(extent.maxX, extent.maxY), resolution);
|
||||
return new ol.TileBounds(min.x, min.y, max.x, max.y);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} z Z.
|
||||
* @return {ol.TileBounds} Tile bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileBoundsForExtentAndZ = function(extent, z) {
|
||||
var resolution = this.getResolution(z);
|
||||
return this.getTileBoundsForExtentAndResolution(extent, resolution);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {ol.Coordinate} Tile center.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileCoordCenter = function(tileCoord) {
|
||||
var origin = this.getOrigin(tileCoord.z);
|
||||
var resolution = this.getResolution(tileCoord.z);
|
||||
var tileSize = this.tileSize_;
|
||||
var x = origin.x + (tileCoord.x + 0.5) * tileSize.width * resolution;
|
||||
var y = origin.y + (tileCoord.y + 0.5) * tileSize.height * resolution;
|
||||
return new ol.Coordinate(x, y);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileCoordExtent = function(tileCoord) {
|
||||
var origin = this.getOrigin(tileCoord.z);
|
||||
var resolution = this.getResolution(tileCoord.z);
|
||||
var tileSize = this.tileSize_;
|
||||
var minX = origin.x + tileCoord.x * tileSize.width * resolution;
|
||||
var minY = origin.y + tileCoord.y * tileSize.height * resolution;
|
||||
var maxX = minX + tileSize.width * resolution;
|
||||
var maxY = minY + tileSize.height * resolution;
|
||||
return new ol.Extent(minX, minY, maxX, maxY);
|
||||
};
|
||||
|
||||
|
||||
@@ -218,69 +274,13 @@ ol.TileGrid.prototype.getTileCoordForCoordAndResolution = function(
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {ol.Coordinate} Tile center.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileCoordCenter = function(tileCoord) {
|
||||
var origin = this.getOrigin(tileCoord.z);
|
||||
var resolution = this.getResolution(tileCoord.z);
|
||||
var tileSize = this.tileSize_;
|
||||
var x = origin.x + (tileCoord.x + 0.5) * tileSize.width * resolution;
|
||||
var y = origin.y + (tileCoord.y + 0.5) * tileSize.height * resolution;
|
||||
return new ol.Coordinate(x, y);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {number} z Z.
|
||||
* @param {ol.TileBounds} tileBounds Tile bounds.
|
||||
* @return {ol.Extent} Extent.
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileBoundsExtent = function(z, tileBounds) {
|
||||
var origin = this.getOrigin(z);
|
||||
ol.TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z) {
|
||||
var resolution = this.getResolution(z);
|
||||
var tileSize = this.tileSize_;
|
||||
var minX = origin.x + tileBounds.minX * tileSize.width * resolution;
|
||||
var minY = origin.y + tileBounds.minY * tileSize.height * resolution;
|
||||
var maxX = origin.x + (tileBounds.maxX + 1) * tileSize.width * resolution;
|
||||
var maxY = origin.y + (tileBounds.maxY + 1) * tileSize.height * resolution;
|
||||
return new ol.Extent(minX, minY, maxX, maxY);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.TileGrid.prototype.getTileCoordExtent = function(tileCoord) {
|
||||
var origin = this.getOrigin(tileCoord.z);
|
||||
var resolution = this.getResolution(tileCoord.z);
|
||||
var tileSize = this.tileSize_;
|
||||
var minX = origin.x + tileCoord.x * tileSize.width * resolution;
|
||||
var minY = origin.y + tileCoord.y * tileSize.height * resolution;
|
||||
var maxX = minX + tileSize.width * resolution;
|
||||
var maxY = minY + tileSize.height * resolution;
|
||||
return new ol.Extent(minX, minY, maxX, maxY);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {ol.PixelBounds} Pixel bounds.
|
||||
*/
|
||||
ol.TileGrid.prototype.getPixelBoundsForTileCoordAndResolution = function(
|
||||
tileCoord, resolution) {
|
||||
var scale = resolution / this.getResolution(tileCoord.z);
|
||||
var tileSize = this.getTileSize();
|
||||
tileSize = new ol.Size(tileSize.width / scale,
|
||||
tileSize.height / scale);
|
||||
var minX, maxX, minY, maxY;
|
||||
minX = Math.round(tileCoord.x * tileSize.width);
|
||||
maxX = Math.round((tileCoord.x + 1) * tileSize.width);
|
||||
minY = Math.round(tileCoord.y * tileSize.height);
|
||||
maxY = Math.round((tileCoord.y + 1) * tileSize.height);
|
||||
return new ol.PixelBounds(minX, minY, maxX, maxY);
|
||||
return this.getTileCoordForCoordAndResolution(coordinate, resolution);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user