/// <reference types="gl-matrix/index.js" />
/*!
 * @maptalks/3dtiles v0.104.2
 * LICENSE : UNLICENSED
 * (c) 2016-2025 maptalks.org
 */
import * as maptalks from 'maptalks';
import { LayerJSONType } from 'maptalks';
import { mat4 } from '@maptalks/gl';
import { vec3 } from 'gl-matrix';

declare const Geo3DTilesLayer_base: (new (...args: any[]) => {
    _maskProjViewMatrix: number[];
    _maskExtentInWorld: [number, number, number, number];
    removeMask(masks: any): any;
    setMask(masks: any): any;
    onAdd(): void;
    getMasks(): any;
    onGeometryEvent(param: any): void;
    identifyMask(point: any, options: any): any[];
    remove(): void;
    updateMask(extent: any): {
        projViewMatrix: number[];
        extentInWorld: [number, number, number, number];
    };
    updateMaskExtent(type: string): void;
    getMaskExtent(): {
        extent: maptalks.Extent;
        ratio: number;
        minHeight: any;
    };
}) & typeof maptalks.Layer;
/**
 * A layer to stream AnalyticalGraphicsInc's 3d-tiles geospatial data
 * 3d-tiles 规范：https://github.com/AnalyticalGraphicsInc/3d-tiles/
 */
declare class Geo3DTilesLayer extends Geo3DTilesLayer_base {
    /**
     * 用layer的JSON对象反序列一个Geo3DTilesLayer对象
     * @english
     * Reproduce a Geo3DTilesLayer from layer's profile JSON.
     * @param  layerJSON - layer's profile JSON
     */
    static fromJSON(layerJSON: object): Geo3DTilesLayer | null;
    static getEnuTransform(coordinate: [number, number, number], scale?: [number, number, number], rotation?: [number, number, number]): mat4;
    isGeo3DTilesLayer: boolean;
    options: Geo3DTilesLayerOptions;
    constructor(id: string, options: Geo3DTilesLayerOptions);
    showService(idx: number): this;
    hideService(idx: number): this;
    setToRedraw(): this;
    addService(info: Geo3DTilesService): this;
    updateService(idx: number, info: Geo3DTilesServiceOptions): this;
    removeService(idx: number): this;
    getTileUrl(url: string, rootNode: RootTileNode): string;
    getExtent(index: number): maptalks.Extent | null;
    boundingVolumeToExtent(node: RootTileNode): maptalks.Extent | null;
    getRootTiles(): RootTileNode[];
    getTiles(): QueriedTiles;
    onTileLoad(tile: TileNode, node: TileNode): void;
    onTilesetLoad(tileset: any, parent: TileNode, url: string): void;
    /**
     * Identify the data on the given coordinate
     * @param point   - point to identify
     * @param [options=null]  - options
     * @param [options.tolerance=0] - identify tolerance in pixel
     * @param [options.count=null]  - result count
     * @return data identified
     */
    identify(coordinate: [number, number] | maptalks.Coordinate, options?: IdentifyOptions): any[];
    /**
     * Identify the data on the given container point
     * @param  {maptalks.Point} point   - point to identify
     * @param  {Object} [options=null]  - options
     * @param  {Object} [options.tolerance=0] - identify tolerance in pixel
     * @return {Object[]} data identified
     */
    identifyAtPoint(point: maptalks.Point, options?: IdentifyOptions): any[];
    getCurrentBatchIDs(): number[];
    highlight(highlights: HighlightItem | HighlightItem[]): this;
    cancelHighlight(serviceIndex: number, ids: number[]): this;
    cancelAllHighlight(): this;
    showOnly(items: ShowOnlyItem[]): this;
    cancelShowOnly(serviceIndex: number): this;
    setServiceOpacity(idx: number, opacity: number): this;
    setServiceDebug(idx: number, debug: boolean): this;
    /**
     * Export the Geo3DTilesLayer's profile json. <br>
     * Layer's profile is a snapshot of the layer in JSON format. <br>
     * It can be used to reproduce the instance by [fromJSON]{@link Layer#fromJSON} method
     */
    toJSON(): LayerJSONType;
}
type OffsetFunction = (center: maptalks.Coordinate) => number[];
type Geo3DTilesLayerOptions = {
    'services': Geo3DTilesService[];
    'maxGPUMemory'?: number;
    'retireInterval'?: number;
    'loadingLimitOnInteracting'?: number;
    'loadingLimit'?: number;
    'debug'?: boolean;
    'meshLimitPerFrame'?: number;
    'i3sNodepageLimitPerFrame'?: number;
    'enableI3SCompressedGeometry'?: boolean;
    'forceI3SCompressedGeometry'?: boolean;
    'onlyCacheNoContentTileWhenError'?: boolean;
    'picking'?: boolean;
    'pickingPoint'?: boolean;
    'geometryEvents'?: boolean;
    'alwaysShowTopTiles'?: boolean;
    'antialias'?: boolean;
    'offset'?: number[] | OffsetFunction;
    'renderer'?: 'gl';
    'forceRenderOnZooming'?: true;
    'forceRenderOnRotating'?: true;
    'forceRenderOnMoving'?: true;
    'optionalExtensions'?: [
        'ANGLE_instanced_arrays',
        'OES_element_index_uint',
        'OES_standard_derivatives',
        'OES_vertex_array_object',
        'OES_texture_half_float',
        'OES_texture_half_float_linear',
        'OES_texture_float',
        'OES_texture_float_linear',
        'WEBGL_depth_texture',
        'EXT_shader_texture_lod',
        'WEBGL_compressed_texture_astc',
        'WEBGL_compressed_texture_etc',
        'WEBGL_compressed_texture_etc1',
        'WEBGL_compressed_texture_pvrtc',
        'WEBGL_compressed_texture_s3tc',
        'WEBGL_compressed_texture_s3tc_srgb'
    ];
};
type Geo3DTilesService = {
    /**
     * 数据服务地址
     * @english
     * service url
     */
    url: string;
    maxExtent?: maptalks.Extent;
} & Geo3DTilesServiceOptions;
/**
 * service的属性定义
 * @english
 * Service property definitions
 */
