@juun-roh/cesium-utils 0.3.2 → 0.3.3
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/dev/index.d.cts +1 -1
- package/dist/dev/index.d.ts +1 -1
- package/dist/experimental/index.d.cts +1 -1
- package/dist/experimental/index.d.ts +1 -1
- package/dist/{hybrid-terrain-provider-CzdhZJyg.d.cts → hybrid-terrain-provider-C2iCeaf-.d.cts} +5 -17
- package/dist/{hybrid-terrain-provider-CzdhZJyg.d.ts → hybrid-terrain-provider-C2iCeaf-.d.ts} +5 -17
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/terrain/index.d.cts +1 -1
- package/dist/terrain/index.d.ts +1 -1
- package/package.json +13 -13
package/dist/dev/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Viewer, Color, Rectangle, EntityCollection, Entity } from 'cesium';
|
|
2
2
|
import { C as Collection } from '../index-iIlou-Sq.cjs';
|
|
3
3
|
export { N as NonFunction, i as isGetterOnly } from '../index-iIlou-Sq.cjs';
|
|
4
|
-
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-
|
|
4
|
+
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2iCeaf-.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Utility for managing deprecation warnings in the cesium-utils library.
|
package/dist/dev/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Viewer, Color, Rectangle, EntityCollection, Entity } from 'cesium';
|
|
2
2
|
import { C as Collection } from '../index-iIlou-Sq.js';
|
|
3
3
|
export { N as NonFunction, i as isGetterOnly } from '../index-iIlou-Sq.js';
|
|
4
|
-
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-
|
|
4
|
+
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2iCeaf-.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Utility for managing deprecation warnings in the cesium-utils library.
|
|
@@ -79,7 +79,7 @@ declare namespace Sunlight {
|
|
|
79
79
|
objectsToExclude?: any[];
|
|
80
80
|
/** size of the point entity for error tolerance */
|
|
81
81
|
errorBoundary?: number;
|
|
82
|
-
/** Whether to show sunlight paths
|
|
82
|
+
/** Whether to show sunlight paths */
|
|
83
83
|
debugShowRays?: boolean;
|
|
84
84
|
/** Whether to show points */
|
|
85
85
|
debugShowPoints?: boolean;
|
|
@@ -79,7 +79,7 @@ declare namespace Sunlight {
|
|
|
79
79
|
objectsToExclude?: any[];
|
|
80
80
|
/** size of the point entity for error tolerance */
|
|
81
81
|
errorBoundary?: number;
|
|
82
|
-
/** Whether to show sunlight paths
|
|
82
|
+
/** Whether to show sunlight paths */
|
|
83
83
|
debugShowRays?: boolean;
|
|
84
84
|
/** Whether to show points */
|
|
85
85
|
debugShowPoints?: boolean;
|
package/dist/{hybrid-terrain-provider-CzdhZJyg.d.cts → hybrid-terrain-provider-C2iCeaf-.d.cts}
RENAMED
|
@@ -8,28 +8,16 @@ import { TerrainProvider, TilingScheme, TileAvailability, Credit, Request, Terra
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ``` typescript
|
|
11
|
-
* //
|
|
12
|
-
* const
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* provider: customProvider,
|
|
16
|
-
* bounds: Rectangle.fromDegrees(-120, 30, -100, 50),
|
|
17
|
-
* levels: [10, 15] // optional
|
|
18
|
-
* }
|
|
19
|
-
* ],
|
|
20
|
-
* defaultProvider: worldTerrain
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Or tile-coordinate based for precise control (multiple levels)
|
|
24
|
-
* const tileRanges = new Map();
|
|
25
|
-
* tileRanges.set(15, { x: [55852, 55871], y: [9556, 9575] });
|
|
26
|
-
* tileRanges.set(16, { x: [111704, 111742], y: [19112, 19150] });
|
|
11
|
+
* // Tile-coordinate based for precise control (multiple levels)
|
|
12
|
+
* const customTiles: TerrainTiles = new Map();
|
|
13
|
+
* customTiles.set(15, { x: [55852, 55871], y: [9556, 9575] });
|
|
14
|
+
* customTiles.set(16, { x: [111704, 111742], y: [19112, 19150] });
|
|
27
15
|
*
|
|
28
16
|
* const hybridTerrain = new HybridTerrainProvider({
|
|
29
17
|
* regions: [
|
|
30
18
|
* {
|
|
31
19
|
* provider: customProvider,
|
|
32
|
-
* tiles:
|
|
20
|
+
* tiles: customTiles,
|
|
33
21
|
* }
|
|
34
22
|
* ],
|
|
35
23
|
* defaultProvider: worldTerrain
|
package/dist/{hybrid-terrain-provider-CzdhZJyg.d.ts → hybrid-terrain-provider-C2iCeaf-.d.ts}
RENAMED
|
@@ -8,28 +8,16 @@ import { TerrainProvider, TilingScheme, TileAvailability, Credit, Request, Terra
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ``` typescript
|
|
11
|
-
* //
|
|
12
|
-
* const
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* provider: customProvider,
|
|
16
|
-
* bounds: Rectangle.fromDegrees(-120, 30, -100, 50),
|
|
17
|
-
* levels: [10, 15] // optional
|
|
18
|
-
* }
|
|
19
|
-
* ],
|
|
20
|
-
* defaultProvider: worldTerrain
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Or tile-coordinate based for precise control (multiple levels)
|
|
24
|
-
* const tileRanges = new Map();
|
|
25
|
-
* tileRanges.set(15, { x: [55852, 55871], y: [9556, 9575] });
|
|
26
|
-
* tileRanges.set(16, { x: [111704, 111742], y: [19112, 19150] });
|
|
11
|
+
* // Tile-coordinate based for precise control (multiple levels)
|
|
12
|
+
* const customTiles: TerrainTiles = new Map();
|
|
13
|
+
* customTiles.set(15, { x: [55852, 55871], y: [9556, 9575] });
|
|
14
|
+
* customTiles.set(16, { x: [111704, 111742], y: [19112, 19150] });
|
|
27
15
|
*
|
|
28
16
|
* const hybridTerrain = new HybridTerrainProvider({
|
|
29
17
|
* regions: [
|
|
30
18
|
* {
|
|
31
19
|
* provider: customProvider,
|
|
32
|
-
* tiles:
|
|
20
|
+
* tiles: customTiles,
|
|
33
21
|
* }
|
|
34
22
|
* ],
|
|
35
23
|
* defaultProvider: worldTerrain
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var K=(n,e)=>{for(var t in e)L(n,t,{get:e[t],enumerable:!0})},X=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Y(e))!U.call(n,r)&&r!==t&&L(n,r,{get:()=>e[r],enumerable:!(i=$(e,r))||i.enumerable});return n};var J=n=>X(L({},"__esModule",{value:!0}),n);var Q={};K(Q,{Collection:()=>_,Highlight:()=>M,HybridTerrainProvider:()=>D,SilhouetteHighlight:()=>p,SurfaceHighlight:()=>y,cloneViewer:()=>G,syncCamera:()=>O});module.exports=J(Q);var v=require("cesium");var B;(l=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(c,u={}){if(!e)return;let{once:g=!0,prefix:C="[DEPRECATED]",includeStack:T=!0,removeInVersion:b}=u;if(g&&n.has(c))return;let P=`${C} ${c}`;b&&(P+=` This feature will be removed in ${b}.`),typeof console<"u"&&console.warn&&(T?(console.warn(P),console.trace("Deprecation stack trace:")):console.warn(P)),g&&n.add(c)}l.warn=t;function i(c,u,g={}){let C=((...T)=>(t(u,g),c(...T)));return Object.defineProperty(C,"name",{value:c.name,configurable:!0}),C}l.deprecate=i;function r(){n.clear()}l.clear=r;function o(){return n.size}l.getWarningCount=o;function s(c){return n.has(c)}l.hasShown=s})(B||={});var j=B;var h=require("cesium");var w=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",h.Color.RED],["default",h.Color.BLUE],["fallback",h.Color.GRAY],["grid",h.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new _({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._terrainProvider=e,this.update()}update(){this.clear(),this._visible&&this.show(this._level)}clear(){this._collection.remove(this._collection.tags)}show(e=15){if(!this._terrainProvider)return;this._collection.remove(n.tag.grid),this._level=e,this._ensureTileCoordinatesLayer();let t=this._getVisibleRectangle();if(!t||!this._isValidRectangle(t)){console.warn("Invalid visible rectangle detected, skipping grid display");return}this._displayTileGrid(t,e),this._visible=!0}_ensureTileCoordinatesLayer(){this._tileCoordinatesLayer||(this._tileCoordinatesLayer=this._viewer.imageryLayers.addImageryProvider(new h.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:h.Color.YELLOW})))}_isValidRectangle(e){return e&&Number.isFinite(e.west)&&Number.isFinite(e.south)&&Number.isFinite(e.east)&&Number.isFinite(e.north)&&e.west<=e.east&&e.south<=e.north}_displayTileGrid(e,t){let i=this._terrainProvider.tilingScheme;try{let r=this._calculateTileBounds(e,t,i);this._generateVisibleTiles(r,t,i).forEach(s=>{this._collection.add(s.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(h.Rectangle.northwest(e),t),o=i.positionToTileXY(h.Rectangle.southeast(e),t);if(!r||!o)throw new Error("Failed to calculate tile bounds");return{start:r,end:o}}_generateVisibleTiles(e,t,i){let r=[],s=Math.min(e.end.x-e.start.x+1,100),l=Math.min(e.end.y-e.start.y+1,100);for(let c=e.start.x;c<e.start.x+s;c++)for(let u=e.start.y;u<e.start.y+l;u++)try{let g=this._createTileEntity(c,u,t,i);g&&r.push({entity:g})}catch(g){console.warn(`Error creating tile (${c}, ${u}, ${t}):`,g)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let s=this._getTileColor(e,t,i),l=n.createRectangle(o,s.withAlpha(.3));return l.properties?.addProperty("tileX",e),l.properties?.addProperty("tileY",t),l.properties?.addProperty("tileLevel",i),l}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||h.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||h.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||h.Color.BLUE:this._colors.get("fallback")||h.Color.GRAY}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){this._viewer.camera.flyTo({destination:e,...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}get colors(){return this._colors}get terrainProvider(){return this._terrainProvider}};(i=>{i.tag={default:"Terrain Visualizer",boundary:"Terrain Visualizer Boundary",grid:"Terrain Visualizer Tile Grid"};function e(r,o){return new h.Entity({rectangle:{coordinates:r,material:o,heightReference:h.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,s){let l=s?.tag||"terrain_region_visualization",c=s?.color||h.Color.RED,u=s?.maxTilesToShow||100,g=s?.show??!0,C=s?.alpha||.7,T=s?.tileAlpha||.2,b=new _({collection:o.entities,tag:l});if(g&&r.tiles&&r.tiles.size>0){let P=r.provider.tilingScheme,x=0;r.tiles.forEach((f,z)=>{let k=Array.isArray(f.x)?f.x:[f.x,f.x],F=Array.isArray(f.y)?f.y:[f.y,f.y];for(let S=k[0];S<=k[1]&&x<u;S++)for(let R=F[0];R<=F[1]&&x<u;R++){let q=P.tileXYToRectangle(S,R,z);b.add(e(q,c.withAlpha(T)),`${l}_tile`),x++}})}return b}i.visualize=t})(w||={});function A(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 de=j.deprecate;var I=class n{static symbol=Symbol("cesium-item-tag");tag;collection;_valuesCache=null;_tagMap=new Map;_eventListeners=new Map;_eventCleanupFunctions=[];constructor({collection:e,tag:t}){this.tag=t||"default",this.collection=e,this._setupCacheInvalidator(e)}[Symbol.iterator](){return this.values[Symbol.iterator]()}get values(){if(this._valuesCache!==null)return this._valuesCache;let e;if(this.collection instanceof v.EntityCollection)e=this.collection.values;else{e=[];for(let t=0;t<this.collection.length;t++)e.push(this.collection.get(t))}return this._valuesCache=e,e}get length(){return this.values?.length||0}get tags(){return Array.from(this._tagMap.keys())}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})),this}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)&&this.collection.remove(e)&&(this._removeFromTagMap(e),this._invalidateCache(),this._emit("remove",{items:[e]})),Array.isArray(e)){if(e.length===0)return this;for(let i of e)this.remove(i)}let t=this.get(e);if(t.length===0)return this;for(let i of t)this.remove(i);return this}removeAll(){this._tagMap.clear(),this.collection.removeAll(),this._invalidateCache(),this._emit("clear")}destroy(){this._eventCleanupFunctions.forEach(e=>e()),this._eventCleanupFunctions=[],this._tagMap.clear(),this._eventListeners.clear(),this._valuesCache=null}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}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,v.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,v.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,v.defined)(i.show)&&(i.show=!i.show);return this}setProperty(e,t,i=this.tag){let r=this.get(i);for(let o of r)if(e in o&&typeof o[e]!="function"){if(A(o,e))throw Error(`Cannot set read-only property '${String(e)}' on ${o.constructor.name}`);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((r,o)=>e(r,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)}_emit(e,t){let i=this._eventListeners.get(e);if(i){let r={type:e,...t};i.forEach(o=>o(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};_setupCacheInvalidator(e){e instanceof v.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof v.PrimitiveCollection?(e.primitiveAdded.addEventListener(this._invalidateCache),e.primitiveRemoved.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.primitiveAdded.removeEventListener(this._invalidateCache),()=>e.primitiveRemoved.removeEventListener(this._invalidateCache))):e instanceof v.DataSourceCollection?(e.dataSourceAdded.addEventListener(this._invalidateCache),e.dataSourceMoved.addEventListener(this._invalidateCache),e.dataSourceRemoved.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.dataSourceAdded.removeEventListener(this._invalidateCache),()=>e.dataSourceMoved.removeEventListener(this._invalidateCache),()=>e.dataSourceRemoved.removeEventListener(this._invalidateCache))):e instanceof v.ImageryLayerCollection&&(e.layerAdded.addEventListener(this._invalidateCache),e.layerMoved.addEventListener(this._invalidateCache),e.layerRemoved.addEventListener(this._invalidateCache),e.layerShownOrHidden.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.layerAdded.removeEventListener(this._invalidateCache),()=>e.layerMoved.removeEventListener(this._invalidateCache),()=>e.layerRemoved.removeEventListener(this._invalidateCache),()=>e.layerShownOrHidden.removeEventListener(this._invalidateCache)))}},_=I;var m=require("cesium");var d=require("cesium"),p=class{_color=d.Color.RED;_silhouette;_composite;_stages;_entity;_currentObject;_currentOptions;constructor(e){this._stages=e.scene.postProcessStages,this._silhouette=d.PostProcessStageLibrary.createEdgeDetectionStage(),this._silhouette.uniforms.color=this._color,this._silhouette.uniforms.length=.01,this._silhouette.selected=[],this._composite=d.PostProcessStageLibrary.createSilhouetteStage([this._silhouette]),this._stages.add(this._composite)}get color(){return this._color}set color(e){this._color=e}get currentObject(){return this._currentObject}show(e,t){if((0,d.defined)(e)&&!(this._currentObject===e&&this._optionsEqual(this._currentOptions,t))){this._clearHighlights();try{if(e instanceof d.Cesium3DTileFeature)this._silhouette.uniforms.color=t?.color||this._color,this._silhouette.selected.push(e);else{if(!e.model)return;this._entity=e,e.model.silhouetteSize=new d.ConstantProperty(t?.width||2),e.model.silhouetteColor=new d.ConstantProperty(t?.color||this._color)}this._currentObject=e,this._currentOptions=t?{...t}:void 0}catch(i){console.error("Failed to highlight object:",i),this._currentObject=void 0,this._currentOptions=void 0}}}hide(){this._clearHighlights(),this._currentObject=void 0,this._currentOptions=void 0}destroy(){this.hide(),this._composite&&this._stages.remove(this._composite),this._currentObject=void 0,this._currentOptions=void 0}_optionsEqual(e,t){return!e&&!t?!0:!e||!t?!1:e.outline===t.outline&&e.width===t.width&&d.Color.equals(e.color||this._color,t.color||this._color)}_clearHighlights(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new d.ConstantProperty(d.Color.TRANSPARENT),this._entity.model.silhouetteSize=new d.ConstantProperty(0),this._entity=void 0)}};var a=require("cesium"),y=class{_color=a.Color.RED;_entity;_entities;_currentObject;_currentOptions;constructor(e){this._entities=e.entities,this._entity=this._entities.add(new a.Entity({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}get color(){return this._color}set color(e){this._color=e}get entity(){return this._entity}get currentObject(){return this._currentObject}show(e,t){if(!(!(0,a.defined)(e)||!this._entity)){if(this._currentObject===e&&this._optionsEqual(this._currentOptions,t))return this._entity;this._clearGeometries();try{if(e instanceof a.Entity&&(e.polygon||e.polyline||e.rectangle))this._update(e,t);else if(e instanceof a.GroundPrimitive)this._update(e,t);else{this._currentObject=void 0,this._currentOptions=void 0;return}return this._currentObject=e,this._currentOptions=t?{...t}:void 0,this._entity.show=!0,this._entity}catch(i){console.error("Failed to highlight object:",i),this._currentObject=void 0,this._currentOptions=void 0;return}}}hide(){this._entity&&(this._entity.show=!1),this._currentObject=void 0,this._currentOptions=void 0}destroy(){this._entities.contains(this._entity)&&this._entities.remove(this._entity),this._currentObject=void 0,this._currentOptions=void 0}_optionsEqual(e,t){return!e&&!t?!0:!e||!t?!1:e.outline===t.outline&&e.width===t.width&&a.Color.equals(e.color||this._color,t.color||this._color)}_clearGeometries(){this._entity.polygon=void 0,this._entity.polyline=void 0,this._entity.rectangle=void 0}_update(e,t={color:this._color,outline:!1,width:2}){if(e instanceof a.Entity){if(e.polygon)if(t.outline){let i=e.polygon.hierarchy?.getValue();if(i&&i.positions){let r;i.positions.length>0&&!a.Cartesian3.equals(i.positions[0],i.positions[i.positions.length-1])?r=[...i.positions,i.positions[0]]:r=i.positions,this._entity.polyline=new a.PolylineGraphics({positions:r,material:t.color,width:t.width||2,clampToGround:!0})}}else{let i=e.polygon.hierarchy?.getValue();i&&(this._entity.polygon=new a.PolygonGraphics({hierarchy:i,material:t.color,heightReference:a.HeightReference.CLAMP_TO_GROUND,classificationType:e.polygon.classificationType?.getValue()||a.ClassificationType.BOTH}))}else if(e.polyline){let i=e.polyline.positions?.getValue();if(i){let r=e.polyline.width?.getValue();this._entity.polyline=new a.PolylineGraphics({positions:i,material:t.color,width:r+(t.width||2),clampToGround:!0})}}else if(e.rectangle)if(t.outline){let i=e.rectangle.coordinates?.getValue();if(i){let r=[a.Cartesian3.fromRadians(i.west,i.north),a.Cartesian3.fromRadians(i.east,i.north),a.Cartesian3.fromRadians(i.east,i.south),a.Cartesian3.fromRadians(i.west,i.south),a.Cartesian3.fromRadians(i.west,i.north)];this._entity.polyline=new a.PolylineGraphics({positions:r,material:t.color,width:t.width||2,clampToGround:!0})}}else{let i=e.rectangle.coordinates?.getValue();i&&(this._entity.rectangle=new a.RectangleGraphics({coordinates:i,material:t.color,heightReference:a.HeightReference.CLAMP_TO_GROUND}))}}else if(e instanceof a.GroundPrimitive){let i=e.geometryInstances,r=Array.isArray(i)?i[0]:i;if(!r.geometry.attributes.position)return;let o=r.geometry.attributes.position.values,s=[];for(let l=0;l<o.length;l+=3)s.push(new a.Cartesian3(o[l],o[l+1],o[l+2]));t.outline?this._entity.polyline=new a.PolylineGraphics({positions:s,material:t.color,width:t.width||2,clampToGround:!0}):this._entity.polygon=new a.PolygonGraphics({hierarchy:new a.PolygonHierarchy(s),material:t.color,heightReference:a.HeightReference.CLAMP_TO_GROUND,classificationType:a.ClassificationType.BOTH})}}};var H=class n{static instances=new WeakMap;_surface;_silhouette;_color=m.Color.RED;constructor(e){this._surface=new y(e),this._silhouette=new p(e),this._surface.color=this._color,this._silhouette.color=this._color}get color(){return this._color}set color(e){this._color=e,this._surface.color=e,this._silhouette.color=e}static getInstance(e){let t=e.container;return n.instances.has(t)||n.instances.set(t,new n(e)),n.instances.get(t)}static releaseInstance(e){let t=e.container,i=n.instances.get(t);i&&(i.hide(),i._surface&&i._surface.destroy(),i._silhouette&&i._silhouette.destroy(),n.instances.delete(t))}show(e,t={color:this._color}){let i=this._getObject(e);if((0,m.defined)(i))return i instanceof m.Cesium3DTileFeature?this._silhouette.show(i,t):i instanceof m.Entity&&i.model?this._silhouette.show(i,t):this._surface.show(i,t)}_getObject(e){if((0,m.defined)(e)){if(e instanceof m.Entity||e instanceof m.Cesium3DTileFeature||e instanceof m.GroundPrimitive)return e;if(e.id instanceof m.Entity)return e.id;if(e.primitive instanceof m.GroundPrimitive)return e.primitive}}hide(){this._surface.hide(),this._silhouette.hide()}},M=H;var N=require("cesium"),E=class{_regions;_defaultProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(e){this._defaultProvider=e.defaultProvider,this._fallbackProvider=e.fallbackProvider||new N.EllipsoidTerrainProvider,this._tilingScheme=e.defaultProvider.tilingScheme,this._regions=e.regions||[],this._availability=e.defaultProvider.availability,this._ready=!0}get ready(){return this._ready}get tilingScheme(){return this._tilingScheme}get availability(){return this._availability}get regions(){return[...this._regions]}get defaultProvider(){return this._defaultProvider}get fallbackProvider(){return this._fallbackProvider}get credit(){return this._defaultProvider?.credit}get errorEvent(){return this._defaultProvider.errorEvent}get hasWaterMask(){return this._defaultProvider.hasWaterMask}get hasVertexNormals(){return this._defaultProvider.hasVertexNormals}loadTileDataAvailability(e,t,i){return this._defaultProvider.loadTileDataAvailability(e,t,i)}getLevelMaximumGeometricError(e){return this._defaultProvider.getLevelMaximumGeometricError(e)}requestTileGeometry(e,t,i,r){if(this._ready){for(let o of this._regions)if(this._regionContains(o,e,t,i))return o.provider.requestTileGeometry(e,t,i,r);return this._defaultProvider.getTileDataAvailable(e,t,i)?this._defaultProvider.requestTileGeometry(e,t,i,r):this._fallbackProvider.requestTileGeometry(e,t,i,r)}}getTileDataAvailable(e,t,i){for(let r of this._regions)if(this._regionContains(r,e,t,i)&&r.provider.getTileDataAvailable(e,t,i))return!0;return this._defaultProvider.getTileDataAvailable(e,t,i)}_regionContains(e,t,i,r){if(e.levels&&!e.levels.includes(r))return!1;if(e.tiles){let o=e.tiles.get(r);if(!o)return!1;let[s,l]=Array.isArray(o.x)?o.x:[o.x,o.x],[c,u]=Array.isArray(o.y)?o.y:[o.y,o.y];return t>=s&&t<=l&&i>=c&&i<=u}return!1}};(e=>{function n(t,i,r){return new e({regions:t.map(o=>({...o})),defaultProvider:i,fallbackProvider:r})}e.fromTileRanges=n})(E||={});var D=E;var W=require("cesium");var V=require("cesium");function O(n,e){if((0,V.defined)(n)&&(0,V.defined)(e)){let{camera:t}=n;e.camera.position=t.positionWC.clone(),e.camera.direction=t.directionWC.clone(),e.camera.up=t.upWC.clone()}}function G(n,e,t){let i={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},r=new W.Viewer(e,{...i,...t});O(n,r);let o=n.imageryLayers;r.imageryLayers.removeAll();for(let c=0;c<o.length;c++){let u=o.get(c);r.imageryLayers.addImageryProvider(u.imageryProvider,c)}r.clock.startTime=n.clock.startTime.clone(),r.clock.stopTime=n.clock.stopTime.clone(),r.clock.currentTime=n.clock.currentTime.clone(),r.clock.multiplier=n.clock.multiplier,r.clock.clockStep=n.clock.clockStep,r.clock.clockRange=n.clock.clockRange,r.clock.shouldAnimate=n.clock.shouldAnimate,r.scene.globe.enableLighting=n.scene.globe.enableLighting,r.scene.globe.depthTestAgainstTerrain=n.scene.globe.depthTestAgainstTerrain,r.scene.screenSpaceCameraController.enableCollisionDetection=n.scene.screenSpaceCameraController.enableCollisionDetection;let s=n.scene.screenSpaceCameraController.tiltEventTypes;s&&(r.scene.screenSpaceCameraController.tiltEventTypes=Array.isArray(s)?[...s]:s);let l=n.scene.screenSpaceCameraController.zoomEventTypes;return l&&(r.scene.screenSpaceCameraController.zoomEventTypes=Array.isArray(l)?[...l]:l),r}
|
|
1
|
+
"use strict";var L=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var K=(n,e)=>{for(var t in e)L(n,t,{get:e[t],enumerable:!0})},X=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Y(e))!U.call(n,r)&&r!==t&&L(n,r,{get:()=>e[r],enumerable:!(i=$(e,r))||i.enumerable});return n};var J=n=>X(L({},"__esModule",{value:!0}),n);var Q={};K(Q,{Collection:()=>_,Highlight:()=>M,HybridTerrainProvider:()=>D,SilhouetteHighlight:()=>p,SurfaceHighlight:()=>y,cloneViewer:()=>G,syncCamera:()=>x});module.exports=J(Q);var v=require("cesium");var j;(l=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(c,u={}){if(!e)return;let{once:g=!0,prefix:C="[DEPRECATED]",includeStack:T=!0,removeInVersion:b}=u;if(g&&n.has(c))return;let P=`${C} ${c}`;b&&(P+=` This feature will be removed in ${b}.`),typeof console<"u"&&console.warn&&(T?(console.warn(P),console.trace("Deprecation stack trace:")):console.warn(P)),g&&n.add(c)}l.warn=t;function i(c,u,g={}){let C=((...T)=>(t(u,g),c(...T)));return Object.defineProperty(C,"name",{value:c.name,configurable:!0}),C}l.deprecate=i;function r(){n.clear()}l.clear=r;function o(){return n.size}l.getWarningCount=o;function a(c){return n.has(c)}l.hasShown=a})(j||={});var B=j;var h=require("cesium");var w=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",h.Color.RED],["default",h.Color.BLUE],["fallback",h.Color.GRAY],["grid",h.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new _({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._terrainProvider=e,this.update()}update(){this.clear(),this._visible&&this.show(this._level)}clear(){this._collection.remove(this._collection.tags)}show(e=15){if(!this._terrainProvider)return;this._collection.remove(n.tag.grid),this._level=e,this._ensureTileCoordinatesLayer();let t=this._getVisibleRectangle();if(!t||!this._isValidRectangle(t)){console.warn("Invalid visible rectangle detected, skipping grid display");return}this._displayTileGrid(t,e),this._visible=!0}_ensureTileCoordinatesLayer(){this._tileCoordinatesLayer||(this._tileCoordinatesLayer=this._viewer.imageryLayers.addImageryProvider(new h.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:h.Color.YELLOW})))}_isValidRectangle(e){return e&&Number.isFinite(e.west)&&Number.isFinite(e.south)&&Number.isFinite(e.east)&&Number.isFinite(e.north)&&e.west<=e.east&&e.south<=e.north}_displayTileGrid(e,t){let i=this._terrainProvider.tilingScheme;try{let r=this._calculateTileBounds(e,t,i);this._generateVisibleTiles(r,t,i).forEach(a=>{this._collection.add(a.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(h.Rectangle.northwest(e),t),o=i.positionToTileXY(h.Rectangle.southeast(e),t);if(!r||!o)throw new Error("Failed to calculate tile bounds");return{start:r,end:o}}_generateVisibleTiles(e,t,i){let r=[],a=Math.min(e.end.x-e.start.x+1,100),l=Math.min(e.end.y-e.start.y+1,100);for(let c=e.start.x;c<e.start.x+a;c++)for(let u=e.start.y;u<e.start.y+l;u++)try{let g=this._createTileEntity(c,u,t,i);g&&r.push({entity:g})}catch(g){console.warn(`Error creating tile (${c}, ${u}, ${t}):`,g)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let a=this._getTileColor(e,t,i),l=n.createRectangle(o,a.withAlpha(.3));return l.properties?.addProperty("tileX",e),l.properties?.addProperty("tileY",t),l.properties?.addProperty("tileLevel",i),l}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||h.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||h.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||h.Color.BLUE:this._colors.get("fallback")||h.Color.GRAY}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){this._viewer.camera.flyTo({destination:e,...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}get colors(){return this._colors}get terrainProvider(){return this._terrainProvider}};(i=>{i.tag={default:"Terrain Visualizer",boundary:"Terrain Visualizer Boundary",grid:"Terrain Visualizer Tile Grid"};function e(r,o){return new h.Entity({rectangle:{coordinates:r,material:o,heightReference:h.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,a){let l=a?.tag||"terrain_region_visualization",c=a?.color||h.Color.RED,u=a?.maxTilesToShow||100,g=a?.show??!0,C=a?.alpha||.7,T=a?.tileAlpha||.2,b=new _({collection:o.entities,tag:l});if(g&&r.tiles&&r.tiles.size>0){let P=r.provider.tilingScheme,O=0;r.tiles.forEach((f,z)=>{let k=Array.isArray(f.x)?f.x:[f.x,f.x],F=Array.isArray(f.y)?f.y:[f.y,f.y];for(let S=k[0];S<=k[1]&&O<u;S++)for(let R=F[0];R<=F[1]&&O<u;R++){let q=P.tileXYToRectangle(S,R,z);b.add(e(q,c.withAlpha(T)),`${l}_tile`),O++}})}return b}i.visualize=t})(w||={});function A(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 de=B.deprecate;var I=class n{static symbol=Symbol("cesium-item-tag");tag;collection;_valuesCache=null;_tagMap=new Map;_eventListeners=new Map;_eventCleanupFunctions=[];constructor({collection:e,tag:t}){this.tag=t||"default",this.collection=e,this._setupCacheInvalidator(e)}[Symbol.iterator](){return this.values[Symbol.iterator]()}get values(){if(this._valuesCache!==null)return this._valuesCache;let e;if(this.collection instanceof v.EntityCollection)e=this.collection.values;else{e=[];for(let t=0;t<this.collection.length;t++)e.push(this.collection.get(t))}return this._valuesCache=e,e}get length(){return this.values?.length||0}get tags(){return Array.from(this._tagMap.keys())}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})),this}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)&&this.collection.remove(e)&&(this._removeFromTagMap(e),this._invalidateCache(),this._emit("remove",{items:[e]})),Array.isArray(e)){if(e.length===0)return this;for(let i of e)this.remove(i)}let t=this.get(e);if(t.length===0)return this;for(let i of t)this.remove(i);return this}removeAll(){this._tagMap.clear(),this.collection.removeAll(),this._invalidateCache(),this._emit("clear")}destroy(){this._eventCleanupFunctions.forEach(e=>e()),this._eventCleanupFunctions=[],this._tagMap.clear(),this._eventListeners.clear(),this._valuesCache=null}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}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,v.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,v.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,v.defined)(i.show)&&(i.show=!i.show);return this}setProperty(e,t,i=this.tag){let r=this.get(i);for(let o of r)if(e in o&&typeof o[e]!="function"){if(A(o,e))throw Error(`Cannot set read-only property '${String(e)}' on ${o.constructor.name}`);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((r,o)=>e(r,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)}_emit(e,t){let i=this._eventListeners.get(e);if(i){let r={type:e,...t};i.forEach(o=>o(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};_setupCacheInvalidator(e){e instanceof v.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof v.PrimitiveCollection?(e.primitiveAdded.addEventListener(this._invalidateCache),e.primitiveRemoved.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.primitiveAdded.removeEventListener(this._invalidateCache),()=>e.primitiveRemoved.removeEventListener(this._invalidateCache))):e instanceof v.DataSourceCollection?(e.dataSourceAdded.addEventListener(this._invalidateCache),e.dataSourceMoved.addEventListener(this._invalidateCache),e.dataSourceRemoved.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.dataSourceAdded.removeEventListener(this._invalidateCache),()=>e.dataSourceMoved.removeEventListener(this._invalidateCache),()=>e.dataSourceRemoved.removeEventListener(this._invalidateCache))):e instanceof v.ImageryLayerCollection&&(e.layerAdded.addEventListener(this._invalidateCache),e.layerMoved.addEventListener(this._invalidateCache),e.layerRemoved.addEventListener(this._invalidateCache),e.layerShownOrHidden.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.layerAdded.removeEventListener(this._invalidateCache),()=>e.layerMoved.removeEventListener(this._invalidateCache),()=>e.layerRemoved.removeEventListener(this._invalidateCache),()=>e.layerShownOrHidden.removeEventListener(this._invalidateCache)))}},_=I;var m=require("cesium");var d=require("cesium"),p=class{_color=d.Color.RED;_silhouette;_composite;_stages;_entity;_currentObject;_currentOptions;constructor(e){this._stages=e.scene.postProcessStages,this._silhouette=d.PostProcessStageLibrary.createEdgeDetectionStage(),this._silhouette.uniforms.color=this._color,this._silhouette.uniforms.length=.01,this._silhouette.selected=[],this._composite=d.PostProcessStageLibrary.createSilhouetteStage([this._silhouette]),this._stages.add(this._composite)}get color(){return this._color}set color(e){this._color=e}get currentObject(){return this._currentObject}show(e,t){if((0,d.defined)(e)&&!(this._currentObject===e&&this._optionsEqual(this._currentOptions,t))){this._clearHighlights();try{if(e instanceof d.Cesium3DTileFeature)this._silhouette.uniforms.color=t?.color||this._color,this._silhouette.selected.push(e);else{if(!e.model)return;this._entity=e,e.model.silhouetteSize=new d.ConstantProperty(t?.width||2),e.model.silhouetteColor=new d.ConstantProperty(t?.color||this._color)}this._currentObject=e,this._currentOptions=t?{...t}:void 0}catch(i){console.error("Failed to highlight object:",i),this._currentObject=void 0,this._currentOptions=void 0}}}hide(){this._clearHighlights(),this._currentObject=void 0,this._currentOptions=void 0}destroy(){this.hide(),this._composite&&this._stages.remove(this._composite),this._currentObject=void 0,this._currentOptions=void 0}_optionsEqual(e,t){return!e&&!t?!0:!e||!t?!1:e.outline===t.outline&&e.width===t.width&&d.Color.equals(e.color||this._color,t.color||this._color)}_clearHighlights(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new d.ConstantProperty(d.Color.TRANSPARENT),this._entity.model.silhouetteSize=new d.ConstantProperty(0),this._entity=void 0)}};var s=require("cesium"),y=class{_color=s.Color.RED;_entity;_entities;_currentObject;_currentOptions;constructor(e){this._entities=e.entities,this._entity=this._entities.add(new s.Entity({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}get color(){return this._color}set color(e){this._color=e}get entity(){return this._entity}get currentObject(){return this._currentObject}show(e,t){if(!(!(0,s.defined)(e)||!this._entity)){if(this._currentObject===e&&this._optionsEqual(this._currentOptions,t))return this._entity;this._clearGeometries();try{if(e instanceof s.Entity&&(e.polygon||e.polyline||e.rectangle))this._update(e,t);else if(e instanceof s.GroundPrimitive)this._update(e,t);else{this._currentObject=void 0,this._currentOptions=void 0;return}return this._currentObject=e,this._currentOptions=t?{...t}:void 0,this._entity.show=!0,this._entity}catch(i){console.error("Failed to highlight object:",i),this._currentObject=void 0,this._currentOptions=void 0;return}}}hide(){this._entity&&(this._entity.show=!1),this._currentObject=void 0,this._currentOptions=void 0}destroy(){this._entities.contains(this._entity)&&this._entities.remove(this._entity),this._currentObject=void 0,this._currentOptions=void 0}_optionsEqual(e,t){return!e&&!t?!0:!e||!t?!1:e.outline===t.outline&&e.width===t.width&&s.Color.equals(e.color||this._color,t.color||this._color)}_clearGeometries(){this._entity.polygon=void 0,this._entity.polyline=void 0,this._entity.rectangle=void 0}_update(e,t={color:this._color,outline:!1,width:2}){if(e instanceof s.Entity){if(e.polygon)if(t.outline){let i=e.polygon.hierarchy?.getValue();if(i&&i.positions){let r;i.positions.length>0&&!s.Cartesian3.equals(i.positions[0],i.positions[i.positions.length-1])?r=[...i.positions,i.positions[0]]:r=i.positions,this._entity.polyline=new s.PolylineGraphics({positions:r,material:t.color,width:t.width||2,clampToGround:!0})}}else{let i=e.polygon.hierarchy?.getValue();i&&(this._entity.polygon=new s.PolygonGraphics({hierarchy:i,material:t.color,heightReference:s.HeightReference.CLAMP_TO_GROUND,classificationType:e.polygon.classificationType?.getValue()||s.ClassificationType.BOTH}))}else if(e.polyline){let i=e.polyline.positions?.getValue();if(i){let r=e.polyline.width?.getValue();this._entity.polyline=new s.PolylineGraphics({positions:i,material:t.color,width:r+(t.width||2),clampToGround:!0})}}else if(e.rectangle)if(t.outline){let i=e.rectangle.coordinates?.getValue();if(i){let r=[s.Cartesian3.fromRadians(i.west,i.north),s.Cartesian3.fromRadians(i.east,i.north),s.Cartesian3.fromRadians(i.east,i.south),s.Cartesian3.fromRadians(i.west,i.south),s.Cartesian3.fromRadians(i.west,i.north)];this._entity.polyline=new s.PolylineGraphics({positions:r,material:t.color,width:t.width||2,clampToGround:!0})}}else{let i=e.rectangle.coordinates?.getValue();i&&(this._entity.rectangle=new s.RectangleGraphics({coordinates:i,material:t.color,heightReference:s.HeightReference.CLAMP_TO_GROUND}))}}else if(e instanceof s.GroundPrimitive){let i=e.geometryInstances,r=Array.isArray(i)?i[0]:i;if(!r.geometry.attributes.position)return;let o=r.geometry.attributes.position.values,a=[];for(let l=0;l<o.length;l+=3)a.push(new s.Cartesian3(o[l],o[l+1],o[l+2]));t.outline?this._entity.polyline=new s.PolylineGraphics({positions:a,material:t.color,width:t.width||2,clampToGround:!0}):this._entity.polygon=new s.PolygonGraphics({hierarchy:new s.PolygonHierarchy(a),material:t.color,heightReference:s.HeightReference.CLAMP_TO_GROUND,classificationType:s.ClassificationType.BOTH})}}};var H=class n{static instances=new WeakMap;_surface;_silhouette;_color=m.Color.RED;constructor(e){this._surface=new y(e),this._silhouette=new p(e),this._surface.color=this._color,this._silhouette.color=this._color}get color(){return this._color}set color(e){this._color=e,this._surface.color=e,this._silhouette.color=e}static getInstance(e){let t=e.container;return n.instances.has(t)||n.instances.set(t,new n(e)),n.instances.get(t)}static releaseInstance(e){let t=e.container,i=n.instances.get(t);i&&(i.hide(),i._surface&&i._surface.destroy(),i._silhouette&&i._silhouette.destroy(),n.instances.delete(t))}show(e,t={color:this._color}){let i=this._getObject(e);if((0,m.defined)(i))return i instanceof m.Cesium3DTileFeature?this._silhouette.show(i,t):i instanceof m.Entity&&i.model?this._silhouette.show(i,t):this._surface.show(i,t)}_getObject(e){if((0,m.defined)(e)){if(e instanceof m.Entity||e instanceof m.Cesium3DTileFeature||e instanceof m.GroundPrimitive)return e;if(e.id instanceof m.Entity)return e.id;if(e.primitive instanceof m.GroundPrimitive)return e.primitive}}hide(){this._surface.hide(),this._silhouette.hide()}},M=H;var N=require("cesium"),E=class{_regions;_defaultProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(e){this._defaultProvider=e.defaultProvider,this._fallbackProvider=e.fallbackProvider||new N.EllipsoidTerrainProvider,this._tilingScheme=e.defaultProvider.tilingScheme,this._regions=e.regions||[],this._availability=e.defaultProvider.availability,this._ready=!0}get ready(){return this._ready}get tilingScheme(){return this._tilingScheme}get availability(){return this._availability}get regions(){return[...this._regions]}get defaultProvider(){return this._defaultProvider}get fallbackProvider(){return this._fallbackProvider}get credit(){return this._defaultProvider?.credit}get errorEvent(){return this._defaultProvider.errorEvent}get hasWaterMask(){return this._defaultProvider.hasWaterMask}get hasVertexNormals(){return this._defaultProvider.hasVertexNormals}loadTileDataAvailability(e,t,i){return this._defaultProvider.loadTileDataAvailability(e,t,i)}getLevelMaximumGeometricError(e){return this._defaultProvider.getLevelMaximumGeometricError(e)}requestTileGeometry(e,t,i,r){if(this._ready){for(let o of this._regions)if(this._regionContains(o,e,t,i))return o.provider.requestTileGeometry(e,t,i,r);return this._defaultProvider.getTileDataAvailable(e,t,i)?this._defaultProvider.requestTileGeometry(e,t,i,r):this._fallbackProvider.requestTileGeometry(e,t,i,r)}}getTileDataAvailable(e,t,i){for(let r of this._regions)if(this._regionContains(r,e,t,i)&&r.provider.getTileDataAvailable(e,t,i))return!0;return this._defaultProvider.getTileDataAvailable(e,t,i)}_regionContains(e,t,i,r){if(e.levels&&!e.levels.includes(r))return!1;if(e.tiles){let o=e.tiles.get(r);if(!o)return!1;let[a,l]=Array.isArray(o.x)?o.x:[o.x,o.x],[c,u]=Array.isArray(o.y)?o.y:[o.y,o.y];return t>=a&&t<=l&&i>=c&&i<=u}return!1}};(e=>{function n(t,i,r){return new e({regions:t.map(o=>({...o})),defaultProvider:i,fallbackProvider:r})}e.fromTileRanges=n})(E||={});var D=E;var W=require("cesium");var V=require("cesium");function x(n,e){if((0,V.defined)(n)&&(0,V.defined)(e)){let{camera:t}=n;e.camera.position=t.positionWC.clone(),e.camera.direction=t.directionWC.clone(),e.camera.up=t.upWC.clone()}}function G(n,e,t){let i={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},r=new W.Viewer(e,{...i,...t});x(n,r);let o=n.imageryLayers;r.imageryLayers.removeAll();for(let c=0;c<o.length;c++){let u=o.get(c);r.imageryLayers.addImageryProvider(u.imageryProvider,c)}r.clock.startTime=n.clock.startTime.clone(),r.clock.stopTime=n.clock.stopTime.clone(),r.clock.currentTime=n.clock.currentTime.clone(),r.clock.multiplier=n.clock.multiplier,r.clock.clockStep=n.clock.clockStep,r.clock.clockRange=n.clock.clockRange,r.clock.shouldAnimate=n.clock.shouldAnimate,r.scene.globe.enableLighting=n.scene.globe.enableLighting,r.scene.globe.depthTestAgainstTerrain=n.scene.globe.depthTestAgainstTerrain,r.scene.screenSpaceCameraController.enableCollisionDetection=n.scene.screenSpaceCameraController.enableCollisionDetection;let a=n.scene.screenSpaceCameraController.tiltEventTypes;a&&(r.scene.screenSpaceCameraController.tiltEventTypes=Array.isArray(a)?[...a]:a);let l=n.scene.screenSpaceCameraController.zoomEventTypes;return l&&(r.scene.screenSpaceCameraController.zoomEventTypes=Array.isArray(l)?[...l]:l),r}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { C as Collection } from './index-iIlou-Sq.cjs';
|
|
2
2
|
export { Highlight, SilhouetteHighlight, SurfaceHighlight } from './highlight/index.cjs';
|
|
3
|
-
export {
|
|
3
|
+
export { TerrainOptions, TerrainRegion, TerrainTiles } from './terrain/index.cjs';
|
|
4
4
|
export { cloneViewer, syncCamera } from './viewer/index.cjs';
|
|
5
|
+
export { H as HybridTerrainProvider } from './hybrid-terrain-provider-C2iCeaf-.cjs';
|
|
5
6
|
import 'cesium';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { C as Collection } from './index-iIlou-Sq.js';
|
|
2
2
|
export { Highlight, SilhouetteHighlight, SurfaceHighlight } from './highlight/index.js';
|
|
3
|
-
export {
|
|
3
|
+
export { TerrainOptions, TerrainRegion, TerrainTiles } from './terrain/index.js';
|
|
4
4
|
export { cloneViewer, syncCamera } from './viewer/index.js';
|
|
5
|
+
export { H as HybridTerrainProvider } from './hybrid-terrain-provider-C2iCeaf-.js';
|
|
5
6
|
import 'cesium';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-RXMNSDKR.js";import{e as r}from"./chunk-EGWUHR3C.js";import{a as
|
|
1
|
+
import"./chunk-RXMNSDKR.js";import{e as r}from"./chunk-EGWUHR3C.js";import{a as e,b as i,c as o}from"./chunk-PSCNWZUR.js";import{a as t}from"./chunk-6I4THOWX.js";import{a as p,b as m}from"./chunk-Z2COOTT4.js";export{r as Collection,o as Highlight,t as HybridTerrainProvider,e as SilhouetteHighlight,i as SurfaceHighlight,m as cloneViewer,p as syncCamera};
|
package/dist/terrain/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-
|
|
1
|
+
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2iCeaf-.cjs';
|
|
2
2
|
import 'cesium';
|
|
3
3
|
|
|
4
4
|
type TerrainTiles = NonNullable<HybridTerrainProvider.TerrainRegion["tiles"]>;
|
package/dist/terrain/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-
|
|
1
|
+
import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2iCeaf-.js';
|
|
2
2
|
import 'cesium';
|
|
3
3
|
|
|
4
4
|
type TerrainTiles = NonNullable<HybridTerrainProvider.TerrainRegion["tiles"]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juun-roh/cesium-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Solve common Cesium.js challenges: combine multiple terrain sources, tag and filter entity collections, and add visual highlights.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cesium",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"node": ">=20.0.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"cesium": "^1.
|
|
84
|
+
"cesium": "^1.133.0"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
@@ -92,30 +92,30 @@
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@changesets/cli": "^2.29.
|
|
95
|
+
"@changesets/cli": "^2.29.7",
|
|
96
96
|
"@commitlint/cli": "^19.8.1",
|
|
97
97
|
"@commitlint/config-conventional": "^19.8.1",
|
|
98
98
|
"@commitlint/cz-commitlint": "^19.8.1",
|
|
99
99
|
"@commitlint/format": "^19.8.1",
|
|
100
100
|
"@commitlint/types": "^19.8.1",
|
|
101
|
-
"@eslint/js": "^9.
|
|
102
|
-
"@types/node": "^24.
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
104
|
-
"@typescript-eslint/parser": "^8.
|
|
101
|
+
"@eslint/js": "^9.36.0",
|
|
102
|
+
"@types/node": "^24.5.2",
|
|
103
|
+
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
104
|
+
"@typescript-eslint/parser": "^8.44.0",
|
|
105
105
|
"@vitest/coverage-v8": "^3.2.4",
|
|
106
|
-
"cesium": "^1.
|
|
107
|
-
"eslint": "^9.
|
|
108
|
-
"eslint-plugin-jsdoc": "^
|
|
106
|
+
"cesium": "^1.133.1",
|
|
107
|
+
"eslint": "^9.36.0",
|
|
108
|
+
"eslint-plugin-jsdoc": "^60.1.0",
|
|
109
109
|
"eslint-plugin-prettier": "^5.5.4",
|
|
110
110
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
111
111
|
"eslint-plugin-unused-imports": "^4.2.0",
|
|
112
112
|
"husky": "^9.1.7",
|
|
113
|
-
"jsdom": "^
|
|
113
|
+
"jsdom": "^27.0.0",
|
|
114
114
|
"rimraf": "^6.0.1",
|
|
115
115
|
"tsup": "^8.5.0",
|
|
116
|
-
"typedoc": "^0.28.
|
|
116
|
+
"typedoc": "^0.28.13",
|
|
117
117
|
"typescript": "^5.9.2",
|
|
118
|
-
"vite": "^7.1.
|
|
118
|
+
"vite": "^7.1.6",
|
|
119
119
|
"vitest": "^3.2.4"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|