@juun-roh/cesium-utils 0.3.0 → 0.3.2

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.
Files changed (37) hide show
  1. package/README.md +7 -4
  2. package/dist/chunk-6I4THOWX.js +1 -0
  3. package/dist/chunk-EGWUHR3C.js +1 -0
  4. package/dist/chunk-PSCNWZUR.js +1 -0
  5. package/dist/collection/index.cjs +1 -1
  6. package/dist/collection/index.d.cts +1 -1
  7. package/dist/collection/index.d.ts +1 -1
  8. package/dist/collection/index.js +1 -1
  9. package/dist/dev/index.cjs +1 -1
  10. package/dist/dev/index.d.cts +3 -3
  11. package/dist/dev/index.d.ts +3 -3
  12. package/dist/dev/index.js +1 -1
  13. package/dist/experimental/index.cjs +1 -1
  14. package/dist/experimental/index.d.cts +8 -5
  15. package/dist/experimental/index.d.ts +8 -5
  16. package/dist/experimental/index.js +1 -1
  17. package/dist/highlight/index.cjs +1 -1
  18. package/dist/highlight/index.d.cts +32 -32
  19. package/dist/highlight/index.d.ts +32 -32
  20. package/dist/highlight/index.js +1 -1
  21. package/dist/{hybrid-terrain-provider-C2V-igd9.d.cts → hybrid-terrain-provider-CzdhZJyg.d.cts} +1 -21
  22. package/dist/{hybrid-terrain-provider-C2V-igd9.d.ts → hybrid-terrain-provider-CzdhZJyg.d.ts} +1 -21
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +1 -1
  27. package/dist/terrain/index.cjs +1 -1
  28. package/dist/terrain/index.d.cts +1 -1
  29. package/dist/terrain/index.d.ts +1 -1
  30. package/dist/terrain/index.js +1 -1
  31. package/package.json +6 -6
  32. package/dist/chunk-OUTUX3ZP.js +0 -1
  33. package/dist/chunk-RZ3PTU3G.js +0 -1
  34. package/dist/chunk-TC3IX3JL.js +0 -1
  35. package/dist/chunk-WVFPGF7U.js +0 -1
  36. package/dist/{index-Bfd24d9-.d.cts → index-iIlou-Sq.d.cts} +59 -59
  37. package/dist/{index-Bfd24d9-.d.ts → index-iIlou-Sq.d.ts} +59 -59
