import { Cartesian2, Cartesian3, Cartographic, Cesium3DTileFeature, CustomDataSource, CzmlDataSource, DataSource, Entity, Event, GeoJsonDataSource, GpxDataSource, JulianDate, KmlDataSource, Label, Material, MaterialProperty, Model, PointPrimitive, Primitive, PrimitiveCollection, Property, Scene, TextureMagnificationFilter, TextureMinificationFilter } from "cesium"; import { Position } from "geojson"; //#region src/arrayDiff.d.ts interface ArrayDiffReturn { added: T[]; removed: T[]; } /** * 计算两个数组的差异,返回新增和删除的元素 */ declare function arrayDiff(list: T[], oldList: T[] | undefined): ArrayDiffReturn; //#endregion //#region src/canvasCoordToCartesian.d.ts /** * Convert canvas coordinates to Cartesian coordinates * * @param canvasCoord Canvas coordinates * @param scene Cesium.Scene instance * @param mode optional values are 'pickPosition' | 'globePick' | 'auto' | 'noHeight' @default 'auto' * * `pickPosition`: Use scene.pickPosition for conversion, which can be used for picking models, oblique photography, etc. * However, if depth detection is not enabled (globe.depthTestAgainstTerrain=false), picking terrain or inaccurate issues may occur * * `globePick`: Use camera.getPickRay for conversion, which cannot be used for picking models or oblique photography, * but can be used for picking terrain. If terrain does not exist, the picked elevation is 0 * * `auto`: Automatically determine which picking content to return * * Calculation speed comparison: globePick > auto >= pickPosition */ declare function canvasCoordToCartesian(canvasCoord: Cartesian2, scene: Scene, mode?: 'pickPosition' | 'globePick' | 'auto'): Cartesian3 | undefined; //#endregion //#region src/cartesianToCanvasCoord.d.ts /** * Convert Cartesian coordinates to canvas coordinates * * @param position Cartesian coordinates * @param scene Cesium.Scene instance */ declare function cartesianToCanvasCoord(position: Cartesian3, scene: Scene): Cartesian2 | undefined; //#endregion //#region src/cesiumEquals.d.ts /** * Determines if two Cesium objects are equal. * * This function not only judges whether the instances are equal, * but also judges the equals method in the example. * * @param left The first Cesium object * @param right The second Cesium object * @returns Returns true if the two Cesium objects are equal, otherwise false */ declare function cesiumEquals(left: any, right: any): boolean; //#endregion //#region src/types.d.ts type Nullable = T | null | undefined; type BasicType = number | string | boolean | symbol | bigint | null | undefined; type ArgsFn = (...args: Args) => Return; type AnyFn = (...args: any[]) => any; type MaybePromise = T | (() => T) | Promise | (() => Promise); /** * 2D Coordinate System */ type CoordArray = Position; /** * 3D Coordinate System */ type CoordArray_ALT = [longitude: number, latitude: number, height?: number]; /** * 2D Coordinate System */ interface CoordObject { longitude: number; latitude: number; } /** * 3D Coordinate System */ interface CoordObject_ALT { longitude: number; latitude: number; height?: number | undefined; } /** * Common Coordinate * Can be a Cartesian3 point, a Cartographic point, an array, or an object containing longitude, latitude, and optional height information */ type CommonCoord = Cartesian3 | Cartographic | CoordArray | CoordArray_ALT | CoordObject | CoordObject_ALT; /** * Common DataSource */ type CesiumDataSource = DataSource | CustomDataSource | CzmlDataSource | GeoJsonDataSource | GpxDataSource | KmlDataSource; //#endregion //#region src/convertDMS.d.ts type DMSCoord = [longitude: string, latitude: string, height?: number]; /** * Convert degrees to DMS (Degrees Minutes Seconds) format string * * @param degrees The angle value * @param precision The number of decimal places to retain for the seconds, defaults to 3 * @returns A DMS formatted string in the format: degrees° minutes′ seconds″ */ declare function dmsEncode(degrees: number, precision?: number): string; /** * Decode a DMS (Degrees Minutes Seconds) formatted string to a decimal angle value * * @param dmsCode DMS formatted string, e.g. "120°30′45″N" * @returns The decoded decimal angle value, or 0 if decoding fails */ declare function dmsDecode(dmsCode: string): number; /** * Convert latitude and longitude coordinates to degrees-minutes-seconds format * * @param position The latitude and longitude coordinates * @param precision The number of decimal places to retain for 'seconds', default is 3 * @returns Returns the coordinates in degrees-minutes-seconds format, or undefined if the conversion fails */ declare function degreesToDms(position: CommonCoord, precision?: number): DMSCoord | undefined; /** * Convert DMS (Degrees Minutes Seconds) format to decimal degrees for latitude and longitude coordinates * * @param dms The latitude or longitude coordinate in DMS format * @returns Returns the coordinate in decimal degrees format, or undefined if the conversion fails */ declare function dmsToDegrees(dms: DMSCoord): CoordArray_ALT | undefined; //#endregion //#region src/is.d.ts declare function isDef(val?: T): val is T; declare function isBoolean(val: unknown): val is boolean; declare function isFunction(val: unknown): val is T; declare function isNumber(val: unknown): val is number; declare function isString(val: unknown): val is string; declare function isObject(val: unknown): val is object; declare function isWindow(val: unknown): val is Window; declare function isPromise>(val: unknown): val is T; declare function isElement(val: unknown): val is T; declare const isArray: (arg: any) => arg is any[]; declare function isBase64(val: string): boolean; declare function assertError(condition: boolean, error: unknown): void; //#endregion //#region src/property.d.ts type MaybeProperty = T | { getValue: (time?: JulianDate) => T; }; type MaybePropertyOrGetter = MaybeProperty | (() => T); /** * Is Cesium.Property * @param value - The target object */ declare function isProperty(value: any): value is Property; /** * Converts a value that may be a Property into its target value, @see {toProperty} for the reverse operation * ```typescript * toPropertyValue('val') //=> 'val' * toPropertyValue(new ConstantProperty('val')) //=> 'val' * toPropertyValue(new CallbackProperty(()=>'val')) //=> 'val' * ``` * * @param value - The value to convert */ declare function toPropertyValue(value: MaybeProperty, time?: JulianDate): T; type PropertyCallback = (time: JulianDate, result?: T) => T; /** * Converts a value that may be a Property into a Property object, @see {toPropertyValue} for the reverse operation * * @param value - The property value or getter to convert, can be undefined or null * @param isConstant - The second parameter for converting to CallbackProperty * @returns Returns the converted Property object, if value is undefined or null, returns undefined */ declare function toProperty(value?: MaybePropertyOrGetter, isConstant?: boolean): Property; /** * Create a Cesium property key * * @param scope The host object * @param field The property name * @param maybeProperty Optional property or getter * @param readonly Whether the property is read-only */ declare function createPropertyField(scope: any, field: string, maybeProperty?: MaybePropertyOrGetter, readonly?: boolean): void; interface CreateCesiumAttributeOptions { readonly?: boolean; toProperty?: boolean; /** * The event name that triggers the change * @default 'definitionChanged' */ changedEventKey?: string; shallowClone?: boolean; } declare function createCesiumAttribute(scope: Scope, key: keyof Scope, value: any, options?: CreateCesiumAttributeOptions): void; interface CreateCesiumPropertyOptions { readonly?: boolean; /** * The event name that triggers the change * @default 'definitionChanged' */ changedEventKey?: string; } declare function createCesiumProperty(scope: Scope, key: keyof Scope, value: any, options?: CreateCesiumPropertyOptions): void; //#endregion //#region src/isCesiumConstant.d.ts /** * Determines if the Cesium property is a constant. * * @param value Cesium property */ declare function isCesiumConstant(value: MaybeProperty): boolean; //#endregion //#region src/material.d.ts /** * Cesium.Material.fabric parameters */ interface CesiumMaterialFabricOptions { /** * Used to declare what material the fabric object will ultimately generate. If it's an official built-in one, use the official built-in one directly; otherwise, create a custom material and cache it. */ type: string; /** * Can nest another level of child fabric to form a composite material */ materials?: Material; /** * glsl code */ source?: string; components?: { diffuse?: string; alpha?: string; }; /** * Pass variables to glsl code */ uniforms?: U & Record; } /** * Cesium.Material parameters */ interface CesiumMaterialConstructorOptions { /** * Strict mode */ strict?: boolean; /** * translucent */ translucent?: boolean | ((...params: any[]) => any); /** * Minification filter */ minificationFilter?: TextureMinificationFilter; /** * Magnification filter */ magnificationFilter?: TextureMagnificationFilter; /** * Matrix configuration */ fabric: CesiumMaterialFabricOptions; } /** * Only as a type fix for `Cesium.Material` */ declare class CesiumMaterial extends Material { constructor(options: CesiumMaterialConstructorOptions); /** * Matrix configuration */ fabric: CesiumMaterialFabricOptions; } /** * Only as a type fix for `Cesium.MaterialProperty` */ interface CesiumMaterialProperty extends MaterialProperty { get isConstant(): boolean; get definitionChanged(): Event<(scope: this, field: string, value: any, previous: any) => void>; getType: (time: JulianDate) => string; getValue: (time: JulianDate, result?: V) => V; equals: (other?: any) => boolean; } /** * Get material from cache, alias of `Material._materialCache.getMaterial` */ declare function getMaterialCache>(type: string): T | undefined; /** * Add material to Cesium's material cache, alias of `Material._materialCache.addMaterial` */ declare function addMaterialCache(type: string, material: CesiumMaterialConstructorOptions): void; //#endregion //#region src/pick.d.ts /** * Represents the result of Cesium's scene.pick operation. * Can contain various pickable Cesium objects. */ interface ScenePickResult { primitive?: Primitive | Model | PointPrimitive | Label | undefined; id?: Entity | Cesium3DTileFeature | Entity[] | undefined; primitiveCollection?: PrimitiveCollection; collection?: PrimitiveCollection; } /** * Analyze the result of Cesium's `scene.pick` and convert it to an array format */ declare function resolvePick(pick?: ScenePickResult): unknown[]; /** * Determine if the given array of graphics is hit by Cesium's `scene.pick` * * @param pick The `scene.pick` object used for matching * @param graphic An array of graphics to check for hits */ declare function pickHitGraphic(pick: ScenePickResult | undefined, graphic: unknown | unknown[]): boolean; //#endregion //#region src/throttle.d.ts type ThrottleCallback = (...rest: T) => void; /** * Throttle function, which limits the frequency of execution of the function * * @param callback raw function * @param delay Throttled delay duration (ms) * @param trailing Trigger callback function after last call @default true * @param leading Trigger the callback function immediately on the first call @default false * @returns Throttle function */ declare function throttle(callback: ThrottleCallback, delay?: number, trailing?: boolean, leading?: boolean): ThrottleCallback; //#endregion //#region src/toCartesian3.d.ts /** * Converts position to a coordinate point in the Cartesian coordinate system * * @param position Position information, which can be a Cartesian coordinate point (Cartesian3), a geographic coordinate point (Cartographic), an array, or an object containing WGS84 latitude, longitude, and height information * @returns The converted Cartesian coordinate point. If the input parameter is invalid, undefined is returned */ declare function toCartesian3(position?: CommonCoord): Cartesian3 | undefined; //#endregion //#region src/toCartographic.d.ts /** * Converts a position to a Cartographic coordinate point * * @param position Position information, which can be a Cartesian3 coordinate point, a Cartographic coordinate point, an array, or an object containing WGS84 longitude, latitude, and height information * @returns The converted Cartographic coordinate point, or undefined if the input parameter is invalid */ declare function toCartographic(position?: CommonCoord): Cartographic | undefined; //#endregion //#region src/toCoord.d.ts interface ToCoordOptions { /** * Return type * @default 'Array' */ type?: T; /** * Whether to return altitude information */ alt?: Alt; } type ToCoordReturn = T extends 'Array' ? Alt extends true ? CoordArray_ALT : CoordArray : Alt extends true ? CoordObject_ALT : CoordObject; /** * Converts coordinates to an array or object in the specified format. * * @param position The coordinate to be converted, which can be a Cartesian3, Cartographic, array, or object. * @param options Conversion options, including conversion type and whether to include altitude information. * @returns The converted coordinate, which may be an array or object. If the input position is empty, undefined is returned. * * @template T Conversion type, optional values are 'Array' or 'Object', @default 'Array'. * @template Alt Whether to include altitude information, default is false */ declare function toCoord(position?: CommonCoord, options?: ToCoordOptions): ToCoordReturn | undefined; //#endregion //#region src/tryRun.d.ts /** * Safely execute the provided function without throwing errors, * essentially a simple wrapper around a `try...catch...` block. * * Errors are logged with context and intentionally not re-thrown, * as this utility is designed for use in callback/event contexts * where one failure should not break the entire execution chain. */ declare function tryRun(fn: T): T; //#endregion export { AnyFn, ArgsFn, ArrayDiffReturn, BasicType, CesiumDataSource, CesiumMaterial, CesiumMaterialConstructorOptions, CesiumMaterialFabricOptions, CesiumMaterialProperty, CommonCoord, CoordArray, CoordArray_ALT, CoordObject, CoordObject_ALT, CreateCesiumAttributeOptions, CreateCesiumPropertyOptions, DMSCoord, MaybePromise, MaybeProperty, MaybePropertyOrGetter, Nullable, PropertyCallback, ScenePickResult, ThrottleCallback, ToCoordReturn, addMaterialCache, arrayDiff, assertError, canvasCoordToCartesian, cartesianToCanvasCoord, cesiumEquals, createCesiumAttribute, createCesiumProperty, createPropertyField, degreesToDms, dmsDecode, dmsEncode, dmsToDegrees, getMaterialCache, isArray, isBase64, isBoolean, isCesiumConstant, isDef, isElement, isFunction, isNumber, isObject, isPromise, isProperty, isString, isWindow, pickHitGraphic, resolvePick, throttle, toCartesian3, toCartographic, toCoord, toProperty, toPropertyValue, tryRun }; //# sourceMappingURL=index.d.cts.map