weatherv-patch
Version:
Weather visualization SDK - Enhanced features patch for v0.1.66
63 lines (62 loc) • 1.89 kB
TypeScript
import { DecodeResult } from './decode-strategy';
export interface TileSourceOptions {
url: string;
factor: string;
zoom?: number;
onerror?: any;
}
export interface ImageTileChunk {
tileXYZ: number[];
pixelXYS: number[];
image: HTMLImageElement;
isDecoded: boolean;
isLoaded: boolean;
decodeArr: DecodeResult[];
canvas?: HTMLCanvasElement;
texture?: WebGLTexture;
}
/**
* 职责:
* 1. 数据加载
* 2. 数据加载后联动图层重绘
* 3. 视口剔除(这块本来应该在渲染组件中,但是局部加载和局部渲染是一体的,职责转移到这里)
* 4. 像素坐标解析格点值
*
* 加载优化:
* 1. 支持局部加载
* 2. 支持缓存
*
* 代码结构优化:
* 1. 对象重用,减少垃圾回收:tileArray
* 2. 手动垃圾回收。
*
* TODO
* 1. 单点解析气象值,在图层切换时的自动回调解析
*/
export declare class GraySource {
private tileArray;
private sourceZoom;
private sourceTileSize;
private copyArray;
private url;
private factor;
private onerror;
private renderCallbackArray;
z: number;
x: number;
y: number;
w: number;
h: number;
constructor(options: TileSourceOptions);
setConfig(options: TileSourceOptions): void;
getFactor(): string;
addRenderCallback(callback: (tileChunks: ImageTileChunk[], copyArray: number[]) => void): void;
load(onerror?: any): void;
decodeTextByViewPixel(pixel: any, extent: any, worldZoom: any): string;
decodeByViewPixel(pixel: any, extent: any, worldZoom: any): DecodeResult;
decodeTextByWorldPixel(wx: any, wy: any, wz: any): string;
decodeByWorldPixel(wx: any, wy: any, worldZoom: any): DecodeResult;
clear(): void;
private allLoadedCallback;
private static idw;
}