package/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Cesium Utils
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@juun-roh/cesium-utils.svg)](https://www.npmjs.com/package/@juun-roh/cesium-utils)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Documentation](https://img.shields.io/badge/docs-typedoc-blue)](https://juunie-roh.github.io/cesium-utils/)
6
- [![Build Status](https://img.shields.io/github/actions/workflow/status/juunie-roh/cesium-utils/release-and-publish.yml)](https://github.com/juunie-roh/cesium-utils/actions)
3
+ [![GitHub](https://img.shields.io/badge/GitHub-%23121011.svg?logo=github&logoColor=white)](https://github.com/juunie-roh/cesium-utils)
4
+ [![npm version](https://img.shields.io/npm/v/@juun-roh/cesium-utils.svg?logo=npm&logoColor=fff&color=CB3837)](https://www.npmjs.com/package/@juun-roh/cesium-utils)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?logo=opensourceinitiative&logoColor=fff)](https://opensource.org/licenses/MIT)
6
+ [![Documentation](https://img.shields.io/badge/docs-typedoc-blue?logo=typescript&logoColor=fff&color=3178C6)](https://juunie-roh.github.io/cesium-utils/)
7
+
8
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/juunie-roh/cesium-utils/release-and-publish.yml?logo=githubactions&logoColor=fff)](https://github.com/juunie-roh/cesium-utils/actions)
9
+ [![Changelog](https://img.shields.io/badge/changelog-releases-blue?logo=git&logoColor=fff&color=green)](https://github.com/juunie-roh/cesium-utils/releases)
7
10
 
8
11
  TypeScript utility library for Cesium.js providing hybrid terrain providers, entity collection tagging, and visual highlighting systems.
9
12
 
@@ -0,0 +1 @@
1
+ import{EllipsoidTerrainProvider as v}from"cesium";var n=class{_regions;_defaultProvider;_fallbackProvider;_tilingScheme;_ready=!1;_availability;constructor(r){this._defaultProvider=r.defaultProvider,this._fallbackProvider=r.fallbackProvider||new v,this._tilingScheme=r.defaultProvider.tilingScheme,this._regions=r.regions||[],this._availability=r.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(r,e,i){return this._defaultProvider.loadTileDataAvailability(r,e,i)}getLevelMaximumGeometricError(r){return this._defaultProvider.getLevelMaximumGeometricError(r)}requestTileGeometry(r,e,i,t){if(this._ready){for(let a of this._regions)if(this._regionContains(a,r,e,i))return a.provider.requestTileGeometry(r,e,i,t);return this._defaultProvider.getTileDataAvailable(r,e,i)?this._defaultProvider.requestTileGeometry(r,e,i,t):this._fallbackProvider.requestTileGeometry(r,e,i,t)}}getTileDataAvailable(r,e,i){for(let t of this._regions)if(this._regionContains(t,r,e,i)&&t.provider.getTileDataAvailable(r,e,i))return!0;return this._defaultProvider.getTileDataAvailable(r,e,i)}_regionContains(r,e,i,t){if(r.levels&&!r.levels.includes(t))return!1;if(r.tiles){let a=r.tiles.get(t);if(!a)return!1;let[l,d]=Array.isArray(a.x)?a.x:[a.x,a.x],[u,s]=Array.isArray(a.y)?a.y:[a.y,a.y];return e>=l&&e<=d&&i>=u&&i<=s}return!1}};(r=>{function o(e,i,t){return new r({regions:e.map(a=>({...a})),defaultProvider:i,fallbackProvider:t})}r.fromTileRanges=o})(n||={});var b=n;export{b as a};
@@ -0,0 +1 @@
1
+ var I;(h=>{let o=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(a,l={}){if(!e)return;let{once:c=!0,prefix:u="[DEPRECATED]",includeStack:m=!0,removeInVersion:g}=l;if(c&&o.has(a))return;let p=`${u} ${a}`;g&&(p+=` This feature will be removed in ${g}.`),typeof console<"u"&&console.warn&&(m?(console.warn(p),console.trace("Deprecation stack trace:")):console.warn(p)),c&&o.add(a)}h.warn=t;function i(a,l,c={}){let u=((...m)=>(t(l,c),a(...m)));return Object.defineProperty(u,"name",{value:a.name,configurable:!0}),u}h.deprecate=i;function r(){o.clear()}h.clear=r;function n(){return o.size}h.getWarningCount=n;function s(a){return o.has(a)}h.hasShown=s})(I||={});var P=I;import{Color as d,Entity as V,HeightReference as j,Rectangle as R,TileCoordinatesImageryProvider as G}from"cesium";import{DataSourceCollection as O,defined as T,EntityCollection as S,ImageryLayerCollection as F,PrimitiveCollection as D}from"cesium";var b=class o{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 S)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,o.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,o.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)T(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)T(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)T(i.show)&&(i.show=!i.show);return this}setProperty(e,t,i=this.tag){let r=this.get(i);for(let n of r)if(e in n&&typeof n[e]!="function"){if(E(n,e))throw Error(`Cannot set read-only property '${String(e)}' on ${n.constructor.name}`);n[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,n)=>e(r,n))}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(n=>n(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[o.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 S?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof D?(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 O?(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 F&&(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)))}},w=b;var f=class o{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",d.RED],["default",d.BLUE],["fallback",d.GRAY],["grid",d.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new w({collection:e.entities,tag:o.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(o.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 G({tilingScheme:this._terrainProvider.tilingScheme,color:d.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,o.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(R.northwest(e),t),n=i.positionToTileXY(R.southeast(e),t);if(!r||!n)throw new Error("Failed to calculate tile bounds");return{start:r,end:n}}_generateVisibleTiles(e,t,i){let r=[],s=Math.min(e.end.x-e.start.x+1,100),h=Math.min(e.end.y-e.start.y+1,100);for(let a=e.start.x;a<e.start.x+s;a++)for(let l=e.start.y;l<e.start.y+h;l++)try{let c=this._createTileEntity(a,l,t,i);c&&r.push({entity:c})}catch(c){console.warn(`Error creating tile (${a}, ${l}, ${t}):`,c)}return r}_createTileEntity(e,t,i,r){let n=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(n))return null;let s=this._getTileColor(e,t,i),h=o.createRectangle(n,s.withAlpha(.3));return h.properties?.addProperty("tileX",e),h.properties?.addProperty("tileY",t),h.properties?.addProperty("tileLevel",i),h}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||d.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||d.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||d.BLUE:this._colors.get("fallback")||d.GRAY}hide(){this._collection.remove(o.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,n){return new V({rectangle:{coordinates:r,material:n,heightReference:j.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,n,s){let h=s?.tag||"terrain_region_visualization",a=s?.color||d.RED,l=s?.maxTilesToShow||100,c=s?.show??!0,u=s?.alpha||.7,m=s?.tileAlpha||.2,g=new w({collection:n.entities,tag:h});if(c&&r.tiles&&r.tiles.size>0){let p=r.provider.tilingScheme,y=0;r.tiles.forEach((v,A)=>{let L=Array.isArray(v.x)?v.x:[v.x,v.x],x=Array.isArray(v.y)?v.y:[v.y,v.y];for(let C=L[0];C<=L[1]&&y<l;C++)for(let _=x[0];_<=x[1]&&y<l;_++){let M=p.tileXYToRectangle(C,_,A);g.add(e(M,a.withAlpha(m)),`${h}_tile`),y++}})}return g}i.visualize=t})(f||={});function E(o,e){let t=!1,i=Object.getOwnPropertyDescriptor(o,e);if(!i){let r=Object.getPrototypeOf(o);for(;r&&!i;)i=Object.getOwnPropertyDescriptor(r,e),r=Object.getPrototypeOf(r)}return i&&i.get&&!i.set&&(t=!0),t}var ee=P.deprecate;export{P as a,f as b,E as c,ee as d,w as e};
@@ -0,0 +1 @@
1
+ import{Cesium3DTileFeature as P,Color as R,defined as H,Entity as p,GroundPrimitive as E}from"cesium";import{Cesium3DTileFeature as T,Color as f,ConstantProperty as u,defined as G,PostProcessStageLibrary as m}from"cesium";var s=class{_color=f.RED;_silhouette;_composite;_stages;_entity;_currentObject;_currentOptions;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)}get color(){return this._color}set color(t){this._color=t}get currentObject(){return this._currentObject}show(t,i){if(G(t)&&!(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))){this._clearHighlights();try{if(t instanceof T)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)}this._currentObject=t,this._currentOptions=i?{...i}:void 0}catch(e){console.error("Failed to highlight object:",e),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(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&f.equals(t.color||this._color,i.color||this._color)}_clearHighlights(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new u(f.TRANSPARENT),this._entity.model.silhouetteSize=new u(0),this._entity=void 0)}};import{Cartesian3 as o,ClassificationType as v,Color as O,defined as S,Entity as g,GroundPrimitive as w,HeightReference as _,PolygonGraphics as C,PolygonHierarchy as b,PolylineGraphics as a,RectangleGraphics as D}from"cesium";var l=class{_color=O.RED;_entity;_entities;_currentObject;_currentOptions;constructor(t){this._entities=t.entities,this._entity=this._entities.add(new g({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}get color(){return this._color}set color(t){this._color=t}get entity(){return this._entity}get currentObject(){return this._currentObject}show(t,i){if(!(!S(t)||!this._entity)){if(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))return this._entity;this._clearGeometries();try{if(t instanceof g&&(t.polygon||t.polyline||t.rectangle))this._update(t,i);else if(t instanceof w)this._update(t,i);else{this._currentObject=void 0,this._currentOptions=void 0;return}return this._currentObject=t,this._currentOptions=i?{...i}:void 0,this._entity.show=!0,this._entity}catch(e){console.error("Failed to highlight object:",e),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(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&O.equals(t.color||this._color,i.color||this._color)}_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 g){if(t.polygon)if(i.outline){let e=t.polygon.hierarchy?.getValue();if(e&&e.positions){let r;e.positions.length>0&&!o.equals(e.positions[0],e.positions[e.positions.length-1])?r=[...e.positions,e.positions[0]]:r=e.positions,this._entity.polyline=new a({positions:r,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:_.CLAMP_TO_GROUND,classificationType:t.polygon.classificationType?.getValue()||v.BOTH}))}else if(t.polyline){let e=t.polyline.positions?.getValue();if(e){let r=t.polyline.width?.getValue();this._entity.polyline=new a({positions:e,material:i.color,width:r+(i.width||2),clampToGround:!0})}}else if(t.rectangle)if(i.outline){let e=t.rectangle.coordinates?.getValue();if(e){let r=[o.fromRadians(e.west,e.north),o.fromRadians(e.east,e.north),o.fromRadians(e.east,e.south),o.fromRadians(e.west,e.south),o.fromRadians(e.west,e.north)];this._entity.polyline=new a({positions:r,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.rectangle.coordinates?.getValue();e&&(this._entity.rectangle=new D({coordinates:e,material:i.color,heightReference:_.CLAMP_TO_GROUND}))}}else if(t instanceof w){let e=t.geometryInstances,r=Array.isArray(e)?e[0]:e;if(!r.geometry.attributes.position)return;let c=r.geometry.attributes.position.values,d=[];for(let h=0;h<c.length;h+=3)d.push(new o(c[h],c[h+1],c[h+2]));i.outline?this._entity.polyline=new a({positions:d,material:i.color,width:i.width||2,clampToGround:!0}):this._entity.polygon=new C({hierarchy:new b(d),material:i.color,heightReference:_.CLAMP_TO_GROUND,classificationType:v.BOTH})}}};var y=class n{static instances=new WeakMap;_surface;_silhouette;_color=R.RED;constructor(t){this._surface=new l(t),this._silhouette=new s(t),this._surface.color=this._color,this._silhouette.color=this._color}get color(){return this._color}set color(t){this._color=t,this._surface.color=t,this._silhouette.color=t}static getInstance(t){let i=t.container;return n.instances.has(i)||n.instances.set(i,new n(t)),n.instances.get(i)}static releaseInstance(t){let i=t.container,e=n.instances.get(i);e&&(e.hide(),e._surface&&e._surface.destroy(),e._silhouette&&e._silhouette.destroy(),n.instances.delete(i))}show(t,i={color:this._color}){let e=this._getObject(t);if(H(e))return e instanceof P?this._silhouette.show(e,i):e instanceof p&&e.model?this._silhouette.show(e,i):this._surface.show(e,i)}_getObject(t){if(H(t)){if(t instanceof p||t instanceof P||t instanceof E)return t;if(t.id instanceof p)return t.id;if(t.primitive instanceof E)return t.primitive}}hide(){this._surface.hide(),this._silhouette.hide()}},V=y;export{s as a,l as b,V as c};
@@ -1 +1 @@
1
- "use strict";var E=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var D=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},V=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of O(e))!F.call(n,r)&&r!==t&&E(n,r,{get:()=>e[r],enumerable:!(i=M(e,r))||i.enumerable});return n};var N=n=>V(E({},"__esModule",{value:!0}),n);var j={};D(j,{Collection:()=>C});module.exports=N(j);var c=require("cesium");var P;(h=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(s,d={}){if(!e)return;let{once:v=!0,prefix:m="[DEPRECATED]",includeStack:p=!0,removeInVersion:g}=d;if(v&&n.has(s))return;let f=`${m} ${s}`;g&&(f+=` This feature will be removed in ${g}.`),typeof console<"u"&&console.warn&&(p?(console.warn(f),console.trace("Deprecation stack trace:")):console.warn(f)),v&&n.add(s)}h.warn=t;function i(s,d,v={}){let m=((...p)=>(t(d,v),s(...p)));return Object.defineProperty(m,"name",{value:s.name,configurable:!0}),m}h.deprecate=i;function r(){n.clear()}h.clear=r;function o(){return n.size}h.getWarningCount=o;function l(s){return n.has(s)}h.hasShown=l})(P||={});var S=P;var a=require("cesium");var y=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",a.Color.RED],["default",a.Color.BLUE],["fallback",a.Color.GRAY],["grid",a.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new C({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 a.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:a.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(l=>{this._collection.add(l.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(a.Rectangle.northwest(e),t),o=i.positionToTileXY(a.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=[],l=Math.min(e.end.x-e.start.x+1,100),h=Math.min(e.end.y-e.start.y+1,100);for(let s=e.start.x;s<e.start.x+l;s++)for(let d=e.start.y;d<e.start.y+h;d++)try{let v=this._createTileEntity(s,d,t,i);v&&r.push({entity:v})}catch(v){console.warn(`Error creating tile (${s}, ${d}, ${t}):`,v)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let l=this._getTileColor(e,t,i),h=n.createRectangle(o,l.withAlpha(.3));return h.properties?.addProperty("tileX",e),h.properties?.addProperty("tileY",t),h.properties?.addProperty("tileLevel",i),h}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||a.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||a.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||a.Color.BLUE:this._colors.get("fallback")||a.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 a.Entity({rectangle:{coordinates:r,material:o,heightReference:a.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,l){let h=l?.tag||"terrain_region_visualization",s=l?.color||a.Color.RED,d=l?.maxTilesToShow||100,v=l?.show??!0,m=l?.alpha||.7,p=l?.tileAlpha||.2,g=new C({collection:o.entities,tag:h});if(r.bounds&&g.add(i.createRectangle(r.bounds,s.withAlpha(m)),h),v&&r.tiles&&r.tiles.size>0){let f=r.provider.tilingScheme,_=0;r.tiles.forEach((u,R)=>{let x=Array.isArray(u.x)?u.x:[u.x,u.x],I=Array.isArray(u.y)?u.y:[u.y,u.y];for(let T=x[0];T<=x[1]&&_<d;T++)for(let b=I[0];b<=I[1]&&_<d;b++){let A=f.tileXYToRectangle(T,b,R);g.add(e(A,s.withAlpha(p)),`${h}_tile`),_++}})}return g}i.visualize=t})(y||={});function w(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 J=S.deprecate;var L=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]()}_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 c.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof c.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 c.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 c.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)))}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 values(){if(this._valuesCache!==null)return this._valuesCache;let e;if(this.collection instanceof c.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(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,c.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,c.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,c.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(w(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)}},C=L;
1
+ "use strict";var E=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var D=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},V=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of O(e))!F.call(n,r)&&r!==t&&E(n,r,{get:()=>e[r],enumerable:!(i=M(e,r))||i.enumerable});return n};var j=n=>V(E({},"__esModule",{value:!0}),n);var G={};D(G,{Collection:()=>C});module.exports=j(G);var c=require("cesium");var P;(v=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(s,h={}){if(!e)return;let{once:d=!0,prefix:m="[DEPRECATED]",includeStack:g=!0,removeInVersion:p}=h;if(d&&n.has(s))return;let f=`${m} ${s}`;p&&(f+=` This feature will be removed in ${p}.`),typeof console<"u"&&console.warn&&(g?(console.warn(f),console.trace("Deprecation stack trace:")):console.warn(f)),d&&n.add(s)}v.warn=t;function i(s,h,d={}){let m=((...g)=>(t(h,d),s(...g)));return Object.defineProperty(m,"name",{value:s.name,configurable:!0}),m}v.deprecate=i;function r(){n.clear()}v.clear=r;function o(){return n.size}v.getWarningCount=o;function l(s){return n.has(s)}v.hasShown=l})(P||={});var S=P;var a=require("cesium");var y=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",a.Color.RED],["default",a.Color.BLUE],["fallback",a.Color.GRAY],["grid",a.Color.YELLOW]]);constructor(e,t){this._viewer=e,this._collection=new C({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 a.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:a.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(l=>{this._collection.add(l.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(a.Rectangle.northwest(e),t),o=i.positionToTileXY(a.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=[],l=Math.min(e.end.x-e.start.x+1,100),v=Math.min(e.end.y-e.start.y+1,100);for(let s=e.start.x;s<e.start.x+l;s++)for(let h=e.start.y;h<e.start.y+v;h++)try{let d=this._createTileEntity(s,h,t,i);d&&r.push({entity:d})}catch(d){console.warn(`Error creating tile (${s}, ${h}, ${t}):`,d)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let l=this._getTileColor(e,t,i),v=n.createRectangle(o,l.withAlpha(.3));return v.properties?.addProperty("tileX",e),v.properties?.addProperty("tileY",t),v.properties?.addProperty("tileLevel",i),v}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||a.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||a.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||a.Color.BLUE:this._colors.get("fallback")||a.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 a.Entity({rectangle:{coordinates:r,material:o,heightReference:a.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,l){let v=l?.tag||"terrain_region_visualization",s=l?.color||a.Color.RED,h=l?.maxTilesToShow||100,d=l?.show??!0,m=l?.alpha||.7,g=l?.tileAlpha||.2,p=new C({collection:o.entities,tag:v});if(d&&r.tiles&&r.tiles.size>0){let f=r.provider.tilingScheme,_=0;r.tiles.forEach((u,R)=>{let x=Array.isArray(u.x)?u.x:[u.x,u.x],I=Array.isArray(u.y)?u.y:[u.y,u.y];for(let T=x[0];T<=x[1]&&_<h;T++)for(let b=I[0];b<=I[1]&&_<h;b++){let A=f.tileXYToRectangle(T,b,R);p.add(e(A,s.withAlpha(g)),`${v}_tile`),_++}})}return p}i.visualize=t})(y||={});function w(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 J=S.deprecate;var L=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 c.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,c.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,c.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,c.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(w(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 c.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof c.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 c.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 c.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)))}},C=L;
@@ -1,2 +1,2 @@
1
- export { C as Collection } from '../index-Bfd24d9-.cjs';
1
+ export { C as Collection } from '../index-iIlou-Sq.cjs';
2
2
  import 'cesium';
@@ -1,2 +1,2 @@
1
- export { C as Collection } from '../index-Bfd24d9-.js';
1
+ export { C as Collection } from '../index-iIlou-Sq.js';
2
2
  import 'cesium';
@@ -1 +1 @@
1
- import"../chunk-RXMNSDKR.js";import{d as a}from"../chunk-OUTUX3ZP.js";import"../chunk-TC3IX3JL.js";export{a as Collection};
1
+ import"../chunk-RXMNSDKR.js";import{e as a}from"../chunk-EGWUHR3C.js";export{a as Collection};
@@ -1 +1 @@
1
- "use strict";var E=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var D=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},V=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of O(e))!F.call(n,r)&&r!==t&&E(n,r,{get:()=>e[r],enumerable:!(i=M(e,r))||i.enumerable});return n};var N=n=>V(E({},"__esModule",{value:!0}),n);var G={};D(G,{Deprecate:()=>w,TerrainVisualizer:()=>p,deprecate:()=>j,isGetterOnly:()=>C});module.exports=N(G);var S;(h=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(s,d={}){if(!e)return;let{once:v=!0,prefix:m="[DEPRECATED]",includeStack:f=!0,removeInVersion:g}=d;if(v&&n.has(s))return;let y=`${m} ${s}`;g&&(y+=` This feature will be removed in ${g}.`),typeof console<"u"&&console.warn&&(f?(console.warn(y),console.trace("Deprecation stack trace:")):console.warn(y)),v&&n.add(s)}h.warn=t;function i(s,d,v={}){let m=((...f)=>(t(d,v),s(...f)));return Object.defineProperty(m,"name",{value:s.name,configurable:!0}),m}h.deprecate=i;function r(){n.clear()}h.clear=r;function o(){return n.size}h.getWarningCount=o;function l(s){return n.has(s)}h.hasShown=l})(S||={});var w=S;var a=require("cesium");var c=require("cesium");var L=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]()}_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 c.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof c.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 c.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 c.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)))}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 values(){if(this._valuesCache!==null)return this._valuesCache;let e;if(this.collection instanceof c.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(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,c.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,c.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,c.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(C(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)}},x=L;var p=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",a.Color.RED],["default",a.Color.BLUE],["fallback",a.Color.GRAY],["grid",a.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._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 a.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:a.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(l=>{this._collection.add(l.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(a.Rectangle.northwest(e),t),o=i.positionToTileXY(a.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=[],l=Math.min(e.end.x-e.start.x+1,100),h=Math.min(e.end.y-e.start.y+1,100);for(let s=e.start.x;s<e.start.x+l;s++)for(let d=e.start.y;d<e.start.y+h;d++)try{let v=this._createTileEntity(s,d,t,i);v&&r.push({entity:v})}catch(v){console.warn(`Error creating tile (${s}, ${d}, ${t}):`,v)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let l=this._getTileColor(e,t,i),h=n.createRectangle(o,l.withAlpha(.3));return h.properties?.addProperty("tileX",e),h.properties?.addProperty("tileY",t),h.properties?.addProperty("tileLevel",i),h}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||a.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||a.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||a.Color.BLUE:this._colors.get("fallback")||a.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 a.Entity({rectangle:{coordinates:r,material:o,heightReference:a.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,l){let h=l?.tag||"terrain_region_visualization",s=l?.color||a.Color.RED,d=l?.maxTilesToShow||100,v=l?.show??!0,m=l?.alpha||.7,f=l?.tileAlpha||.2,g=new x({collection:o.entities,tag:h});if(r.bounds&&g.add(i.createRectangle(r.bounds,s.withAlpha(m)),h),v&&r.tiles&&r.tiles.size>0){let y=r.provider.tilingScheme,_=0;r.tiles.forEach((u,R)=>{let I=Array.isArray(u.x)?u.x:[u.x,u.x],P=Array.isArray(u.y)?u.y:[u.y,u.y];for(let T=I[0];T<=I[1]&&_<d;T++)for(let b=P[0];b<=P[1]&&_<d;b++){let A=y.tileXYToRectangle(T,b,R);g.add(e(A,s.withAlpha(f)),`${h}_tile`),_++}})}return g}i.visualize=t})(p||={});function C(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 j=w.deprecate;
1
+ "use strict";var E=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var D=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},V=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of O(e))!F.call(n,r)&&r!==t&&E(n,r,{get:()=>e[r],enumerable:!(i=M(e,r))||i.enumerable});return n};var j=n=>V(E({},"__esModule",{value:!0}),n);var N={};D(N,{Deprecate:()=>w,TerrainVisualizer:()=>m,deprecate:()=>G,isGetterOnly:()=>C});module.exports=j(N);var S;(v=>{let n=new Set,e=typeof process<"u"?process.env.CESIUM_UTILS_DISABLE_DEPRECATION_WARNINGS!=="true":!0;function t(s,h={}){if(!e)return;let{once:d=!0,prefix:g="[DEPRECATED]",includeStack:p=!0,removeInVersion:f}=h;if(d&&n.has(s))return;let y=`${g} ${s}`;f&&(y+=` This feature will be removed in ${f}.`),typeof console<"u"&&console.warn&&(p?(console.warn(y),console.trace("Deprecation stack trace:")):console.warn(y)),d&&n.add(s)}v.warn=t;function i(s,h,d={}){let g=((...p)=>(t(h,d),s(...p)));return Object.defineProperty(g,"name",{value:s.name,configurable:!0}),g}v.deprecate=i;function r(){n.clear()}v.clear=r;function o(){return n.size}v.getWarningCount=o;function l(s){return n.has(s)}v.hasShown=l})(S||={});var w=S;var a=require("cesium");var c=require("cesium");var L=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 c.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,c.defined)(i.show)&&(i.show=!0);return this}hide(e){let t=this.get(e);for(let i of t)(0,c.defined)(i.show)&&(i.show=!1);return this}toggle(e){let t=this.get(e);for(let i of t)(0,c.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(C(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 c.EntityCollection?(e.collectionChanged.addEventListener(this._invalidateCache),this._eventCleanupFunctions.push(()=>e.collectionChanged.removeEventListener(this._invalidateCache))):e instanceof c.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 c.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 c.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)))}},x=L;var m=class n{_viewer;_collection;_terrainProvider;_visible=!1;_level=15;_tileCoordinatesLayer;_colors=new Map([["custom",a.Color.RED],["default",a.Color.BLUE],["fallback",a.Color.GRAY],["grid",a.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._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 a.TileCoordinatesImageryProvider({tilingScheme:this._terrainProvider.tilingScheme,color:a.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(l=>{this._collection.add(l.entity,n.tag.grid)})}catch(r){console.error("Error displaying tile grid:",r)}}_calculateTileBounds(e,t,i){let r=i.positionToTileXY(a.Rectangle.northwest(e),t),o=i.positionToTileXY(a.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=[],l=Math.min(e.end.x-e.start.x+1,100),v=Math.min(e.end.y-e.start.y+1,100);for(let s=e.start.x;s<e.start.x+l;s++)for(let h=e.start.y;h<e.start.y+v;h++)try{let d=this._createTileEntity(s,h,t,i);d&&r.push({entity:d})}catch(d){console.warn(`Error creating tile (${s}, ${h}, ${t}):`,d)}return r}_createTileEntity(e,t,i,r){let o=r.tileXYToRectangle(e,t,i);if(!this._isValidRectangle(o))return null;let l=this._getTileColor(e,t,i),v=n.createRectangle(o,l.withAlpha(.3));return v.properties?.addProperty("tileX",e),v.properties?.addProperty("tileY",t),v.properties?.addProperty("tileLevel",i),v}_getTileColor(e,t,i){if(!this._terrainProvider)return this._colors.get("fallback")||a.Color.TRANSPARENT;for(let r of this._terrainProvider.regions)if(this._terrainProvider._regionContains(r,e,t,i))return this._colors.get("custom")||a.Color.RED;return this._terrainProvider.getTileDataAvailable(e,t,i)?this._colors.get("default")||a.Color.BLUE:this._colors.get("fallback")||a.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 a.Entity({rectangle:{coordinates:r,material:o,heightReference:a.HeightReference.CLAMP_TO_GROUND}})}i.createRectangle=e;function t(r,o,l){let v=l?.tag||"terrain_region_visualization",s=l?.color||a.Color.RED,h=l?.maxTilesToShow||100,d=l?.show??!0,g=l?.alpha||.7,p=l?.tileAlpha||.2,f=new x({collection:o.entities,tag:v});if(d&&r.tiles&&r.tiles.size>0){let y=r.provider.tilingScheme,_=0;r.tiles.forEach((u,R)=>{let I=Array.isArray(u.x)?u.x:[u.x,u.x],P=Array.isArray(u.y)?u.y:[u.y,u.y];for(let T=I[0];T<=I[1]&&_<h;T++)for(let b=P[0];b<=P[1]&&_<h;b++){let A=y.tileXYToRectangle(T,b,R);f.add(e(A,s.withAlpha(p)),`${v}_tile`),_++}})}return f}i.visualize=t})(m||={});function C(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 G=w.deprecate;
@@ -1,7 +1,7 @@
1
1
  import { Viewer, Color, Rectangle, EntityCollection, Entity } from 'cesium';
2
- import { C as Collection } from '../index-Bfd24d9-.cjs';
3
- export { N as NonFunction, i as isGetterOnly } from '../index-Bfd24d9-.cjs';
4
- import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2V-igd9.cjs';
2
+ import { C as Collection } from '../index-iIlou-Sq.cjs';
3
+ export { N as NonFunction, i as isGetterOnly } from '../index-iIlou-Sq.cjs';
4
+ import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-CzdhZJyg.cjs';
5
5
 
6
6
  /**
7
7
  * Utility for managing deprecation warnings in the cesium-utils library.
@@ -1,7 +1,7 @@
1
1
  import { Viewer, Color, Rectangle, EntityCollection, Entity } from 'cesium';
2
- import { C as Collection } from '../index-Bfd24d9-.js';
3
- export { N as NonFunction, i as isGetterOnly } from '../index-Bfd24d9-.js';
4
- import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-C2V-igd9.js';
2
+ import { C as Collection } from '../index-iIlou-Sq.js';
3
+ export { N as NonFunction, i as isGetterOnly } from '../index-iIlou-Sq.js';
4
+ import { H as HybridTerrainProvider } from '../hybrid-terrain-provider-CzdhZJyg.js';
5
5
 
6
6
  /**
7
7
  * Utility for managing deprecation warnings in the cesium-utils library.
package/dist/dev/index.js CHANGED
@@ -1 +1 @@
1
- import{a as b,b as c,c as d}from"../chunk-OUTUX3ZP.js";import{a}from"../chunk-TC3IX3JL.js";export{a as Deprecate,b as TerrainVisualizer,d as deprecate,c as isGetterOnly};
1
+ import{a,b,c,d}from"../chunk-EGWUHR3C.js";export{a as Deprecate,b as TerrainVisualizer,d as deprecate,c as isGetterOnly};
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var b=(r,t)=>{for(var e in t)y(r,e,{get:t[e],enumerable:!0})},C=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m(t))!S.call(r,s)&&s!==e&&y(r,s,{get:()=>t[s],enumerable:!(i=v(t,s))||i.enumerable});return r};var f=r=>C(y({},"__esModule",{value:!0}),r);var E={};b(E,{Sunlight:()=>g});module.exports=f(E);var o=require("cesium"),n=require("cesium"),d=class{_sunPositionWC;_sunDirectionWC;_viewer;_analyzing=!1;_pointEntityId;_debugEntities=[];constructor(t){let{sunPositionWC:e,sunDirectionWC:i}=t.scene.context.uniformState;this._sunPositionWC=e,this._sunDirectionWC=i,this._viewer=t}get sunPositionWC(){return this._sunPositionWC}get sunDirectionWC(){return this._sunDirectionWC}get isAnalyzing(){return this._analyzing}getVirtualSunPosition(t,e=1e3){let i=n.Cartesian3.normalize(n.Cartesian3.subtract(this._sunPositionWC,t,new n.Cartesian3),new n.Cartesian3);return n.Cartesian3.multiplyByScalar(i,e,i),n.Cartesian3.add(t,i,new n.Cartesian3)}analyze(t,e,i){let s=[],c=!this._analyzing,p=c?this._viewer.clock.currentTime.clone():void 0;c&&(this._viewer.entities.add(this._createPointEntity(t,i?.debugShowPoints,i?.errorBoundary)),this._analyzing=!0);try{if(e instanceof n.JulianDate){this._viewer.clock.currentTime=e,this._viewer.scene.render();let h=new o.Ray(this.getVirtualSunPosition(t),this._sunDirectionWC),l=this._viewer.scene.picking,{object:u,position:a}=l.pickFromRay(l,this._viewer.scene,h,i?.objectsToExclude),w=u instanceof o.Entity&&u.id===this._pointEntityId;if(i?.debugShowPoints&&a){let _=new o.Entity({point:{show:!0,pixelSize:5},position:a});this._viewer.entities.add(_),this._debugEntities.push(_)}return{timestamp:e.toString(),result:w}}else{let{start:h,end:l,step:u}=e,a=h.clone();for(;n.JulianDate.compare(a,l)<=0;)s.push(this.analyze(t,a,i)),n.JulianDate.addSeconds(a,u,a)}}finally{c&&p&&(this._viewer.clock.currentTime=p,this._viewer.scene.render(),this._analyzing=!1,this._pointEntityId&&!i?.debugShowPoints&&this._viewer.entities.removeById(this._pointEntityId))}return s}_createPointEntity(t,e,i){let s=new o.Entity({point:{show:e,pixelSize:i??5},position:t});return this._pointEntityId=s.id,s}clear(){this._debugEntities.forEach(t=>{this._viewer.entities.contains(t)&&this._viewer.entities.remove(t)}),this._debugEntities=[],this._pointEntityId&&this._viewer.entities.getById(this._pointEntityId)&&this._viewer.entities.removeById(this._pointEntityId)}},g=d;
1
+ "use strict";var y=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var i in t)y(r,i,{get:t[i],enumerable:!0})},m=(r,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _(t))!w.call(r,n)&&n!==i&&y(r,n,{get:()=>t[n],enumerable:!(e=p(t,n))||e.enumerable});return r};var v=r=>m(y({},"__esModule",{value:!0}),r);var b={};S(b,{Sunlight:()=>g});module.exports=v(b);var a=require("cesium"),s=require("cesium"),d=class{_sunPositionWC;_sunDirectionWC;_viewer;_analyzing=!1;_pointEntityId;_debugEntityIds=[];constructor(t){let{sunPositionWC:i,sunDirectionWC:e}=t.scene.context.uniformState;this._sunPositionWC=i,this._sunDirectionWC=e,this._viewer=t}get sunPositionWC(){return this._sunPositionWC}get sunDirectionWC(){return this._sunDirectionWC}get isAnalyzing(){return this._analyzing}getVirtualSunPosition(t,i=1e3){let e=s.Cartesian3.normalize(s.Cartesian3.subtract(this._sunPositionWC,t,new s.Cartesian3),new s.Cartesian3);return s.Cartesian3.multiplyByScalar(e,i,e),s.Cartesian3.add(t,e,new s.Cartesian3)}analyze(t,i,e){let n=this._viewer.clock.currentTime.clone();this._viewer.entities.add(this._createPointEntity(t,e?.debugShowPoints,e?.errorBoundary)),this._analyzing=!0;try{return i instanceof s.JulianDate?this._analyzeSingleTime(t,i,e):this._analyzeTimeRange(t,i,e)}finally{this._viewer.clock.currentTime=n,this._viewer.scene.render(),this._analyzing=!1,this._pointEntityId&&!e?.debugShowPoints&&this._viewer.entities.removeById(this._pointEntityId)}}clear(){this._debugEntityIds.forEach(t=>this._viewer.entities.removeById(t)),this._debugEntityIds=[],this._pointEntityId&&this._viewer.entities.removeById(this._pointEntityId)}_createPointEntity(t,i,e){let n=new a.Entity({point:{show:i,pixelSize:e??5},position:t});return this._pointEntityId=n.id,n}_analyzeSingleTime(t,i,e){this._viewer.clock.currentTime=i,this._viewer.scene.render();let n=new a.Ray(this.getVirtualSunPosition(t),this._sunDirectionWC);if(e?.debugShowRays){let l=new a.Entity({polyline:{positions:[this.getVirtualSunPosition(t),t],width:10,material:a.Color.YELLOW.withAlpha(.5)}});this._debugEntityIds.push(l.id),this._viewer.entities.add(l)}let u=this._viewer.scene.picking,{object:h,position:c}=u.pickFromRay(u,this._viewer.scene,n,this._getExcludedObjects(e?.objectsToExclude)),o=h instanceof a.Entity&&h.id===this._pointEntityId;if(e?.debugShowPoints&&c){let l=new a.Entity({point:{show:!0,pixelSize:5},position:c});this._debugEntityIds.push(l.id),this._viewer.entities.add(l)}return{timestamp:i.toString(),result:o}}_analyzeTimeRange(t,i,e){let n=[],{start:u,end:h,step:c}=i,o=u.clone();for(;s.JulianDate.compare(o,h)<=0;)n.push(this._analyzeSingleTime(t,o,e)),s.JulianDate.addSeconds(o,c,o);return n}_getExcludedObjects(t){return[...this._debugEntityIds.map(i=>this._viewer.entities.getById(i)).filter(Boolean),...t??[]]}},g=d;
@@ -20,7 +20,7 @@ declare class Sunlight {
20
20
  private _viewer;
21
21
  private _analyzing;
22
22
  private _pointEntityId?;
23
- private _debugEntities;
23
+ private _debugEntityIds;
24
24
  constructor(viewer: Viewer);
25
25
  /** The sun position in 3D world coordinates at the current scene time. */
26
26
  get sunPositionWC(): Cartesian3;
@@ -49,6 +49,10 @@ declare class Sunlight {
49
49
  * @param options {@link Sunlight.AnalyzeOptions}
50
50
  */
51
51
  analyze(from: Cartesian3, range: Sunlight.TimeRange, options?: Sunlight.AnalyzeOptions): Sunlight.AnalysisResult[];
52
+ /**
53
+ * Remove all instances created for debug purpose
54
+ */
55
+ clear(): void;
52
56
  /**
53
57
  * Create a point entity for collision detection
54
58
  * @param at where to create the entity
@@ -56,10 +60,9 @@ declare class Sunlight {
56
60
  * @param errorBoundary size of the point entity for error tolerance
57
61
  */
58
62
  private _createPointEntity;
59
- /**
60
- * Remove all instances created for debug purpose
61
- */
62
- clear(): void;
63
+ private _analyzeSingleTime;
64
+ private _analyzeTimeRange;
65
+ private _getExcludedObjects;
63
66
  }
64
67
  declare namespace Sunlight {
65
68
  /** for time-range analysis */
@@ -20,7 +20,7 @@ declare class Sunlight {
20
20
  private _viewer;
21
21
  private _analyzing;
22
22
  private _pointEntityId?;
23
- private _debugEntities;
23
+ private _debugEntityIds;
24
24
  constructor(viewer: Viewer);
25
25
  /** The sun position in 3D world coordinates at the current scene time. */
26
26
  get sunPositionWC(): Cartesian3;
@@ -49,6 +49,10 @@ declare class Sunlight {
49
49
  * @param options {@link Sunlight.AnalyzeOptions}
50
50
  */
51
51
  analyze(from: Cartesian3, range: Sunlight.TimeRange, options?: Sunlight.AnalyzeOptions): Sunlight.AnalysisResult[];
52
+ /**
53
+ * Remove all instances created for debug purpose
54
+ */
55
+ clear(): void;
52
56
  /**
53
57
  * Create a point entity for collision detection
54
58
  * @param at where to create the entity
@@ -56,10 +60,9 @@ declare class Sunlight {
56
60
  * @param errorBoundary size of the point entity for error tolerance
57
61
  */
58
62
  private _createPointEntity;
59
- /**
60
- * Remove all instances created for debug purpose
61
- */
62
- clear(): void;
63
+ private _analyzeSingleTime;
64
+ private _analyzeTimeRange;
65
+ private _getExcludedObjects;
63
66
  }
64
67
  declare namespace Sunlight {
65
68
  /** for time-range analysis */
@@ -1 +1 @@
1
- import{Entity as c,Ray as g}from"cesium";import{Cartesian3 as s,JulianDate as h}from"cesium";var y=class{_sunPositionWC;_sunDirectionWC;_viewer;_analyzing=!1;_pointEntityId;_debugEntities=[];constructor(t){let{sunPositionWC:e,sunDirectionWC:i}=t.scene.context.uniformState;this._sunPositionWC=e,this._sunDirectionWC=i,this._viewer=t}get sunPositionWC(){return this._sunPositionWC}get sunDirectionWC(){return this._sunDirectionWC}get isAnalyzing(){return this._analyzing}getVirtualSunPosition(t,e=1e3){let i=s.normalize(s.subtract(this._sunPositionWC,t,new s),new s);return s.multiplyByScalar(i,e,i),s.add(t,i,new s)}analyze(t,e,i){let r=[],l=!this._analyzing,d=l?this._viewer.clock.currentTime.clone():void 0;l&&(this._viewer.entities.add(this._createPointEntity(t,i?.debugShowPoints,i?.errorBoundary)),this._analyzing=!0);try{if(e instanceof h){this._viewer.clock.currentTime=e,this._viewer.scene.render();let u=new g(this.getVirtualSunPosition(t),this._sunDirectionWC),a=this._viewer.scene.picking,{object:o,position:n}=a.pickFromRay(a,this._viewer.scene,u,i?.objectsToExclude),_=o instanceof c&&o.id===this._pointEntityId;if(i?.debugShowPoints&&n){let p=new c({point:{show:!0,pixelSize:5},position:n});this._viewer.entities.add(p),this._debugEntities.push(p)}return{timestamp:e.toString(),result:_}}else{let{start:u,end:a,step:o}=e,n=u.clone();for(;h.compare(n,a)<=0;)r.push(this.analyze(t,n,i)),h.addSeconds(n,o,n)}}finally{l&&d&&(this._viewer.clock.currentTime=d,this._viewer.scene.render(),this._analyzing=!1,this._pointEntityId&&!i?.debugShowPoints&&this._viewer.entities.removeById(this._pointEntityId))}return r}_createPointEntity(t,e,i){let r=new c({point:{show:e,pixelSize:i??5},position:t});return this._pointEntityId=r.id,r}clear(){this._debugEntities.forEach(t=>{this._viewer.entities.contains(t)&&this._viewer.entities.remove(t)}),this._debugEntities=[],this._pointEntityId&&this._viewer.entities.getById(this._pointEntityId)&&this._viewer.entities.removeById(this._pointEntityId)}},w=y;export{w as Sunlight};
1
+ import{Color as d,Entity as h,Ray as g}from"cesium";import{Cartesian3 as s,JulianDate as c}from"cesium";var y=class{_sunPositionWC;_sunDirectionWC;_viewer;_analyzing=!1;_pointEntityId;_debugEntityIds=[];constructor(t){let{sunPositionWC:i,sunDirectionWC:e}=t.scene.context.uniformState;this._sunPositionWC=i,this._sunDirectionWC=e,this._viewer=t}get sunPositionWC(){return this._sunPositionWC}get sunDirectionWC(){return this._sunDirectionWC}get isAnalyzing(){return this._analyzing}getVirtualSunPosition(t,i=1e3){let e=s.normalize(s.subtract(this._sunPositionWC,t,new s),new s);return s.multiplyByScalar(e,i,e),s.add(t,e,new s)}analyze(t,i,e){let n=this._viewer.clock.currentTime.clone();this._viewer.entities.add(this._createPointEntity(t,e?.debugShowPoints,e?.errorBoundary)),this._analyzing=!0;try{return i instanceof c?this._analyzeSingleTime(t,i,e):this._analyzeTimeRange(t,i,e)}finally{this._viewer.clock.currentTime=n,this._viewer.scene.render(),this._analyzing=!1,this._pointEntityId&&!e?.debugShowPoints&&this._viewer.entities.removeById(this._pointEntityId)}}clear(){this._debugEntityIds.forEach(t=>this._viewer.entities.removeById(t)),this._debugEntityIds=[],this._pointEntityId&&this._viewer.entities.removeById(this._pointEntityId)}_createPointEntity(t,i,e){let n=new h({point:{show:i,pixelSize:e??5},position:t});return this._pointEntityId=n.id,n}_analyzeSingleTime(t,i,e){this._viewer.clock.currentTime=i,this._viewer.scene.render();let n=new g(this.getVirtualSunPosition(t),this._sunDirectionWC);if(e?.debugShowRays){let r=new h({polyline:{positions:[this.getVirtualSunPosition(t),t],width:10,material:d.YELLOW.withAlpha(.5)}});this._debugEntityIds.push(r.id),this._viewer.entities.add(r)}let o=this._viewer.scene.picking,{object:l,position:u}=o.pickFromRay(o,this._viewer.scene,n,this._getExcludedObjects(e?.objectsToExclude)),a=l instanceof h&&l.id===this._pointEntityId;if(e?.debugShowPoints&&u){let r=new h({point:{show:!0,pixelSize:5},position:u});this._debugEntityIds.push(r.id),this._viewer.entities.add(r)}return{timestamp:i.toString(),result:a}}_analyzeTimeRange(t,i,e){let n=[],{start:o,end:l,step:u}=i,a=o.clone();for(;c.compare(a,l)<=0;)n.push(this._analyzeSingleTime(t,a,e)),c.addSeconds(a,u,a);return n}_getExcludedObjects(t){return[...this._debugEntityIds.map(i=>this._viewer.entities.getById(i)).filter(Boolean),...t??[]]}},p=y;export{p as Sunlight};
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(n,t)=>{for(var i in t)f(n,i,{get:t[i],enumerable:!0})},O=(n,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!m.call(n,o)&&o!==i&&f(n,o,{get:()=>t[o],enumerable:!(e=p(t,o))||e.enumerable});return n};var w=n=>O(f({},"__esModule",{value:!0}),n);var C={};v(C,{Highlight:()=>_,SilhouetteHighlight:()=>h,SurfaceHighlight:()=>c});module.exports=w(C);var l=require("cesium");var s=require("cesium"),h=class{_color=s.Color.RED;_silhouette;_composite;_stages;_entity;_currentObject;_currentOptions;constructor(t){this._stages=t.scene.postProcessStages,this._silhouette=s.PostProcessStageLibrary.createEdgeDetectionStage(),this._silhouette.uniforms.color=this._color,this._silhouette.uniforms.length=.01,this._silhouette.selected=[],this._composite=s.PostProcessStageLibrary.createSilhouetteStage([this._silhouette]),this._stages.add(this._composite)}show(t,i){if((0,s.defined)(t)&&!(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))){this._clearHighlights();try{if(t instanceof s.Cesium3DTileFeature)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 s.ConstantProperty(i?.width||2),t.model.silhouetteColor=new s.ConstantProperty(i?.color||this._color)}this._currentObject=t,this._currentOptions=i?{...i}:void 0}catch(e){console.error("Failed to highlight object:",e),this._currentObject=void 0,this._currentOptions=void 0}}}_optionsEqual(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&s.Color.equals(t.color||this._color,i.color||this._color)}_clearHighlights(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new s.ConstantProperty(s.Color.TRANSPARENT),this._entity.model.silhouetteSize=new s.ConstantProperty(0),this._entity=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}get color(){return this._color}set color(t){this._color=t}get currentObject(){return this._currentObject}};var r=require("cesium"),c=class{_color=r.Color.RED;_entity;_entities;_currentObject;_currentOptions;constructor(t){this._entities=t.entities,this._entity=this._entities.add(new r.Entity({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}show(t,i){if(!(!(0,r.defined)(t)||!this._entity)){if(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))return this._entity;this._clearGeometries();try{if(t instanceof r.Entity&&(t.polygon||t.polyline||t.rectangle))this._update(t,i);else if(t instanceof r.GroundPrimitive)this._update(t,i);else{this._currentObject=void 0,this._currentOptions=void 0;return}return this._currentObject=t,this._currentOptions=i?{...i}:void 0,this._entity.show=!0,this._entity}catch(e){console.error("Failed to highlight object:",e),this._currentObject=void 0,this._currentOptions=void 0;return}}}_optionsEqual(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&r.Color.equals(t.color||this._color,i.color||this._color)}_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 r.Entity){if(t.polygon)if(i.outline){let e=t.polygon.hierarchy?.getValue();if(e&&e.positions){let o;e.positions.length>0&&!r.Cartesian3.equals(e.positions[0],e.positions[e.positions.length-1])?o=[...e.positions,e.positions[0]]:o=e.positions,this._entity.polyline=new r.PolylineGraphics({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.polygon.hierarchy?.getValue();e&&(this._entity.polygon=new r.PolygonGraphics({hierarchy:e,material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND,classificationType:t.polygon.classificationType?.getValue()||r.ClassificationType.BOTH}))}else if(t.polyline){let e=t.polyline.positions?.getValue();if(e){let o=t.polyline.width?.getValue();this._entity.polyline=new r.PolylineGraphics({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=[r.Cartesian3.fromRadians(e.west,e.north),r.Cartesian3.fromRadians(e.east,e.north),r.Cartesian3.fromRadians(e.east,e.south),r.Cartesian3.fromRadians(e.west,e.south),r.Cartesian3.fromRadians(e.west,e.north)];this._entity.polyline=new r.PolylineGraphics({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.rectangle.coordinates?.getValue();e&&(this._entity.rectangle=new r.RectangleGraphics({coordinates:e,material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND}))}}else if(t instanceof r.GroundPrimitive){let e=t.geometryInstances,o=Array.isArray(e)?e[0]:e;if(!o.geometry.attributes.position)return;let a=o.geometry.attributes.position.values,d=[];for(let u=0;u<a.length;u+=3)d.push(new r.Cartesian3(a[u],a[u+1],a[u+2]));i.outline?this._entity.polyline=new r.PolylineGraphics({positions:d,material:i.color,width:i.width||2,clampToGround:!0}):this._entity.polygon=new r.PolygonGraphics({hierarchy:new r.PolygonHierarchy(d),material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND,classificationType:r.ClassificationType.BOTH})}}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}get color(){return this._color}set color(t){this._color=t}get entity(){return this._entity}get currentObject(){return this._currentObject}};var g=class n{static instances=new WeakMap;_surface;_silhouette;_color=l.Color.RED;constructor(t){this._surface=new c(t),this._silhouette=new h(t),this._surface.color=this._color,this._silhouette.color=this._color}static getInstance(t){let i=t.container;return n.instances.has(i)||n.instances.set(i,new n(t)),n.instances.get(i)}static releaseInstance(t){let i=t.container,e=n.instances.get(i);e&&(e.hide(),e._surface&&e._surface.destroy(),e._silhouette&&e._silhouette.destroy(),n.instances.delete(i))}show(t,i={color:this._color}){let e=this._getObject(t);if((0,l.defined)(e))return e instanceof l.Cesium3DTileFeature?this._silhouette.show(e,i):e instanceof l.Entity&&e.model?this._silhouette.show(e,i):this._surface.show(e,i)}_getObject(t){if((0,l.defined)(t)){if(t instanceof l.Entity||t instanceof l.Cesium3DTileFeature||t instanceof l.GroundPrimitive)return t;if(t.id instanceof l.Entity)return t.id;if(t.primitive instanceof l.GroundPrimitive)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}},_=g;
1
+ "use strict";var f=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(n,t)=>{for(var i in t)f(n,i,{get:t[i],enumerable:!0})},O=(n,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!m.call(n,o)&&o!==i&&f(n,o,{get:()=>t[o],enumerable:!(e=p(t,o))||e.enumerable});return n};var w=n=>O(f({},"__esModule",{value:!0}),n);var C={};v(C,{Highlight:()=>_,SilhouetteHighlight:()=>h,SurfaceHighlight:()=>c});module.exports=w(C);var l=require("cesium");var s=require("cesium"),h=class{_color=s.Color.RED;_silhouette;_composite;_stages;_entity;_currentObject;_currentOptions;constructor(t){this._stages=t.scene.postProcessStages,this._silhouette=s.PostProcessStageLibrary.createEdgeDetectionStage(),this._silhouette.uniforms.color=this._color,this._silhouette.uniforms.length=.01,this._silhouette.selected=[],this._composite=s.PostProcessStageLibrary.createSilhouetteStage([this._silhouette]),this._stages.add(this._composite)}get color(){return this._color}set color(t){this._color=t}get currentObject(){return this._currentObject}show(t,i){if((0,s.defined)(t)&&!(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))){this._clearHighlights();try{if(t instanceof s.Cesium3DTileFeature)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 s.ConstantProperty(i?.width||2),t.model.silhouetteColor=new s.ConstantProperty(i?.color||this._color)}this._currentObject=t,this._currentOptions=i?{...i}:void 0}catch(e){console.error("Failed to highlight object:",e),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(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&s.Color.equals(t.color||this._color,i.color||this._color)}_clearHighlights(){this._silhouette.selected.length>0&&(this._silhouette.selected=[]),this._entity?.model&&(this._entity.model.silhouetteColor=new s.ConstantProperty(s.Color.TRANSPARENT),this._entity.model.silhouetteSize=new s.ConstantProperty(0),this._entity=void 0)}};var r=require("cesium"),c=class{_color=r.Color.RED;_entity;_entities;_currentObject;_currentOptions;constructor(t){this._entities=t.entities,this._entity=this._entities.add(new r.Entity({id:`highlight-entity-${Math.random().toString(36).substring(2)}`,show:!1}))}get color(){return this._color}set color(t){this._color=t}get entity(){return this._entity}get currentObject(){return this._currentObject}show(t,i){if(!(!(0,r.defined)(t)||!this._entity)){if(this._currentObject===t&&this._optionsEqual(this._currentOptions,i))return this._entity;this._clearGeometries();try{if(t instanceof r.Entity&&(t.polygon||t.polyline||t.rectangle))this._update(t,i);else if(t instanceof r.GroundPrimitive)this._update(t,i);else{this._currentObject=void 0,this._currentOptions=void 0;return}return this._currentObject=t,this._currentOptions=i?{...i}:void 0,this._entity.show=!0,this._entity}catch(e){console.error("Failed to highlight object:",e),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(t,i){return!t&&!i?!0:!t||!i?!1:t.outline===i.outline&&t.width===i.width&&r.Color.equals(t.color||this._color,i.color||this._color)}_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 r.Entity){if(t.polygon)if(i.outline){let e=t.polygon.hierarchy?.getValue();if(e&&e.positions){let o;e.positions.length>0&&!r.Cartesian3.equals(e.positions[0],e.positions[e.positions.length-1])?o=[...e.positions,e.positions[0]]:o=e.positions,this._entity.polyline=new r.PolylineGraphics({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.polygon.hierarchy?.getValue();e&&(this._entity.polygon=new r.PolygonGraphics({hierarchy:e,material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND,classificationType:t.polygon.classificationType?.getValue()||r.ClassificationType.BOTH}))}else if(t.polyline){let e=t.polyline.positions?.getValue();if(e){let o=t.polyline.width?.getValue();this._entity.polyline=new r.PolylineGraphics({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=[r.Cartesian3.fromRadians(e.west,e.north),r.Cartesian3.fromRadians(e.east,e.north),r.Cartesian3.fromRadians(e.east,e.south),r.Cartesian3.fromRadians(e.west,e.south),r.Cartesian3.fromRadians(e.west,e.north)];this._entity.polyline=new r.PolylineGraphics({positions:o,material:i.color,width:i.width||2,clampToGround:!0})}}else{let e=t.rectangle.coordinates?.getValue();e&&(this._entity.rectangle=new r.RectangleGraphics({coordinates:e,material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND}))}}else if(t instanceof r.GroundPrimitive){let e=t.geometryInstances,o=Array.isArray(e)?e[0]:e;if(!o.geometry.attributes.position)return;let a=o.geometry.attributes.position.values,d=[];for(let u=0;u<a.length;u+=3)d.push(new r.Cartesian3(a[u],a[u+1],a[u+2]));i.outline?this._entity.polyline=new r.PolylineGraphics({positions:d,material:i.color,width:i.width||2,clampToGround:!0}):this._entity.polygon=new r.PolygonGraphics({hierarchy:new r.PolygonHierarchy(d),material:i.color,heightReference:r.HeightReference.CLAMP_TO_GROUND,classificationType:r.ClassificationType.BOTH})}}};var g=class n{static instances=new WeakMap;_surface;_silhouette;_color=l.Color.RED;constructor(t){this._surface=new c(t),this._silhouette=new h(t),this._surface.color=this._color,this._silhouette.color=this._color}get color(){return this._color}set color(t){this._color=t,this._surface.color=t,this._silhouette.color=t}static getInstance(t){let i=t.container;return n.instances.has(i)||n.instances.set(i,new n(t)),n.instances.get(i)}static releaseInstance(t){let i=t.container,e=n.instances.get(i);e&&(e.hide(),e._surface&&e._surface.destroy(),e._silhouette&&e._silhouette.destroy(),n.instances.delete(i))}show(t,i={color:this._color}){let e=this._getObject(t);if((0,l.defined)(e))return e instanceof l.Cesium3DTileFeature?this._silhouette.show(e,i):e instanceof l.Entity&&e.model?this._silhouette.show(e,i):this._surface.show(e,i)}_getObject(t){if((0,l.defined)(t)){if(t instanceof l.Entity||t instanceof l.Cesium3DTileFeature||t instanceof l.GroundPrimitive)return t;if(t.id instanceof l.Entity)return t.id;if(t.primitive instanceof l.GroundPrimitive)return t.primitive}}hide(){this._surface.hide(),this._silhouette.hide()}},_=g;
@@ -1,4 +1,4 @@
1
- import { Viewer, Entity, Color, Primitive, GroundPrimitive, Model, Cesium3DTileset, Cesium3DTileFeature } from 'cesium';
1
+ import { Color, Viewer, Entity, Primitive, GroundPrimitive, Model, Cesium3DTileset, Cesium3DTileFeature } from 'cesium';
2
2
 
3
3
  /**
4
4
  * @class
@@ -37,6 +37,13 @@ declare class Highlight {
37
37
  * @param viewer A viewer to create highlight entity in
38
38
  */
39
39
  private constructor();
40
+ /** Gets the highlight color. */
41
+ get color(): Color;
42
+ /**
43
+ * Sets the highlight color.
44
+ * @param color The new color for highlights
45
+ */
46
+ set color(color: Color);
40
47
  /**
41
48
  * Gets or creates highlight instance from a viewer.
42
49
  * @param viewer The viewer to get or create a new instance from.
@@ -59,13 +66,6 @@ declare class Highlight {
59
66
  * Clears the current highlight effects.
60
67
  */
61
68
  hide(): void;
62
- /** Gets the highlight color. */
63
- get color(): Color;
64
- /**
65
- * Sets the highlight color.
66
- * @param color The new color for highlights
67
- */
68
- set color(color: Color);
69
69
  }
70
70
  declare namespace Highlight {
71
71
  export interface Base {
@@ -129,6 +129,12 @@ declare class SilhouetteHighlight implements Highlight.Base {
129
129
  * @param viewer A viewer to create highlight silhouette in
130
130
  */
131
131
  constructor(viewer: Viewer);
132
+ /** Gets the highlight color. */
133
+ get color(): Color;
134
+ /** Sets the highlight color. */
135
+ set color(color: Color);
136
+ /** Gets the currently highlighted object */
137
+ get currentObject(): Cesium3DTileFeature | Entity | undefined;
132
138
  /**
133
139
  * Highlights a picked `Cesium3DTileset` by updating silhouette composite.
134
140
  * @param object The object to be highlighted.
@@ -141,6 +147,10 @@ declare class SilhouetteHighlight implements Highlight.Base {
141
147
  * @param options Optional style for the highlight.
142
148
  */
143
149
  show(object: Entity, options?: Highlight.Options): void;
150
+ /** Clears the current highlight */
151
+ hide(): void;
152
+ /** Clean up the instances */
153
+ destroy(): void;
144
154
  /**
145
155
  * Compares two Highlight.Options objects for equality
146
156
  * @private
@@ -151,16 +161,6 @@ declare class SilhouetteHighlight implements Highlight.Base {
151
161
  * @private
152
162
  */
153
163
  private _clearHighlights;
154
- /** Clears the current highlight */
155
- hide(): void;
156
- /** Clean up the instances */
157
- destroy(): void;
158
- /** Gets the highlight color. */
159
- get color(): Color;
160
- /** Sets the highlight color. */
161
- set color(color: Color);
162
- /** Gets the currently highlighted object */
163
- get currentObject(): Cesium3DTileFeature | Entity | undefined;
164
164
  }
165
165
 
166
166
  /**
@@ -204,6 +204,14 @@ declare class SurfaceHighlight implements Highlight.Base {
204
204
  * @param viewer A viewer to create highlight entity in
205
205
  */
206
206
  constructor(viewer: Viewer);
207
+ /** Gets the highlight color. */
208
+ get color(): Color;
209
+ /** Sets the highlight color. */
210
+ set color(color: Color);
211
+ /** Gets the highlight entity */
212
+ get entity(): Entity;
213
+ /** Gets the currently highlighted object */
214
+ get currentObject(): Entity | GroundPrimitive | undefined;
207
215
  /**
208
216
  * Highlights a picked object by updating the reusable entity
209
217
  * @param object The object to be highlighted.
@@ -211,6 +219,12 @@ declare class SurfaceHighlight implements Highlight.Base {
211
219
  * @see {@link Highlight.Options}
212
220
  */
213
221
  show(object: Entity | GroundPrimitive, options?: Highlight.Options): Entity | undefined;
222
+ /**
223
+ * Clears the current highlight
224
+ */
225
+ hide(): void;
226
+ /** Clean up the instances */
227
+ destroy(): void;
214
228
  /**
215
229
  * Compares two Highlight.Options objects for equality
216
230
  * @private
@@ -226,20 +240,6 @@ declare class SurfaceHighlight implements Highlight.Base {
226
240
  * @private
227
241
  */
228
242
  private _update;
229
- /**
230
- * Clears the current highlight
231
- */
232
- hide(): void;
233
- /** Clean up the instances */
234
- destroy(): void;
235
- /** Gets the highlight color. */
236
- get color(): Color;
237
- /** Sets the highlight color. */
238
- set color(color: Color);
239
- /** Gets the highlight entity */
240
- get entity(): Entity;
241
- /** Gets the currently highlighted object */
242
- get currentObject(): Entity | GroundPrimitive | undefined;
243
243
  }
244
244
 
245
245
  export { Highlight, SilhouetteHighlight, SurfaceHighlight };
@@ -1,4 +1,4 @@
1
- import { Viewer, Entity, Color, Primitive, GroundPrimitive, Model, Cesium3DTileset, Cesium3DTileFeature } from 'cesium';
1
+ import { Color, Viewer, Entity, Primitive, GroundPrimitive, Model, Cesium3DTileset, Cesium3DTileFeature } from 'cesium';
2
2
 
3
3
  /**
4
4
  * @class
@@ -37,6 +37,13 @@ declare class Highlight {
37
37
  * @param viewer A viewer to create highlight entity in
38
38
  */
39
39
  private constructor();
40
+ /** Gets the highlight color. */
41
+ get color(): Color;
42
+ /**
43
+ * Sets the highlight color.
44
+ * @param color The new color for highlights
45
+ */
46
+ set color(color: Color);
40
47
  /**
41
48
  * Gets or creates highlight instance from a viewer.
42
49
  * @param viewer The viewer to get or create a new instance from.
@@ -59,13 +66,6 @@ declare class Highlight {
59
66
  * Clears the current highlight effects.
60
67
  */
61
68
  hide(): void;
62
- /** Gets the highlight color. */
63
- get color(): Color;
64
- /**
65
- * Sets the highlight color.
66
- * @param color The new color for highlights
67
- */
68
- set color(color: Color);
69
69
  }
70
70
  declare namespace Highlight {
71
71
  export interface Base {
@@ -129,6 +129,12 @@ declare class SilhouetteHighlight implements Highlight.Base {
129
129
  * @param viewer A viewer to create highlight silhouette in
130
130
  */
131
131
  constructor(viewer: Viewer);
132
+ /** Gets the highlight color. */
133
+ get color(): Color;
134
+ /** Sets the highlight color. */
135
+ set color(color: Color);
136
+ /** Gets the currently highlighted object */
137
+ get currentObject(): Cesium3DTileFeature | Entity | undefined;
132
138
  /**
133
139
  * Highlights a picked `Cesium3DTileset` by updating silhouette composite.
134
140
  * @param object The object to be highlighted.
@@ -141,6 +147,10 @@ declare class SilhouetteHighlight implements Highlight.Base {
141
147
  * @param options Optional style for the highlight.
142
148
  */
143
149
  show(object: Entity, options?: Highlight.Options): void;
150
+ /** Clears the current highlight */
151
+ hide(): void;
152
+ /** Clean up the instances */
153
+ destroy(): void;
144
154
  /**
145
155
  * Compares two Highlight.Options objects for equality
146
156
  * @private
@@ -151,16 +161,6 @@ declare class SilhouetteHighlight implements Highlight.Base {
151
161
  * @private
152
162
  */
153
163
  private _clearHighlights;
154
- /** Clears the current highlight */
155
- hide(): void;
156
- /** Clean up the instances */
157
- destroy(): void;
158
- /** Gets the highlight color. */
159
- get color(): Color;
160
- /** Sets the highlight color. */
161
- set color(color: Color);
162
- /** Gets the currently highlighted object */
163
- get currentObject(): Cesium3DTileFeature | Entity | undefined;
164
164
  }
165
165
 
166
166
  /**
@@ -204,6 +204,14 @@ declare class SurfaceHighlight implements Highlight.Base {
204
204
  * @param viewer A viewer to create highlight entity in
205
205
  */
206
206
  constructor(viewer: Viewer);
207
+ /** Gets the highlight color. */
208
+ get color(): Color;
209
+ /** Sets the highlight color. */
210
+ set color(color: Color);
211
+ /** Gets the highlight entity */
212
+ get entity(): Entity;
213
+ /** Gets the currently highlighted object */
214
+ get currentObject(): Entity | GroundPrimitive | undefined;
207
215
  /**
208
216
  * Highlights a picked object by updating the reusable entity
209
217
  * @param object The object to be highlighted.
@@ -211,6 +219,12 @@ declare class SurfaceHighlight implements Highlight.Base {
211
219
  * @see {@link Highlight.Options}
212
220
  */
213
221
  show(object: Entity | GroundPrimitive, options?: Highlight.Options): Entity | undefined;
222
+ /**
223
+ * Clears the current highlight
224
+ */
225
+ hide(): void;
226
+ /** Clean up the instances */
227
+ destroy(): void;
214
228
  /**
215
229
  * Compares two Highlight.Options objects for equality
216
230
  * @private
@@ -226,20 +240,6 @@ declare class SurfaceHighlight implements Highlight.Base {
226
240
  * @private
227
241
  */
228
242
  private _update;
229
- /**
230
- * Clears the current highlight
231
- */
232
- hide(): void;
233
- /** Clean up the instances */
234
- destroy(): void;
235
- /** Gets the highlight color. */
236
- get color(): Color;
237
- /** Sets the highlight color. */
238
- set color(color: Color);
239
- /** Gets the highlight entity */
240
- get entity(): Entity;
241
- /** Gets the currently highlighted object */
242
- get currentObject(): Entity | GroundPrimitive | undefined;
243
243
  }
244
244
 
245
245
  export { Highlight, SilhouetteHighlight, SurfaceHighlight };
@@ -1 +1 @@
1
- import{a,b,c}from"../chunk-RZ3PTU3G.js";export{c as Highlight,a as SilhouetteHighlight,b as SurfaceHighlight};
1
+ import{a,b,c}from"../chunk-PSCNWZUR.js";export{c as Highlight,a as SilhouetteHighlight,b as SurfaceHighlight};