type Geo3DTilesServiceOptions = {
    /**
     * 最大的屏幕空间误差，默认为8。当模型瓦片在屏幕上大小超过设定时会尝试请求下一级瓦片，数字越小请求的模型瓦片越精细
     * @english
     * maximum screen space error, default is 8
     */
    maximumScreenSpaceError?: number;
    /**
     * 是否开启 debug
     * @english
     * Enable debug
     */
    debug?: boolean;
    /**
     * 设置材质中的alphaTest，默认为0.1
     * @english
     * Set alphaTest in material, default is 0.1
     */
    alphaTest?: number;
    /**
     * 模型在ECEF坐标系下的转换矩阵，优先级比rotation，scale，coordOffset和heightOffset更高
     * @english
     * Model's transform matrix in ECEF coordinate system, Higher priority than rotation, scale, coordinateOffset and heightOffset
     */
    ecefTransform?: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
    /**
     * 模型的缩放比例
     * @english
     * Model scaling
     */
    scale?: number | [number, number, number];
    /**
     * 模型在xy平面上的偏移量，与地图的坐标系一致。
     * @english
     * The offset of the model on the xy plane, consistent with the coordinate system of the map.
     */
    coordOffset?: number[];
    /**
     * 模型在z轴上的偏移量，单位为米
     * @english
     * Offset of the model on the z-axis in meters
     */
    heightOffset?: number;
    /**
     * 模型在xyz轴上旋转角度，单位为度，取值范围-180到180
     * @english
     * Angle of rotation of the model on the xyz-axis in degrees, ranging from -180 to 180.
     */
    rotation?: [number, number, number];
    /**
     * 服务子域，用于替换url中的{s}
     * @english
     * Service subdomain to replace {s} in the url
     */
    subdomains?: string[];
    /**
     * 透明度，取值范围0-1
     * @english
     * opacity，ranging from 0 to 1
     */
    opacity?: number;
    /**
     * 是否可见
     * @english
     * Whether is visible
     */
    visible?: boolean;
    /**
     * fetch 请求的设置
     * @english
     * fetch options
     */
    fetchOptions?: any;
    /**
     * 点云数据的 pointSize，单位像素，支持zoom级别的 function-type
     * @english
     * pointSize of the point cloud data in pixels, supports function-type at zoom level.
     */
    pointSize?: number;
    /**
     * 点云数据的透明度，取值范围0-1，支持zoom级别的 function-type
     * @english
     * Transparency of the point cloud data, value range 0-1, supports zoom level function-type.
     */
    pointOpacity?: number;
    /**
     * 模型设置为unlit，渲染时忽略全局灯光设置，适用于倾斜摄影等模型中已经包含灯光信息的场景
     * @english
     * The model is set to unlit, and the global lighting settings are ignored when rendering, for scenes where lighting information is already included in the model, such as photometry modeling.
     */
    unlit?: boolean;
    /**
     *
     */
    polygonFill?: number[];
    /**
     * 环境光曝光参数
     * @english
     * environment exposure
     */
    environmentExposure?: number;
    /**
     * 模型是否双面绘制，默认为false
     * @english
     * Whether the model is rendered double-sided, default is false
     */
    doubleSided?: boolean;
    /**
     * 模型纹理尺寸最大值，默认为1024
     * @english
     * Maximum model texture size, default is 1024.
     */
    maxTextureSize?: number;
    /**
     * 材质 uniform 变量的预设值
     * @english
     * The preset value of the material uniforms
     */
    material?: any;
    /**
     * 如果模型没有法线属性数据，则为其创建
     * @english
     * Create normal attribute for models if it's missing
     */
    createNormalIfMissed?: boolean;
};
type TileNode = {
    id?: string;
    transform?: number[];
    matrix: number[];
    refine: string;
    boundingVolume?: BoundingVolume;
    viewerRequestVolume?: BoundingVolume;
    geometricError?: number;
    children?: TileNode[];
    visible?: boolean;
    parent?: TileNode;
    baseUrl?: string;
    content?: {
        url?: string;
        uri?: string;
    };
    maxExtent?: maptalks.Extent;
    hasParentContent?: boolean;
    extent?: maptalks.Extent;
    service?: Record<string, any>;
};
type RootTileNode = {
    version: number;
    service: Geo3DTilesService;
    domainKey?: string | null;
} & TileNode;
type BoundingVolume = {
    box?: number[];
    region?: number[];
    sphere?: number[];
    coordOffset?: number[];
    heightOffset?: number;
    originalVolume?: number[];
};
type CandinateNode = {
    id?: string;
    node?: TileNode;
    children: CandinateNode[];
    level: number;
    parent?: CandinateNode;
    content?: string;
};
type HighlightItem = {
    color?: number[];
    filter?: (object: any) => boolean;
    bloom?: boolean;
    id?: number;
    opacity: number;
};
type ShowOnlyItem = {
    id: number;
    service?: number;
};
type IdentifyOptions = {
    /**
     * 像素冗余，默认为0
     * @english
     * tolerance in pixel, default is 0
     */
    tolerance?: number;
    count?: number;
    filter?: (picked: any) => boolean;
};
type QueriedTiles = {
    tiles: CandinateNode[];
    root?: CandinateNode;
};

