@juun-roh/cesium-utils 0.1.2 → 0.2.0

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/index.d.cts CHANGED
@@ -1,225 +1,6 @@
1
- export { CesiumCollection, CesiumCollectionItem, Collection, CollectionEventType, EventHandler, NonFunction, Tag, WithTag } from './collection/index.cjs';
2
- import { Entity, Cesium3DTileFeature, GroundPrimitive, Primitive, Model, Cesium3DTileset, Color, Viewer } from 'cesium';
3
- export { H as HybridTerrainProvider, T as TerrainArea, a as TileRange } from './hybrid-terrain-provider-C4b9z5pv.cjs';
4
- export { TerrainAreaCollection, computeRectangle } from './terrain/index.cjs';
5
- export { TerrainVisualizer, isGetterOnly } from './utils/index.cjs';
1
+ export { C as Collection, N as NonFunction, i as isGetterOnly } from './index-Bd_-DTWl.cjs';
2
+ export { Highlight, SilhouetteHighlight, SurfaceHighlight } from './highlight/index.cjs';
3
+ export { HybridTerrainProvider, TerrainArea } from './terrain/index.cjs';
4
+ export { TerrainVisualizer } from './utils/index.cjs';
6
5
  export { cloneViewer, syncCamera } from './viewer/index.cjs';
