@juun-roh/cesium-utils 0.0.6 → 0.0.7
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-MIDZHLUZ.js +1 -0
- package/dist/collection/index.cjs +1 -1
- package/dist/collection/index.d.cts +110 -67
- package/dist/collection/index.d.ts +110 -67
- package/dist/collection/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +132 -5
- package/dist/utils/index.d.ts +132 -5
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HC6YX7RQ.js +0 -1
- package/dist/sync-camera-CFIMO7Ut.d.cts +0 -133
- package/dist/sync-camera-DHUVJ-Fl.d.ts +0 -133
|
@@ -49,8 +49,7 @@ type NonFunction<T> = {
|
|
|
49
49
|
* entities.add(new Entity({ ... }), 'roads');
|
|
50
50
|
*
|
|
51
51
|
* // Later, show only buildings
|
|
52
|
-
* entities.show('buildings');
|
|
53
|
-
* entities.hide('roads');
|
|
52
|
+
* entities.show('buildings').hide('roads');
|
|
54
53
|
*/
|
|
55
54
|
declare class Collection<C extends CesiumCollection, I extends CesiumCollectionItem> {
|
|
56
55
|
/**
|
|
@@ -95,6 +94,22 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
95
94
|
collection: C;
|
|
96
95
|
tag?: Tag;
|
|
97
96
|
});
|
|
97
|
+
/**
|
|
98
|
+
* Makes the collection directly iterable, allowing it to be used in `for...of` loops
|
|
99
|
+
* and with spread operators.
|
|
100
|
+
*
|
|
101
|
+
* @returns An iterator for the items in the collection
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // Iterate through all items in the collection
|
|
105
|
+
* for (const entity of collection) {
|
|
106
|
+
* console.log(entity.id);
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* // Convert collection to array using spread syntax
|
|
110
|
+
* const entitiesArray = [...collection];
|
|
111
|
+
*/
|
|
112
|
+
[Symbol.iterator](): Iterator<I>;
|
|
98
113
|
/**
|
|
99
114
|
* Emits an event to all registered listeners.
|
|
100
115
|
*
|
|
@@ -168,10 +183,22 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
168
183
|
/**
|
|
169
184
|
* Returns true if the provided item is in this collection, false otherwise.
|
|
170
185
|
*
|
|
171
|
-
* @param item - The item to check for
|
|
186
|
+
* @param item - The item instance to check for
|
|
172
187
|
* @returns True if the item is in the collection, false otherwise
|
|
173
188
|
*/
|
|
174
189
|
contains(item: I): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Checks if the collection has any items with the specified tag.
|
|
192
|
+
*
|
|
193
|
+
* @param tag - The tag to check for
|
|
194
|
+
* @returns True if items with the tag exist, false otherwise
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* if (collection.contains('temporary')) {
|
|
198
|
+
* console.log('Temporary items exist');
|
|
199
|
+
* }
|
|
200
|
+
*/
|
|
201
|
+
contains(tag: Tag): boolean;
|
|
175
202
|
/**
|
|
176
203
|
* Removes an item from the collection.
|
|
177
204
|
*
|
|
@@ -179,6 +206,20 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
179
206
|
* @returns True if the item was removed, false if it wasn't found
|
|
180
207
|
*/
|
|
181
208
|
remove(item: I): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Removes all items with the specified tag from the collection.
|
|
211
|
+
*
|
|
212
|
+
* @param by - The tag identifying which items to remove
|
|
213
|
+
* @returns True if the item was removed, false if it wasn't found
|
|
214
|
+
*/
|
|
215
|
+
remove(by: Tag): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Removes all items with the array of tags from the collection.
|
|
218
|
+
*
|
|
219
|
+
* @param by - The tags identifying which items to remove
|
|
220
|
+
* @returns True if the item was removed, false if it wasn't found
|
|
221
|
+
*/
|
|
222
|
+
remove(by: Tag[]): boolean;
|
|
182
223
|
/**
|
|
183
224
|
* Removes all items from the collection.
|
|
184
225
|
*/
|
|
@@ -200,26 +241,26 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
200
241
|
* Gets all items with the specified tag from the collection.
|
|
201
242
|
* Uses an optimized internal map for faster lookups.
|
|
202
243
|
*
|
|
203
|
-
* @param
|
|
244
|
+
* @param by - The tag to filter by
|
|
204
245
|
* @returns An array of items with the specified tag, or an empty array if none found
|
|
205
246
|
*
|
|
206
247
|
* @example
|
|
207
248
|
* // Get all buildings
|
|
208
|
-
* const buildings = collection.
|
|
249
|
+
* const buildings = collection.get('buildings');
|
|
209
250
|
*/
|
|
210
|
-
|
|
251
|
+
get(by: Tag): I[];
|
|
211
252
|
/**
|
|
212
|
-
* Gets the first item matching the tag. More efficient than
|
|
253
|
+
* Gets the first item matching the tag. More efficient than `get` when
|
|
213
254
|
* you only need one item, especially for large collections.
|
|
214
255
|
*
|
|
215
|
-
* @param
|
|
256
|
+
* @param by - The tag to search for
|
|
216
257
|
* @returns The first matching item or undefined if none found
|
|
217
258
|
*
|
|
218
259
|
* @example
|
|
219
260
|
* // Get the first building
|
|
220
|
-
* const firstBuilding = collection.
|
|
261
|
+
* const firstBuilding = collection.first('buildings');
|
|
221
262
|
*/
|
|
222
|
-
|
|
263
|
+
first(by: Tag): I | undefined;
|
|
223
264
|
/**
|
|
224
265
|
* Gets all unique tags currently in use in the collection.
|
|
225
266
|
*
|
|
@@ -227,99 +268,63 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
227
268
|
*
|
|
228
269
|
* @example
|
|
229
270
|
* // Get all tags
|
|
230
|
-
* const tags = collection.
|
|
271
|
+
* const tags = collection.tags;
|
|
231
272
|
* console.log(`Collection has these tags: ${tags.join(', ')}`);
|
|
232
273
|
*/
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Checks if the collection has any items with the specified tag.
|
|
236
|
-
*
|
|
237
|
-
* @param tag - The tag to check for
|
|
238
|
-
* @returns True if items with the tag exist, false otherwise
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* if (collection.hasTag('temporary')) {
|
|
242
|
-
* console.log('Temporary items exist');
|
|
243
|
-
* }
|
|
244
|
-
*/
|
|
245
|
-
hasTag(tag: Tag): boolean;
|
|
274
|
+
get tags(): Tag[];
|
|
246
275
|
/**
|
|
247
276
|
* Updates the tag for all items with the specified tag.
|
|
248
277
|
*
|
|
249
|
-
* @param
|
|
250
|
-
* @param
|
|
278
|
+
* @param from - The tag to replace
|
|
279
|
+
* @param to - The new tag to assign
|
|
251
280
|
* @returns The number of items updated
|
|
252
281
|
*
|
|
253
282
|
* @example
|
|
254
283
|
* // Rename a tag
|
|
255
|
-
* const count = collection.
|
|
284
|
+
* const count = collection.update('temp', 'temporary');
|
|
256
285
|
* console.log(`Updated ${count} items`);
|
|
257
286
|
*/
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Removes all items with the specified tag from the collection.
|
|
261
|
-
*
|
|
262
|
-
* @param tag - The tag identifying which items to remove
|
|
263
|
-
* @returns The number of items removed
|
|
264
|
-
*
|
|
265
|
-
* @example
|
|
266
|
-
* // Remove all temporary markers
|
|
267
|
-
* const count = collection.removeByTag('temporary');
|
|
268
|
-
* console.log(`Removed ${count} items`);
|
|
269
|
-
*/
|
|
270
|
-
removeByTag(tag: Tag): number;
|
|
271
|
-
/**
|
|
272
|
-
* Removes all items with the array of tags from the collection.
|
|
273
|
-
*
|
|
274
|
-
* @param tag - The tags identifying which items to remove
|
|
275
|
-
* @returns The number of items removed
|
|
276
|
-
*
|
|
277
|
-
* @example
|
|
278
|
-
* // Remove all items containing tags
|
|
279
|
-
* const count = collection.removeByTag('temporary', 'default', 'tag');
|
|
280
|
-
* console.log(`Removed ${count} items`);
|
|
281
|
-
*/
|
|
282
|
-
removeByTag(tag: Tag[]): number;
|
|
287
|
+
update(from: Tag, to: Tag): number;
|
|
283
288
|
/**
|
|
284
289
|
* Makes all items with the specified tag visible.
|
|
285
290
|
* Only affects items that have a 'show' property.
|
|
286
291
|
*
|
|
287
|
-
* @param
|
|
288
|
-
* @returns The
|
|
292
|
+
* @param by - The tag identifying which items to show
|
|
293
|
+
* @returns The collection itself.
|
|
289
294
|
*
|
|
290
295
|
* @example
|
|
291
296
|
* // Show all buildings
|
|
292
297
|
* collection.show('buildings');
|
|
293
298
|
*/
|
|
294
|
-
show(
|
|
299
|
+
show(by: Tag): this;
|
|
295
300
|
/**
|
|
296
301
|
* Hides all items with the specified tag.
|
|
297
302
|
* Only affects items that have a 'show' property.
|
|
298
303
|
*
|
|
299
|
-
* @param
|
|
300
|
-
* @returns The
|
|
304
|
+
* @param by - The tag identifying which items to hide
|
|
305
|
+
* @returns The collection itself.
|
|
301
306
|
*
|
|
302
307
|
* @example
|
|
303
308
|
* // Hide all buildings
|
|
304
309
|
* collection.hide('buildings');
|
|
305
310
|
*/
|
|
306
|
-
hide(
|
|
311
|
+
hide(by: Tag): this;
|
|
307
312
|
/**
|
|
308
313
|
* Toggles visibility of all items with the specified tag.
|
|
309
314
|
* Only affects items that have a 'show' property.
|
|
310
315
|
*
|
|
311
|
-
* @param
|
|
312
|
-
* @returns The
|
|
316
|
+
* @param by - The tag identifying which items to toggle
|
|
317
|
+
* @returns The collection itself.
|
|
313
318
|
*
|
|
314
319
|
* @example
|
|
315
320
|
* // Toggle visibility of all buildings
|
|
316
321
|
* collection.toggle('buildings');
|
|
317
322
|
*/
|
|
318
|
-
toggle(
|
|
323
|
+
toggle(by: Tag): this;
|
|
319
324
|
/**
|
|
320
325
|
* Sets a property value on all items with the specified tag.
|
|
321
326
|
*
|
|
322
|
-
* @param
|
|
327
|
+
* @param by - The tag identifying which items to update
|
|
323
328
|
* @param property - The property name to set
|
|
324
329
|
* @param value - The value to set
|
|
325
330
|
* @returns The number of items updated
|
|
@@ -328,13 +333,13 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
328
333
|
* // Change color of all buildings to red
|
|
329
334
|
* collection.setProperty('buildings', 'color', Color.RED);
|
|
330
335
|
*/
|
|
331
|
-
setProperty<K extends NonFunction<I>, V extends Exclude<I[K], Function>>(property: K, value: V,
|
|
336
|
+
setProperty<K extends NonFunction<I>, V extends Exclude<I[K], Function>>(property: K, value: V, by?: Tag): this;
|
|
332
337
|
/**
|
|
333
338
|
* Filters items in the collection based on a predicate function.
|
|
334
339
|
* Optionally only filters items with a specific tag.
|
|
335
340
|
*
|
|
336
341
|
* @param predicate - Function that tests each item
|
|
337
|
-
* @param
|
|
342
|
+
* @param by - Optional tag to filter by before applying the predicate
|
|
338
343
|
* @returns Array of items that pass the test
|
|
339
344
|
*
|
|
340
345
|
* @example
|
|
@@ -344,13 +349,13 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
344
349
|
* 'buildings'
|
|
345
350
|
* );
|
|
346
351
|
*/
|
|
347
|
-
filter(predicate: (item: I) => boolean,
|
|
352
|
+
filter(predicate: (item: I) => boolean, by?: Tag): I[];
|
|
348
353
|
/**
|
|
349
354
|
* Executes a callback function for each item in the collection.
|
|
350
355
|
* Optionally filters items by tag before execution.
|
|
351
356
|
*
|
|
352
357
|
* @param callback - Function to execute for each item
|
|
353
|
-
* @param
|
|
358
|
+
* @param by - Optional tag to filter items (if not provided, processes all items)
|
|
354
359
|
*
|
|
355
360
|
* @example
|
|
356
361
|
* // Highlight all buildings
|
|
@@ -360,7 +365,45 @@ declare class Collection<C extends CesiumCollection, I extends CesiumCollectionI
|
|
|
360
365
|
* }
|
|
361
366
|
* }, 'buildings');
|
|
362
367
|
*/
|
|
363
|
-
forEach(callback: (
|
|
368
|
+
forEach(callback: (value: I, index: number) => void, by?: Tag): void;
|
|
369
|
+
/**
|
|
370
|
+
* Creates a new array with the results of calling a provided function on every element
|
|
371
|
+
* in the collection. Optionally filters by tag before mapping.
|
|
372
|
+
*
|
|
373
|
+
* @param callbackfn - Function that produces an element of the new array
|
|
374
|
+
* @param by - Optional tag to filter items by before mapping
|
|
375
|
+
* @returns A new array with each element being the result of the callback function
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* // Get all entity IDs
|
|
379
|
+
* const entityIds = collection.map(entity => entity.id);
|
|
380
|
+
*
|
|
381
|
+
* // Get positions of all buildings
|
|
382
|
+
* const buildingPositions = collection.map(
|
|
383
|
+
* entity => entity.position.getValue(Cesium.JulianDate.now()),
|
|
384
|
+
* 'buildings'
|
|
385
|
+
* );
|
|
386
|
+
*/
|
|
387
|
+
map<R>(callbackfn: (value: I, index: number) => R, by?: Tag): R[];
|
|
388
|
+
/**
|
|
389
|
+
* Returns the first element in the collection that satisfies the provided testing function.
|
|
390
|
+
* Optionally filters by tag before searching.
|
|
391
|
+
*
|
|
392
|
+
* @param predicate - Function to test each element
|
|
393
|
+
* @param by - Optional tag to filter items by before searching
|
|
394
|
+
* @returns The first element that passes the test, or undefined if no elements pass
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* // Find the first entity with a specific name
|
|
398
|
+
* const namedEntity = collection.find(entity => entity.name === 'Target');
|
|
399
|
+
*
|
|
400
|
+
* // Find the first building taller than 100 meters
|
|
401
|
+
* const tallBuilding = collection.find(
|
|
402
|
+
* entity => entity.properties?.height?.getValue() > 100,
|
|
403
|
+
* 'buildings'
|
|
404
|
+
* );
|
|
405
|
+
*/
|
|
406
|
+
find(predicate: (value: I) => boolean, by?: Tag): I | undefined;
|
|
364
407
|
}
|
|
365
408
|
|
|
366
409
|
export { type CesiumCollection, type CesiumCollectionItem, Collection, type CollectionEventType, type EventHandler, type NonFunction, type Tag, type WithTag };
|
package/dist/collection/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"../chunk-
|
|
1
|
+
import{c as o}from"../chunk-MIDZHLUZ.js";import"../chunk-YZ7AUGIO.js";export{o as Collection};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var r in e)k(n,r,{get:e[r],enumerable:!0})},$=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Y(e))!q.call(n,i)&&i!==r&&k(n,i,{get:()=>e[i],enumerable:!(t=H(e,i))||t.enumerable});return n};var U=n=>$(k({},"__esModule",{value:!0}),n);var X={};W(X,{Collection:()=>R,HybridTerrainProvider:()=>P,TerrainArea:()=>g,TerrainAreas:()=>p,TerrainBounds:()=>v,TerrainVisualizer:()=>T,cloneViewer:()=>D,syncCamera:()=>C});module.exports=U(X);var w=require("cesium");var l=require("cesium");var T=class n{_viewer;_collection;_hybridTerrain;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",l.Color.RED],["default",l.Color.BLUE],["fallback",l.Color.GRAY],["grid",l.Color.YELLOW]]);constructor(e,r){this._viewer=e,this._collection=new R({collection:e.entities,tag:n.tag.default}),r&&(r.colors&&Object.entries(r.colors).forEach(([t,i])=>{this._colors.set(t,i)}),r.tile!==void 0&&(this._visible=r.tile),r.activeLevel!==void 0&&(this._level=r.activeLevel),r.terrainProvider&&this.setTerrainProvider(r.terrainProvider))}setTerrainProvider(e){this._hybridTerrain=e,this.update()}update(){this.clear(),this._visible&&this.show(this._level)}clear(){this._collection.removeByTag(this._collection.getTags())}show(e=15){if(!this._hybridTerrain)return;this._collection.removeByTag(n.tag.grid),this._level=e;let r=this._hybridTerrain.tilingScheme;this._tileCoordinatesLayer||(this._tileCoordinatesLayer=this._viewer.imageryLayers.addImageryProvider(new l.TileCoordinatesImageryProvider({tilingScheme:r,color:l.Color.YELLOW})));let t=(a,s,c)=>{if(this._hybridTerrain){for(let d of this._hybridTerrain.terrainAreas)if(d.contains(a,s,c))return d.isCustom?this._colors.get("custom")||l.Color.RED:this._colors.get("default")||l.Color.BLUE;if(this._hybridTerrain.getTileDataAvailable(a,s,c))return this._colors.get("default")||l.Color.BLUE}return this._colors.get("fallback")||l.Color.TRANSPARENT},i=this._getVisibleRectangle();if(!i)return;function o(a){return a&&Number.isFinite(a.west)&&Number.isFinite(a.south)&&Number.isFinite(a.east)&&Number.isFinite(a.north)&&a.west<=a.east&&a.south<=a.north}if(!o(i)){console.warn("Invalid visible rectangle detected, skipping grid display");return}try{let a=r.positionToTileXY(l.Rectangle.northwest(i),e),s=r.positionToTileXY(l.Rectangle.southeast(i),e);if(!a||!s)return;let c=100,d=Math.min(s.x-a.x+1,c),y=Math.min(s.y-a.y+1,c);for(let m=a.x;m<=a.x+d-1;m++)for(let f=a.y;f<=a.y+y-1;f++)try{let h=r.tileXYToRectangle(m,f,e);if(!o(h)){console.warn(`Invalid rectangle for tile (${m}, ${f}, ${e}), skipping`);continue}let A=t(m,f,e),_=n.createRectangle(h,A.withAlpha(.3));_.properties?.addProperty("tileX",m),_.properties?.addProperty("tileY",f),_.properties?.addProperty("tileLevel",e),this._collection.add(_,n.tag.grid)}catch(h){console.warn(`Error creating tile (${m}, ${f}, ${e}): ${h.message}`);continue}console.log("\u{1F680} ~ TerrainVisualizer ~ showGrid ~ collection:",this._collection),this._visible=!0}catch(a){console.error("Error displaying tile grid:",a)}}hide(){this._collection.removeByTag(n.tag.grid),this._tileCoordinatesLayer&&(this._viewer.imageryLayers.remove(this._tileCoordinatesLayer),this._tileCoordinatesLayer=void 0),this._visible=!1}setColors(e){Object.entries(e).forEach(([r,t])=>{this._colors.set(r,t)}),this.update()}flyTo(e,r){let{rectangle:t}=e.bounds;this._viewer.camera.flyTo({destination:t,...r,complete:()=>{this._visible&&this.update()}})}_getVisibleRectangle(){return this._viewer.camera.computeViewRectangle()}get level(){return this._level}set level(e){this._level=e,this._visible&&this.update()}get visible(){return this._visible}get collection(){return this._collection}get viewer(){return this._viewer}};(t=>{t.tag={default:"Terrain Visualizer",boundary:"Terrain Visualizer Boundary",grid:"Terrain Visualizer Tile Grid"};function e(i,o){return new l.Entity({rectangle:{coordinates:i,material:o,heightReference:l.HeightReference.CLAMP_TO_GROUND}})}t.createRectangle=e;function r(i,o,a){let s=a?.tag||"terrain_area_visualization",c=a?.color||l.Color.RED,d=a?.maxTilesToShow||100,y=a?.show??!0,m=a?.alpha||.7,f=a?.tileAlpha||.2,h="provider"in i?i.bounds:i,A=new R({collection:o.entities,tag:s}),{rectangle:_}=h;if(A.add(t.createRectangle(_,c.withAlpha(m)),s),y&&h.levels.size>0){let{tilingScheme:G}=h;h.levels.forEach(B=>{let I=0,{tileRanges:F}=h;for(let[z,E]of F.entries())if(z===B)for(let x=E.start.x;x<=E.end.x&&I<d;x++)for(let S=E.start.y;S<=E.end.y&&I<d;S++){let j=G.tileXYToRectangle(x,S,B);A.add(e(j,c.withAlpha(f)),`${s}_tile`),I++}})}return A}t.visualize=r})(T||={});function M(n,e){let r=!1,t=Object.getOwnPropertyDescriptor(n,e);if(!t){let i=Object.getPrototypeOf(n);for(;i&&!t;)t=Object.getOwnPropertyDescriptor(i,e),i=Object.getPrototypeOf(i)}return t&&t.get&&!t.set&&(r=!0),r}var L=require("cesium");function C(n,e){if((0,L.defined)(n)&&(0,L.defined)(e)){let{camera:r}=n;e.camera.position=r.positionWC.clone(),e.camera.direction=r.directionWC.clone(),e.camera.up=r.upWC.clone()}}var O=class n{static symbol=Symbol("cesium-item-tag");tag;collection;_valuesCache=null;_tagMap=new Map;_eventListeners=new Map;constructor({collection:e,tag:r}){this.tag=r||"default",this.collection=e}_emit(e,r){let t=this._eventListeners.get(e);if(t){let i={type:e,...r};t.forEach(o=>o(i))}}_addToTagMap(e,r){this._tagMap.has(r)||this._tagMap.set(r,new Set),this._tagMap.get(r)?.add(e)}_removeFromTagMap(e){let r=e[n.symbol],t=this._tagMap.get(r);t&&(t.delete(e),t.size===0&&this._tagMap.delete(r))}_invalidateCache(){this._valuesCache=null}addEventListener(e,r){return this._eventListeners.has(e)||this._eventListeners.set(e,new Set),this._eventListeners.get(e)?.add(r),this}removeEventListener(e,r){return this._eventListeners.get(e)?.delete(r),this}add(e,r=this.tag,t){return Array.isArray(e)?e.forEach(i=>{this.add(i,r)}):(Object.defineProperty(e,n.symbol,{value:r,enumerable:!1,writable:!0,configurable:!0}),this.collection.add(e,t),this._addToTagMap(e,r),this._invalidateCache(),this._emit("add",{items:[e],tag:r})),e}contains(e){return this.collection.contains(e)}remove(e){let r=this.collection.remove(e);return r&&(this._removeFromTagMap(e),this._invalidateCache(),this._emit("remove",{items:[e]})),r}removeAll(){this._tagMap.clear(),this.collection.removeAll(),this._invalidateCache(),this._emit("clear")}get values(){if(this.collection instanceof w.EntityCollection)return this.collection.values;{let e=[];for(let r=0;r<this.collection.length;r++)e.push(this.collection.get(r));return e}}get length(){return this.values?.length||0}getByTag(e){let r=this._tagMap.get(e);return r?Array.from(r):[]}getFirstByTag(e){let r=this._tagMap.get(e);if(r&&r.size>0)return r.values().next().value}getTags(){return Array.from(this._tagMap.keys())}hasTag(e){let r=this._tagMap.get(e);return!!r&&r.size>0}updateTag(e,r){let t=this.getByTag(e);for(let i of t)this._removeFromTagMap(i),Object.defineProperty(i,n.symbol,{value:r,enumerable:!1,writable:!0,configurable:!0}),this._addToTagMap(i,r);return t.length>0&&this._emit("update",{items:t,tag:r}),t.length}removeByTag(e){let r=0;return Array.isArray(e)?e.forEach(t=>{r+=this.removeByTag(t)}):this.getByTag(e).forEach(t=>{this.remove(t)&&r++}),r}show(e){let r=this.getByTag(e),t=0;for(let i of r)(0,w.defined)(i.show)&&(i.show=!0,t++);return t}hide(e){let r=this.getByTag(e),t=0;for(let i of r)(0,w.defined)(i.show)&&(i.show=!1,t++);return t}toggle(e){let r=this.getByTag(e),t=0;for(let i of r)(0,w.defined)(i.show)&&(i.show=!i.show,t++);return t}setProperty(e,r,t=this.tag){let i=this.getByTag(t),o=0;for(let a of i)if(e in a&&typeof a[e]!="function"){if(M(a,e))throw Error(`setProperty(${a}, ${e}) failed; The property is readonly.`);a[e]=r,o++}return o}filter(e,r){return(r?this.getByTag(r):this.values).filter(e)}forEach(e,r){(r?this.getByTag(r):this.values).forEach((i,o)=>e(i,o))}},R=O;var b=require("cesium");var V=require("cesium");var u=require("cesium"),v=class{_rectangle;_tilingScheme;_tileRanges;_levels;constructor(e,r){if(this._tilingScheme=r||new u.GeographicTilingScheme,this._rectangle=new u.Rectangle,this._tileRanges=new Map,this._levels=new Set,e.type==="rectangle"&&e.rectangle)this._rectangle=u.Rectangle.clone(e.rectangle);else if(e.type==="tileRange"&&e.tileRanges)e.tileRanges instanceof Map?this._tileRanges=new Map(e.tileRanges):this._tileRanges=new Map(Object.entries(e.tileRanges).map(([t,i])=>[parseInt(t),i])),this._calculateRectangleFromTileRanges();else throw new Error("Either rectangle or tileRanges must be provided.");this._levels=new Set(Array.from(this._tileRanges.keys()))}contains(e,r,t){if(this._tileRanges.has(t)){let o=this._tileRanges.get(t);return e>=o.start.x&&e<=o.end.x&&r>=o.start.y&&r<=o.end.y}let i=this._tilingScheme.tileXYToRectangle(e,r,t);return u.Rectangle.intersection(i,this._rectangle)!==void 0}configureAvailability(e){if(e.availability){e.availability._tilingScheme&&(e.availability._tilingScheme=this._tilingScheme);for(let[r,t]of this._tileRanges.entries())e.availability.addAvailableTileRange(r,t.start.x,t.start.y,t.end.x,t.end.y)}}get rectangle(){return this._rectangle}get tilingScheme(){return this._tilingScheme}get tileRanges(){return this._tileRanges}get levels(){return this._levels}_calculateRectangleFromTileRanges(){let e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=Array.from(this._tileRanges.keys());if(o.length===0){this._rectangle=u.Rectangle.MAX_VALUE;return}let a=Math.min(...o),s=this._tileRanges.get(a);if(s){let{start:c,end:d}=s,y=this._tilingScheme.tileXYToRectangle(c.x,c.y,a),m=this._tilingScheme.tileXYToRectangle(d.x,d.y,a);e=Math.min(y.west,e),r=Math.min(m.south,r),t=Math.max(m.east,t),i=Math.max(y.north,i)}this._rectangle=new u.Rectangle(e,r,t,i)}};(r=>{function n(t,i,o,a=new u.GeographicTilingScheme){let s=new Map;return s.set(o,{start:{x:t,y:i},end:{x:t,y:i}}),new r({type:"tileRange",tileRanges:s},a)}r.fromTile=n;function e(t,i=new u.GeographicTilingScheme){return new r({type:"rectangle",rectangle:u.Rectangle.clone(t)},i)}r.fromRectangle=e})(v||={});var g=class n{_provider;_bounds;_levels;_ready=!1;_credit;_isCustom;constructor(e,r){this._bounds=e.bounds instanceof v?e.bounds:new v(e.bounds),this._levels=new Set(e.levels||[]),this._credit=e.credit||"custom",this._isCustom=e.isCustom!==void 0?e.isCustom:!0,this._provider=r,this._ready=!0,this._bounds.configureAvailability(this._provider)}static async create(e){let r;return typeof e.provider=="string"?r=await V.CesiumTerrainProvider.fromUrl(e.provider,{requestVertexNormals:!0,credit:e.credit||"custom"}):r=e.provider,new n(e,r)}contains(e,r,t){return this._levels.size>0&&!this._levels.has(t)?!1:this._bounds.contains(e,r,t)}requestTileGeometry(e,r,t,i){if(!(!this._ready||!this.contains(e,r,t)||!this._provider?.getTileDataAvailable(e,r,t)))return this._provider.requestTileGeometry(e,r,t,i)}getTileDataAvailable(e,r,t){return!this.contains(e,r,t)||!this._ready?!1:this._provider?.getTileDataAvailable(e,r,t)??!1}get isCustom(){return this._isCustom}get credit(){return this._credit}get provider(){return this._provider}get bounds(){return this._bounds}get levels(){return this._levels}get ready(){return this._ready}};(e=>{async function n(r,t,i,o="custom"){let a=new v({type:"tileRange",tileRanges:t});return await e.create({provider:r,bounds:a,levels:i||Object.keys(t).map(c=>parseInt(c)),credit:o})}e.fromUrl=n})(g||={});var p=class extends Array{async add(e){let r;return e instanceof g?r=e:r=await g.create(e),this.push(r)}remove(e){let r=this.indexOf(e);return r>=0?(this.splice(r,1),!0):!1}clear(){this.length=0}};var P=class n{_terrainAreas=new p;_terrainProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(e,r,t){this._terrainProvider=e,this._fallbackProvider=r,this._tilingScheme=e.tilingScheme||new b.GeographicTilingScheme,this._terrainAreas=new p(...t),this._availability=e.availability,this._ready=!0}static async create(e){try{let r;typeof e.terrainProvider=="string"?r=await b.CesiumTerrainProvider.fromUrl(e.terrainProvider,{requestVertexNormals:!0}):r=e.terrainProvider;let t;e.fallbackProvider?typeof e.fallbackProvider=="string"?t=await b.CesiumTerrainProvider.fromUrl(e.fallbackProvider,{requestVertexNormals:!0}):t=e.fallbackProvider:t=new b.EllipsoidTerrainProvider;let i=[];for(let o of e.terrainAreas){let a=await g.create(o);i.push(a)}return new n(r,t,i)}catch(r){throw console.error("Failed to initialize HybridTerrainProvider:",r),r}}get ready(){return this._ready}get tilingScheme(){return this._tilingScheme}get availability(){return this._availability}get terrainAreas(){return[...this._terrainAreas]}get defaultProvider(){return this._terrainProvider}get fallbackProvider(){return this._fallbackProvider}get credit(){return this._terrainProvider?.credit}get errorEvent(){return this._terrainProvider.errorEvent}get hasWaterMask(){return this._terrainProvider.hasWaterMask}get hasVertexNormals(){return this._terrainProvider.hasVertexNormals}loadTileDataAvailability(e,r,t){return this._terrainProvider.loadTileDataAvailability(e,r,t)}getLevelMaximumGeometricError(e){return this._terrainProvider.getLevelMaximumGeometricError(e)}requestTileGeometry(e,r,t,i){if(this._ready){for(let o of this._terrainAreas)if(o.contains(e,r,t))return o.requestTileGeometry(e,r,t,i);return this._terrainProvider.getTileDataAvailable(e,r,t)?this._terrainProvider.requestTileGeometry(e,r,t,i):this._fallbackProvider.requestTileGeometry(e,r,t,i)}}getTileDataAvailable(e,r,t){return this._terrainAreas.forEach(i=>{if(i.contains(e,r,t)&&i.getTileDataAvailable(e,r,t))return!0}),this._terrainProvider.getTileDataAvailable(e,r,t)||!0}};(e=>{async function n(r,t,i,o){return e.create({terrainAreas:[{provider:r,bounds:{type:"tileRange",tileRanges:i},levels:o||Object.keys(i).map(a=>parseInt(a)),credit:"custom"}],terrainProvider:t,fallbackProvider:new b.EllipsoidTerrainProvider})}e.createOverlay=n})(P||={});var N=require("cesium");function D(n,e,r){let t={baseLayerPicker:n.baseLayerPicker!==void 0,geocoder:n.geocoder!==void 0,homeButton:n.homeButton!==void 0,sceneModePicker:n.sceneModePicker!==void 0,timeline:n.timeline!==void 0,navigationHelpButton:n.navigationHelpButton!==void 0,animation:n.animation!==void 0,fullscreenButton:n.fullscreenButton!==void 0,shouldAnimate:n.clock.shouldAnimate,terrainProvider:n.terrainProvider,requestRenderMode:n.scene.requestRenderMode,infoBox:n.infoBox!==void 0},i=new N.Viewer(e,{...t,...r});C(n,i);let o=n.imageryLayers;i.imageryLayers.removeAll();for(let c=0;c<o.length;c++){let d=o.get(c);i.imageryLayers.addImageryProvider(d.imageryProvider,c)}i.clock.startTime=n.clock.startTime.clone(),i.clock.stopTime=n.clock.stopTime.clone(),i.clock.currentTime=n.clock.currentTime.clone(),i.clock.multiplier=n.clock.multiplier,i.clock.clockStep=n.clock.clockStep,i.clock.clockRange=n.clock.clockRange,i.clock.shouldAnimate=n.clock.shouldAnimate,i.scene.globe.enableLighting=n.scene.globe.enableLighting,i.scene.globe.depthTestAgainstTerrain=n.scene.globe.depthTestAgainstTerrain,i.scene.screenSpaceCameraController.enableCollisionDetection=n.scene.screenSpaceCameraController.enableCollisionDetection;let a=n.scene.screenSpaceCameraController.tiltEventTypes;a&&(i.scene.screenSpaceCameraController.tiltEventTypes=Array.isArray(a)?[...a]:a);let s=n.scene.screenSpaceCameraController.zoomEventTypes;return s&&(i.scene.screenSpaceCameraController.zoomEventTypes=Array.isArray(s)?[...s]:s),i}
|
|
1
|
+
"use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var t in e)M(n,t,{get:e[t],enumerable:!0})},$=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Y(e))!q.call(n,i)&&i!==t&&M(n,i,{get:()=>e[i],enumerable:!(r=H(e,i))||r.enumerable});return n};var U=n=>$(M({},"__esModule",{value:!0}),n);var X={};W(X,{Collection:()=>R,HybridTerrainProvider:()=>P,TerrainArea:()=>h,TerrainAreas:()=>T,TerrainBounds:()=>v,TerrainVisualizer:()=>p,cloneViewer:()=>D,isGetterOnly:()=>I,syncCamera:()=>w});module.exports=U(X);var C=require("cesium");var l=require("cesium");var p=class n{_viewer;_collection;_hybridTerrain;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",l.Color.RED],["default",l.Color.BLUE],["fallback",l.Color.GRAY],["grid",l.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new R({collection:e.entities,tag:n.tag.default}),t&&(t.colors&&Object.entries(t.colors).forEach(([r,i])=>{this._colors.set(r,i)}),t.tile!==void 0&&(this._visible=t.tile),t.activeLevel!==void 0&&(this._level=t.activeLevel),t.terrainProvider&&this.setTerrainProvider(t.terrainProvider))}setTerrainProvider(e){this._hybridTerrain=e,this.update()}update(){this.clear(),this._visible&&this.show(this._level)}clear(){this._collection.remove(this._collection.tags)}show(e=15){if(!this._hybridTerrain)return;this._collection.remove(n.tag.grid),this._level=e;let t=this._hybridTerrain.tilingScheme;this._tileCoordinatesLayer||(this._tileCoordinatesLayer=this._viewer.imageryLayers.addImageryProvider(new l.TileCoordinatesImageryProvider({tilingScheme:t,color:l.Color.YELLOW})));let r=(a,s,c)=>{if(this._hybridTerrain){for(let d of this._hybridTerrain.terrainAreas)if(d.contains(a,s,c))return d.isCustom?this._colors.get("custom")||l.Color.RED:this._colors.get("default")||l.Color.BLUE;if(this._hybridTerrain.getTileDataAvailable(a,s,c))return this._colors.get("default")||l.Color.BLUE}return this._colors.get("fallback")||l.Color.TRANSPARENT},i=this._getVisibleRectangle();if(!i)return;function o(a){return a&&Number.isFinite(a.west)&&Number.isFinite(a.south)&&Number.isFinite(a.east)&&Number.isFinite(a.north)&&a.west<=a.east&&a.south<=a.north}if(!o(i)){console.warn("Invalid visible rectangle detected, skipping grid display");return}try{let a=t.positionToTileXY(l.Rectangle.northwest(i),e),s=t.positionToTileXY(l.Rectangle.southeast(i),e);if(!a||!s)return;let c=100,d=Math.min(s.x-a.x+1,c),y=Math.min(s.y-a.y+1,c);for(let m=a.x;m<=a.x+d-1;m++)for(let f=a.y;f<=a.y+y-1;f++)try{let g=t.tileXYToRectangle(m,f,e);if(!o(g)){console.warn(`Invalid rectangle for tile (${m}, ${f}, ${e}), skipping`);continue}let A=r(m,f,e),_=n.createRectangle(g,A.withAlpha(.3));_.properties?.addProperty("tileX",m),_.properties?.addProperty("tileY",f),_.properties?.addProperty("tileLevel",e),this._collection.add(_,n.tag.grid)}catch(g){console.warn(`Error creating tile (${m}, ${f}, ${e}): ${g.message}`);continue}console.log("\u{1F680} ~ TerrainVisualizer ~ showGrid ~ collection:",this._collection),this._visible=!0}catch(a){console.error("Error displaying tile grid:",a)}}hide(){this._collection.remove(n.tag.grid),this._tileCoordinatesLayer&&(this._viewer.imageryLayers.remove(this._tileCoordinatesLayer),this._tileCoordinatesLayer=void 0),this._visible=!1}setColors(e){Object.entries(e).forEach(([t,r])=>{this._colors.set(t,r)}),this.update()}flyTo(e,t){let{rectangle:r}=e.bounds;this._viewer.camera.flyTo({destination:r,...t,complete:()=>{this._visible&&this.update()}})}_getVisibleRectangle(){return this._viewer.camera.computeViewRectangle()}get level(){return this._level}set level(e){this._level=e,this._visible&&this.update()}get visible(){return this._visible}get collection(){return this._collection}get viewer(){return this._viewer}};(r=>{r.tag={default:"Terrain Visualizer",boundary:"Terrain Visualizer Boundary",grid:"Terrain Visualizer Tile Grid"};function e(i,o){return new l.Entity({rectangle:{coordinates:i,material:o,heightReference:l.HeightReference.CLAMP_TO_GROUND}})}r.createRectangle=e;function t(i,o,a){let s=a?.tag||"terrain_area_visualization",c=a?.color||l.Color.RED,d=a?.maxTilesToShow||100,y=a?.show??!0,m=a?.alpha||.7,f=a?.tileAlpha||.2,g="provider"in i?i.bounds:i,A=new R({collection:o.entities,tag:s}),{rectangle:_}=g;if(A.add(r.createRectangle(_,c.withAlpha(m)),s),y&&g.levels.size>0){let{tilingScheme:G}=g;g.levels.forEach(V=>{let x=0,{tileRanges:j}=g;for(let[z,E]of j.entries())if(z===V)for(let S=E.start.x;S<=E.end.x&&x<d;S++)for(let k=E.start.y;k<=E.end.y&&x<d;k++){let F=G.tileXYToRectangle(S,k,V);A.add(e(F,c.withAlpha(f)),`${s}_tile`),x++}})}return A}r.visualize=t})(p||={});function I(n,e){let t=!1,r=Object.getOwnPropertyDescriptor(n,e);if(!r){let i=Object.getPrototypeOf(n);for(;i&&!r;)r=Object.getOwnPropertyDescriptor(i,e),i=Object.getPrototypeOf(i)}return r&&r.get&&!r.set&&(t=!0),t}var O=require("cesium");function w(n,e){if((0,O.defined)(n)&&(0,O.defined)(e)){let{camera:t}=n;e.camera.position=t.positionWC.clone(),e.camera.direction=t.directionWC.clone(),e.camera.up=t.upWC.clone()}}var L=class n{static symbol=Symbol("cesium-item-tag");tag;collection;_valuesCache=null;_tagMap=new Map;_eventListeners=new Map;constructor({collection:e,tag:t}){this.tag=t||"default",this.collection=e}[Symbol.iterator](){return this.values[Symbol.iterator]()}_emit(e,t){let r=this._eventListeners.get(e);if(r){let i={type:e,...t};r.forEach(o=>o(i))}}_addToTagMap(e,t){this._tagMap.has(t)||this._tagMap.set(t,new Set),this._tagMap.get(t)?.add(e)}_removeFromTagMap(e){let t=e[n.symbol],r=this._tagMap.get(t);r&&(r.delete(e),r.size===0&&this._tagMap.delete(t))}_invalidateCache(){this._valuesCache=null}addEventListener(e,t){return this._eventListeners.has(e)||this._eventListeners.set(e,new Set),this._eventListeners.get(e)?.add(t),this}removeEventListener(e,t){return this._eventListeners.get(e)?.delete(t),this}add(e,t=this.tag,r){return Array.isArray(e)?e.forEach(i=>{this.add(i,t)}):(Object.defineProperty(e,n.symbol,{value:t,enumerable:!1,writable:!0,configurable:!0}),this.collection.add(e,r),this._addToTagMap(e,t),this._invalidateCache(),this._emit("add",{items:[e],tag:t})),e}contains(e){if(typeof e=="object")return this.collection.contains(e);let t=this._tagMap.get(e);return!!t&&t.size>0}remove(e){if(typeof e=="object"&&!Array.isArray(e)){let i=this.collection.remove(e);return i&&(this._removeFromTagMap(e),this._invalidateCache(),this._emit("remove",{items:[e]})),i}if(Array.isArray(e)){if(e.length===0)return!1;let i=!1;for(let o of e)this.remove(o)&&(i=!0);return i}let t=this.get(e);if(t.length===0)return!1;let r=!1;for(let i of t)this.remove(i)&&(r=!0);return r}removeAll(){this._tagMap.clear(),this.collection.removeAll(),this._invalidateCache(),this._emit("clear")}get values(){if(this.collection instanceof C.EntityCollection)return this.collection.values;{let e=[];for(let t=0;t<this.collection.length;t++)e.push(this.collection.get(t));return e}}get length(){return this.values?.length||0}get(e){let t=this._tagMap.get(e);return t?Array.from(t):[]}first(e){let t=this._tagMap.get(e);if(t&&t.size>0)return t.values().next().value}get tags(){return Array.from(this._tagMap.keys())}update(e,t){let r=this.get(e);for(let i of r)this._removeFromTagMap(i),Object.defineProperty(i,n.symbol,{value:t,enumerable:!1,writable:!0,configurable:!0}),this._addToTagMap(i,t);return r.length>0&&this._emit("update",{items:r,tag:t}),r.length}show(e){let t=this.get(e);for(let r of t)(0,C.defined)(r.show)&&(r.show=!0);return this}hide(e){let t=this.get(e);for(let r of t)(0,C.defined)(r.show)&&(r.show=!1);return this}toggle(e){let t=this.get(e);for(let r of t)(0,C.defined)(r.show)&&(r.show=!r.show);return this}setProperty(e,t,r=this.tag){let i=this.get(r);for(let o of i)if(e in o&&typeof o[e]!="function"){if(I(o,e))throw Error(`setProperty(${o}, ${e}) failed; The property is readonly.`);o[e]=t}return this}filter(e,t){return(t?this.get(t):this.values).filter(e)}forEach(e,t){(t?this.get(t):this.values).forEach((i,o)=>e(i,o))}map(e,t){return(t?this.get(t):this.values).map(e)}find(e,t){return(t?this.get(t):this.values).find(e)}},R=L;var b=require("cesium");var N=require("cesium");var u=require("cesium"),v=class{_rectangle;_tilingScheme;_tileRanges;_levels;constructor(e,t){if(this._tilingScheme=t||new u.GeographicTilingScheme,this._rectangle=new u.Rectangle,this._tileRanges=new Map,this._levels=new Set,e.type==="rectangle"&&e.rectangle)this._rectangle=u.Rectangle.clone(e.rectangle);else if(e.type==="tileRange"&&e.tileRanges)e.tileRanges instanceof Map?this._tileRanges=new Map(e.tileRanges):this._tileRanges=new Map(Object.entries(e.tileRanges).map(([r,i])=>[parseInt(r),i])),this._calculateRectangleFromTileRanges();else throw new Error("Either rectangle or tileRanges must be provided.");this._levels=new Set(Array.from(this._tileRanges.keys()))}contains(e,t,r){if(this._tileRanges.has(r)){let o=this._tileRanges.get(r);return e>=o.start.x&&e<=o.end.x&&t>=o.start.y&&t<=o.end.y}let i=this._tilingScheme.tileXYToRectangle(e,t,r);return u.Rectangle.intersection(i,this._rectangle)!==void 0}configureAvailability(e){if(e.availability){e.availability._tilingScheme&&(e.availability._tilingScheme=this._tilingScheme);for(let[t,r]of this._tileRanges.entries())e.availability.addAvailableTileRange(t,r.start.x,r.start.y,r.end.x,r.end.y)}}get rectangle(){return this._rectangle}get tilingScheme(){return this._tilingScheme}get tileRanges(){return this._tileRanges}get levels(){return this._levels}_calculateRectangleFromTileRanges(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=Array.from(this._tileRanges.keys());if(o.length===0){this._rectangle=u.Rectangle.MAX_VALUE;return}let a=Math.min(...o),s=this._tileRanges.get(a);if(s){let{start:c,end:d}=s,y=this._tilingScheme.tileXYToRectangle(c.x,c.y,a),m=this._tilingScheme.tileXYToRectangle(d.x,d.y,a);e=Math.min(y.west,e),t=Math.min(m.south,t),r=Math.max(m.east,r),i=Math.max(y.north,i)}this._rectangle=new u.Rectangle(e,t,r,i)}};(t=>{function n(r,i,o,a=new u.GeographicTilingScheme){let s=new Map;return s.set(o,{start:{x:r,y:i},end:{x:r,y:i}}),new t({type:"tileRange",tileRanges:s},a)}t.fromTile=n;function e(r,i=new u.GeographicTilingScheme){return new t({type:"rectangle",rectangle:u.Rectangle.clone(r)},i)}t.fromRectangle=e})(v||={});var h=class n{_provider;_bounds;_levels;_ready=!1;_credit;_isCustom;constructor(e,t){this._bounds=e.bounds instanceof v?e.bounds:new v(e.bounds),this._levels=new Set(e.levels||[]),this._credit=e.credit||"custom",this._isCustom=e.isCustom!==void 0?e.isCustom:!0,this._provider=t,this._ready=!0,this._bounds.configureAvailability(this._provider)}static async create(e){let t;return typeof e.provider=="string"?t=await N.CesiumTerrainProvider.fromUrl(e.provider,{requestVertexNormals:!0,credit:e.credit||"custom"}):t=e.provider,new n(e,t)}contains(e,t,r){return this._levels.size>0&&!this._levels.has(r)?!1:this._bounds.contains(e,t,r)}requestTileGeometry(e,t,r,i){if(!(!this._ready||!this.contains(e,t,r)||!this._provider?.getTileDataAvailable(e,t,r)))return this._provider.requestTileGeometry(e,t,r,i)}getTileDataAvailable(e,t,r){return!this.contains(e,t,r)||!this._ready?!1:this._provider?.getTileDataAvailable(e,t,r)??!1}get isCustom(){return this._isCustom}get credit(){return this._credit}get provider(){return this._provider}get bounds(){return this._bounds}get levels(){return this._levels}get ready(){return this._ready}};(e=>{async function n(t,r,i,o="custom"){let a=new v({type:"tileRange",tileRanges:r});return await e.create({provider:t,bounds:a,levels:i||Object.keys(r).map(c=>parseInt(c)),credit:o})}e.fromUrl=n})(h||={});var T=class extends Array{async add(e){let t;return e instanceof h?t=e:t=await h.create(e),this.push(t)}remove(e){let t=this.indexOf(e);return t>=0?(this.splice(t,1),!0):!1}clear(){this.length=0}};var P=class n{_terrainAreas=new T;_terrainProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(e,t,r){this._terrainProvider=e,this._fallbackProvider=t,this._tilingScheme=e.tilingScheme||new b.GeographicTilingScheme,this._terrainAreas=new T(...r),this._availability=e.availability,this._ready=!0}static async create(e){try{let t;typeof e.terrainProvider=="string"?t=await b.CesiumTerrainProvider.fromUrl(e.terrainProvider,{requestVertexNormals:!0}):t=e.terrainProvider;let r;e.fallbackProvider?typeof e.fallbackProvider=="string"?r=await b.CesiumTerrainProvider.fromUrl(e.fallbackProvider,{requestVertexNormals:!0}):r=e.fallbackProvider:r=new b.EllipsoidTerrainProvider;let i=[];for(let o of e.terrainAreas){let a=await h.create(o);i.push(a)}return new n(t,r,i)}catch(t){throw console.error("Failed to initialize HybridTerrainProvider:",t),t}}get ready(){return this._ready}get tilingScheme(){return this._tilingScheme}get availability(){return this._availability}get terrainAreas(){return[...this._terrainAreas]}get defaultProvider(){return this._terrainProvider}get fallbackProvider(){return this._fallbackProvider}get credit(){return this._terrainProvider?.credit}get errorEvent(){return this._terrainProvider.errorEvent}get hasWaterMask(){return this._terrainProvider.hasWaterMask}get hasVertexNormals(){return this._terrainProvider.hasVertexNormals}loadTileDataAvailability(e,t,r){return this._terrainProvider.loadTileDataAvailability(e,t,r)}getLevelMaximumGeometricError(e){return this._terrainProvider.getLevelMaximumGeometricError(e)}requestTileGeometry(e,t,r,i){if(this._ready){for(let o of this._terrainAreas)if(o.contains(e,t,r))return o.requestTileGeometry(e,t,r,i);return this._terrainProvider.getTileDataAvailable(e,t,r)?this._terrainProvider.requestTileGeometry(e,t,r,i):this._fallbackProvider.requestTileGeometry(e,t,r,i)}}getTileDataAvailable(e,t,r){return this._terrainAreas.forEach(i=>{if(i.contains(e,t,r)&&i.getTileDataAvailable(e,t,r))return!0}),this._terrainProvider.getTileDataAvailable(e,t,r)||!0}};(e=>{async function n(t,r,i,o){return e.create({terrainAreas:[{provider:t,bounds:{type:"tileRange",tileRanges:i},levels:o||Object.keys(i).map(a=>parseInt(a)),credit:"custom"}],terrainProvider:r,fallbackProvider:new b.EllipsoidTerrainProvider})}e.createOverlay=n})(P||={});var B=require("cesium");function D(n,e,t){let r={baseLayerPicker:n.baseLayerPicker!==void 0,geocoder:n.geocoder!==void 0,homeButton:n.homeButton!==void 0,sceneModePicker:n.sceneModePicker!==void 0,timeline:n.timeline!==void 0,navigationHelpButton:n.navigationHelpButton!==void 0,animation:n.animation!==void 0,fullscreenButton:n.fullscreenButton!==void 0,shouldAnimate:n.clock.shouldAnimate,terrainProvider:n.terrainProvider,requestRenderMode:n.scene.requestRenderMode,infoBox:n.infoBox!==void 0},i=new B.Viewer(e,{...r,...t});w(n,i);let o=n.imageryLayers;i.imageryLayers.removeAll();for(let c=0;c<o.length;c++){let d=o.get(c);i.imageryLayers.addImageryProvider(d.imageryProvider,c)}i.clock.startTime=n.clock.startTime.clone(),i.clock.stopTime=n.clock.stopTime.clone(),i.clock.currentTime=n.clock.currentTime.clone(),i.clock.multiplier=n.clock.multiplier,i.clock.clockStep=n.clock.clockStep,i.clock.clockRange=n.clock.clockRange,i.clock.shouldAnimate=n.clock.shouldAnimate,i.scene.globe.enableLighting=n.scene.globe.enableLighting,i.scene.globe.depthTestAgainstTerrain=n.scene.globe.depthTestAgainstTerrain,i.scene.screenSpaceCameraController.enableCollisionDetection=n.scene.screenSpaceCameraController.enableCollisionDetection;let a=n.scene.screenSpaceCameraController.tiltEventTypes;a&&(i.scene.screenSpaceCameraController.tiltEventTypes=Array.isArray(a)?[...a]:a);let s=n.scene.screenSpaceCameraController.zoomEventTypes;return s&&(i.scene.screenSpaceCameraController.zoomEventTypes=Array.isArray(s)?[...s]:s),i}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CesiumCollection, CesiumCollectionItem, Collection, CollectionEventType, EventHandler, NonFunction, Tag, WithTag } from './collection/index.cjs';
|
|
2
2
|
export { H as HybridTerrainProvider, T as TerrainArea, a as TerrainBounds, b as TileRange, c as TileRanges } from './hybrid-terrain-provider-C6aXdtyo.cjs';
|
|
3
3
|
export { TerrainAreas } from './terrain/index.cjs';
|
|
4
|
-
export {
|
|
4
|
+
export { TerrainVisualizer, isGetterOnly, syncCamera } from './utils/index.cjs';
|
|
5
5
|
export { cloneViewer } from './viewer/index.cjs';
|
|
6
6
|
import 'cesium';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CesiumCollection, CesiumCollectionItem, Collection, CollectionEventType, EventHandler, NonFunction, Tag, WithTag } from './collection/index.js';
|
|
2
2
|
export { H as HybridTerrainProvider, T as TerrainArea, a as TerrainBounds, b as TileRange, c as TileRanges } from './hybrid-terrain-provider-C6aXdtyo.js';
|
|
3
3
|
export { TerrainAreas } from './terrain/index.js';
|
|
4
|
-
export {
|
|
4
|
+
export { TerrainVisualizer, isGetterOnly, syncCamera } from './utils/index.js';
|
|
5
5
|
export { cloneViewer } from './viewer/index.js';
|
|
6
6
|
import 'cesium';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as t,b as m,c as p,d as n}from"./chunk-C52KJ2WP.js";import{a as r,b as o,c as i}from"./chunk-MIDZHLUZ.js";import{a}from"./chunk-STARYORM.js";import{a as e}from"./chunk-YZ7AUGIO.js";export{i as Collection,n as HybridTerrainProvider,m as TerrainArea,p as TerrainAreas,t as TerrainBounds,r as TerrainVisualizer,a as cloneViewer,o as isGetterOnly,e as syncCamera};
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(n,e)=>{for(var t in e)I(n,t,{get:e[t],enumerable:!0})},$=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!z.call(n,r)&&r!==t&&I(n,r,{get:()=>e[r],enumerable:!(i=S(e,r))||i.enumerable});return n};var H=n=>$(I({},"__esModule",{value:!0}),n);var N={};F(N,{TerrainVisualizer:()=>v,isGetterOnly:()=>b,syncCamera:()=>A});module.exports=H(N);var s=require("cesium");var f=require("cesium");var E=class n{static symbol=Symbol("cesium-item-tag");tag;collection;_valuesCache=null;_tagMap=new Map;_eventListeners=new Map;constructor({collection:e,tag:t}){this.tag=t||"default",this.collection=e}[Symbol.iterator](){return this.values[Symbol.iterator]()}_emit(e,t){let i=this._eventListeners.get(e);if(i){let r={type:e,...t};i.forEach(a=>a(r))}}_addToTagMap(e,t){this._tagMap.has(t)||this._tagMap.set(t,new Set),this._tagMap.get(t)?.add(e)}_removeFromTagMap(e){let t=e[n.symbol],i=this._tagMap.get(t);i&&(i.delete(e),i.size===0&&this._tagMap.delete(t))}_invalidateCache(){this._valuesCache=null}addEventListener(e,t){return this._eventListeners.has(e)||this._eventListeners.set(e,new Set),this._eventListeners.get(e)?.add(t),this}removeEventListener(e,t){return this._eventListeners.get(e)?.delete(t),this}add(e,t=this.tag,i){return Array.isArray(e)?e.forEach(r=>{this.add(r,t)}):(Object.defineProperty(e,n.symbol,{value:t,enumerable:!1,writable:!0,configurable:!0}),this.collection.add(e,i),this._addToTagMap(e,t),this._invalidateCache(),this._emit("add",{items:[e],tag:t})),e}contains(e){if(typeof e=="object")return this.collection.contains(e);let t=this._tagMap.get(e);return!!t&&t.size>0}remove(e){if(typeof e=="object"&&!Array.isArray(e)){let r=this.collection.remove(e);return r&&(this._removeFromTagMap(e),this._invalidateCache(),this._emit("remove",{items:[e]})),r}if(Array.isArray(e)){if(e.length===0)return!1;let r=!1;for(let a of e)this.remove(a)&&(r=!0);return r}let t=this.get(e);if(t.length===0)return!1;let i=!1;for(let r of t)this.remove(r)&&(i=!0);return i}removeAll(){this._tagMap.clear(),this.collection.removeAll(),this._invalidateCache(),this._emit("clear")}get values(){if(this.collection instanceof f.EntityCollection)return this.collection.values;{let e=[];for(let t=0;t<this.collection.length;t++)e.push(this.collection.get(t));return e}}get length(){return this.values?.length||0}get(e){let t=this._tagMap.get(e);return t?Array.from(t):[]}first(e){let t=this._tagMap.get(e);if(t&&t.size>0)return t.values().next().value}get tags(){return Array.from(this._tagMap.keys())}update(e,t){let i=this.get(e);for(let r of i)this._removeFromTagMap(r),Object.defineProperty(r,n.symbol,{value:t,enumerable:!1,writable:!0,configurable:!0}),this._addToTagMap(r,t);return i.length>0&&this._emit("update",{items:i,tag:t}),i.length}show(e){let t=this.get(e);for(let i of t)(0,f.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,f.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,f.defined)(i.show)&&(i.show=!i.show);return this}setProperty(e,t,i=this.tag){let r=this.get(i);for(let a of r)if(e in a&&typeof a[e]!="function"){if(b(a,e))throw Error(`setProperty(${a}, ${e}) failed; The property is readonly.`);a[e]=t}return this}filter(e,t){return(t?this.get(t):this.values).filter(e)}forEach(e,t){(t?this.get(t):this.values).forEach((r,a)=>e(r,a))}map(e,t){return(t?this.get(t):this.values).map(e)}find(e,t){return(t?this.get(t):this.values).find(e)}},x=E;var v=class n{_viewer;_collection;_hybridTerrain;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",s.Color.RED],["default",s.Color.BLUE],["fallback",s.Color.GRAY],["grid",s.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new x({collection:e.entities,tag:n.tag.default}),t&&(t.colors&&Object.entries(t.colors).forEach(([i,r])=>{this._colors.set(i,r)}),t.tile!==void 0&&(this._visible=t.tile),t.activeLevel!==void 0&&(this._level=t.activeLevel),t.terrainProvider&&this.setTerrainProvider(t.terrainProvider))}setTerrainProvider(e){this._hybridTerrain=e,this.update()}update(){this.clear(),this._visible&&this.show(this._level)}clear(){this._collection.remove(this._collection.tags)}show(e=15){if(!this._hybridTerrain)return;this._collection.remove(n.tag.grid),this._level=e;let t=this._hybridTerrain.tilingScheme;this._tileCoordinatesLayer||(this._tileCoordinatesLayer=this._viewer.imageryLayers.addImageryProvider(new s.TileCoordinatesImageryProvider({tilingScheme:t,color:s.Color.YELLOW})));let i=(o,l,u)=>{if(this._hybridTerrain){for(let m of this._hybridTerrain.terrainAreas)if(m.contains(o,l,u))return m.isCustom?this._colors.get("custom")||s.Color.RED:this._colors.get("default")||s.Color.BLUE;if(this._hybridTerrain.getTileDataAvailable(o,l,u))return this._colors.get("default")||s.Color.BLUE}return this._colors.get("fallback")||s.Color.TRANSPARENT},r=this._getVisibleRectangle();if(!r)return;function a(o){return o&&Number.isFinite(o.west)&&Number.isFinite(o.south)&&Number.isFinite(o.east)&&Number.isFinite(o.north)&&o.west<=o.east&&o.south<=o.north}if(!a(r)){console.warn("Invalid visible rectangle detected, skipping grid display");return}try{let o=t.positionToTileXY(s.Rectangle.northwest(r),e),l=t.positionToTileXY(s.Rectangle.southeast(r),e);if(!o||!l)return;let u=100,m=Math.min(l.x-o.x+1,u),T=Math.min(l.y-o.y+1,u);for(let h=o.x;h<=o.x+m-1;h++)for(let d=o.y;d<=o.y+T-1;d++)try{let c=t.tileXYToRectangle(h,d,e);if(!a(c)){console.warn(`Invalid rectangle for tile (${h}, ${d}, ${e}), skipping`);continue}let p=i(h,d,e),g=n.createRectangle(c,p.withAlpha(.3));g.properties?.addProperty("tileX",h),g.properties?.addProperty("tileY",d),g.properties?.addProperty("tileLevel",e),this._collection.add(g,n.tag.grid)}catch(c){console.warn(`Error creating tile (${h}, ${d}, ${e}): ${c.message}`);continue}console.log("\u{1F680} ~ TerrainVisualizer ~ showGrid ~ collection:",this._collection),this._visible=!0}catch(o){console.error("Error displaying tile grid:",o)}}hide(){this._collection.remove(n.tag.grid),this._tileCoordinatesLayer&&(this._viewer.imageryLayers.remove(this._tileCoordinatesLayer),this._tileCoordinatesLayer=void 0),this._visible=!1}setColors(e){Object.entries(e).forEach(([t,i])=>{this._colors.set(t,i)}),this.update()}flyTo(e,t){let{rectangle:i}=e.bounds;this._viewer.camera.flyTo({destination:i,...t,complete:()=>{this._visible&&this.update()}})}_getVisibleRectangle(){return this._viewer.camera.computeViewRectangle()}get level(){return this._level}set level(e){this._level=e,this._visible&&this.update()}get visible(){return this._visible}get collection(){return this._collection}get viewer(){return this._viewer}};(i=>{i.tag={default:"Terrain Visualizer",boundary:"Terrain Visualizer Boundary",grid:"Terrain Visualizer Tile Grid"};function e(r,a){return new s.Entity({rectangle:{coordinates:r,material:a,heightReference:s.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,a,o){let l=o?.tag||"terrain_area_visualization",u=o?.color||s.Color.RED,m=o?.maxTilesToShow||100,T=o?.show??!0,h=o?.alpha||.7,d=o?.tileAlpha||.2,c="provider"in r?r.bounds:r,p=new x({collection:a.entities,tag:l}),{rectangle:g}=c;if(p.add(i.createRectangle(g,u.withAlpha(h)),l),T&&c.levels.size>0){let{tilingScheme:M}=c;c.levels.forEach(R=>{let _=0,{tileRanges:O}=c;for(let[P,y]of O.entries())if(P===R)for(let C=y.start.x;C<=y.end.x&&_<m;C++)for(let w=y.start.y;w<=y.end.y&&_<m;w++){let V=M.tileXYToRectangle(C,w,R);p.add(e(V,u.withAlpha(d)),`${l}_tile`),_++}})}return p}i.visualize=t})(v||={});function b(n,e){let t=!1,i=Object.getOwnPropertyDescriptor(n,e);if(!i){let r=Object.getPrototypeOf(n);for(;r&&!i;)i=Object.getOwnPropertyDescriptor(r,e),r=Object.getPrototypeOf(r)}return i&&i.get&&!i.set&&(t=!0),t}var L=require("cesium");function A(n,e){if((0,L.defined)(n)&&(0,L.defined)(e)){let{camera:t}=n;e.camera.position=t.positionWC.clone(),e.camera.direction=t.directionWC.clone(),e.camera.up=t.upWC.clone()}}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,7 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import '../
|
|
4
|
-
|
|
1
|
+
import { Viewer, Color, EntityCollection, Entity, Rectangle } from 'cesium';
|
|
2
|
+
import { H as HybridTerrainProvider, T as TerrainArea, a as TerrainBounds } from '../hybrid-terrain-provider-C6aXdtyo.cjs';
|
|
3
|
+
import { Collection } from '../collection/index.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @class
|
|
7
|
+
* Utility class for visualizing terrain provider boundaries and debugging terrain loading.
|
|
8
|
+
*/
|
|
9
|
+
declare class TerrainVisualizer {
|
|
10
|
+
private _viewer;
|
|
11
|
+
private _collection;
|
|
12
|
+
private _hybridTerrain?;
|
|
13
|
+
private _visible;
|
|
14
|
+
private _level;
|
|
15
|
+
private _tileCoordinatesLayer;
|
|
16
|
+
private _colors;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new `TerrainVisualizer`.
|
|
19
|
+
* @param viewer The Cesium viewer instance
|
|
20
|
+
* @param options {@link TerrainVisualizer.ConstructorOptions}
|
|
21
|
+
*/
|
|
22
|
+
constructor(viewer: Viewer, options?: TerrainVisualizer.ConstructorOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Sets the terrain provider to visualize.
|
|
25
|
+
* @param terrainProvider The terrain provider to visualize.
|
|
26
|
+
*/
|
|
27
|
+
setTerrainProvider(terrainProvider: HybridTerrainProvider): void;
|
|
28
|
+
/**
|
|
29
|
+
* Updates all active visualizations.
|
|
30
|
+
*/
|
|
31
|
+
update(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Clears all visualizations.
|
|
34
|
+
*/
|
|
35
|
+
clear(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Shows a grid of tiles at the specified level.
|
|
38
|
+
* @param level The zoom level to visualize
|
|
39
|
+
*/
|
|
40
|
+
show(level?: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hides the tile grid.
|
|
43
|
+
*/
|
|
44
|
+
hide(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the colors used for visualization.
|
|
47
|
+
* @param colors Map of role names to colors
|
|
48
|
+
*/
|
|
49
|
+
setColors(colors: Record<string, Color>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Flies the camera to focus on a terrain area.
|
|
52
|
+
* @param area The terrain area to focus on.
|
|
53
|
+
* @param options {@link Viewer.flyTo}
|
|
54
|
+
*/
|
|
55
|
+
flyTo(area: TerrainArea, options?: {
|
|
56
|
+
duration?: number;
|
|
57
|
+
}): void;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the rectangle representing the current view.
|
|
60
|
+
* @returns The current view rectangle or undefined.
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private _getVisibleRectangle;
|
|
64
|
+
/** The current zoom level set on the visualizer. */
|
|
65
|
+
get level(): number;
|
|
66
|
+
/** Set zoom level on the visualizer. */
|
|
67
|
+
set level(level: number);
|
|
68
|
+
/** Whether the grid is currently visible. */
|
|
69
|
+
get visible(): boolean;
|
|
70
|
+
/** The collection used in the visualizer. */
|
|
71
|
+
get collection(): Collection<EntityCollection, Entity>;
|
|
72
|
+
/** The viewer used in the visualizer */
|
|
73
|
+
get viewer(): Viewer;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @namespace
|
|
77
|
+
* Contains types, utility functions, and constants for terrain visualization.
|
|
78
|
+
*/
|
|
79
|
+
declare namespace TerrainVisualizer {
|
|
80
|
+
/** Initialization options for `TerrainVisualizer` constructor. */
|
|
81
|
+
interface ConstructorOptions {
|
|
82
|
+
/** Colors to use for different visualization elements */
|
|
83
|
+
colors?: Record<string, Color>;
|
|
84
|
+
/** Whether to show boundaries initially. */
|
|
85
|
+
boundaries?: boolean;
|
|
86
|
+
/** Whether to show tile grid initially. */
|
|
87
|
+
tile?: boolean;
|
|
88
|
+
/** Initial zoom level to use for visualizations. */
|
|
89
|
+
activeLevel?: number;
|
|
90
|
+
/** Terrain provider to visualize. */
|
|
91
|
+
terrainProvider?: HybridTerrainProvider;
|
|
92
|
+
}
|
|
93
|
+
/** Tag constants for entity collection management. */
|
|
94
|
+
const tag: {
|
|
95
|
+
default: string;
|
|
96
|
+
boundary: string;
|
|
97
|
+
grid: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Creates a ground-clamped rectangle entity for visualization.
|
|
101
|
+
* @param rectangle The rectangle to visualize
|
|
102
|
+
* @param color The color to use
|
|
103
|
+
* @returns A new entity
|
|
104
|
+
*/
|
|
105
|
+
function createRectangle(rectangle: Rectangle, color: Color): Entity;
|
|
106
|
+
/** Options for {@link TerrainVisualizer.visualize} */
|
|
107
|
+
interface Options {
|
|
108
|
+
color?: Color;
|
|
109
|
+
show?: boolean;
|
|
110
|
+
maxTilesToShow?: number;
|
|
111
|
+
levels?: number[];
|
|
112
|
+
tag?: string;
|
|
113
|
+
alpha?: number;
|
|
114
|
+
tileAlpha?: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Visualizes a specific terrain area in a viewer.
|
|
118
|
+
* @param terrain The terrain area to visualize.
|
|
119
|
+
* @param viewer The Cesium viewer.
|
|
120
|
+
* @param options Visualization options.
|
|
121
|
+
* @returns Collection of created entities.
|
|
122
|
+
*/
|
|
123
|
+
function visualize(terrain: TerrainArea | TerrainBounds, viewer: Viewer, options?: Options): Collection<EntityCollection, Entity>;
|
|
124
|
+
}
|
|
5
125
|
|
|
6
126
|
/**
|
|
7
127
|
* Examine the property descriptors at runtime
|
|
@@ -12,4 +132,11 @@ import '../collection/index.cjs';
|
|
|
12
132
|
*/
|
|
13
133
|
declare function isGetterOnly(o: object, k: string | number | symbol): boolean;
|
|
14
134
|
|
|
15
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Copies camera state from source viewer to destination viewer.
|
|
137
|
+
* @param source The source viewer to copy camera states from.
|
|
138
|
+
* @param dest The destination viewer to apply camera properties from the source.
|
|
139
|
+
*/
|
|
140
|
+
declare function syncCamera(source: Viewer, dest: Viewer): void;
|
|
141
|
+
|
|
142
|
+
export { TerrainVisualizer, isGetterOnly, syncCamera };
|