import { AmbientLight } from 'three'; import { BaseEvent } from 'three'; import { BufferGeometry } from 'three'; import { Camera } from 'three'; import { Clock } from 'three-tile'; import { Color } from 'three'; import { ColorRepresentation } from 'three'; import { default as default_2 } from 'geojson-vt'; import { DirectionalLight } from 'three'; import { EventDispatcher } from 'three'; import { FlyControls } from 'three/examples/jsm/controls/FlyControls.js'; import { FogExp2 } from 'three'; import { Group } from 'three'; import { ITileGeometryLoader } from 'three-tile'; import { ITileMaterial } from 'three-tile'; import { ITileMaterialLoader } from 'three-tile'; import { MapControls } from 'three/examples/jsm/controls/MapControls.js'; import { Material } from 'three'; import { Mesh } from 'three'; import { Object3D } from 'three'; import { OrbitControls } from 'three/examples/jsm/Addons.js'; import { OrbitControls as OrbitControls_2 } from 'three/examples/jsm/controls/OrbitControls.js'; import { PerspectiveCamera } from 'three'; import { PointerLockControls } from 'three/examples/jsm/controls/PointerLockControls.js'; import { Scene } from 'three'; import { ShaderMaterial } from 'three'; import { SourceOptions } from 'three-tile'; import { Texture } from 'three'; import { TileCanvasLoader } from 'three-tile'; import { TileLoadClipParamsType } from 'three-tile'; import { TileMap } from 'three-tile'; import { TileMaterialLoader } from 'three-tile'; import { TileSource } from 'three-tile'; import { TileSourceLoadParamsType } from 'three-tile'; import { Vector3 } from 'three'; import { VectorStyle } from 'three-tile'; import { VectorStyles } from 'three-tile'; import { WebGLRenderer } from 'three'; /** * 根据观察者距模型(地面)距离调整缩放速度 * @param model 模型,传入TileMap,根据TileMap及其子模型距离调整缩放速度,传入TileMap.root,根据地面距离调整缩放速度 * @param camera 摄像机 * @param controls 控制器 * @param speed { * factor 缩放系数,值越大缩放越快,默认1.0 * minSpeed 最小速度,默认0.2 * maxSpeed 最大速度,默认10 * } */ export declare function adjustZoomSpeedFromDist(model: Object3D, camera: Camera, controls: OrbitControls, speed?: { factor?: number; minSpeed?: number; maxSpeed?: number; }): void; /** * ArcGis terrain datasource */ export declare class ArcGisDemSource extends TileSource { dataType: string; attribution: string; minLevel: number; maxLevel: number; url: string; constructor(options?: SourceOptions); } /** * ArcGis datasource */ export declare class ArcGisSource extends TileSource { dataType: string; attribution: string; style: string; url: string; constructor(options?: ArcGisSourceOptions); } export declare type ArcGisSourceOptions = SourceOptions & { style?: string; }; /** * 地图背景加载器 */ export declare class BackgroundLoader extends TileMaterialLoader { info: { version: string; description: string; }; dataType: string; createMaterial(params: TileSourceLoadParamsType): ITileMaterial; } export declare class BackgroundSource extends TileSource { dataType: string; color: ColorRepresentation; constructor(options: BackgroundSourceOptions); } export declare type BackgroundSourceOptions = SourceOptions & { color: ColorRepresentation; }; /** * Threejs scene initialize base class */ export declare class BaseViewer extends EventDispatcher { readonly scene: Scene; readonly topScenes: Scene[]; readonly renderer: WebGLRenderer; readonly camera: PerspectiveCamera; readonly ambLight: AmbientLight; readonly dirLight: DirectionalLight; readonly clock: Clock; container?: HTMLElement; /** Container width */ get width(): number; /** Container height */ get height(): number; /** * Constructor * @param container container element or selector string * @param options GLViewer options */ constructor(container?: HTMLElement | string, options?: ViewerOptions); /** * Add the renderer to a container * @param container container element or selector string * @returns this */ addTo(container: HTMLElement | string): this; /** * Create scene * @returns scene */ protected createScene(): Scene; /** * Create WebGL renderer * @param antialias * @param stencil * @param logarithmicDepthBuffer * @returns renderer */ protected createRenderer(antialias: boolean, stencil: boolean, logarithmicDepthBuffer: boolean): WebGLRenderer; /** * Create camera * @returns camera */ protected createCamera(): PerspectiveCamera; /** * Create ambient light * @returns AmbientLight */ protected createAmbLight(): AmbientLight; /** * Create directional light * @returns DirectionalLight */ protected createDirLight(): DirectionalLight; /** * Container resize * @returns this */ resize(): this; protected update(): void; /** * Threejs animation loop */ animate(): void; } /** * Bing datasource */ export declare class BingSource extends TileSource { dataType: string; attribution: string; style: string; mkt: string; subdomains: string; url: string; maxLevel: number; constructor(options?: BingSourceOptions); getUrl(x: number, y: number, z: number): string | undefined; } /** - A:卫星图像图层(Aerial)。 - R:道路图层(Road)。 - H:高度图层(Height)。 - O:鸟瞰图图层(Oblique)。 - B:建筑物图层(Building)。 - P:地形图层(Terrain)。 - G:地理特征图层(Geography)。 - T:交通图层(Traffic)。 - L:标签图层(Label)。 */ export declare type BingSourceOptions = SourceOptions & { style?: string; }; /** * 将指定模型贴地 * @param map 地图 * @param obj 模型 */ export declare function clampToGround(map: TileMap, obj: Object3D): void; /** 罗盘类 */ export declare class Compass { /** 罗盘顶层dom */ dom: HTMLDivElement; plane: HTMLElement | null | undefined; /** 罗盘中的文字 */ text: HTMLElement | null | undefined; controls: OrbitControls_2; /** * 构造函数 * @param controls 地图控制器 */ constructor(controls: OrbitControls_2); } export declare class ContourLoader extends TileMaterialLoader { dataType: string; constructor(color?: ColorRepresentation, interval?: number, width?: number); } export declare class ContourShader extends ShaderMaterial { constructor(parameters?: ContourShaderParameters); copy(material: this): this; } export declare interface ContourShaderParameters { color: ColorRepresentation; interval: number; width: number; } /** 创建罗盘实例 */ export declare function createCompass(controls: OrbitControls_2): Compass; export declare function createFog(controls: MapControls, fogColor?: ColorRepresentation): MapFog; export declare type CreateFogParams = { controls: MapControls; fogColor?: ColorRepresentation; }; export declare function createFrakEarth(map: TileMap, bkColor?: ColorRepresentation, airColor?: ColorRepresentation): FakeEarth; declare type DEMType = { dem: Float32Array; width: number; height: number; }; /** * Fake ball material */ export declare class EarthMaskMaterial extends ShaderMaterial { constructor(parameters: { bkColor: Color; airColor: Color; }); } export declare class ElevationLoader extends TileMaterialLoader { dataType: string; constructor(minHeight?: number, maxHeight?: number); get maxHeight(): number; set maxHeight(value: number); get minHeight(): number; set minHeight(value: number); } export declare class ElevationShader extends ShaderMaterial { /** 获取最小高度 */ get minHeight(): number; /** 获取最大高度 */ get maxHeight(): number; /** 设置最小高度 */ set minHeight(value: number); /** 设置最大高度 */ set maxHeight(value: number); constructor(minH: number, maxH: number); copy(material: this): this; } /** * A Earth ball mask */ export declare class FakeEarth extends Mesh { get bkColor(): Color; set bkColor(value: Color); constructor(bkColor: Color, airColor?: Color); } export declare class Fillter { private _scene; private _camera; private _renderer; private _composer; private _hueSaturationPass; private _brightnessContrastPass; set hue(value: number); get hue(): number; set saturation(value: number); get brightness(): number; set brightness(value: number); get contrast(): number; set contrast(value: number); set enable(value: boolean); constructor(params: { scene: Scene; camera: Camera; renderer: WebGLRenderer; }); update(): void; } /** * Threejs scene initialize class with FlyControls */ export declare class FLViewer extends BaseViewer { controls: FlyControls; get autoForward(): boolean; set autoForward(value: boolean); /** * Constructor * @param container container element or selector string * @param options GLViewer options */ constructor(container?: HTMLElement | string, options?: ViewerOptions); /** * Create map controls * @returns MapControls */ private _createControls; /** * Threejs animation loop */ animate(): void; } /** * GaoDe datasource */ export declare class GDSource extends TileSource { dataType: string; attribution: string; style: Style; subdomains: string; maxLevel: number; url: string; constructor(options?: GDSourceOptions); } export declare type GDSourceOptions = SourceOptions & { style?: Style; }; /** GeoJSON 加载器 */ export declare class GeoJSONLoader extends TileMaterialLoader { info: { version: string; author: string; description: string; }; /** 数据类型标识 */ readonly dataType = "geojson"; /** 文件加载器 */ private _loader; /** 瓦片渲染器 */ private _render; /** * 构造函数 */ constructor(); /** * 异步加载瓦片纹理,该方法在瓦片创建后被调用 * * @param url GeoJSON的URL地址 * @param params 加载参数,包括数据源、瓦片坐标等 * @returns 瓦片纹理 */ protected doLoad(url: string, params: TileLoadClipParamsType): Promise; /** * 异步加载 JSON 文件,创建 geojson-vt 实例返回。 * * @param url JSON 文件的 URL 地址 * @returns 返回 geojsonvt 实例 */ protected loadJSON(url: string): Promise<{ options: default_2.Options; tiles: Record<`${number}`, default_2.Tile>; tileCoords: default_2.TileCoords; total: number; stats: Record<`z${number}`, number>; splitTile(features: default_2.Tile, z: number, x: number, y: number, cz: number, cx: number, cy: number): void; getTile(z: number | string, x: number | string, y: number | string): null | default_2.Tile; }>; private drawTile; private _renderFeature; /** * 根据给定的坐标和样式绘制瓦片纹理 * * @param gv 地图视图对象 * @param x 瓦片的 x 坐标 * @param y 瓦片的 y 坐标 * @param z 瓦片的层级 * @param style 可选的 GeoJSON 样式类型 * @returns 返回瓦片的纹理对象,如果瓦片不存在则返回空纹理对象 */ private _getTileTexture; } export declare class GeoJSONSource extends TileSource { dataType: string; loading: boolean; style: VectorStyle; gv: any; constructor(options: GeoJSONSourceOptions); } export declare type GeoJSONSourceOptions = SourceOptions & { style?: VectorStyle; }; /** * Geoq datasource */ export declare class GeoqSource extends TileSource { dataType: string; maxLevel: number; attribution: string; style: string; url: string; constructor(options?: GeoqSourceOptions); } export declare type GeoqSourceOptions = SourceOptions & { style?: string; }; export declare function getAttributions(map: TileMap): string[]; export declare function getLocalFromMouse(mouseEvent: MouseEvent, map: TileMap, camera: Camera): Vector3 | undefined; /** * Threejs scene initialize class */ export declare class GLViewer extends BaseViewer { controls: TileMapControls; private _fogFactor; /** Get fog factor */ get fogFactor(): number; /** Set fog factor, default 1 */ set fogFactor(value: number); get controlsMode(): "MAP" | "ORBIT"; set controlsMode(value: "MAP" | "ORBIT"); private _changeFogFactor; /** * Create map controls * @returns MapControls */ private _createControls; /** * Threejs animation loop */ animate(): void; /** * Fly to a position * @param centerPostion Map center target position (world coordinate) * @param cameraPostion Camera target position (world coordinate) * @param animate animate or not */ flyTo(centerPostion: Vector3, cameraPostion: Vector3, animate?: boolean): Promise; /** * 飞行到指定对象的位置 * @param object - 目标对象,相机将飞向该对象 * @param offset - 相机位置的偏移参数 * @param offset.azimuthDeg - 方位角,单位为度,默认值为 0 * @param offset.pitchDeg - 俯仰角,单位为度,默认值为 30 * @param offset.distanceMultiplier - 距离乘数,用于调整相机与对象的距离,默认值为 1.2 * @param offset.animate - 是否使用动画效果飞行,默认值为 true * @returns 一个 Promise,在飞行完成时 resolve */ flyToObject(object: Object3D, offset?: { azimuthDeg?: number; pitchDeg?: number; distanceMultiplier?: number; animate?: boolean; }): Promise; /** * Get current scens state * @returns center position and camera position */ getState(): { centerPosition: Vector3; cameraPosition: Vector3; }; } /** * Google datasource, can not uese in CN */ export declare class GoogleSource extends TileSource { dataType: string; attribution: string; maxLevel: number; style: Style_2; subdomains: string; url: string; constructor(options?: GoogleSourceOptions); } export declare type GoogleSourceOptions = SourceOptions & { style?: Style_2; }; /** * 贴地模型组,加入该组的模型将自动贴地 */ export declare class GroundGroup extends Group { map: TileMap; /** * 是否每块瓦片下载完成调整模型高度以贴地, 如果未false,仅在瓦片全部下载完成后调整模型高度以贴地 */ updateAllTiles: boolean; /** * 贴地模型组 * map 地图 * params {updateEveryTile:是否每块瓦片下载完成调整模型高度以贴地} */ constructor(map: TileMap, params?: { updateEveryTile: boolean; }); add(...object: Object3D[]): this; update(...object: Object3D[]): this; } /** * IndexDB 缓存插件 * * 使用:IndexDBCacheEable() */ /** * 开启 IndexDB 缓存 * @returns db实例 */ export declare function IndexDBCacheEable(): Promise; /** * 防止摄像机碰撞或穿过地面 * @param map - 地图实例 * @param camera - 摄像机 * @param limitHeight - 摄像机与地面的最小高度差,默认为 10。 * @returns 摄像机是否碰撞地面。 */ export declare function limitCameraHeight(map: TileMap, camera: PerspectiveCamera, limitHeight?: number): boolean; export declare function limitPan(camera: Camera, controls: OrbitControls, map: TileMap): void; /** * MapBox datasource */ export declare class MapBoxSource extends TileSource { token: string; format: string; style: string; attribution: string; maxLevel: number; url: string; constructor(options?: MapBoxSourceOptions); } export declare type MapBoxSourceOptions = SourceOptions & { style?: string; token: string; }; export declare class MapFog extends FogExp2 { private _controls; private _factor; get factor(): number; set factor(value: number); onChange(): void; constructor(controls: OrbitControls_2, color: ColorRepresentation); } /** * MapTiler data source */ export declare class MapTilerSource extends TileSource { attribution: string; token: string; format: string; style: string; url: string; constructor(options?: MapTilerSourceOptins); } export declare type MapTilerSourceOptins = SourceOptions & { style?: string; token: string; format: string; }; export declare class MVTLoader extends TileMaterialLoader { dataType: string; info: { version: string; author: string; description: string; }; private _loader; private _render; constructor(); protected doLoad(url: string, params: TileLoadClipParamsType): Promise; /** * 在离屏画布上绘制矢量瓦片 * * @param vectorTile 待绘制的矢量瓦片对象 * @returns 绘制完成的图像位图 * @throws 如果画布上下文不可用,则抛出错误 */ private drawTile; private _renderLayer; private _renderFeature; } export declare class MVTSource extends TileSource { dataType: string; style: StyleType; constructor(options: MVTSourceOptions); } export declare type MVTSourceOptions = SourceOptions & { style?: { layer: VectorStyles; }; }; /** * Threejs scene initialize class with PointerLockControls. */ export declare class PLViewer extends BaseViewer { controls: PointerLockControls; cameraHeight: number; private _autoForward; get autoForward(): boolean; set autoForward(value: boolean); /** * Constructor * @param container container element or selector string * @param options GLViewer options */ constructor(container?: HTMLElement | string, options?: ViewerOptions); private createControls; update(): void; } /** * Single image Material loader */ export declare class SingleImageLoader implements ITileMaterialLoader { readonly info: { version: string; description: string; }; readonly dataType: string; private _imageLoader; /** * 加载材质 * @param source 数据源 * @param tile 瓦片 * @returns 材质 */ load(params: TileSourceLoadParamsType): Promise; private _setTexture; private _getTileTexture; } /** 单影像数据源 */ export declare class SingleImageSource extends TileSource { /** 该数据源的类型标识 */ dataType: string; /** 影像数据,内部使用 */ image?: HTMLImageElement; } /** * TIF DEM terrain loader 单张TIF图地形加载器 */ export declare class SingleTifDEMLoader implements ITileGeometryLoader { readonly info: { author: string; version: string; description: string; }; readonly dataType: string; private _loader; /** * 构造函数,初始化 TifDEMLoder 实例 */ constructor(); /** * 加载瓦片的几何体数据 * @param params 包含加载瓦片所需的参数,类型为 TileSourceLoadParamsType * @returns 加载完成后返回一个 BufferGeometry 对象 */ load(params: TileSourceLoadParamsType): Promise; /** * 从 ArrayBuffer 中读取 TIFF 图像的栅格数据 * @param buffer 包含 TIFF 图像数据的 ArrayBuffer * @returns 包含栅格数据的对象,包含 buffer、width 和 height 属性 */ private getTIFFRaster; } /** 单TIF图像高程 */ export declare class SingleTifDEMSource extends TileSource { /** 该数据源的类型标识 */ dataType: string; /** 高程数据,内部使用 */ data?: DEMType; } /** * Stadia data source */ export declare class StadiaSource extends TileSource { dataType: string; attribution: string; url: string; constructor(options?: SourceOptions); } /** 6卫星(st),7简图(st rd),8详图(不透明rd,透明图st)*/ declare type Style = "6" | "7" | "8"; /** m 标准路线图 lyrs=m r 某种改变的路线图(路线不明显) lyrs=r s 影像层(卫星图) lyrs=s y 带标签的卫星图 lyrs=y h 标签层(路名、地名等) lyrs=h t 地形图 lyrs=t p 带标签的地形图 lyrs=p */ declare type Style_2 = "s" | "m" | "r" | "y" | "h" | "t" | "p"; declare type Style_3 = "img_w" | "cia_w" | "cva_w" | "ibo_w" | "ter_w" | "vec_w" | "cta_w" | "img_c" | "cia_c"; declare type Style_4 = "img" | "cia" | "terrain_rgb"; export declare type StyleType = { layer: VectorStyle[]; }; export declare class TDTQMSource extends TileSource { dataType: string; attribution: string; token: string; subdomains: string; url: string; constructor(options?: TDTSourceOptins); } /** * TianDiTu datasource */ export declare class TDTSource extends TileSource { dataType: string; attribution: string; token: string; style: Style_3; subdomains: string; url: string; constructor(options?: TDTSourceOptins); } export declare type TDTSourceOptins = SourceOptions & { style?: Style_3; token: string; }; /** * Tile map controls */ export declare class TileMapControls extends OrbitControls { /** * Map max polar angle, default is Math.PI / 2.1 */ mapMaxPolarAngle: number; /** * Rest azimuth when distance > restAzimuthDist, default is 8e6 */ restAzimuthDist: number; /** * Whether to use dynamic zoom speed whit distance, default is true */ dynamicZoomSpeed: boolean; dynamicMaxPolarAngle: boolean; private _controlsMode; get controlsMode(): "MAP" | "ORBIT"; set controlsMode(value: "MAP" | "ORBIT"); constructor(camera: Camera, domElement: HTMLElement); onChange(): void; } /** * Debug material laoder, it draw a rectangle and coordinate on the tile */ export declare class TileMaterialDebugeLoader extends TileCanvasLoader { /** Loader info */ readonly info: { version: string; description: string; }; /** Source data type */ readonly dataType = "debug"; /** * Draw tile on canvas * @param ctx Tile canvas context * @param params Tile load params */ protected drawTile(ctx: OffscreenCanvasRenderingContext2D, params: TileSourceLoadParamsType): void; } /** * LOGO tile Material loader */ export declare class TileMaterialLogoLoader extends TileCanvasLoader { readonly info: { version: string; description: string; }; dataType: string; /** * Draw tile on canvas * @param ctx Tile canvas context * @param params Tile load params */ protected drawTile(ctx: OffscreenCanvasRenderingContext2D, params: TileSourceLoadParamsType): void; } /** * Wireframe material loader */ export declare class TileMaterialWrieLoader implements ITileMaterialLoader { readonly info: { version: string; description: string; }; readonly dataType: string; load(params: TileSourceLoadParamsType): Promise; } /** * Tile normal Material loader */ export declare class TileMateriaNormalLoader extends TileMaterialLoader { readonly info: { version: string; description: string; }; readonly dataType: string; constructor(); } /** Tencent datasource */ export declare class TXSource extends TileSource { dataType: string; style: string; attribution: string; subdomains: string; maxLevel: number; isTMS: boolean; url: string; constructor(options?: TXSourceOptins); getUrl(x: number, y: number, z: number): string | undefined; } export declare type TXSourceOptins = SourceOptions & { style?: string; }; /** * Viewer event map */ export declare interface ViewerEventMap extends BaseEvent { update: BaseEvent & { delta: number; }; resize: { size: { width: number; height: number; }; }; } /** * Viewer options */ export declare type ViewerOptions = { /** Whether to use antialiasing. Default is false. */ antialias?: boolean; /** Whether to use stencil buffer. Default is true. */ stencil?: boolean; /** Whether to use logarithmic depth buffer. Default is true. */ logarithmicDepthBuffer?: boolean; }; export declare class VirtualEarthSource extends BingSource { mkt: string; attribution: string; subdomains: string; url: string; maxLevel: number; } /** WMS datasource */ export declare class WmsSource extends TileSource { dataType: string; getUrl(x: number, y: number, z: number): string | undefined; } export declare class ZKXTQMSource extends TileSource { dataType: string; attribution: string; token: string; subdomains: string; url: string; constructor(options?: ZKXTSourceOptions); } /** * ZhongkeXingTu datasource */ export declare class ZKXTSource extends TileSource { readonly attribution = "\u4E2D\u79D1\u661F\u56FE[GS(2022)3995\u53F7]"; token: string; style: Style_4; format: string; subdomains: string; url: string; constructor(options?: ZKXTSourceOptions); } export declare type ZKXTSourceOptions = SourceOptions & { style?: Style_4; token: string; format?: string; }; export { }