7
-
8
- interface IHighlight {
9
- show(object: any, options?: HighlightOptions): void;
10
- hide(): void;
11
- destroy(): void;
12
- color: Color;
13
- }
14
- interface HighlightOptions {
15
- /** Color of the highlight */
16
- color?: Color;
17
- /** To apply outline style for the highlight */
18
- outline?: boolean;
19
- /** Outline width */
20
- width?: number;
21
- }
22
- type PickedObject = {
23
- id?: Entity;
24
- primitive?: Primitive | GroundPrimitive | Model | Cesium3DTileset;
25
- tileset?: Cesium3DTileset;
26
- detail?: {
27
- model?: Model;
28
- };
29
- };
30
- type Picked = Entity | Cesium3DTileFeature | GroundPrimitive | PickedObject;
31
-
32
- /**
33
- * @class
34
- * Lightweight multiton highlight manager for Cesium using flyweight pattern.
35
- *
36
- * @example
37
- * ```
38
- * // Setup
39
- * const viewer1 = new Viewer('cesiumContainer1');
40
- * const viewer2 = new Viewer('cesiumContainer2');
41
- *
42
- * const highlighter1 = Highlight.getInstance(viewer1);
43
- * const highlighter2 = Highlight.getInstance(viewer2);
44
- *
45
- * // This highlight only affects viewer1
46
- * highlighter1.show(someEntity, { color: Color.RED });
47
- *
48
- * // This highlight only affects viewer2
49
- * highlighter2.show(someEntity, { color: Color.BLUE });
50
- *
51
- * // When done with viewers
52
- * Highlight.releaseInstance(viewer1);
53
- * Highlight.releaseInstance(viewer2);
54
- * viewer1.destroy();
55
- * viewer2.destroy();
56
- * ```
57
- */
58
- declare class Highlight {
59
- private static instances;
60
- private _surface;
61
- private _silhouette;
62
- private _color;
63
- /**
64
- * Creates a new `Highlight` instance.
65
- * @private Use {@link getInstance `Highlight.getInstance()`}
66
- * @param viewer A viewer to create highlight entity in
67
- */
68
- private constructor();
69
- /**
70
- * Gets or creates highlight instance from a viewer.
71
- * @param viewer The viewer to get or create a new instance from.
72
- */
73
- static getInstance(viewer: Viewer): Highlight;
74
- /**
75
- * Releases the highlight instance associated with a viewer.
76
- * @param viewer The viewer whose highlight instance should be released.
77
- */
78
- static releaseInstance(viewer: Viewer): void;
79
- /**
80
- * Highlights a picked object or a direct instance.
81
- * @param picked The result of `Scene.pick()` or direct instance to be highlighted.
82
- * @param options Optional style for the highlight.
83
- * @see {@link HighlightOptions}
84
- */
85
- show(picked: Picked, options?: HighlightOptions): void | Entity;
86
- private _getObject;
87
- /**
88
- * Clears the current highlight effects.
89
- */
90
- hide(): void;
91
- /** Gets the highlight color. */
92
- get color(): Color;
93
- /**
94
- * Sets the highlight color.
95
- * @param color The new color for highlights
96
- */
97
- set color(color: Color);
98
- }
99
-
100
- /**
101
- * @class
102
- * An implementation for highlighting 3D objects in Cesium.
103
- *
104
- * **Supported Object Types:**
105
- * - `Entity` with model graphics. (adjustable outline width)
106
- * - `Cesium3DTileset` instances. (fixed outline width)
107
- *
108
- * Currently supports outline style only.
109
- *
110
- * @example
111
- * ```typescript
112
- * const viewer = new Viewer("cesiumContainer");
113
- * const silhouetteHighlight = new SilhouetteHighlight(viewer);
114
- *
115
- * // Highlight an object
116
- * const entity = viewer.entities.add(new Entity({
117
- * model: new ModelGraphics(),
118
- * }));
119
- * silhouetteHighlight.show(entity);
120
- * ```
121
- */
122
- declare class SilhouetteHighlight implements IHighlight {
123
- private _color;
124
- private _silhouette;
125
- private _composite;
126
- private _stages;
127
- private _entity?;
128
- /**
129
- * Creates a new `Silhouette` instance.
130
- * @param viewer A viewer to create highlight silhouette in
131
- */
132
- constructor(viewer: Viewer);
133
- /**
134
- * Highlights a picked `Cesium3DTileset` by updating silhouette composite.
135
- * @param object The object to be highlighted.
136
- * @param options Optional style for the highlight.
137
- */
138
- show(object: Cesium3DTileFeature, options?: HighlightOptions): void;
139
- /**
140
- * Highlights a picked `Entity` by updating the model properties.
141
- * @param object The object to be highlighted.
142
- * @param options Optional style for the highlight.
143
- */
144
- show(object: Entity, options?: HighlightOptions): void;
145
- /** Clears the current highlight */
146
- hide(): void;
147
- /** Clean up the instances */
148
- destroy(): void;
149
- /** Gets the highlight color. */
150
- get color(): Color;
151
- /** Sets the highlight color. */
152
- set color(color: Color);
153
- }
154
-
155
- /**
156
- * @class
157
- * A flyweight implementation for highlighting 2D surface objects in Cesium.
158
- *
159
- * This class provides highlighting for ground-clamped geometries (polygons, polylines, rectangles)
160
- *
161
- * **Supported Geometry Types:**
162
- * - `Entity` with polygon, polyline, or rectangle graphics
163
- * - `GroundPrimitive` instances
164
- *
165
- * **Highlighting Modes:**
166
- * - **Fill mode** (default): Creates a filled geometry using the original shape
167
- * - **Outline mode**: Creates a polyline outline of the original geometry
168
- *
169
- * @example
170
- * ```typescript
171
- * // Basic usage
172
- * const viewer = new Viewer('cesiumContainer');
173
- * const surfaceHighlight = new SurfaceHighlight(viewer);
174
- *
175
- * // Highlight an entity with default red fill
176
- * const entity = viewer.entities.add(new Entity({
177
- * polygon: {
178
- * hierarchy: Cartesian3.fromDegreesArray([-75, 35, -74, 35, -74, 36, -75, 36]),
179
- * material: Color.BLUE
180
- * }
181
- * }));
182
- * surfaceHighlight.show(entity);
183
- * ```
184
- */
185
- declare class SurfaceHighlight implements IHighlight {
186
- private _color;
187
- private _entity;
188
- private _entities;
189
- /**
190
- * Creates a new `SurfaceHighlight` instance.
191
- * @param viewer A viewer to create highlight entity in
192
- */
193
- constructor(viewer: Viewer);
194
- /**
195
- * Highlights a picked object by updating the reusable entity
196
- * @param object The object to be highlighted.
197
- * @param options Optional style for the highlight.
198
- * @see {@link HighlightOptions}
199
- */
200
- show(object: Entity | GroundPrimitive, options?: HighlightOptions): Entity | undefined;
201
- /**
202
- * Removes all geometry properties from the highlight entity
203
- * @private
204
- */
205
- private _clearGeometries;
206
- /**
207
- * Updates the highlight entity from an Entity object
208
- * @private
209
- */
210
- private _update;
211
- /**
212
- * Clears the current highlight
213
- */
214
- hide(): void;
215
- /** Clean up the instances */
216
- destroy(): void;
217
- /** Gets the highlight color. */
218
- get color(): Color;
219
- /** Sets the highlight color. */
220
- set color(color: Color);
221
- /** Gets the highlight entity */
222
- get entity(): Entity;
223
- }
224
-
225
- export { Highlight, type HighlightOptions, type IHighlight, type Picked, type PickedObject, SilhouetteHighlight, SurfaceHighlight };
6
+ import 'cesium';
package/dist/index.d.ts CHANGED
@@ -1,225 +1,6 @@
1
- export { CesiumCollection, CesiumCollectionItem, Collection, CollectionEventType, EventHandler, NonFunction, Tag, WithTag } from './collection/index.js';
2
- import { Entity, Cesium3DTileFeature, GroundPrimitive, Primitive, Model, Cesium3DTileset, Color, Viewer } from 'cesium';
3
- export { H as HybridTerrainProvider, T as TerrainArea, a as TileRange } from './hybrid-terrain-provider-C4b9z5pv.js';
4
- export { TerrainAreaCollection, computeRectangle } from './terrain/index.js';
5
- export { TerrainVisualizer, isGetterOnly } from './utils/index.js';
1
+ export { C as Collection, N as NonFunction, i as isGetterOnly } from './index-Bd_-DTWl.js';
2
+ export { Highlight, SilhouetteHighlight, SurfaceHighlight } from './highlight/index.js';
3
+ export { HybridTerrainProvider, TerrainArea } from './terrain/index.js';
4
+ export { TerrainVisualizer } from './utils/index.js';
6
5
  export { cloneViewer, syncCamera } from './viewer/index.js';