declare function isNil(v: any): boolean;
declare function extend(dest: any, ...args: any[]): any;
declare function isFunction(obj: any): boolean;
/**
 * Whether the obj is a javascript object.
 * @param  {Object}  obj  - object
 * @return {Boolean}
 * @memberOf Util
 */
declare function isObject(obj: any): boolean;
/**
 * Whether val is a number and not a NaN.
 * @param  {Object}  val - val
 * @return {Boolean}
 * @memberOf Util
 */
declare function isNumber(val: any): boolean;
declare function toRadian(d: any): number;
declare function toDegree(d: any): number;
declare function getAbsoluteURL(url: any): any;
declare function sign(x: any): number;
declare function stringFromUTF8Array(data: any): string;
declare function setColumn3(out: any, arr: any, col: any): any;
declare function flatArr(arr: any): any;
declare function getBatchIdArrayType(max: any): Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor;
declare function isBase64(url: any): boolean;
declare function base64URLToArrayBuffer(url: any): ArrayBufferLike;
declare function pushIn(dest: any, ...args: any[]): any;
declare function normalizeColor(out: any, color: any): any;

declare const Util_d_base64URLToArrayBuffer: typeof base64URLToArrayBuffer;
declare const Util_d_extend: typeof extend;
declare const Util_d_flatArr: typeof flatArr;
declare const Util_d_getAbsoluteURL: typeof getAbsoluteURL;
declare const Util_d_getBatchIdArrayType: typeof getBatchIdArrayType;
declare const Util_d_isBase64: typeof isBase64;
declare const Util_d_isFunction: typeof isFunction;
declare const Util_d_isNil: typeof isNil;
declare const Util_d_isNumber: typeof isNumber;
declare const Util_d_isObject: typeof isObject;
declare const Util_d_normalizeColor: typeof normalizeColor;
declare const Util_d_pushIn: typeof pushIn;
declare const Util_d_setColumn3: typeof setColumn3;
declare const Util_d_sign: typeof sign;
declare const Util_d_stringFromUTF8Array: typeof stringFromUTF8Array;
declare const Util_d_toDegree: typeof toDegree;
declare const Util_d_toRadian: typeof toRadian;
declare namespace Util_d {
  export { Util_d_base64URLToArrayBuffer as base64URLToArrayBuffer, Util_d_extend as extend, Util_d_flatArr as flatArr, Util_d_getAbsoluteURL as getAbsoluteURL, Util_d_getBatchIdArrayType as getBatchIdArrayType, Util_d_isBase64 as isBase64, Util_d_isFunction as isFunction, Util_d_isNil as isNil, Util_d_isNumber as isNumber, Util_d_isObject as isObject, Util_d_normalizeColor as normalizeColor, Util_d_pushIn as pushIn, Util_d_setColumn3 as setColumn3, Util_d_sign as sign, Util_d_stringFromUTF8Array as stringFromUTF8Array, Util_d_toDegree as toDegree, Util_d_toRadian as toRadian };
}

