Skip to content

Commit

Permalink
add TileLayer.options.tileErrorScale
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Oct 24, 2024
1 parent aa3d78a commit 4da962a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/layer/tile/TileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class TileHashset {
* @property [options.fetchOptions=object] - fetch params,such as fetchOptions: { 'headers': { 'accept': '' } }, about accept value more info https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation/List_of_default_Accept_values
* @property [options.awareOfTerrain=true] - if the tile layer is aware of terrain.
* @property [options.bufferPixel=0.5] - tile buffer size,the unit is pixel
* @property [options.depthMask=true] - mask to decide whether to write depth buffe
* @property [options.depthMask=true] - mask to decide whether to write depth buffer
* @property [options.tileErrorScale=1] - scale for tile's geometric error, default is 1
* @memberOf TileLayer
* @instance
*/
Expand Down Expand Up @@ -163,7 +164,8 @@ const options: TileLayerOptionsType = {
'mipmapTexture': true,
'depthMask': true,
'currentTilesFirst': true,
'forceRenderOnMoving': true
'forceRenderOnMoving': true,
'tileErrorScale': 1
};

const URL_PATTERN = /\{ *([\w_]+) *\}/g;
Expand Down Expand Up @@ -777,7 +779,7 @@ class TileLayer extends Layer {
r = gap <= 1 ? 1 : gap <= 2 ? 0.7 : 0.605;
}
// const r = 1;
const error = geometricError * r / distance;
const error = geometricError * r / distance * this.options['tileErrorScale'];
const pitch = this.getMap().getPitch();
if (pitch <= 60) {
return error * 1.45;
Expand Down Expand Up @@ -1710,4 +1712,5 @@ export type TileLayerOptionsType = LayerOptionsType & {
tileStackDepth?: number;
mipmapTexture?: boolean;
currentTilesFirst?: boolean;
tileErrorScale?: number;
};

0 comments on commit 4da962a

Please sign in to comment.