@juun-roh/cesium-utils 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-C52KJ2WP.js +1 -0
- package/dist/chunk-CNYZN4AC.js +1 -0
- package/dist/chunk-KDRPSZ3A.js +1 -0
- package/dist/chunk-STARYORM.js +1 -0
- package/dist/chunk-YZ7AUGIO.js +1 -0
- package/dist/collection/index.cjs +1 -0
- package/dist/collection/index.d.cts +363 -0
- package/dist/collection/index.d.ts +363 -0
- package/dist/collection/index.js +1 -0
- package/dist/hybrid-terrain-provider-C6aXdtyo.d.cts +345 -0
- package/dist/hybrid-terrain-provider-C6aXdtyo.d.ts +345 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -839
- package/dist/index.d.ts +6 -839
- package/dist/index.js +1 -1
- package/dist/terrain/index.cjs +1 -0
- package/dist/terrain/index.d.cts +22 -0
- package/dist/terrain/index.d.ts +22 -0
- package/dist/terrain/index.js +1 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.cts +133 -0
- package/dist/utils/index.d.ts +133 -0
- package/dist/utils/index.js +1 -0
- package/dist/viewer/index.cjs +1 -0
- package/dist/viewer/index.d.cts +12 -0
- package/dist/viewer/index.d.ts +12 -0
- package/dist/viewer/index.js +1 -0
- package/package.json +24 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,839 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface WithTag {
|
|
8
|
-
[key: symbol]: Tag;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Collection event types
|
|
12
|
-
*/
|
|
13
|
-
type CollectionEventType = 'add' | 'remove' | 'update' | 'clear';
|
|
14
|
-
/**
|
|
15
|
-
* Event handler function type
|
|
16
|
-
*/
|
|
17
|
-
type EventHandler<I> = (event: {
|
|
18
|
-
type: CollectionEventType;
|
|
19
|
-
items?: I[];
|
|
20
|
-
tag?: Tag;
|
|
21
|
-
}) => void;
|
|
22
|
-
/**
|
|
23
|
-
* @class
|
|
24
|
-
* Abstract class that enhances Cesium collection objects with tagging functionality.
|
|
25
|
-
* This class provides a consistent API for working with different types of Cesium collections
|
|
26
|
-
* and allows grouping and manipulating collection items by custom tags.
|
|
27
|
-
*
|
|
28
|
-
* @template C - The type of Cesium collection (e.g., EntityCollection, PrimitiveCollection)
|
|
29
|
-
* @template I - The type of items in the collection (e.g., Entity, Primitive)
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* // Creating a specialized collection for entities
|
|
33
|
-
* class MyEntities extends Collection<EntityCollection, Entity> {
|
|
34
|
-
* constructor(viewer) {
|
|
35
|
-
* super({ collection: viewer.entities, tag: 'myEntities' });
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* get values() {
|
|
39
|
-
* return this.collection.values;
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* const entities = new MyEntities(viewer);
|
|
44
|
-
* entities.add(new Entity({ ... }), 'buildings');
|
|
45
|
-
* entities.add(new Entity({ ... }), 'roads');
|
|
46
|
-
*
|
|
47
|
-
* // Later, show only buildings
|
|
48
|
-
* entities.show('buildings');
|
|
49
|
-
* entities.hide('roads');
|
|
50
|
-
*/
|
|
51
|
-
declare class Collection<C extends CesiumCollection, I extends CesiumCollectionItem> {
|
|
52
|
-
/**
|
|
53
|
-
* Symbol used as a property key to store tags on collection items.
|
|
54
|
-
* Using a Symbol ensures no property naming conflicts with the item's own properties.
|
|
55
|
-
* @readonly
|
|
56
|
-
*/
|
|
57
|
-
static readonly symbol: unique symbol;
|
|
58
|
-
/**
|
|
59
|
-
* Default tag used when adding items without specifying a tag.
|
|
60
|
-
* @protected
|
|
61
|
-
*/
|
|
62
|
-
protected tag: Tag;
|
|
63
|
-
/**
|
|
64
|
-
* The underlying Cesium collection being wrapped.
|
|
65
|
-
* @protected
|
|
66
|
-
*/
|
|
67
|
-
protected collection: C;
|
|
68
|
-
/**
|
|
69
|
-
* Cache for values array to improve performance
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
private _valuesCache;
|
|
73
|
-
/**
|
|
74
|
-
* Tag to items map for faster lookups
|
|
75
|
-
* @private
|
|
76
|
-
*/
|
|
77
|
-
private _tagMap;
|
|
78
|
-
/**
|
|
79
|
-
* Event listeners
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
private _eventListeners;
|
|
83
|
-
/**
|
|
84
|
-
* Creates a new Collection instance.
|
|
85
|
-
*
|
|
86
|
-
* @param options - Configuration options
|
|
87
|
-
* @param options.collection - The Cesium collection to wrap
|
|
88
|
-
* @param options.tag - The default tag to use for items (defaults to 'default')
|
|
89
|
-
*/
|
|
90
|
-
constructor({ collection, tag }: {
|
|
91
|
-
collection: C;
|
|
92
|
-
tag?: Tag;
|
|
93
|
-
});
|
|
94
|
-
/**
|
|
95
|
-
* Emits an event to all registered listeners.
|
|
96
|
-
*
|
|
97
|
-
* @private
|
|
98
|
-
* @param type - The event type
|
|
99
|
-
* @param data - Additional event data
|
|
100
|
-
*/
|
|
101
|
-
private _emit;
|
|
102
|
-
/**
|
|
103
|
-
* Adds an item to the internal tag map for quick lookups.
|
|
104
|
-
*
|
|
105
|
-
* @private
|
|
106
|
-
* @param item - The item to add
|
|
107
|
-
* @param tag - The tag to associate with the item
|
|
108
|
-
*/
|
|
109
|
-
private _addToTagMap;
|
|
110
|
-
/**
|
|
111
|
-
* Removes an item from the internal tag map.
|
|
112
|
-
*
|
|
113
|
-
* @private
|
|
114
|
-
* @param item - The item to remove
|
|
115
|
-
*/
|
|
116
|
-
private _removeFromTagMap;
|
|
117
|
-
/**
|
|
118
|
-
* Invalidates the values cache when collection changes.
|
|
119
|
-
*
|
|
120
|
-
* @private
|
|
121
|
-
*/
|
|
122
|
-
private _invalidateCache;
|
|
123
|
-
/**
|
|
124
|
-
* Registers an event listener for collection events.
|
|
125
|
-
*
|
|
126
|
-
* @param type - The event type to listen for
|
|
127
|
-
* @param handler - The callback function
|
|
128
|
-
* @returns The collection instance for method chaining
|
|
129
|
-
*/
|
|
130
|
-
addEventListener(type: CollectionEventType, handler: EventHandler<I>): this;
|
|
131
|
-
/**
|
|
132
|
-
* Removes an event listener.
|
|
133
|
-
*
|
|
134
|
-
* @param type - The event type
|
|
135
|
-
* @param handler - The callback function to remove
|
|
136
|
-
* @returns The collection instance for method chaining
|
|
137
|
-
*/
|
|
138
|
-
removeEventListener(type: CollectionEventType, handler: EventHandler<I>): this;
|
|
139
|
-
/**
|
|
140
|
-
* Adds a single item with a tag to the collection.
|
|
141
|
-
*
|
|
142
|
-
* @param item - The item to add to the collection
|
|
143
|
-
* @param tag - Tag to associate with this item (defaults to the collection's default tag)
|
|
144
|
-
* @param index - The index to add the item at (if supported by the collection)
|
|
145
|
-
* @returns The added item for chaining
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* const entity = collection.add(new Entity({ ... }), 'landmarks');
|
|
149
|
-
*/
|
|
150
|
-
add(item: I, tag?: Tag, index?: number): I;
|
|
151
|
-
/**
|
|
152
|
-
* Adds multiple items with the same tag to the collection.
|
|
153
|
-
*
|
|
154
|
-
* @param items - The array of items to add to the collection
|
|
155
|
-
* @param tag - Tag to associate with this item (defaults to the collection's default tag)
|
|
156
|
-
* @returns The array of added items
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* // Add multiple entities with the same tag
|
|
160
|
-
* const entities = [new Entity({ ... }), new Entity({ ... })];
|
|
161
|
-
* const addedEntities = collection.add(entities, 'buildings');
|
|
162
|
-
*/
|
|
163
|
-
add(items: I[], tag?: Tag): I[];
|
|
164
|
-
/**
|
|
165
|
-
* Returns true if the provided item is in this collection, false otherwise.
|
|
166
|
-
*
|
|
167
|
-
* @param item - The item to check for
|
|
168
|
-
* @returns True if the item is in the collection, false otherwise
|
|
169
|
-
*/
|
|
170
|
-
contains(item: I): boolean;
|
|
171
|
-
/**
|
|
172
|
-
* Removes an item from the collection.
|
|
173
|
-
*
|
|
174
|
-
* @param item - The item to remove
|
|
175
|
-
* @returns True if the item was removed, false if it wasn't found
|
|
176
|
-
*/
|
|
177
|
-
remove(item: I & WithTag): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Removes all items from the collection.
|
|
180
|
-
*/
|
|
181
|
-
removeAll(): void;
|
|
182
|
-
/**
|
|
183
|
-
* Gets all item instances in the collection.
|
|
184
|
-
* This array should not be modified directly.
|
|
185
|
-
*
|
|
186
|
-
* @returns An array of all items in the collection
|
|
187
|
-
*/
|
|
188
|
-
get values(): I[];
|
|
189
|
-
/**
|
|
190
|
-
* Gets the number of items in the collection.
|
|
191
|
-
*
|
|
192
|
-
* @returns The item count
|
|
193
|
-
*/
|
|
194
|
-
get length(): number;
|
|
195
|
-
/**
|
|
196
|
-
* Gets all items with the specified tag from the collection.
|
|
197
|
-
* Uses an optimized internal map for faster lookups.
|
|
198
|
-
*
|
|
199
|
-
* @param tag - The tag to filter by
|
|
200
|
-
* @returns An array of items with the specified tag, or an empty array if none found
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* // Get all buildings
|
|
204
|
-
* const buildings = collection.getByTag('buildings');
|
|
205
|
-
*/
|
|
206
|
-
getByTag(tag: Tag): I[];
|
|
207
|
-
/**
|
|
208
|
-
* Gets the first item matching the tag. More efficient than getByTag when
|
|
209
|
-
* you only need one item, especially for large collections.
|
|
210
|
-
*
|
|
211
|
-
* @param tag - The tag to search for
|
|
212
|
-
* @returns The first matching item or undefined if none found
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* // Get the first building
|
|
216
|
-
* const firstBuilding = collection.getFirstByTag('buildings');
|
|
217
|
-
*/
|
|
218
|
-
getFirstByTag(tag: Tag): I | undefined;
|
|
219
|
-
/**
|
|
220
|
-
* Gets all unique tags currently in use in the collection.
|
|
221
|
-
*
|
|
222
|
-
* @returns An array of all unique tags
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* // Get all tags
|
|
226
|
-
* const tags = collection.getTags();
|
|
227
|
-
* console.log(`Collection has these tags: ${tags.join(', ')}`);
|
|
228
|
-
*/
|
|
229
|
-
getTags(): Tag[];
|
|
230
|
-
/**
|
|
231
|
-
* Checks if the collection has any items with the specified tag.
|
|
232
|
-
*
|
|
233
|
-
* @param tag - The tag to check for
|
|
234
|
-
* @returns True if items with the tag exist, false otherwise
|
|
235
|
-
*
|
|
236
|
-
* @example
|
|
237
|
-
* if (collection.hasTag('temporary')) {
|
|
238
|
-
* console.log('Temporary items exist');
|
|
239
|
-
* }
|
|
240
|
-
*/
|
|
241
|
-
hasTag(tag: Tag): boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Updates the tag for all items with the specified tag.
|
|
244
|
-
*
|
|
245
|
-
* @param oldTag - The tag to replace
|
|
246
|
-
* @param newTag - The new tag to assign
|
|
247
|
-
* @returns The number of items updated
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* // Rename a tag
|
|
251
|
-
* const count = collection.updateTag('temp', 'temporary');
|
|
252
|
-
* console.log(`Updated ${count} items`);
|
|
253
|
-
*/
|
|
254
|
-
updateTag(oldTag: Tag, newTag: Tag): number;
|
|
255
|
-
/**
|
|
256
|
-
* Removes all items with the specified tag from the collection.
|
|
257
|
-
*
|
|
258
|
-
* @param tag - The tag identifying which items to remove
|
|
259
|
-
* @returns The number of items removed
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* // Remove all temporary markers
|
|
263
|
-
* const count = collection.removeByTag('temporary');
|
|
264
|
-
* console.log(`Removed ${count} items`);
|
|
265
|
-
*/
|
|
266
|
-
removeByTag(tag: Tag): number;
|
|
267
|
-
/**
|
|
268
|
-
* Removes all items with the array of tags from the collection.
|
|
269
|
-
*
|
|
270
|
-
* @param tag - The tags identifying which items to remove
|
|
271
|
-
* @returns The number of items removed
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* // Remove all items containing tags
|
|
275
|
-
* const count = collection.removeByTag('temporary', 'default', 'tag');
|
|
276
|
-
* console.log(`Removed ${count} items`);
|
|
277
|
-
*/
|
|
278
|
-
removeByTag(tag: Tag[]): number;
|
|
279
|
-
/**
|
|
280
|
-
* Makes all items with the specified tag visible.
|
|
281
|
-
* Only affects items that have a 'show' property.
|
|
282
|
-
*
|
|
283
|
-
* @param tag - The tag identifying which items to show
|
|
284
|
-
* @returns The number of items affected
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* // Show all buildings
|
|
288
|
-
* collection.show('buildings');
|
|
289
|
-
*/
|
|
290
|
-
show(tag: Tag): number;
|
|
291
|
-
/**
|
|
292
|
-
* Hides all items with the specified tag.
|
|
293
|
-
* Only affects items that have a 'show' property.
|
|
294
|
-
*
|
|
295
|
-
* @param tag - The tag identifying which items to hide
|
|
296
|
-
* @returns The number of items affected
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* // Hide all buildings
|
|
300
|
-
* collection.hide('buildings');
|
|
301
|
-
*/
|
|
302
|
-
hide(tag: Tag): number;
|
|
303
|
-
/**
|
|
304
|
-
* Toggles visibility of all items with the specified tag.
|
|
305
|
-
* Only affects items that have a 'show' property.
|
|
306
|
-
*
|
|
307
|
-
* @param tag - The tag identifying which items to toggle
|
|
308
|
-
* @returns The number of items affected
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* // Toggle visibility of all buildings
|
|
312
|
-
* collection.toggle('buildings');
|
|
313
|
-
*/
|
|
314
|
-
toggle(tag: Tag): number;
|
|
315
|
-
/**
|
|
316
|
-
* Sets a property value on all items with the specified tag.
|
|
317
|
-
*
|
|
318
|
-
* @param tag - The tag identifying which items to update
|
|
319
|
-
* @param property - The property name to set
|
|
320
|
-
* @param value - The value to set
|
|
321
|
-
* @returns The number of items updated
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* // Change color of all buildings to red
|
|
325
|
-
* collection.setProperty('buildings', 'color', Color.RED);
|
|
326
|
-
*/
|
|
327
|
-
setProperty<K extends string, V>(tag: Tag, property: K, value: V): number;
|
|
328
|
-
/**
|
|
329
|
-
* Filters items in the collection based on a predicate function.
|
|
330
|
-
* Optionally only filters items with a specific tag.
|
|
331
|
-
*
|
|
332
|
-
* @param predicate - Function that tests each item
|
|
333
|
-
* @param tag - Optional tag to filter by before applying the predicate
|
|
334
|
-
* @returns Array of items that pass the test
|
|
335
|
-
*
|
|
336
|
-
* @example
|
|
337
|
-
* // Get all buildings taller than 100 meters
|
|
338
|
-
* const tallBuildings = collection.filter(
|
|
339
|
-
* entity => entity.properties?.height?.getValue() > 100,
|
|
340
|
-
* 'buildings'
|
|
341
|
-
* );
|
|
342
|
-
*/
|
|
343
|
-
filter(predicate: (item: I) => boolean, tag?: Tag): I[];
|
|
344
|
-
/**
|
|
345
|
-
* Executes a callback function for each item in the collection.
|
|
346
|
-
* Optionally filters items by tag before execution.
|
|
347
|
-
*
|
|
348
|
-
* @param callback - Function to execute for each item
|
|
349
|
-
* @param tag - Optional tag to filter items (if not provided, processes all items)
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* // Highlight all buildings
|
|
353
|
-
* collection.forEach((entity) => {
|
|
354
|
-
* if (entity.polygon) {
|
|
355
|
-
* entity.polygon.material = new ColorMaterialProperty(Color.YELLOW);
|
|
356
|
-
* }
|
|
357
|
-
* }, 'buildings');
|
|
358
|
-
*/
|
|
359
|
-
forEach(callback: (item: I, index: number) => void, tag?: Tag): void;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/** A range of tiles from `start` to `end` */
|
|
363
|
-
type TileRange = {
|
|
364
|
-
/** Top Left tile coordinates */
|
|
365
|
-
start: {
|
|
366
|
-
x: number;
|
|
367
|
-
y: number;
|
|
368
|
-
};
|
|
369
|
-
/** Bottom Right tile coordinates */
|
|
370
|
-
end: {
|
|
371
|
-
x: number;
|
|
372
|
-
y: number;
|
|
373
|
-
};
|
|
374
|
-
};
|
|
375
|
-
/** A `TileRange` map with specific levels as their keys. */
|
|
376
|
-
type TileRanges = Map<number, TileRange>;
|
|
377
|
-
/**
|
|
378
|
-
* @class
|
|
379
|
-
* Defines the geographic boundaries for a terrain area and handles tile availability checks.
|
|
380
|
-
*/
|
|
381
|
-
declare class TerrainBounds {
|
|
382
|
-
private _rectangle;
|
|
383
|
-
private _tilingScheme;
|
|
384
|
-
private _tileRanges;
|
|
385
|
-
private _levels;
|
|
386
|
-
/**
|
|
387
|
-
* Creates a new instance of TerrainBounds.
|
|
388
|
-
* @param options {@link TerrainBounds.ConstructorOptions}
|
|
389
|
-
* @param tilingScheme (optional) The tiling scheme to use for coordinate calculations.
|
|
390
|
-
*/
|
|
391
|
-
constructor(options: TerrainBounds.ConstructorOptions, tilingScheme?: TilingScheme);
|
|
392
|
-
/**
|
|
393
|
-
* Checks if the specified tile coordinates are within the bounds.
|
|
394
|
-
* @param x The tile X coordinate.
|
|
395
|
-
* @param y The tile Y coordinate.
|
|
396
|
-
* @param level The tile level.
|
|
397
|
-
* @returns `true` if the tile is within bounds, `false` otherwise.
|
|
398
|
-
*/
|
|
399
|
-
contains(x: number, y: number, level: number): boolean;
|
|
400
|
-
/**
|
|
401
|
-
*
|
|
402
|
-
* Configures a terrain provider's availability based on these bounds.
|
|
403
|
-
* @see WARNING This method is accessing private property of {@link https://cesium.com/learn/csiumjs/ref-doc/TileAvailability.html `TileAvailability`}.
|
|
404
|
-
* @param provider The terrain provider to configure.
|
|
405
|
-
*/
|
|
406
|
-
configureAvailability(provider: TerrainProvider): void;
|
|
407
|
-
/**
|
|
408
|
-
* Gets the rectangle representing these bounds.
|
|
409
|
-
*/
|
|
410
|
-
get rectangle(): Rectangle;
|
|
411
|
-
/** Gets the tiling scheme used by these bounds. */
|
|
412
|
-
get tilingScheme(): TilingScheme;
|
|
413
|
-
/** Gets the tile ranges defined for these bounds. */
|
|
414
|
-
get tileRanges(): TileRanges;
|
|
415
|
-
/** Gets the levels for which tile ranges are defined. */
|
|
416
|
-
get levels(): Set<number>;
|
|
417
|
-
/**
|
|
418
|
-
* Calculates a bounding rectangle that encompasses all the specified tile ranges.
|
|
419
|
-
* @private
|
|
420
|
-
*/
|
|
421
|
-
private _calculateRectangleFromTileRanges;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* @namespace
|
|
425
|
-
* Contains types and factory methods for creating `TerrainBounds` instances.
|
|
426
|
-
*/
|
|
427
|
-
declare namespace TerrainBounds {
|
|
428
|
-
/** Initialization options for Terrain Bounds constructor */
|
|
429
|
-
interface ConstructorOptions {
|
|
430
|
-
/** Type of bounds definition. */
|
|
431
|
-
type: 'tileRange' | 'rectangle';
|
|
432
|
-
/**
|
|
433
|
-
* Tile ranges by level when using tileRange type.
|
|
434
|
-
* Keys are zoom levels, values define the range of tiles at that level.
|
|
435
|
-
* Can be provided either as a Map or as a plain object with numeric keys.
|
|
436
|
-
*/
|
|
437
|
-
tileRanges?: Map<number, TileRange> | Record<string | number, TileRange>;
|
|
438
|
-
/** Rectangle bounds when using rectangle type. */
|
|
439
|
-
rectangle?: Rectangle;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Creates `TerrainBounds` from tile coordinates at a specific level.
|
|
443
|
-
* @param x The tile X coordinate.
|
|
444
|
-
* @param y The tile Y coordinate.
|
|
445
|
-
* @param level The tile level.
|
|
446
|
-
* @param tilingScheme The tiling scheme to use.
|
|
447
|
-
* @returns A new `TerrainBounds` instance for the specified tile.
|
|
448
|
-
*/
|
|
449
|
-
function fromTile(x: number, y: number, level: number, tilingScheme?: TilingScheme): TerrainBounds;
|
|
450
|
-
/**
|
|
451
|
-
* Creates `TerrainBounds` from a rectangle.
|
|
452
|
-
* @param rectangle The rectangle defining the bounds.
|
|
453
|
-
* @param tilingScheme The tiling scheme to use.
|
|
454
|
-
* @returns A new `TerrainBounds` instance for the specified rectangle.
|
|
455
|
-
*/
|
|
456
|
-
function fromRectangle(rectangle: Rectangle, tilingScheme?: TilingScheme): TerrainBounds;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* @class
|
|
461
|
-
* Represents a geographic area with a specific terrain provider.
|
|
462
|
-
* `TerrainArea` pairs a provider with geographic bounds and level constraints.
|
|
463
|
-
*/
|
|
464
|
-
declare class TerrainArea {
|
|
465
|
-
private _provider;
|
|
466
|
-
private _bounds;
|
|
467
|
-
private _levels;
|
|
468
|
-
private _ready;
|
|
469
|
-
private _credit;
|
|
470
|
-
private _isCustom;
|
|
471
|
-
/**
|
|
472
|
-
* Creates a new instance of `TerrainArea`.
|
|
473
|
-
* @param options Object describing initialization options
|
|
474
|
-
* @private Use {@link TerrainArea.create} instead.
|
|
475
|
-
*/
|
|
476
|
-
private constructor();
|
|
477
|
-
/**
|
|
478
|
-
* Asynchronously creates a new instance of `TerrainArea`.
|
|
479
|
-
* @param options {@link TerrainArea.ConstructorOptions}
|
|
480
|
-
* @returns A promise that resolves to a new `TerrainArea` instance.
|
|
481
|
-
*/
|
|
482
|
-
static create(options: TerrainArea.ConstructorOptions): Promise<TerrainArea>;
|
|
483
|
-
/**
|
|
484
|
-
* @see {@link TerrainBounds.contains}
|
|
485
|
-
*/
|
|
486
|
-
contains(x: number, y: number, level: number): boolean;
|
|
487
|
-
/**
|
|
488
|
-
* Requests the geometry for a given tile. The result must include terrain data and
|
|
489
|
-
* may optionally include a water mask and an indication of which child tiles are available.
|
|
490
|
-
* @param x - The X coordinate of the tile for which to request geometry.
|
|
491
|
-
* @param y - The Y coordinate of the tile for which to request geometry.
|
|
492
|
-
* @param level - The level of the tile for which to request geometry.
|
|
493
|
-
* @param [request] - The request object. Intended for internal use only.
|
|
494
|
-
* @returns A promise for the requested geometry. If this method
|
|
495
|
-
* returns undefined instead of a promise, it is an indication that too many requests are already
|
|
496
|
-
* pending and the request will be retried later.
|
|
497
|
-
*/
|
|
498
|
-
requestTileGeometry(x: number, y: number, level: number, request?: Request): Promise<Awaited<TerrainData>> | undefined;
|
|
499
|
-
/**
|
|
500
|
-
* Determines whether data for a tile is available to be loaded.
|
|
501
|
-
* @param x - The X coordinate of the tile for which to request geometry.
|
|
502
|
-
* @param y - The Y coordinate of the tile for which to request geometry.
|
|
503
|
-
* @param level - The level of the tile for which to request geometry.
|
|
504
|
-
* @returns Undefined if not supported by the terrain provider, otherwise true or false.
|
|
505
|
-
* @see {@link TerrainProvider.getTileDataAvailable} */
|
|
506
|
-
getTileDataAvailable(x: number, y: number, level: number): boolean;
|
|
507
|
-
/** Checks if this terrain provider is marked as a custom provider. */
|
|
508
|
-
get isCustom(): boolean;
|
|
509
|
-
/** Gets the credit associated with this terrain area. */
|
|
510
|
-
get credit(): string | Credit;
|
|
511
|
-
/** Gets the terrain provider for this terrain area. */
|
|
512
|
-
get provider(): TerrainProvider | undefined;
|
|
513
|
-
/** Gets the terrain bounds for this terrain area. */
|
|
514
|
-
get bounds(): TerrainBounds;
|
|
515
|
-
/** Gets available zoom levels set with this terrain area. */
|
|
516
|
-
get levels(): Set<number>;
|
|
517
|
-
/** Gets if this terrain area is ready. */
|
|
518
|
-
get ready(): boolean;
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* @namespace
|
|
522
|
-
* Contains types and factory methods for creating `TerrainArea` instances.
|
|
523
|
-
*/
|
|
524
|
-
declare namespace TerrainArea {
|
|
525
|
-
/** Initialization options for `TerrainArea` constructor. */
|
|
526
|
-
interface ConstructorOptions {
|
|
527
|
-
/** The terrain provider for this area or a URL to create one from. */
|
|
528
|
-
provider: TerrainProvider | string;
|
|
529
|
-
/** The geographic bounds of this terrain area. */
|
|
530
|
-
bounds: TerrainBounds | TerrainBounds.ConstructorOptions;
|
|
531
|
-
/**
|
|
532
|
-
* The zoom levels this terrain area applies to.
|
|
533
|
-
* If empty, the area applies to all levels.
|
|
534
|
-
*/
|
|
535
|
-
levels?: number[];
|
|
536
|
-
/**
|
|
537
|
-
* Credit to associate with this terrain provider.
|
|
538
|
-
* Used to identify custom terrain providers.
|
|
539
|
-
* @default custom
|
|
540
|
-
*/
|
|
541
|
-
credit?: string | Credit;
|
|
542
|
-
/**
|
|
543
|
-
* Whether this is a custom terrain provider.
|
|
544
|
-
* @default true
|
|
545
|
-
*/
|
|
546
|
-
isCustom?: boolean;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Creates a `TerrainArea` from a URL and tile ranges.
|
|
550
|
-
* @param url The URL to create the terrain provider from.
|
|
551
|
-
* @param tileRanges Tile ranges by level.
|
|
552
|
-
* @param levels The zoom levels this area applies to.
|
|
553
|
-
* @param credit Credit to associate with this terrain provider.
|
|
554
|
-
* @returns A promise resolving to a new `TerrainArea`
|
|
555
|
-
*/
|
|
556
|
-
function fromUrl(url: string, tileRanges: TileRanges, levels?: number[], credit?: string | Credit): Promise<Awaited<TerrainArea>>;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* @class
|
|
561
|
-
* Provides terrain by delegating requests to different terrain providers
|
|
562
|
-
* based on geographic regions and zoom levels. This allows combining
|
|
563
|
-
* multiple terrain sources into a single seamless terrain.
|
|
564
|
-
*
|
|
565
|
-
* @example
|
|
566
|
-
* ``` typescript
|
|
567
|
-
* const hybridTerrain = await HybridTerrainProvider.create({
|
|
568
|
-
* terrainAreas: [
|
|
569
|
-
* provider: 'custom-terrain-url',
|
|
570
|
-
* bounds: {
|
|
571
|
-
* type: 'tileRange',
|
|
572
|
-
* tileRanges: {
|
|
573
|
-
* 15: {
|
|
574
|
-
* start: { x: 55852, y: 9556 },
|
|
575
|
-
* end: { x: 55871, y: 9575 },
|
|
576
|
-
* },
|
|
577
|
-
* },
|
|
578
|
-
* levels: [15],
|
|
579
|
-
* }
|
|
580
|
-
* ],
|
|
581
|
-
* terrainProvider: 'default-terrain-url',
|
|
582
|
-
* fallbackProvider: new EllipsoidTerrainProvider(),
|
|
583
|
-
* });
|
|
584
|
-
*
|
|
585
|
-
* viewer.terrainProvider = hybridTerrain;
|
|
586
|
-
* ```
|
|
587
|
-
*/
|
|
588
|
-
declare class HybridTerrainProvider implements TerrainProvider {
|
|
589
|
-
private _terrainAreas;
|
|
590
|
-
private _terrainProvider;
|
|
591
|
-
private _fallbackProvider;
|
|
592
|
-
private _tilingScheme;
|
|
593
|
-
private _ready;
|
|
594
|
-
private _availability?;
|
|
595
|
-
/**
|
|
596
|
-
* Creates a new `HybridTerrainProvider`. Use the {@link HybridTerrainProvider.create}
|
|
597
|
-
* instead of the constructor for async initialization.
|
|
598
|
-
* @param terrainProvider The initialized default terrain provider
|
|
599
|
-
* @param fallbackProvider The initialized fallback terrain provider
|
|
600
|
-
* @param terrainAreas The array of initialized terrain areas
|
|
601
|
-
* @private - Use {@link HybridTerrainProvider.create} instead.
|
|
602
|
-
*/
|
|
603
|
-
private constructor();
|
|
604
|
-
/**
|
|
605
|
-
* Asynchronously creates a new `HybridTerrainProvider`.
|
|
606
|
-
* @param options {@link HybridTerrainProvider.ConstructorOptions}
|
|
607
|
-
* @returns A promise that resolves to a new `HybridTerrainProvider` instance.
|
|
608
|
-
*/
|
|
609
|
-
static create(options: HybridTerrainProvider.ConstructorOptions): Promise<HybridTerrainProvider>;
|
|
610
|
-
/**
|
|
611
|
-
* Gets a value indicating whether or not the provider is ready for use,
|
|
612
|
-
* or a promise that resolves when the provider becomes ready.
|
|
613
|
-
*/
|
|
614
|
-
get ready(): boolean;
|
|
615
|
-
/**
|
|
616
|
-
* Gets the tiling scheme used by this provider.
|
|
617
|
-
*/
|
|
618
|
-
get tilingScheme(): TilingScheme;
|
|
619
|
-
/**
|
|
620
|
-
* Gets an object that can be used to determine availability of terrain from this provider.
|
|
621
|
-
*/
|
|
622
|
-
get availability(): TileAvailability | undefined;
|
|
623
|
-
/**
|
|
624
|
-
* Gets the list of terrain areas managed by this provider.
|
|
625
|
-
*/
|
|
626
|
-
get terrainAreas(): readonly TerrainArea[];
|
|
627
|
-
/**
|
|
628
|
-
* Gets the default terrain provider.
|
|
629
|
-
*/
|
|
630
|
-
get defaultProvider(): TerrainProvider;
|
|
631
|
-
/**
|
|
632
|
-
* Gets the fallback terrain provider.
|
|
633
|
-
*/
|
|
634
|
-
get fallbackProvider(): TerrainProvider;
|
|
635
|
-
/**
|
|
636
|
-
* @see {@link TerrainProvider.credit}
|
|
637
|
-
*/
|
|
638
|
-
get credit(): any;
|
|
639
|
-
/**
|
|
640
|
-
* @see {@link TerrainProvider.errorEvent}
|
|
641
|
-
*/
|
|
642
|
-
get errorEvent(): any;
|
|
643
|
-
/**
|
|
644
|
-
* @see {@link TerrainProvider.hasWaterMask}
|
|
645
|
-
*/
|
|
646
|
-
get hasWaterMask(): boolean;
|
|
647
|
-
/**
|
|
648
|
-
* @see {@link TerrainProvider.hasVertexNormals}
|
|
649
|
-
*/
|
|
650
|
-
get hasVertexNormals(): boolean;
|
|
651
|
-
/**
|
|
652
|
-
* @see {@link TerrainProvider.loadTileDataAvailability}
|
|
653
|
-
*/
|
|
654
|
-
loadTileDataAvailability(x: number, y: number, level: number): Promise<void> | undefined;
|
|
655
|
-
/**
|
|
656
|
-
* @see {@link TerrainProvider.getLevelMaximumGeometricError}
|
|
657
|
-
*/
|
|
658
|
-
getLevelMaximumGeometricError(level: number): number;
|
|
659
|
-
/**
|
|
660
|
-
* Requests the terrain for a given tile coordinate.
|
|
661
|
-
* @param x The X coordinate of the tile.
|
|
662
|
-
* @param y The Y coordinate of the tile.
|
|
663
|
-
* @param level The zoom level of the tile.
|
|
664
|
-
* @param request The request.
|
|
665
|
-
* @returns A promise for the requested terrain.
|
|
666
|
-
*/
|
|
667
|
-
requestTileGeometry(x: number, y: number, level: number, request?: Request): Promise<Awaited<TerrainData>> | undefined;
|
|
668
|
-
/**
|
|
669
|
-
* @see {@link TerrainProvider.getTileDataAvailable}
|
|
670
|
-
* @param x
|
|
671
|
-
* @param y
|
|
672
|
-
* @param level
|
|
673
|
-
*/
|
|
674
|
-
getTileDataAvailable(x: number, y: number, level: number): boolean | undefined;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* @namespace
|
|
678
|
-
* Contains types and factory methods for creating `HybridTerrainProvider` instance.
|
|
679
|
-
*/
|
|
680
|
-
declare namespace HybridTerrainProvider {
|
|
681
|
-
/**
|
|
682
|
-
* Initialization options for `HybridTerrainProvider` constructor.
|
|
683
|
-
*/
|
|
684
|
-
interface ConstructorOptions {
|
|
685
|
-
/** An array of terrain areas to include in the hybrid terrain. */
|
|
686
|
-
terrainAreas: TerrainArea.ConstructorOptions[];
|
|
687
|
-
/** Default provider to use outside of specified terrain areas. */
|
|
688
|
-
terrainProvider: TerrainProvider | string;
|
|
689
|
-
/** Optional fallback provider when data is not available from default provider. @default EllipsoidTerrainProvider */
|
|
690
|
-
fallbackProvider?: TerrainProvider | string;
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Creates a `HybridTerrainProvider` with a custom terrain area overlaid on a base terrain.
|
|
694
|
-
* @param customTerrainUrl URL to the custom terrain.
|
|
695
|
-
* @param baseTerrainUrl URL to the base terrain.
|
|
696
|
-
* @param tileRanges Tile ranges defining the custom terrain area.
|
|
697
|
-
* @param levels Levels to apply the custom terrain.
|
|
698
|
-
* @returns A promise resolving to a new `HybridTerrainProvider`.
|
|
699
|
-
*/
|
|
700
|
-
function createOverlay(customTerrainUrl: string, baseTerrainUrl: string, tileRanges: TileRanges, levels?: number[]): Promise<Awaited<HybridTerrainProvider>>;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* Copies configuration and state from one Cesium Viewer to another.
|
|
705
|
-
* @param source - The source viewer to copy properties from
|
|
706
|
-
* @param container - DOM element ID or element for the new viewer
|
|
707
|
-
* @param options - Optional override options for the new viewer
|
|
708
|
-
* @returns A new Viewer instance with copied properties
|
|
709
|
-
*/
|
|
710
|
-
declare function cloneViewer(source: Viewer, container: Element | string, options?: Viewer.ConstructorOptions): Viewer;
|
|
711
|
-
/**
|
|
712
|
-
* Copies camera state from source viewer to destination viewer.
|
|
713
|
-
* @param source The source viewer to copy camera states from.
|
|
714
|
-
* @param dest The destination viewer to apply camera properties from the source.
|
|
715
|
-
*/
|
|
716
|
-
declare function syncCameraState(source: Viewer, dest: Viewer): void;
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @class
|
|
720
|
-
* Utility class for visualizing terrain provider boundaries and debugging terrain loading.
|
|
721
|
-
*/
|
|
722
|
-
declare class TerrainVisualizer {
|
|
723
|
-
private _viewer;
|
|
724
|
-
private _collection;
|
|
725
|
-
private _hybridTerrain?;
|
|
726
|
-
private _visible;
|
|
727
|
-
private _level;
|
|
728
|
-
private _tileCoordinatesLayer;
|
|
729
|
-
private _colors;
|
|
730
|
-
/**
|
|
731
|
-
* Creates a new `TerrainVisualizer`.
|
|
732
|
-
* @param viewer The Cesium viewer instance
|
|
733
|
-
* @param options {@link TerrainVisualizer.ConstructorOptions}
|
|
734
|
-
*/
|
|
735
|
-
constructor(viewer: Viewer, options?: TerrainVisualizer.ConstructorOptions);
|
|
736
|
-
/**
|
|
737
|
-
* Sets the terrain provider to visualize.
|
|
738
|
-
* @param terrainProvider The terrain provider to visualize.
|
|
739
|
-
*/
|
|
740
|
-
setTerrainProvider(terrainProvider: HybridTerrainProvider): void;
|
|
741
|
-
/**
|
|
742
|
-
* Updates all active visualizations.
|
|
743
|
-
*/
|
|
744
|
-
update(): void;
|
|
745
|
-
/**
|
|
746
|
-
* Clears all visualizations.
|
|
747
|
-
*/
|
|
748
|
-
clear(): void;
|
|
749
|
-
/**
|
|
750
|
-
* Shows a grid of tiles at the specified level.
|
|
751
|
-
* @param level The zoom level to visualize
|
|
752
|
-
*/
|
|
753
|
-
show(level?: number): void;
|
|
754
|
-
/**
|
|
755
|
-
* Hides the tile grid.
|
|
756
|
-
*/
|
|
757
|
-
hide(): void;
|
|
758
|
-
/**
|
|
759
|
-
* Sets the colors used for visualization.
|
|
760
|
-
* @param colors Map of role names to colors
|
|
761
|
-
*/
|
|
762
|
-
setColors(colors: Record<string, Color>): void;
|
|
763
|
-
/**
|
|
764
|
-
* Flies the camera to focus on a terrain area.
|
|
765
|
-
* @param area The terrain area to focus on.
|
|
766
|
-
* @param options {@link Viewer.flyTo}
|
|
767
|
-
*/
|
|
768
|
-
flyTo(area: TerrainArea, options?: {
|
|
769
|
-
duration?: number;
|
|
770
|
-
}): void;
|
|
771
|
-
/**
|
|
772
|
-
* Gets the rectangle representing the current view.
|
|
773
|
-
* @returns The current view rectangle or undefined.
|
|
774
|
-
* @private
|
|
775
|
-
*/
|
|
776
|
-
private _getVisibleRectangle;
|
|
777
|
-
/** The current zoom level set on the visualizer. */
|
|
778
|
-
get level(): number;
|
|
779
|
-
/** Set zoom level on the visualizer. */
|
|
780
|
-
set level(level: number);
|
|
781
|
-
/** Whether the grid is currently visible. */
|
|
782
|
-
get visible(): boolean;
|
|
783
|
-
/** The collection used in the visualizer. */
|
|
784
|
-
get collection(): Collection<EntityCollection, Entity>;
|
|
785
|
-
/** The viewer used in the visualizer */
|
|
786
|
-
get viewer(): Viewer;
|
|
787
|
-
}
|
|
788
|
-
/**
|
|
789
|
-
* @namespace
|
|
790
|
-
* Contains types, utility functions, and constants for terrain visualization.
|
|
791
|
-
*/
|
|
792
|
-
declare namespace TerrainVisualizer {
|
|
793
|
-
/** Initialization options for `TerrainVisualizer` constructor. */
|
|
794
|
-
interface ConstructorOptions {
|
|
795
|
-
/** Colors to use for different visualization elements */
|
|
796
|
-
colors?: Record<string, Color>;
|
|
797
|
-
/** Whether to show boundaries initially. */
|
|
798
|
-
boundaries?: boolean;
|
|
799
|
-
/** Whether to show tile grid initially. */
|
|
800
|
-
tile?: boolean;
|
|
801
|
-
/** Initial zoom level to use for visualizations. */
|
|
802
|
-
activeLevel?: number;
|
|
803
|
-
/** Terrain provider to visualize. */
|
|
804
|
-
terrainProvider?: HybridTerrainProvider;
|
|
805
|
-
}
|
|
806
|
-
/** Tag constants for entity collection management. */
|
|
807
|
-
const tag: {
|
|
808
|
-
default: string;
|
|
809
|
-
boundary: string;
|
|
810
|
-
grid: string;
|
|
811
|
-
};
|
|
812
|
-
/**
|
|
813
|
-
* Creates a ground-clamped rectangle entity for visualization.
|
|
814
|
-
* @param rectangle The rectangle to visualize
|
|
815
|
-
* @param color The color to use
|
|
816
|
-
* @returns A new entity
|
|
817
|
-
*/
|
|
818
|
-
function createRectangle(rectangle: Rectangle, color: Color): Entity;
|
|
819
|
-
/** Options for {@link TerrainVisualizer.visualize} */
|
|
820
|
-
interface Options {
|
|
821
|
-
color?: Color;
|
|
822
|
-
show?: boolean;
|
|
823
|
-
maxTilesToShow?: number;
|
|
824
|
-
levels?: number[];
|
|
825
|
-
tag?: string;
|
|
826
|
-
alpha?: number;
|
|
827
|
-
tileAlpha?: number;
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Visualizes a specific terrain area in a viewer.
|
|
831
|
-
* @param terrain The terrain area to visualize.
|
|
832
|
-
* @param viewer The Cesium viewer.
|
|
833
|
-
* @param options Visualization options.
|
|
834
|
-
* @returns Collection of created entities.
|
|
835
|
-
*/
|
|
836
|
-
function visualize(terrain: TerrainArea | TerrainBounds, viewer: Viewer, options?: Options): Collection<EntityCollection, Entity>;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
export { Collection, HybridTerrainProvider, TerrainArea, TerrainBounds, TerrainVisualizer, cloneViewer, syncCameraState };
|
|
1
|
+
export { CesiumCollection, CesiumCollectionItem, Collection, CollectionEventType, EventHandler, Primitives, Tag, WithTag } from './collection/index.js';
|
|
2
|
+
export { H as HybridTerrainProvider, T as TerrainArea, a as TerrainBounds, b as TileRange, c as TileRanges } from './hybrid-terrain-provider-C6aXdtyo.js';
|
|
3
|
+
export { TerrainAreas } from './terrain/index.js';
|
|
4
|
+
export { TerrainVisualizer, syncCamera } from './utils/index.js';
|
|
5
|
+
export { cloneViewer } from './viewer/index.js';
|
|
6
|
+
import 'cesium';
|