UNPKG

vesium

Version:

Vue component and composition-api library for Cesium.

1,290 lines (1,285 loc) 49.8 kB
import { Arrayable, FunctionArgs, MaybeComputedElementRef } from "@vueuse/core"; import { Camera, Cartesian2, Cartesian3, Cartographic, CustomDataSource, CzmlDataSource, DataSource, DataSourceCollection, Entity, EntityCollection, Event, GeoJsonDataSource, GpxDataSource, ImageryLayer, ImageryLayerCollection, JulianDate, KeyboardEventModifier, KmlDataSource, Material, MaterialProperty, PostProcessStage, PostProcessStageCollection, PrimitiveCollection, Property, Rectangle, Scene, ScreenSpaceEventHandler, ScreenSpaceEventType, TextureMagnificationFilter, TextureMinificationFilter, Viewer } from "cesium"; import { ComputedRef, MaybeRef, MaybeRefOrGetter, Ref, ShallowReactive, ShallowRef, WatchStopHandle } from "vue"; //#region createViewer/index.d.ts /** * Pass in an existing Viewer instance, * which can be accessed by the current component and its descendant components using {@link useViewer} * * When the Viewer instance referenced by this overloaded function becomes invalid, it will not trigger destruction. */ declare function createViewer(viewer: MaybeRef<Viewer | undefined>): Readonly<ShallowRef<Viewer | undefined>>; /** * Initialize a Viewer instance, which can be accessed by the * current component and its descendant components using {@link useViewer}. * * The Viewer instance created by this overloaded function will automatically be destroyed when it becomes invalid. * * @param element - The DOM element or ID that will contain the widget * @param options - @see {Viewer.ConstructorOptions} */ declare function createViewer(element?: MaybeComputedElementRef, options?: Viewer.ConstructorOptions): Readonly<ShallowRef<Viewer | undefined>>; //# sourceMappingURL=index.d.ts.map //#endregion //#region toPromiseValue/index.d.ts type OnAsyncGetterCancel = (onCancel: () => void) => void; type MaybeAsyncGetter<T> = () => (Promise<T> | T); type MaybeRefOrAsyncGetter<T> = MaybeRef<T> | MaybeAsyncGetter<T>; interface ToPromiseValueOptions { /** * Determines whether the source should be unwrapped to its raw value. * @default true */ raw?: boolean; } /** * Similar to Vue's built-in `toValue`, but capable of handling asynchronous functions, thus returning a `await value`. * * Used in conjunction with VueUse's `computedAsync`. * * @param source The source value, which can be a reactive reference or an asynchronous getter. * @param options Conversion options * * @example * ```ts * * const data = computedAsync(async ()=> { * return await toPromiseValue(promiseRef) * }) * * ``` */ declare function toPromiseValue<T>(source: MaybeRefOrAsyncGetter<T>, options?: ToPromiseValueOptions): Promise<T>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useCameraState/index.d.ts interface UseCameraStateOptions { /** * The camera to use * @default useViewer().value.scene.camera */ camera?: MaybeRefOrGetter<Camera | undefined>; /** * Camera event type to watch * @default `changed` */ event?: MaybeRefOrGetter<'changed' | 'moveStart' | 'moveEnd'>; /** * Throttled delay duration (ms) * @default 8 */ delay?: number; } interface UseCameraStateRetrun { camera: ComputedRef<Camera | undefined>; /** * The position of the camera. */ position: ComputedRef<Cartesian3 | undefined>; /** * The view direction of the camera. */ direction: ComputedRef<Cartesian3 | undefined>; /** * The up direction of the camera. */ up: ComputedRef<Cartesian3 | undefined>; /** * The right direction of the camera. */ right: ComputedRef<Cartesian3 | undefined>; /** * Gets the {@link Cartographic} position of the camera, with longitude and latitude * expressed in radians and height in meters. In 2D and Columbus View, it is possible * for the returned longitude and latitude to be outside the range of valid longitudes * and latitudes when the camera is outside the map. */ positionCartographic: ComputedRef<Cartographic | undefined>; /** * Gets the position of the camera in world coordinates. */ positionWC: ComputedRef<Cartesian3 | undefined>; /** * Gets the view direction of the camera in world coordinates. */ directionWC: ComputedRef<Cartesian3 | undefined>; /** * Gets the up direction of the camera in world coordinates. */ upWC: ComputedRef<Cartesian3 | undefined>; /** * Gets the right direction of the camera in world coordinates. */ rightWC: ComputedRef<Cartesian3 | undefined>; /** * Computes the approximate visible rectangle on the ellipsoid. */ viewRectangle: ComputedRef<Rectangle | undefined>; /** * Gets the camera heading in radians. */ heading: ComputedRef<number | undefined>; /** * Gets the camera pitch in radians. */ pitch: ComputedRef<number | undefined>; /** * Gets the camera roll in radians. */ roll: ComputedRef<number | undefined>; /** * Gets the camera center hierarchy level */ level: ComputedRef<number | undefined>; } /** * Reactive Cesium Camera state */ declare function useCameraState(options?: UseCameraStateOptions): UseCameraStateRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useCesiumEventListener/index.d.ts interface UseCesiumEventListenerOptions { /** * Whether to active the event listener. * @default true */ isActive?: MaybeRefOrGetter<boolean>; } /** * Easily use the `addEventListener` in `Cesium.Event` instances, * when the dependent data changes or the component is unmounted, * the listener function will automatically reload or destroy. */ declare function useCesiumEventListener<FN extends FunctionArgs<any[]>>(event: Arrayable<Event<FN> | undefined> | Arrayable<MaybeRefOrGetter<Event<FN> | undefined>> | MaybeRefOrGetter<Arrayable<Event<FN> | undefined>>, listener: FN, options?: UseCesiumEventListenerOptions): WatchStopHandle; //# sourceMappingURL=index.d.ts.map //#endregion //#region useCesiumFps/index.d.ts interface UseCesiumFpsOptions { /** * Throttled sampling (ms) * @default 100 */ delay?: number; } interface UseCesiumFpsRetrun { /** * Inter-frame Interval (ms) */ interval: Readonly<Ref<number>>; /** * Frames Per Second */ fps: Readonly<Ref<number>>; } /** * Reactive get the frame rate of Cesium */ declare function useCesiumFps(options?: UseCesiumFpsOptions): UseCesiumFpsRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useCollectionScope/index.d.ts type EffcetRemovePredicate<T> = (instance: T) => boolean; interface UseCollectionScopeReturn<isPromise extends boolean, T, AddArgs extends any[], RemoveArgs extends any[], RemoveReturn = any> { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<T>>>; /** * Add SideEffect instance */ add: (i: T, ...args: AddArgs) => isPromise extends true ? Promise<T> : T; /** * Remove specified SideEffect instance */ remove: (i: T, ...args: RemoveArgs) => RemoveReturn; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<T>, ...args: RemoveArgs) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (...args: RemoveArgs) => void; } /** * Scope the SideEffects of Cesium-related `Collection` and automatically remove them when unmounted. * - note: This is a basic function that is intended to be called by other lower-level function * @param addFn - add SideEffect function. eg.`entites.add` * @param removeFn - Clean SideEffect function. eg.`entities.remove` * @param removeScopeArgs - The parameters to pass for `removeScope` triggered when the component is unmounted */ declare function useCollectionScope<isPromise extends boolean, T = any, AddArgs extends any[] = any[], RemoveArgs extends any[] = any[], RemoveReturn = any>(addFn: (i: T, ...args: AddArgs) => isPromise extends true ? Promise<T> : T, removeFn: (i: T, ...args: RemoveArgs) => RemoveReturn, removeScopeArgs: RemoveArgs): UseCollectionScopeReturn<isPromise, T, AddArgs, RemoveArgs, RemoveReturn>; //# sourceMappingURL=index.d.ts.map //#endregion //#region utils/arrayDiff.d.ts interface ArrayDiffRetrun<T> { added: T[]; removed: T[]; } /** * 计算两个数组的差异,返回新增和删除的元素 */ declare function arrayDiff<T>(list: T[], oldList: T[] | undefined): ArrayDiffRetrun<T>; //# sourceMappingURL=arrayDiff.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=canvasCoordToCartesian.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=cartesianToCanvasCoord.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=cesiumEquals.d.ts.map //#endregion //#region utils/types.d.ts type Nullable<T> = T | null | undefined; type BasicType = number | string | boolean | symbol | bigint | null | undefined; type ArgsFn<Args extends any[] = any[], Return = void> = (...args: Args) => Return; type AnyFn = (...args: any[]) => any; type MaybePromise<T = any> = T | (() => T) | Promise<T> | (() => Promise<T>); /** * 2D Coordinate System */ type CoordArray = [longitude: number, latitude: number]; /** * 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; //# sourceMappingURL=types.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=convertDMS.d.ts.map //#endregion //#region utils/is.d.ts declare function isDef<T = any>(val?: T): val is T; declare function isBoolean(val: any): val is boolean; declare function isFunction<T extends AnyFn>(val: any): val is T; declare function isNumber(val: any): val is number; declare function isString(val: unknown): val is string; declare function isObject(val: any): val is object; declare function isWindow(val: any): val is Window; declare function isPromise$1<T extends Promise<any>>(val: any): val is T; declare function isElement<T extends Element>(val: any): val is T; declare const isArray: (arg: any) => arg is any[]; declare function isBase64(val: string): boolean; declare function assertError(condition: boolean, error: any): void; //# sourceMappingURL=is.d.ts.map //#endregion //#region utils/property.d.ts type MaybeProperty<T = any> = T | { getValue: (time?: JulianDate) => T; }; type MaybePropertyOrGetter<T = any> = MaybeProperty<T> | (() => 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<T = unknown>(value: MaybeProperty<T>, time?: JulianDate): T; type PropertyCallback<T = any> = (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<T>(value?: MaybePropertyOrGetter<T>, 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<T>(scope: any, field: string, maybeProperty?: MaybePropertyOrGetter<T>, 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 extends object>(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 extends object>(scope: Scope, key: keyof Scope, value: any, options?: CreateCesiumPropertyOptions): void; //# sourceMappingURL=property.d.ts.map //#endregion //#region utils/isCesiumConstant.d.ts /** * Determines if the Cesium property is a constant. * * @param value Cesium property */ declare function isCesiumConstant(value: MaybeProperty): boolean; //# sourceMappingURL=isCesiumConstant.d.ts.map //#endregion //#region utils/material.d.ts /** * Cesium.Material.fabric parameters */ interface CesiumMaterialFabricOptions<U> { /** * 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<string, any>; } /** * Cesium.Material parameters */ interface CesiumMaterialConstructorOptions<U> { /** * Strict mode */ strict?: boolean; /** * translucent */ translucent?: boolean | ((...params: any[]) => any); /** * Minification filter */ minificationFilter?: TextureMinificationFilter; /** * Magnification filter */ magnificationFilter?: TextureMagnificationFilter; /** * Matrix configuration */ fabric: CesiumMaterialFabricOptions<U>; } /** * Only as a type fix for `Cesium.Material` */ declare class CesiumMaterial<U> extends Material { constructor(options: CesiumMaterialConstructorOptions<U>); /** * Matrix configuration */ fabric: CesiumMaterialFabricOptions<U>; } /** * Only as a type fix for `Cesium.MaterialProperty` */ interface CesiumMaterialProperty<V> 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<T extends Material = CesiumMaterial<any>>(type: string): T | undefined; /** * Add material to Cesium's material cache, alias of `Material._materialCache.addMaterial` */ declare function addMaterialCache(type: string, material: CesiumMaterialConstructorOptions<any>): void; //# sourceMappingURL=material.d.ts.map //#endregion //#region utils/pick.d.ts /** * Analyze the result of Cesium's `scene.pick` and convert it to an array format */ declare function resolvePick(pick?: any): any[]; /** * 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: any, graphic: any | any[]): boolean; //# sourceMappingURL=pick.d.ts.map //#endregion //#region utils/throttle.d.ts type ThrottleCallback<T extends any[]> = (...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<T extends any[]>(callback: ThrottleCallback<T>, delay?: number, trailing?: boolean, leading?: boolean): ThrottleCallback<T>; //# sourceMappingURL=throttle.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=toCartesian3.d.ts.map //#endregion //#region utils/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; //# sourceMappingURL=toCartographic.d.ts.map //#endregion //#region utils/toCoord.d.ts interface ToCoordOptions<T extends 'Array' | 'Object', Alt extends boolean> { /** * Return type * @default 'Array' */ type?: T; /** * Whether to return altitude information */ alt?: Alt; } type ToCoordReturn<T extends 'Array' | 'Object', Alt extends boolean> = 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<T extends 'Array' | 'Object' = 'Array', Alt extends boolean = false>(position?: CommonCoord, options?: ToCoordOptions<T, Alt>): ToCoordReturn<T, Alt> | undefined; //#endregion //#region utils/tryRun.d.ts /** * Safely execute the provided function without throwing errors, * essentially a simple wrapper around a `try...catch...` block */ declare function tryRun<T extends AnyFn>(fn: T): T; //# sourceMappingURL=tryRun.d.ts.map //#endregion //#region useDataSource/index.d.ts interface UseDataSourceOptions { /** * The collection of DataSource to be added * @default useViewer().value.dataSources */ collection?: DataSourceCollection; /** * default value of `isActive` * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Ref passed to receive the updated of async evaluation */ evaluating?: Ref<boolean>; /** * The second parameter passed to the `remove` function * * `dataSources.remove(dataSource,destroyOnRemove)` */ destroyOnRemove?: MaybeRefOrGetter<boolean>; } /** * Add `DataSource` to the `DataSourceCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `DataSource`. * * overLoaded1: Parameter supports passing in a single value. */ declare function useDataSource<T extends CesiumDataSource = CesiumDataSource>(dataSource?: MaybeRefOrAsyncGetter<T | undefined>, options?: UseDataSourceOptions): ComputedRef<T | undefined>; /** * Add `DataSource` to the `DataSourceCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `DataSource`. * * overLoaded2: Parameter supports passing in an array. */ declare function useDataSource<T extends CesiumDataSource = CesiumDataSource>(dataSources?: MaybeRefOrAsyncGetter<T[] | undefined>, options?: UseDataSourceOptions): ComputedRef<T[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useDataSourceScope/index.d.ts interface UseDataSourceScopeOptions { /** * The collection of DataSource to be added * @default useViewer().value.dataSources */ collection?: MaybeRefOrGetter<DataSourceCollection>; /** * The second parameter passed to the `remove` function * * `dataSources.remove(dataSource,destroyOnRemove)` */ destroyOnRemove?: boolean; } interface UseDataSourceScopeRetrun { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<CesiumDataSource>>>; /** * Add SideEffect instance */ add: <T extends CesiumDataSource>(dataSource: T) => Promise<T>; /** * Remove specified SideEffect instance */ remove: (dataSource: CesiumDataSource, destroy?: boolean) => boolean; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<CesiumDataSource>, destroy?: boolean) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (destroy?: boolean) => void; } /** * // Scope the SideEffects of `DataSourceCollection` operations and automatically remove them when unmounted */ declare function useDataSourceScope(options?: UseDataSourceScopeOptions): UseDataSourceScopeRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useElementOverlay/index.d.ts interface UseElementOverlayOptions { /** * Horizontal origin of the target element * @default `center` */ horizontal?: MaybeRefOrGetter<'center' | 'left' | 'right' | undefined>; /** * Vertical origin of the target element * @default `bottom` */ vertical?: MaybeRefOrGetter<'center' | 'bottom' | 'top' | undefined>; /** * Pixel offset presented by the target element * @default {x:0,y:0} */ offset?: MaybeRefOrGetter<{ x?: number; y?: number; } | undefined>; /** * The reference element for calculating the position of the target element * - `true` refer to the browser viewport * - `false` refer to the Cesium canvas */ referenceWindow?: MaybeRefOrGetter<boolean>; /** * Whether to apply style to the target element * @default true */ applyStyle?: MaybeRefOrGetter<boolean>; } interface UseElementOverlayRetrun { /** * Calculation result of the target element's horizontal direction */ x: ComputedRef<number>; /** * Calculation result of the target element's vertical direction */ y: ComputedRef<number>; /** * Calculation `css` of the target element */ style: ComputedRef<{ left: string; top: string; }>; } /** * Cesium HtmlElement Overlay */ declare function useElementOverlay(target?: MaybeComputedElementRef, position?: MaybeRefOrGetter<CommonCoord | undefined>, options?: UseElementOverlayOptions): UseElementOverlayRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useEntity/index.d.ts interface UseEntityOptions { /** * The collection of Entity to be added * @default useViewer().value.entities */ collection?: EntityCollection; /** * default value of `isActive` * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Ref passed to receive the updated of async evaluation */ evaluating?: Ref<boolean>; } /** * Add `Entity` to the `EntityCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `Entity`. * * overLoaded1: Parameter supports passing in a single value. */ declare function useEntity<T extends Entity = Entity>(entity?: MaybeRefOrAsyncGetter<T | undefined>, options?: UseEntityOptions): ComputedRef<T | undefined>; /** * Add `Entity` to the `EntityCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `Entity`. * * overLoaded2: Parameter supports passing in an array. */ declare function useEntity<T extends Entity = Entity>(entities?: MaybeRefOrAsyncGetter<Array<T | undefined>>, options?: UseEntityOptions): ComputedRef<T[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useEntityScope/index.d.ts interface UseEntityScopeOptions { /** * The collection of Entity to be added * @default useViewer().value.entities */ collection?: MaybeRefOrGetter<EntityCollection>; } interface UseEntityScopeRetrun { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<Entity>>>; /** * Add SideEffect instance */ add: <T extends Entity>(entity: T) => T; /** * Remove specified SideEffect instance */ remove: (entity: Entity, destroy?: boolean) => boolean; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<Entity>, destroy?: boolean) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (destroy?: boolean) => void; } /** * Make `add` and `remove` operations of `EntityCollection` scoped, * automatically remove `Entity` instance when component is unmounted. */ declare function useEntityScope(options?: UseEntityScopeOptions): UseEntityScopeRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useGraphicEvent/useDrag.d.ts /** * Parameters for graphic drag events */ interface GraphicDragEvent { /** * Event of the motion event */ event: ScreenSpaceEventHandler.MotionEvent; /** * The graphic object picked by `scene.pick` */ pick: any; /** * Whether the graphic is currently being dragged. */ dragging: boolean; /** * Whether to lock the camera, Will automatically resume when you end dragging. */ lockCamera: () => void; } /** * Use graphic drag events with ease, and remove listener automatically on unmounted. */ //#endregion //#region useGraphicEvent/useHover.d.ts /** * Parameters for graphic hover events */ interface GraphicHoverEvent { /** * Event of the motion event */ event: ScreenSpaceEventHandler.MotionEvent; /** * The graphic object picked by `scene.pick` */ pick: any; /** * Whether the graphic is currently being hoverged. Returns `true` continuously while hoverging, and `false` once it ends. */ hovering: boolean; } /** * Use graphic hover events with ease, and remove listener automatically on unmounted. */ //#endregion //#region useGraphicEvent/usePositioned.d.ts type PositionedEventType = 'LEFT_DOWN' | 'LEFT_UP' | 'LEFT_CLICK' | 'LEFT_DOUBLE_CLICK' | 'RIGHT_DOWN' | 'RIGHT_UP' | 'RIGHT_CLICK' | 'MIDDLE_DOWN' | 'MIDDLE_UP' | 'MIDDLE_CLICK'; /** * Parameters for graphics click related events */ interface GraphicPositionedEvent { /** * Event of the picked area */ event: ScreenSpaceEventHandler.PositionedEvent; /** * The graphic object picked by `scene.pick` */ pick: any; } //#endregion //#region useGraphicEvent/index.d.ts type CesiumGraphic = Entity | any; type GraphicEventType = PositionedEventType | 'HOVER' | 'DRAG'; type GraphicEventListener<T extends GraphicEventType> = T extends 'DRAG' ? (event: GraphicDragEvent) => void : T extends 'HOVER' ? (event: GraphicHoverEvent) => void : (event: GraphicPositionedEvent) => void; type RemoveGraphicEventFn = () => void; interface AddGraphicEventOptions { /** * The cursor style to use when the mouse is over the graphic. * @default 'pointer' */ cursor?: Nullable<string> | ((event: GraphicHoverEvent) => Nullable<string>); /** * The cursor style to use when the mouse is over the graphic during a drag operation. * @default 'crosshair' */ dragCursor?: Nullable<string> | ((event: GraphicHoverEvent) => Nullable<string>); } interface UseGraphicEventRetrun { /** * Add a graphic event listener and return a function to remove it. * @param graphic - The graphic object, 'global' indicates the global graphic object. * @param type - The event type, 'all' indicates clearing all events. * @param listener - The event listener function. */ addGraphicEvent: <T extends GraphicEventType>(graphic: CesiumGraphic | 'global', type: T, listener: GraphicEventListener<T>, options?: AddGraphicEventOptions) => RemoveGraphicEventFn; /** * Remove a graphic event listener. * @param graphic - The graphic object, 'global' indicates the global graphic object. * @param type - The event type, 'all' indicates clearing all events. * @param listener - The event listener function. */ removeGraphicEvent: <T extends GraphicEventType>(graphic: CesiumGraphic | 'global', type: T, listener: GraphicEventListener<T>) => void; /** * Clear graphic event listeners. * @param graphic - The graphic object. * @param type - The event type, 'all' indicates clearing all events. */ clearGraphicEvent: (graphic: CesiumGraphic | 'global', type: GraphicEventType | 'all') => void; } /** * Handle graphic event listeners and cursor styles for Cesium graphics. * You don't need to overly worry about memory leaks from the function, as it automatically cleans up internally. */ declare function useGraphicEvent(): UseGraphicEventRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useImageryLayer/index.d.ts interface UseImageryLayerOptions { /** * The collection of ImageryLayer to be added * @default useViewer().value.imageryLayers */ collection?: ImageryLayerCollection; /** * default value of `isActive` * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Ref passed to receive the updated of async evaluation */ evaluating?: Ref<boolean>; /** * The second parameter passed to the `remove` function * * `imageryLayers.remove(layer,destroyOnRemove)` */ destroyOnRemove?: MaybeRefOrGetter<boolean>; } /** * Add `ImageryLayer` to the `ImageryLayerCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `ImageryLayer`. * * overLoaded1: Parameter supports passing in a single value. */ declare function useImageryLayer<T extends ImageryLayer = ImageryLayer>(layer?: MaybeRefOrAsyncGetter<T | undefined>, options?: UseImageryLayerOptions): ComputedRef<T | undefined>; /** * Add `ImageryLayer` to the `ImageryLayerCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `ImageryLayer`. * * overLoaded2: Parameter supports passing in an array. */ declare function useImageryLayer<T extends ImageryLayer = ImageryLayer>(layers?: MaybeRefOrAsyncGetter<Array<T | undefined>>, options?: UseImageryLayerOptions): ComputedRef<T[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useImageryLayerScope/index.d.ts interface UseImageryLayerScopeOptions { /** * The collection of ImageryLayer to be added * @default useViewer().value.imageryLayers */ collection?: MaybeRefOrGetter<ImageryLayerCollection>; /** * The second parameter passed to the `remove` function * * `imageryLayers.remove(imageryLayer,destroyOnRemove)` */ destroyOnRemove?: boolean; } interface UseImageryLayerScopeRetrun { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<ImageryLayer>>>; /** * Add SideEffect instance */ add: <T extends ImageryLayer>(imageryLayer: T) => T; /** * Remove specified SideEffect instance */ remove: (imageryLayer: ImageryLayer, destroy?: boolean) => boolean; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<ImageryLayer>, destroy?: boolean) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (destroy?: boolean) => void; } /** * Make `add` and `remove` operations of `ImageryLayerCollection` scoped, * automatically remove `ImageryLayer` instance when component is unmounted. */ declare function useImageryLayerScope(options?: UseImageryLayerScopeOptions): UseImageryLayerScopeRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region usePostProcessStage/index.d.ts interface UsePostProcessStageOptions { /** * The collection of PostProcessStage to be added * @default useViewer().scene.postProcessStages */ collection?: PostProcessStageCollection; /** * default value of `isActive` * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Ref passed to receive the updated of async evaluation */ evaluating?: Ref<boolean>; } /** * Add `PostProcessStage` to the `PostProcessStageCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `PostProcessStage`. * * overLoaded1: Parameter supports passing in a single value. */ declare function usePostProcessStage<T extends PostProcessStage = PostProcessStage>(stage?: MaybeRefOrAsyncGetter<T | undefined>, options?: UsePostProcessStageOptions): ComputedRef<T | undefined>; /** * Add `PostProcessStage` to the `PostProcessStageCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `PostProcessStage`. * * overLoaded2: Parameter supports passing in an array. */ declare function usePostProcessStage<T extends PostProcessStage = PostProcessStage>(stages?: MaybeRefOrAsyncGetter<Array<T | undefined>>, options?: UsePostProcessStageOptions): ComputedRef<T[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region usePostProcessStageScope/index.d.ts interface UsePostProcessStageScopeOptions { /** * The collection of PostProcessStage to be added * @default useViewer().value.postProcessStages */ collection?: MaybeRefOrGetter<PostProcessStageCollection>; } interface UsePostProcessStageScopeRetrun { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<PostProcessStage>>>; /** * Add SideEffect instance */ add: <T extends PostProcessStage>(postProcessStage: T) => T; /** * Remove specified SideEffect instance */ remove: (postProcessStage: PostProcessStage, destroy?: boolean) => boolean; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<PostProcessStage>, destroy?: boolean) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (destroy?: boolean) => void; } /** * Make `add` and `remove` operations of `PostProcessStageCollection` scoped, * automatically remove `PostProcessStage` instance when component is unmounted. */ declare function usePostProcessStageScope(options?: UsePostProcessStageScopeOptions): UsePostProcessStageScopeRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region usePrimitive/index.d.ts interface UsePrimitiveOptions { /** * The collection of Primitive to be added * - `ground` : `useViewer().scene.groundPrimitives` * @default useViewer().scene.primitives */ collection?: PrimitiveCollection | 'ground'; /** * default value of `isActive` * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Ref passed to receive the updated of async evaluation */ evaluating?: Ref<boolean>; } /** * Add `Primitive` to the `PrimitiveCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `Primitive`. * * overLoaded1: Parameter supports passing in a single value. */ declare function usePrimitive<T = any>(primitive?: MaybeRefOrAsyncGetter<T | undefined>, options?: UsePrimitiveOptions): ComputedRef<T | undefined>; /** * Add `Primitive` to the `PrimitiveCollection`, automatically update when the data changes, and destroy the side effects caused by the previous `Primitive`. * * overLoaded2: Parameter supports passing in an array. */ declare function usePrimitive<T = any>(primitives?: MaybeRefOrAsyncGetter<Array<T | undefined>>, options?: UsePrimitiveOptions): ComputedRef<T[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region usePrimitiveScope/index.d.ts interface UsePrimitiveScopeOptions { /** * The collection of Primitive to be added * @default useViewer().value.scene.primitives */ collection?: MaybeRefOrGetter<PrimitiveCollection>; } interface UsePrimitiveScopeRetrun { /** * A `Set` for storing SideEffect instance, * which is encapsulated using `ShallowReactive` to provide Vue's reactive functionality */ scope: Readonly<ShallowReactive<Set<any>>>; /** * Add SideEffect instance */ add: <T>(primitive: T) => T; /** * Remove specified SideEffect instance */ remove: (primitive: any, destroy?: boolean) => boolean; /** * Remove all SideEffect instance that meets the specified criteria */ removeWhere: (predicate: EffcetRemovePredicate<any>, destroy?: boolean) => void; /** * Remove all SideEffect instance within current scope */ removeScope: (destroy?: boolean) => void; } /** * Make `add` and `remove` operations of `PrimitiveCollection` scoped, * automatically remove `Primitive` instance when component is unmounted. */ declare function usePrimitiveScope(options?: UsePrimitiveScopeOptions): UsePrimitiveScopeRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useScaleBar/index.d.ts interface UseScaleBarOptions { /** * The maximum width of the scale (px) * @default 80 */ maxPixel?: MaybeRefOrGetter<number>; /** * Throttled delay duration (ms) * @default 8 */ delay?: number; } interface UseScaleBarRetrun { /** * The actual distance of a single pixel in the current canvas */ pixelDistance: Readonly<Ref<number | undefined>>; /** * The width of the scale.(px) */ width: Readonly<Ref<number>>; /** * The actual distance corresponding to the width of the scale (m) */ distance: Readonly<Ref<number | undefined>>; /** * Formatted content of distance. * eg. 100m,100km */ distanceText: Readonly<Ref<string | undefined>>; } /** * Reactive generation of scale bars */ declare function useScaleBar(options?: UseScaleBarOptions): UseScaleBarRetrun; //# sourceMappingURL=index.d.ts.map //#endregion //#region useSceneDrillPick/index.d.ts interface UseSceneDrillPickOptions { /** * Whether to activate the pick function. * @default true */ isActive?: MaybeRefOrGetter<boolean | undefined>; /** * Throttled sampling (ms) * @default 8 */ throttled?: number; /** * If supplied, stop drilling after collecting this many picks. */ limit?: MaybeRefOrGetter<number | undefined>; /** * The width of the pick rectangle. * @default 3 */ width?: MaybeRefOrGetter<number | undefined>; /** * The height of the pick rectangle. * @default 3 */ height?: MaybeRefOrGetter<number | undefined>; } /** * Uses the `scene.drillPick` function to perform screen point picking, * return a computed property containing the pick result, or undefined if no object is picked. * * @param windowPosition The screen coordinates of the pick point. */ declare function useSceneDrillPick(windowPosition: MaybeRefOrGetter<Cartesian2 | undefined>, options?: UseSceneDrillPickOptions): ComputedRef<any[] | undefined>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useScenePick/index.d.ts interface UseScenePickOptions { /** * Whether to active the event listener. * @default true */ isActive?: MaybeRefOrGetter<boolean>; /** * Throttled sampling (ms) * @default 8 */ throttled?: number; /** * The width of the pick rectangle. * @default 3 */ width?: MaybeRefOrGetter<number | undefined>; /** * The height of the pick rectangle. * @default 3 */ height?: MaybeRefOrGetter<number | undefined>; } /** * Uses the `scene.pick` function in Cesium's Scene object to perform screen point picking, * return a computed property containing the pick result, or undefined if no object is picked. * * @param windowPosition The screen coordinates of the pick point. */ declare function useScenePick(windowPosition: MaybeRefOrGetter<Cartesian2 | undefined>, options?: UseScenePickOptions): Readonly<ShallowRef<any | undefined>>; //# sourceMappingURL=index.d.ts.map //#endregion //#region useScreenSpaceEventHandler/index.d.ts type ScreenSpaceEvent<T extends ScreenSpaceEventType> = { [ScreenSpaceEventType.LEFT_DOWN]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.LEFT_UP]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.LEFT_CLICK]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.LEFT_DOUBLE_CLICK]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.RIGHT_DOWN]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.RIGHT_UP]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.RIGHT_CLICK]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.MIDDLE_DOWN]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.MIDDLE_UP]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.MIDDLE_CLICK]: ScreenSpaceEventHandler.PositionedEvent; [ScreenSpaceEventType.MOUSE_MOVE]: ScreenSpaceEventHandler.MotionEvent; [ScreenSpaceEventType.WHEEL]: number; [ScreenSpaceEventType.PINCH_START]: ScreenSpaceEventHandler.TwoPointEvent; [ScreenSpaceEventType.PINCH_END]: ScreenSpaceEventHandler.TwoPointEvent; [ScreenSpaceEventType.PINCH_MOVE]: ScreenSpaceEventHandler.TwoPointMotionEvent; }[T]; interface UseScreenSpaceEventHandlerOptions { /** * Modifier key */ modifier?: MaybeRefOrGetter<KeyboardEventModifier | undefined>; /** * Whether to active the event listener. * @default true */ isActive?: MaybeRefOrGetter<boolean>; } /** * Easily use the `ScreenSpaceEventHandler`, * when the dependent data changes or the component is unmounted, * the listener function will automatically reload or destroy. * * @param type Types of mouse event * @param inputAction Callback function for listening */ declare function useScreenSpaceEventHandler<T extends ScreenSpaceEventType>(type?: MaybeRefOrGetter<T | undefined>, inputAction?: (event: ScreenSpaceEvent<T>) => any, options?: UseScreenSpaceEventHandlerOptions): WatchStopHandle; //# sourceMappingURL=index.d.ts.map //#endregion //#region useViewer/index.d.ts /** * Obtain the `Viewer` instance injected through `createViewer` in the current component or its ancestor components. * * note: * - If `createViewer` and `useViewer` are called in the same component, the `Viewer` instance injected by `createViewer` will be used preferentially. * - When calling `createViewer` and `useViewer` in the same component, `createViewer` should be called before `useViewer`. */ declare function useViewer(): Readonly<ShallowRef<Viewer | undefined>>; //# sourceMappingURL=index.d.ts.map //#endregion export { AddGraphicEventOptions, AnyFn, ArgsFn, ArrayDiffRetrun, BasicType, CesiumDataSource, CesiumGraphic, CesiumMaterial, CesiumMaterialConstructorOptions, CesiumMaterialFabricOptions, CesiumMaterialProperty, CommonCoord, CoordArray, CoordArray_ALT, CoordObject, CoordObject_ALT, CreateCesiumAttributeOptions, CreateCesiumPropertyOptions, DMSCoord, EffcetRemovePredicate, GraphicEventListener, GraphicEventType, MaybeAsyncGetter, MaybePromise, MaybeProperty, MaybePropertyOrGetter, MaybeRefOrAsyncGetter, Nullable, OnAsyncGetterCancel, PropertyCallback, RemoveGraphicEventFn, ScreenSpaceEvent, ThrottleCallback, ToCoordReturn, ToPromiseValueOptions, UseCameraStateOptions, UseCameraStateRetrun, UseCesiumEventListenerOptions, UseCesiumFpsOptions, UseCesiumFpsRetrun, UseCollectionScopeReturn, UseDataSourceOptions, UseDataSourceScopeOptions, UseDataSourceScopeRetrun, UseElementOverlayOptions, UseElementOverlayRetrun, UseEntityOptions, UseEntityScopeOptions, UseEntityScopeRetrun, UseGraphicEventRetrun, UseImageryLayerOptions, UseImageryLayerScopeOptions, UseImageryLayerScopeRetrun, UsePostProcessStageOptions, UsePostProcessStageScopeOptions, UsePostProcessStageScopeRetrun, UsePrimitiveOptions, UsePrimitiveScopeOptions, UsePrimitiveScopeRetrun, UseScaleBarOptions, UseScaleBarRetrun, UseSceneDrillPickOptions, UseScenePickOptions, UseScreenSpaceEventHandlerOptions, addMaterialCache, arrayDiff, assertError, canvasCoordToCartesian, cartesianToCanvasCoord, cesiumEquals, createCesiumAttribute, createCesiumProperty, createPropertyField, createViewer, degreesToDms, dmsDecode, dmsEncode, dmsToDegrees, getMaterialCache, isArray, isBase64, isBoolean, isCesiumConstant, isDef, isElement, isFunction, isNumber, isObject, isPromise$1 as isPromise, isProperty, isString, isWindow, pickHitGraphic, resolvePick, throttle, toCartesian3, toCartographic, toCoord, toPromiseValue, toProperty, toPropertyValue, tryRun, useCameraState, useCesiumEventListener, useCesiumFps, useCollectionScope, useDataSource, useDataSourceScope, useElementOverlay, useEntity, useEntityScope, useGraphicEvent, useImageryLayer, useImageryLayerScope, usePostProcessStage, usePostProcessStageScope, usePrimitive, usePrimitiveScope, useScaleBar, useSceneDrillPick, useScenePick, useScreenSpaceEventHandler, useViewer }; //# sourceMappingURL=index.d.mts.map