@juun-roh/cesium-utils
Version:
Utilities to handle Cesium classes easier.
145 lines (141 loc) • 4.84 kB
text/typescript
import { Viewer, Color, EntityCollection, Entity, Rectangle } from 'cesium';
import { H as HybridTerrainProvider, T as TerrainArea } from '../hybrid-terrain-provider-C4b9z5pv.cjs';
import { Collection } from '../collection/index.cjs';
/**
* @class
* Utility class for visualizing terrain provider boundaries and debugging terrain loading.
*/
declare class TerrainVisualizer {
private _viewer;
private _collection;
private _terrainProvider?;
private _visible;
private _level;
private _tileCoordinatesLayer;
private _colors;
/**
* Creates a new `TerrainVisualizer`.
* @param viewer The Cesium viewer instance
* @param options {@link TerrainVisualizer.ConstructorOptions}
*/
constructor(viewer: Viewer, options?: TerrainVisualizer.ConstructorOptions);
/**
* Sets the terrain provider to visualize.
* @param terrainProvider The terrain provider to visualize.
*/
setTerrainProvider(terrainProvider: HybridTerrainProvider): void;
/**
* Updates all active visualizations.
*/
update(): void;
/**
* Clears all visualizations.
*/
clear(): void;
/**
* Shows a grid of tiles at the specified level.
* @param level The zoom level to visualize
*/
show(level?: number): void;
private _ensureTileCoordinatesLayer;
private _isValidRectangle;
private _displayTileGrid;
private _calculateTileBounds;
private _generateVisibleTiles;
private _createTileEntity;
private _getTileColor;
/**
* Hides the tile grid.
*/
hide(): void;
/**
* Sets the colors used for visualization.
* @param colors Map of role names to colors
*/
setColors(colors: Record<string, Color>): void;
/**
* Flies the camera to focus on a terrain area.
* @param area The terrain area to focus on.
* @param options {@link Viewer.flyTo}
*/
flyTo(area: TerrainArea, options?: {
duration?: number;
}): void;
/**
* Gets the rectangle representing the current view.
* @returns The current view rectangle or undefined.
* @private
*/
private _getVisibleRectangle;
/** The current zoom level set on the visualizer. */
get level(): number;
/** Set zoom level on the visualizer. */
set level(level: number);
/** Whether the grid is currently visible. */
get visible(): boolean;
/** The collection used in the visualizer. */
get collection(): Collection<EntityCollection, Entity>;
/** The viewer used in the visualizer */
get viewer(): Viewer;
/** The colors used in the visualizer */
get colors(): Map<string, Color>;
/** The hybrid terrain instance used in the visualizer */
get terrainProvider(): HybridTerrainProvider | undefined;
}
/**
* @namespace
* Contains types, utility functions, and constants for terrain visualization.
*/
declare namespace TerrainVisualizer {
/** Initialization options for `TerrainVisualizer` constructor. */
interface ConstructorOptions {
/** Colors to use for different visualization elements */
colors?: Record<string, Color>;
/** Whether to show tile grid initially. */
tile?: boolean;
/** Initial zoom level to use for visualizations. */
activeLevel?: number;
/** Terrain provider to visualize. */
terrainProvider?: HybridTerrainProvider;
}
/** Tag constants for entity collection management. */
const tag: {
default: string;
boundary: string;
grid: string;
};
/**
* Creates a ground-clamped rectangle entity for visualization.
* @param rectangle The rectangle to visualize
* @param color The color to use
* @returns A new entity
*/
function createRectangle(rectangle: Rectangle, color: Color): Entity;
/** Options for {@link TerrainVisualizer.visualize} */
interface Options {
color?: Color;
show?: boolean;
maxTilesToShow?: number;
levels?: number[];
tag?: string;
alpha?: number;
tileAlpha?: number;
}
/**
* Visualizes a specific terrain area in a viewer.
* @param terrain The terrain area to visualize.
* @param viewer The Cesium viewer.
* @param options Visualization options.
* @returns Collection of created entities.
*/
function visualize(area: TerrainArea, viewer: Viewer, options?: Options): Collection<EntityCollection, Entity>;
}
/**
* Examine the property descriptors at runtime
* to detect properties that only have getters.
* (read-only accessor properties)
* @param o The object to examine.
* @param k The key value of the property.
*/
declare function isGetterOnly(o: object, k: string | number | symbol): boolean;
export { TerrainVisualizer, isGetterOnly };