Move max subdivision and max triangle width to triangulation module
This commit is contained in:
@@ -62,30 +62,6 @@ export var ENABLE_WEBGL = true;
|
|||||||
export var DEBUG_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
|
* TODO: move this to renderer/vector.js
|
||||||
* @type {number} Tolerance for geometry simplification in device pixels.
|
* @type {number} Tolerance for geometry simplification in device pixels.
|
||||||
@@ -211,8 +187,6 @@ export default {
|
|||||||
ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION,
|
ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION,
|
||||||
ENABLE_WEBGL: ENABLE_WEBGL,
|
ENABLE_WEBGL: ENABLE_WEBGL,
|
||||||
DEBUG_WEBGL: DEBUG_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,
|
SIMPLIFY_TOLERANCE: SIMPLIFY_TOLERANCE,
|
||||||
HAS_WEBGL: HAS_WEBGL,
|
HAS_WEBGL: HAS_WEBGL,
|
||||||
WEBGL_MAX_TEXTURE_SIZE: WEBGL_MAX_TEXTURE_SIZE,
|
WEBGL_MAX_TEXTURE_SIZE: WEBGL_MAX_TEXTURE_SIZE,
|
||||||
|
|||||||
@@ -1,11 +1,33 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/reproj/Triangulation
|
* @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_extent_ from '../extent.js';
|
||||||
import _ol_math_ from '../math.js';
|
import _ol_math_ from '../math.js';
|
||||||
import _ol_proj_ from '../proj.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
|
* @classdesc
|
||||||
* Class containing triangulation of the given target extent.
|
* Class containing triangulation of the given target extent.
|
||||||
@@ -112,7 +134,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
|
|||||||
destinationTopLeft, destinationTopRight,
|
destinationTopLeft, destinationTopRight,
|
||||||
destinationBottomRight, destinationBottomLeft,
|
destinationBottomRight, destinationBottomLeft,
|
||||||
sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft,
|
sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft,
|
||||||
RASTER_REPROJECTION_MAX_SUBDIVISION);
|
MAX_SUBDIVISION);
|
||||||
|
|
||||||
if (this.wrapsXInSource_) {
|
if (this.wrapsXInSource_) {
|
||||||
var leftBound = Infinity;
|
var leftBound = Infinity;
|
||||||
@@ -213,11 +235,11 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
|
|||||||
var targetCoverageX =
|
var targetCoverageX =
|
||||||
_ol_extent_.getWidth(targetQuadExtent) / this.targetWorldWidth_;
|
_ol_extent_.getWidth(targetQuadExtent) / this.targetWorldWidth_;
|
||||||
needsSubdivision |=
|
needsSubdivision |=
|
||||||
targetCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH;
|
targetCoverageX > MAX_TRIANGLE_WIDTH;
|
||||||
}
|
}
|
||||||
if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {
|
if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {
|
||||||
needsSubdivision |=
|
needsSubdivision |=
|
||||||
sourceCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH;
|
sourceCoverageX > MAX_TRIANGLE_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user