@maptiler/weather
Version:
Weather layers for MapTiler Cloud and MapTiler SDK
130 lines (129 loc) • 4.13 kB
TypeScript
import { Tile } from '../../core/TileTextureSource';
/**
* Options for the TileLayer construction
*/
interface TileLayerOptions {
/**
* Minimum zoom of the tile pyramids that will be added into this layer.
*/
minZoom?: number;
/**
* Maximum zoom.
*/
maxZoom?: number;
/**
* Limited bounds of the tile pyramids -- tiles outside this will not be loaded.
*
* `[west, south, east, north]` in degrees
*/
bounds?: [number, number, number, number];
/**
* Rendering areas with opacity < 1.0
* Default value is false.
*/
renderTransparentArea?: boolean;
/**
* Indicated whether the the function `map.triggerRepaint()` should be called
* when the animation is paused.
*/
repaintOnPausedAnimation?: boolean;
/**
* Linear interpolation between keyframes when true, or jumping from a keyframe to the
* next when false;
*/
timeInterpolation?: boolean;
/**
* Bilinear interpolation of category color (but not of category value) when true (requires more performance).
* No interpolation when false.
* Applies only to TileLayers using MultiChannelGradientColoringFragment
* (as the other types of Coloring Fragment are not compatible with categories)
*/
categorySmoothTransition?: boolean;
/**
* Enables the local smoothing if tue.
* Default: false
*/
localSmoothing?: boolean;
/**
* Number of adjacent texture reads used to compute a smooth average for each pixel on screen.
* If `0`, then only the central point is read, which does the same as `localSmoothing = false`.
* If very high (32 or more), will have a performance impact on low-end devices.
* Default: 16
*/
nbSmoothingBins?: number;
/**
* The distance of the smoothing bins are dependant of the zoom-level. The distance is the longest at z0
* and decays. maxSmoothingDistance is the distance at z0.
* Default: 10
*/
maxSmoothingDistance?: number;
/**
* The decay factor has an influence on how the distance between the reference texture and its adjacent bins
* diminishes as the zoom level gets higher.
* If smoothingDistanceDecayFactor is closer to `0`, the decaying function will have the shape of the inverse
* function (fast decay very quickly). If smoothingDistanceDecayFactor is closer to `100`,
* the decay is considered linear.
* Default: 12
*/
smoothingDistanceDecayFactor?: number;
/**
* If `true`, will load the lower zoom level (up to z0) if the tile of requested zoom level
* is not ready/loaded. This will lead to visually smoother transitions as zooming in but will
* require fetching more tiles at high zoom level.
* If `false`, will load only the tile of the requested zoom level.
* Default: `true`
*/
loadLowerZoomLevels?: boolean;
/**
* If `true` the edges of each tile is will be interpolated with its neighbor tile to obtain
* smoother in-between-tile transition.
* This requires sending more tiles (textures) to the GPU and perform more texture reads, which could impact performance.
* Note: at the moment, this is only implemented for `MultiChannelGradientColoringFragment`
* Default: `false`
*/
interpolateTileEdge?: boolean;
}
/**
*
*/
interface TilePlacement {
/**
* The Tile
*/
tile: Tile;
/**
* The index along x and y axis
*/
xy: [number, number];
/**
* Texture size in pixel
*/
size: number;
}
/**
* Coordinates of a tile
*/
interface TileCoordinates {
/**
* Index of the tile along x axis (horizontal)
*/
x: number;
/**
* Index of the tile along y axis (vertical)
*/
y: number;
/**
* Zoom level
*/
z: number;
}
/**
* Key-value list of tile. The IDs are of the form `"z/x/y"` and the value is true.
* See it as a Set.
*
* TODO: Why not using Set?
*/
type TileList = {
[key: string]: true;
};
export type { TilePlacement, TileCoordinates, TileList, TileLayerOptions };