7
-
8
- interface IHighlight {
9
- show(object: any, options?: HighlightOptions): void;
10
- hide(): void;
11
- destroy(): void;
12
- color: Color;
13
- }
14
- interface HighlightOptions {
15
- /** Color of the highlight */
16
- color?: Color;
17
- /** To apply outline style for the highlight */
18
- outline?: boolean;
19
- /** Outline width */
20
- width?: number;
21
- }
22
- type PickedObject = {
23
- id?: Entity;
24
- primitive?: Primitive | GroundPrimitive | Model | Cesium3DTileset;
25
- tileset?: Cesium3DTileset;
26
- detail?: {
27
- model?: Model;
28
- };
29
- };
30
- type Picked = Entity | Cesium3DTileFeature | GroundPrimitive | PickedObject;
31
-
32
- /**
33
- * @class
34
- * Lightweight multiton highlight manager for Cesium using flyweight pattern.
35
- *
36
- * @example
37
- * ```
38
- * // Setup
39
- * const viewer1 = new Viewer('cesiumContainer1');
40
- * const viewer2 = new Viewer('cesiumContainer2');
41
- *
42
- * const highlighter1 = Highlight.getInstance(viewer1);
43
- * const highlighter2 = Highlight.getInstance(viewer2);
44
- *
45
- * // This highlight only affects viewer1
46
- * highlighter1.show(someEntity, { color: Color.RED });
47
- *
48
- * // This highlight only affects viewer2
49
- * highlighter2.show(someEntity, { color: Color.BLUE });
50
- *
51
- * // When done with viewers
52
- * Highlight.releaseInstance(viewer1);
53
- * Highlight.releaseInstance(viewer2);
54
- * viewer1.destroy();
55
- * viewer2.destroy();
56
- * ```
57
- */
58
- declare class Highlight {
59
- private static instances;
60
- private _surface;
61
- private _silhouette;
62
- private _color;
63
- /**
64
- * Creates a new `Highlight` instance.
65
- * @private Use {@link getInstance `Highlight.getInstance()`}
66
- * @param viewer A viewer to create highlight entity in
67
- */
68
- private constructor();
69
- /**
70
- * Gets or creates highlight instance from a viewer.
71
- * @param viewer The viewer to get or create a new instance from.
72
- */
73
- static getInstance(viewer: Viewer): Highlight;
74
- /**
75
- * Releases the highlight instance associated with a viewer.
76
- * @param viewer The viewer whose highlight instance should be released.
77
- */
78
- static releaseInstance(viewer: Viewer): void;
79
- /**
80
- * Highlights a picked object or a direct instance.
81
- * @param picked The result of `Scene.pick()` or direct instance to be highlighted.
82
- * @param options Optional style for the highlight.
83
- * @see {@link HighlightOptions}
84
- */
85
- show(picked: Picked, options?: HighlightOptions): void | Entity;
86
- private _getObject;
87
- /**
88
- * Clears the current highlight effects.
89
- */
90
- hide(): void;
91
- /** Gets the highlight color. */
92
- get color(): Color;
93
- /**
94
- * Sets the highlight color.
95
- * @param color The new color for highlights
96
- */
97
- set color(color: Color);
98
- }
99
-
100
- /**
101
- * @class
102
- * An implementation for highlighting 3D objects in Cesium.
103
- *
104
- * **Supported Object Types:**
105
- * - `Entity` with model graphics. (adjustable outline width)
106
- * - `Cesium3DTileset` instances. (fixed outline width)
107
- *
108
- * Currently supports outline style only.
109
- *
110
- * @example
111
- * ```typescript
112
- * const viewer = new Viewer("cesiumContainer");
113
- * const silhouetteHighlight = new SilhouetteHighlight(viewer);
114
- *
115
- * // Highlight an object
116
- * const entity = viewer.entities.add(new Entity({
117
- * model: new ModelGraphics(),
118
- * }));
119
- * silhouetteHighlight.show(entity);
120
- * ```
121
- */
122
- declare class SilhouetteHighlight implements IHighlight {
123
- private _color;
124
- private _silhouette;
125
- private _composite;
126
- private _stages;
127
- private _entity?;
128
- /**
129
- * Creates a new `Silhouette` instance.
130
- * @param viewer A viewer to create highlight silhouette in
131
- */
132
- constructor(viewer: Viewer);
133
- /**
134
- * Highlights a picked `Cesium3DTileset` by updating silhouette composite.
135
- * @param object The object to be highlighted.
136
- * @param options Optional style for the highlight.
137
- */
138
- show(object: Cesium3DTileFeature, options?: HighlightOptions): void;
139
- /**
140
- * Highlights a picked `Entity` by updating the model properties.
141
- * @param object The object to be highlighted.
142
- * @param options Optional style for the highlight.
143
- */
144
- show(object: Entity, options?: HighlightOptions): void;
145
- /** Clears the current highlight */
146
- hide(): void;
147
- /** Clean up the instances */
148
- destroy(): void;
149
- /** Gets the highlight color. */
150
- get color(): Color;
151
- /** Sets the highlight color. */
152
- set color(color: Color);
153
- }
154
-
155
- /**
156
- * @class
157
- * A flyweight implementation for highlighting 2D surface objects in Cesium.
158
- *
159
- * This class provides highlighting for ground-clamped geometries (polygons, polylines, rectangles)
160
- *
161
- * **Supported Geometry Types:**
162
- * - `Entity` with polygon, polyline, or rectangle graphics
163
- * - `GroundPrimitive` instances
164
- *
165
- * **Highlighting Modes:**
166
- * - **Fill mode** (default): Creates a filled geometry using the original shape
167
- * - **Outline mode**: Creates a polyline outline of the original geometry
168
- *
169
- * @example
170
- * ```typescript
171
- * // Basic usage
172
- * const viewer = new Viewer('cesiumContainer');
173
- * const surfaceHighlight = new SurfaceHighlight(viewer);
174
- *
175
- * // Highlight an entity with default red fill
176
- * const entity = viewer.entities.add(new Entity({
177
- * polygon: {
178
- * hierarchy: Cartesian3.fromDegreesArray([-75, 35, -74, 35, -74, 36, -75, 36]),
179
- * material: Color.BLUE
180
- * }
181
- * }));
182
- * surfaceHighlight.show(entity);
183
- * ```
184
- */
185
- declare class SurfaceHighlight implements IHighlight {
186
- private _color;
187
- private _entity;
188
- private _entities;
189
- /**
190
- * Creates a new `SurfaceHighlight` instance.
191
- * @param viewer A viewer to create highlight entity in
192
- */
193
- constructor(viewer: Viewer);
194
- /**
195
- * Highlights a picked object by updating the reusable entity
196
- * @param object The object to be highlighted.
197
- * @param options Optional style for the highlight.
198
- * @see {@link HighlightOptions}
199
- */
200
- show(object: Entity | GroundPrimitive, options?: HighlightOptions): Entity | undefined;
201
- /**
202
- * Removes all geometry properties from the highlight entity
203
- * @private
204
- */
205
- private _clearGeometries;
206
- /**
207
- * Updates the highlight entity from an Entity object
208
- * @private
209
- */
210
- private _update;
211
- /**
212
- * Clears the current highlight
213
- */
214
- hide(): void;
215
- /** Clean up the instances */
216
- destroy(): void;
217
- /** Gets the highlight color. */
218
- get color(): Color;
219
- /** Sets the highlight color. */
220
- set color(color: Color);
221
- /** Gets the highlight entity */
222
- get entity(): Entity;
223
- }
224
-
225
- export { Highlight, type HighlightOptions, type IHighlight, type Picked, type PickedObject, SilhouetteHighlight, SurfaceHighlight };
6
+ import 'cesium';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-RXMNSDKR.js";import{a as G,b as R,c as V,d as D}from"./chunk-D2H7O3WV.js";import{a as x,b as A}from"./chunk-2JNRK7SN.js";import{a as E,b as O,c as S}from"./chunk-I53ZQ7WC.js";import{Cesium3DTileFeature as P,Color as U,defined as H,Entity as y,GroundPrimitive as T}from"cesium";import{Cesium3DTileFeature as I,Color as _,ConstantProperty as u,defined as F,PostProcessStageLibrary as m}from"cesium";var r=class{_color=_.RED;_silhouette;_composite;_stages;_entity;constructor(t){this._stages=t.scene.postProcessStages,this._silhouette=m.createEdgeDetectionStage(),this._silhouette.uniforms.color=this._color,this._silhouette.uniforms.length=.01,this._silhouette.selected=[],this._composite=m.createSilhouetteStage([this._silhouette]),this._stages.add(this._composite)}show(t,i){if(!(!F(t)||this._silhouette.selected[0]===t))if(t instanceof I)this._silhouette.uniforms.color=i?.color||this._color,this._silhouette.selected.push(t);else{if(!t.model)return;this._entity=t,t.model.silhouetteSize=new u(i?.width||2),t.model.silhouetteColor=new u(i?.color||this._color)}}hide(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new u(_.TRANSPARENT),this._entity.model.silhouetteSize=new u(0),this._entity=void 0)}destroy(){this.hide(),this._composite&&this._stages.remove(this._composite)}get color(){return this._color}set color(t){this._color=t}};import{Cartesian3 as n,ClassificationType as w,Color as M,defined as N,Entity as f,GroundPrimitive as v,HeightReference as d,PolygonGraphics as C,PolygonHierarchy as L,PolylineGraphics as g,RectangleGraphics as z}from"cesium";var l=class{_color=M.RED;_entity;_entities;constructor(t){this._entities=t.entities,this._entity=this._entities.add(new f({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}show(t,i){if(!(!N(t)||!this._entity)){this._clearGeometries();try{if(t instanceof f&&(t.polygon||t.polyline||t.rectangle))this._update(t,i);else if(t instanceof v)this._update(t,i);else return;return this._entity.show=!0,this._entity}catch(e){console.error("Failed to highlight object:",e);return}}}_clearGeometries(){this._entity.polygon=void 0,this._entity.polyline=void 0,this._entity.rectangle=void 0}_update(t,i={color:this._color,outline:!1,width:2}){if(t instanceof f){if(t.polygon)if(i.outline){let e=t.polygon.hierarchy?.getValue();if(e&&e.positions){let o;e.positions.length>0&&!n.equals(e.positions[0],e.positions[e.positions.length-1])?o=[...e.positions,e.positions[0]]:o=e.positions,this._entity.polyline=new g({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.polygon.hierarchy?.getValue();e&&(this._entity.polygon=new C({hierarchy:e,material:i.color,heightReference:d.CLAMP_TO_GROUND,classificationType:t.polygon.classificationType?.getValue()||w.BOTH}))}else if(t.polyline){let e=t.polyline.positions?.getValue();if(e){let o=t.polyline.width?.getValue();this._entity.polyline=new g({positions:e,material:i.color,width:o+(i.width||2),clampToGround:!0})}}else if(t.rectangle)if(i.outline){let e=t.rectangle.coordinates?.getValue();if(e){let o=[n.fromRadians(e.west,e.north),n.fromRadians(e.east,e.north),n.fromRadians(e.east,e.south),n.fromRadians(e.west,e.south),n.fromRadians(e.west,e.north)];this._entity.polyline=new g({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.rectangle.coordinates?.getValue();e&&(this._entity.rectangle=new z({coordinates:e,material:i.color,heightReference:d.CLAMP_TO_GROUND}))}}else if(t instanceof v){let e=t.geometryInstances,o=Array.isArray(e)?e[0]:e;if(!o.geometry.attributes.position)return;let c=o.geometry.attributes.position.values,p=[];for(let h=0;h<c.length;h+=3)p.push(new n(c[h],c[h+1],c[h+2]));i.outline?this._entity.polyline=new g({positions:p,material:i.color,width:i.width||2,clampToGround:!0}):this._entity.polygon=new C({hierarchy:new L(p),material:i.color,heightReference:d.CLAMP_TO_GROUND,classificationType:w.BOTH})}}hide(){this._entity&&(this._entity.show=!1)}destroy(){this._entities.contains(this._entity)&&this._entities.remove(this._entity)}get color(){return this._color}set color(t){this._color=t}get entity(){return this._entity}};var a=class s{static instances=new WeakMap;_surface;_silhouette;_color=U.RED;constructor(t){this._surface=new l(t),this._silhouette=new r(t),this._surface.color=this._color,this._silhouette.color=this._color}static getInstance(t){let i=t.container;return s.instances.has(i)||s.instances.set(i,new s(t)),s.instances.get(i)}static releaseInstance(t){let i=t.container,e=s.instances.get(i);e&&(e.hide(),e._surface&&e._surface.destroy(),e._silhouette&&e._silhouette.destroy(),s.instances.delete(i))}show(t,i={color:this._color}){this.hide();let e=this._getObject(t);if(H(e))return e instanceof P?this._silhouette.show(e,i):e instanceof y&&e.model?this._silhouette.show(e,i):this._surface.show(e,i)}_getObject(t){if(H(t)){if(t instanceof y||t instanceof P||t instanceof T)return t;if(t.id instanceof y)return t.id;if(t.primitive instanceof T)return t.primitive}}hide(){this._surface.hide(),this._silhouette.hide()}get color(){return this._color}set color(t){this._color=t,this._surface.color=t,this._silhouette.color=t}};export{S as Collection,a as Highlight,D as HybridTerrainProvider,r as SilhouetteHighlight,l as SurfaceHighlight,R as TerrainArea,V as TerrainAreaCollection,E as TerrainVisualizer,A as cloneViewer,G as computeRectangle,O as isGetterOnly,x as syncCamera};
1
+ import"./chunk-RXMNSDKR.js";import{a as o,b as t,c as m}from"./chunk-RZ3PTU3G.js";import{a as l,b as p}from"./chunk-BXU5HNPI.js";import{a as r,b as i,c as e}from"./chunk-4HY6RL6I.js";import{a,b as h}from"./chunk-2JNRK7SN.js";export{e as Collection,m as Highlight,p as HybridTerrainProvider,o as SilhouetteHighlight,t as SurfaceHighlight,l as TerrainArea,r as TerrainVisualizer,h as cloneViewer,i as isGetterOnly,a as syncCamera};
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var R=(a,r)=>{for(var e in r)c(a,e,{get:r[e],enumerable:!0})},C=(a,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of p(r))!y.call(a,t)&&t!==e&&c(a,t,{get:()=>r[t],enumerable:!(i=A(r,t))||i.enumerable});return a};var x=a=>C(c({},"__esModule",{value:!0}),a);var I={};R(I,{HybridTerrainProvider:()=>d,TerrainArea:()=>o,TerrainAreaCollection:()=>s,computeRectangle:()=>u});module.exports=x(I);var P=require("cesium");var _=require("cesium");var h=require("cesium");function u(a,r){if(r.size===0)return new h.Rectangle;let e=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,m=Array.from(r.keys()),l=Math.min(...m),v=r.get(l);if(v){let{start:T,end:g}=v,b=a.tileXYToRectangle(T.x,T.y,l),f=a.tileXYToRectangle(g.x,g.y,l);e=Math.min(b.west,e),i=Math.min(f.south,i),t=Math.max(f.east,t),n=Math.max(b.north,n)}return new h.Rectangle(e,i,t,n)}var o=class{_terrainProvider;_rectangle;_tileRanges;_ready=!1;_credit;_isCustom;constructor(r){this._terrainProvider=r.terrainProvider,this._tileRanges=r.tileRanges,this._credit=r.credit||"custom",this._isCustom=r.isCustom!==void 0?r.isCustom:!0,this._rectangle=u(r.terrainProvider.tilingScheme,r.tileRanges),r.tileRanges.forEach((e,i)=>{this._terrainProvider.availability?.addAvailableTileRange(i,e.start.x,e.start.y,e.end.x,e.end.y)}),this._ready=!0}contains(r,e,i){if(this._tileRanges.size===0||!this._tileRanges.has(i))return!1;let t=this._tileRanges.get(i);return r>=t.start.x&&r<=t.end.x&&e>=t.start.y&&e<=t.end.y}requestTileGeometry(r,e,i,t){if(!(!this._ready||!this.contains(r,e,i)))return this._terrainProvider.requestTileGeometry(r,e,i,t)}getTileDataAvailable(r,e,i){if(this._tileRanges.size===0||!this._tileRanges.has(i))return!1;let t=this._tileRanges.get(i);return r>=t.start.x&&r<=t.end.x&&e>=t.start.y&&e<=t.end.y}get isCustom(){return this._isCustom}get credit(){return this._credit}get terrainProvider(){return this._terrainProvider}get tileRanges(){return this._tileRanges}get rectangle(){return this._rectangle}get ready(){return this._ready}};(r=>{async function a(e,i,t){let n=t?.credit||"custom",m=await _.CesiumTerrainProvider.fromUrl(e,{...t,credit:n});return new r({terrainProvider:m,tileRanges:i,credit:n})}r.fromUrl=a})(o||={});var s=class extends Array{add(r){if(Array.isArray(r)){for(let i of r)this.add(i);return this.length}let e;return r instanceof o?e=r:e=new o(r),this.push(e)}remove(r){if(Array.isArray(r))return r.forEach(i=>this.remove(i)),this;let e=this.indexOf(r);return e>=0&&this.splice(e,1),this}removeAll(){this.length=0}};var d=class{_terrainAreas=new s;_terrainProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(r){this._terrainProvider=r.terrainProvider,this._fallbackProvider=r.fallbackProvider||new P.EllipsoidTerrainProvider,this._tilingScheme=r.terrainProvider.tilingScheme,this._terrainAreas=new s(...r.terrainAreas),this._availability=r.terrainProvider.availability,this._ready=!0}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(r,e,i){return this._terrainProvider.loadTileDataAvailability(r,e,i)}getLevelMaximumGeometricError(r){return this._terrainProvider.getLevelMaximumGeometricError(r)}requestTileGeometry(r,e,i,t){if(this._ready){for(let n of this._terrainAreas)if(n.contains(r,e,i))return n.requestTileGeometry(r,e,i,t);return this._terrainProvider.getTileDataAvailable(r,e,i)?this._terrainProvider.requestTileGeometry(r,e,i,t):this._fallbackProvider.requestTileGeometry(r,e,i,t)}}getTileDataAvailable(r,e,i){for(let t of this._terrainAreas)if(t.contains(r,e,i))return t.getTileDataAvailable(r,e,i);return this._terrainProvider.getTileDataAvailable(r,e,i)}};
1
+ "use strict";var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var C=(n,r)=>{for(var i in r)v(n,i,{get:r[i],enumerable:!0})},x=(n,r,i,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of y(r))!R.call(n,e)&&e!==i&&v(n,e,{get:()=>r[e],enumerable:!(t=p(r,e))||t.enumerable});return n};var I=n=>x(v({},"__esModule",{value:!0}),n);var N={};C(N,{HybridTerrainProvider:()=>c,TerrainArea:()=>m});module.exports=I(N);var d=require("cesium");var P=require("cesium");var l=class{_terrainProvider;_rectangle;_tileRanges;_ready=!1;_credit;_isCustom;constructor(r){this._terrainProvider=r.terrainProvider,this._tileRanges=r.tileRanges,this._credit=r.credit||"custom",this._isCustom=r.isCustom!==void 0?r.isCustom:!0,this._rectangle=c.computeRectangle(r.terrainProvider.tilingScheme,r.tileRanges),r.tileRanges.forEach((i,t)=>{this._terrainProvider.availability?.addAvailableTileRange(t,i.start.x,i.start.y,i.end.x,i.end.y)}),this._ready=!0}contains(r,i,t){if(this._tileRanges.size===0||!this._tileRanges.has(t))return!1;let e=this._tileRanges.get(t);return r>=e.start.x&&r<=e.end.x&&i>=e.start.y&&i<=e.end.y}requestTileGeometry(r,i,t,e){if(!(!this._ready||!this.contains(r,i,t)))return this._terrainProvider.requestTileGeometry(r,i,t,e)}getTileDataAvailable(r,i,t){if(this._tileRanges.size===0||!this._tileRanges.has(t))return!1;let e=this._tileRanges.get(t);return r>=e.start.x&&r<=e.end.x&&i>=e.start.y&&i<=e.end.y}get isCustom(){return this._isCustom}get credit(){return this._credit}get terrainProvider(){return this._terrainProvider}get tileRanges(){return this._tileRanges}get rectangle(){return this._rectangle}get ready(){return this._ready}};(i=>{async function n(t,e,a){let s=a?.credit||"custom",o=await P.CesiumTerrainProvider.fromUrl(t,{...a,credit:s});return new i({terrainProvider:o,tileRanges:e,credit:s})}i.fromUrl=n;class r extends Array{add(e){if(Array.isArray(e)){for(let s of e)this.add(s);return this}let a;return e instanceof i?a=e:a=new i(e),this.push(a),this}remove(e){if(Array.isArray(e))return e.forEach(s=>this.remove(s)),this;let a=this.indexOf(e);return a>=0&&this.splice(a,1),this}removeAll(){this.length=0}}i.Collection=r})(l||={});var m=l;var u=class{_terrainAreas;_terrainProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(r){this._terrainProvider=r.terrainProvider,this._fallbackProvider=r.fallbackProvider||new d.EllipsoidTerrainProvider,this._tilingScheme=r.terrainProvider.tilingScheme,this._terrainAreas=new m.Collection(...r.terrainAreas),this._availability=r.terrainProvider.availability,this._ready=!0}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(r,i,t){return this._terrainProvider.loadTileDataAvailability(r,i,t)}getLevelMaximumGeometricError(r){return this._terrainProvider.getLevelMaximumGeometricError(r)}requestTileGeometry(r,i,t,e){if(this._ready){for(let a of this._terrainAreas)if(a.contains(r,i,t))return a.requestTileGeometry(r,i,t,e);return this._terrainProvider.getTileDataAvailable(r,i,t)?this._terrainProvider.requestTileGeometry(r,i,t,e):this._fallbackProvider.requestTileGeometry(r,i,t,e)}}getTileDataAvailable(r,i,t){for(let e of this._terrainAreas)if(e.contains(r,i,t))return e.getTileDataAvailable(r,i,t);return this._terrainProvider.getTileDataAvailable(r,i,t)}};(r=>{function n(i,t){if(t.size===0)return new d.Rectangle;let e=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,T=Array.from(t.keys()),h=Math.min(...T),b=t.get(h);if(b){let{start:g,end:f}=b,_=i.tileXYToRectangle(g.x,g.y,h),A=i.tileXYToRectangle(f.x,f.y,h);e=Math.min(_.west,e),a=Math.min(A.south,a),s=Math.max(A.east,s),o=Math.max(_.north,o)}return new d.Rectangle(e,a,s,o)}r.computeRectangle=n})(u||={});var c=u;