diff --git a/src/ol/index.js b/src/ol/index.js index 174b3400e1..bcc694bd72 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -62,30 +62,6 @@ export var ENABLE_WEBGL = true; export var DEBUG_WEBGL = true; -/** - * TODO: move this to Triangulation.js - * @type {number} Maximum number of subdivision steps during raster - * reprojection triangulation. Prevents high memory usage and large - * number of proj4 calls (for certain transformations and areas). - * At most `2*(2^this)` triangles are created for each triangulated - * extent (tile/image). Default is `10`. - */ -export var RASTER_REPROJECTION_MAX_SUBDIVISION = 10; - - -/** - * TODO: move this to Triangulation.js - * @type {number} Maximum allowed size of triangle relative to world width. - * When transforming corners of world extent between certain projections, - * the resulting triangulation seems to have zero error and no subdivision - * is performed. - * If the triangle width is more than this (relative to world width; 0-1), - * subdivison is forced (up to `RASTER_REPROJECTION_MAX_SUBDIVISION`). - * Default is `0.25`. - */ -export var RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH = 0.25; - - /** * TODO: move this to renderer/vector.js * @type {number} Tolerance for geometry simplification in device pixels. @@ -211,8 +187,6 @@ export default { ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION, ENABLE_WEBGL: ENABLE_WEBGL, DEBUG_WEBGL: DEBUG_WEBGL, - RASTER_REPROJECTION_MAX_SUBDIVISION: RASTER_REPROJECTION_MAX_SUBDIVISION, - RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH: RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH, SIMPLIFY_TOLERANCE: SIMPLIFY_TOLERANCE, HAS_WEBGL: HAS_WEBGL, WEBGL_MAX_TEXTURE_SIZE: WEBGL_MAX_TEXTURE_SIZE, diff --git a/src/ol/reproj/Triangulation.js b/src/ol/reproj/Triangulation.js index d70031a88b..954153633a 100644 --- a/src/ol/reproj/Triangulation.js +++ b/src/ol/reproj/Triangulation.js @@ -1,11 +1,33 @@ /** * @module ol/reproj/Triangulation */ -import {RASTER_REPROJECTION_MAX_SUBDIVISION, RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH} from '../index.js'; import _ol_extent_ from '../extent.js'; import _ol_math_ from '../math.js'; import _ol_proj_ from '../proj.js'; + +/** + * @type {number} Maximum number of subdivision steps during raster + * reprojection triangulation. Prevents high memory usage and large + * number of proj4 calls (for certain transformations and areas). + * At most `2*(2^this)` triangles are created for each triangulated + * extent (tile/image). + */ +var MAX_SUBDIVISION = 10; + + +/** + * @type {number} Maximum allowed size of triangle relative to world width. + * When transforming corners of world extent between certain projections, + * the resulting triangulation seems to have zero error and no subdivision + * is performed. + * If the triangle width is more than this (relative to world width; 0-1), + * subdivison is forced (up to `MAX_SUBDIVISION`). + * Default is `0.25`. + */ +var MAX_TRIANGLE_WIDTH = 0.25; + + /** * @classdesc * Class containing triangulation of the given target extent. @@ -112,7 +134,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, destinationTopLeft, destinationTopRight, destinationBottomRight, destinationBottomLeft, sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, - RASTER_REPROJECTION_MAX_SUBDIVISION); + MAX_SUBDIVISION); if (this.wrapsXInSource_) { var leftBound = Infinity; @@ -213,11 +235,11 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, var targetCoverageX = _ol_extent_.getWidth(targetQuadExtent) / this.targetWorldWidth_; needsSubdivision |= - targetCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH; + targetCoverageX > MAX_TRIANGLE_WIDTH; } if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) { needsSubdivision |= - sourceCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH; + sourceCoverageX > MAX_TRIANGLE_WIDTH; } }