import { LngLatBounds, Map as MapSDK, LngLat } from '@maptiler/sdk'; import { TileLayer } from '../layers/TileLayer'; /** * A number in [0, 255] */ export type ColorChannelValue = number; /** * A number in [0, 1] */ export type AlphaChannelValue = number; /** * RgbChannel */ export type RgbChannel = "r" | "b" | "g"; /** * Channel(s) in a use by a layer */ export type UsedRgbChannel = RgbChannel | `${RgbChannel}${RgbChannel}`; /** * Indices of RGBA image channels */ export declare enum ChannelIndices { r = 0, g = 1, b = 2, a = 3 } /** * Defines a color type made of 3 ColorChannelValue OR 3 ColorChannelValue and one AlphaChannelValue */ export type RgbaColor = [ColorChannelValue, ColorChannelValue, ColorChannelValue] | [ColorChannelValue, ColorChannelValue, ColorChannelValue, AlphaChannelValue]; /** * Turns a RgbaColor into a string GLSL color constructor. * @param color * @returns a GLSL vec4 color constructor */ export declare function floatifyColor(color: RgbaColor): string; /** * Turns a [r, g, b] or [r, g, b, a] color defined on the [0, 255] range * into a [r, g, b, a] color in the [0, 1] range * @param color * @returns */ export declare function makeUnitColor(color: RgbaColor): RgbaColor; /** * Converts a latitude in degree into a unit value. * See the function here: https://www.desmos.com/calculator/ptaooqjt8c * @param lat * @returns */ export declare function latToUnit(lat: number): number; /** * Converts WGS84 coordinates to [-0.5, 0.5] range. * @param lng * @param lat * @internal */ export declare function wgs84ToUnit(lng: number, lat: number): readonly [number, number]; /** * Converts unit range [-0.5, 0.5] to WGS84 coordinates. * @param unit * @returns */ export declare function unitToLat(unit: number): number; /** * With a mercator image (origin: top left), return the latitude from the y in pixel coordinates * @param y * @param imageSize * @returns */ export declare function pixelToLat(y: number, imageSize: number): number; /** * Radius of the Earth in meter */ export declare const EARTH_RADIUS_M = 6378137; /** * Perimeter of the Earth alongside the equator in meter */ export declare const EARTH_PERIMETER_M: number; /** * Converts wgs84 (longitude and latitude) into Mercator coordinates (in meters) * @param lng * @param lat * @returns */ export declare function wgs84ToMerc(lng: number, lat: number): number[]; /** * A Pixel as in HTMLImageElement, with the form `{r, g, b, a}` */ export interface Pixel extends Record { a: AlphaChannelValue; } /** * Get the pixel value of an image at a given position * @param image * @param x * @param y * @returns The pixel as `{r, g, b, a}` in a [0, 1] interval (and not in [0, 255]) */ export declare function sampleImage(image: HTMLImageElement, x: number, y: number): Pixel; export declare function addLayerWhenReady(map: MapSDK, layer: TileLayer, beforeId?: string): void; /** * Get the cardinal direction based on an angle with * - `0°`: true north * - `90°`: east * - `180°`: south * - `270°`: west * @param angle * @returns */ export declare function getCardinalDirection(angle: number): string; export declare function wgs84ToMaplibreMerc(lng: number, lat: number): number[]; export declare function wgs84ToTileIndex(lngLat: LngLat, z: number): { z: number; x: number; y: number; }; declare function getTileCoverage(wgs84Bound: LngLatBounds, z: number): string[]; export { getTileCoverage };