/**
 * from Cesium
 * Convert radians to Cartesian3 coordinate
 * from Cesium Cartesian3.fromRadians
 * @param {Number} longitude in radians
 * @param {Number} latitude in radians
 * @param {Number} height in meters
 * @param {Number} radius earth sphere's radius
 * @returns {Number[]} coordinate in Cartesian3
 */
declare function radianToCartesian3(out: any, longitude: number, latitude: number, height: number): number[];
/**
 * from Cesium
 * Creates a new Cartographic instance from a Cartesian position. The values in the
 * resulting object will be in radians.
 *
 * @param cartesian The Cartesian position to convert to cartographic representation.
 * @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
 */
declare function cartesian3ToDegree(result: any, cartesian: any): Cartographic;
declare function normalizeCartesian(out: any, a: any): any;
declare function geodeticSurfaceNormal(origin: any, out: any): vec3;
declare function geodeticSurfaceNormalCartographic(cartographic: any, result: any): vec3;

declare const Transform_d_cartesian3ToDegree: typeof cartesian3ToDegree;
declare const Transform_d_geodeticSurfaceNormal: typeof geodeticSurfaceNormal;
declare const Transform_d_geodeticSurfaceNormalCartographic: typeof geodeticSurfaceNormalCartographic;
declare const Transform_d_normalizeCartesian: typeof normalizeCartesian;
declare const Transform_d_radianToCartesian3: typeof radianToCartesian3;
declare namespace Transform_d {
  export { Transform_d_cartesian3ToDegree as cartesian3ToDegree, Transform_d_geodeticSurfaceNormal as geodeticSurfaceNormal, Transform_d_geodeticSurfaceNormalCartographic as geodeticSurfaceNormalCartographic, Transform_d_normalizeCartesian as normalizeCartesian, Transform_d_radianToCartesian3 as radianToCartesian3 };
}

declare class B3DMLoader {
    static createEmptyB3DM(): {
        featureTable: any;
        batchTable: any;
        gltf: {};
    };
    constructor(requestImage: any, loaderCtor: any, supportedFormats: any);
    _requestImage: any;
    _loaderCtor: any;
    _supportedFormats: any;
    _decoders: any;
    /**
     * 载入b3dm模型，返回一个promise，promise中的参数是 gltf 模型对象
     * @param {String} url - url of b3dm
     * @param {ArrayBuffer} [arraybuffer=null] - optional b3dm arraybuffer content
     * @returns {Promise}
     */
    load(url: string, arraybuffer?: ArrayBuffer, offset: number, byteLength: number, options: any): Promise<any>;
    _parse(url: any, b3dm: any, offset: any, b3dmByteLength: any, options: any): any;
    /**
     * 解析b3dm数据，返回数据块：
     * 1. feature table
     * 2. batch table
     * 3. gltf
     * @param {ArrayBuffer} b3dm
     */
    _readB3DM(b3dm: ArrayBuffer, offset: any, byteLength: any, url: any): {
        error: string;
        count?: undefined;
        transferables?: undefined;
        featureTable?: undefined;
        batchTable?: undefined;
        batchTableBin?: undefined;
        b3dm?: undefined;
        glb?: undefined;
    } | {
        count: any;
        transferables: ArrayBuffer[];
        featureTable: any;
        batchTable: any;
        batchTableBin: ArrayBuffer;
        b3dm: {
            BATCH_ID: {
                byteStride: number;
                byteOffset: any;
                itemSize: any;
                count: number;
                componentType: any;
                array: any;
            };
        };
        glb: {
            buffer: ArrayBuffer;
            byteOffset: any;
            byteLength: number;
        };
        error?: undefined;
    };
    _readBatchTable(): any;
}

declare class CMPTLoader {
    constructor(requestImage: any, GLTFloaderCtor: any, supportedFormats: any, maxTextureSize: any);
    _supportedFormats: any;
    _requestImage: any;
    _loaderCtor: any;
    _maxTextureSize: any;
    /**
     * 载入b3dm模型，返回一个promise，promise中的参数是 gltf 模型对象
     * @param {String} url - url of b3dm
     * @param {ArrayBuffer} [arraybuffer=null] - optional b3dm arraybuffer content
     * @returns {Promise}
     */
    load(url: string, arraybuffer?: ArrayBuffer, offset: number, byteLength: number, options: any): Promise<any>;
    _parse(url: any, cmpt: any, offset: any, byteLength: any, options: any): Promise<{
        magic: string;
        tiles: any[];
    }>;
    /**
     * 解析b3dm数据，返回数据块：
     * 1. feature table
     * 2. batch table
     * 3. gltf
     * @param {ArrayBuffer} b3dm
     */
    _readCMPT(cmpt: any, url: any, byteOffset: any, byteLength: any): {
        error: string;
    } | {
        magic: string;
        buffer: any;
        offset: any;
        byteLength: number;
    }[];
}

export { B3DMLoader, CMPTLoader, Geo3DTilesLayer, Util_d as Geo3DTilesUtil, Transform_d as Geo3DTransform };
