@geoscene/core 4.33.14 → 4.33.16

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 (65) hide show
  1. package/README.md +25 -25
  2. package/assets/geoscene/core/workers/chunks/0229c573fa8a2fff2d8b.js +1 -1
  3. package/assets/geoscene/core/workers/chunks/17fcdaeb42e932712096.js +1 -1
  4. package/assets/geoscene/core/workers/chunks/29fb64826bb1351aca8d.js +1 -1
  5. package/assets/geoscene/core/workers/chunks/54f981fe0f8851767be9.js +1 -1
  6. package/assets/geoscene/core/workers/chunks/58b2dc0ec977af7413b0.js +1 -1
  7. package/assets/geoscene/core/workers/chunks/73ddb356121add556994.js +1 -1
  8. package/assets/geoscene/core/workers/chunks/7e1906d35a764f7f10b0.js +1 -1
  9. package/assets/geoscene/core/workers/chunks/88b7265270feede80e1d.js +1 -1
  10. package/assets/geoscene/core/workers/chunks/8a87c181b85d0b86b9bb.js +1 -1
  11. package/assets/geoscene/core/workers/chunks/aad9a693813b47a51530.js +1 -1
  12. package/assets/geoscene/core/workers/chunks/f3b51aa0a1a8fc3b231c.js +1 -1
  13. package/assets/geoscene/css/main.scss +1 -1
  14. package/assets/geoscene/css/view.scss +1 -1
  15. package/assets/geoscene/themes/base/_colorVariables.scss +1 -1
  16. package/assets/geoscene/themes/base/_functions.scss +23 -23
  17. package/assets/geoscene/themes/base/_layout.scss +11 -11
  18. package/assets/geoscene/themes/base/_sizes.scss +130 -130
  19. package/assets/geoscene/themes/base/_type.scss +25 -25
  20. package/assets/geoscene/themes/base/colors/css/brand_colors.css +76 -76
  21. package/assets/geoscene/themes/base/colors/css/calcite_core_colors.css +169 -169
  22. package/assets/geoscene/themes/base/colors/css/calcite_core_colors_dark.css +169 -169
  23. package/assets/geoscene/themes/base/colors/css/calcite_gray_colors.css +43 -43
  24. package/assets/geoscene/themes/base/colors/css/calcite_gray_colors_dark.css +43 -43
  25. package/assets/geoscene/themes/base/colors/css/calcite_highlight_colors.css +43 -43
  26. package/assets/geoscene/themes/base/colors/css/calcite_highlight_colors_dark.css +43 -43
  27. package/assets/geoscene/themes/base/colors/css/calcite_vibrant_colors.css +67 -67
  28. package/assets/geoscene/themes/base/colors/css/calcite_vibrant_colors_dark.css +67 -67
  29. package/assets/geoscene/themes/base/colors/css/complete.css +610 -610
  30. package/assets/geoscene/themes/base/colors/css/scss/calcite_core_colors_dark.scss +285 -285
  31. package/assets/geoscene/themes/base/colors/css/scss/calcite_gray_colors_dark.scss +91 -91
  32. package/assets/geoscene/themes/base/colors/css/scss/calcite_highlight_colors_dark.scss +64 -64
  33. package/assets/geoscene/themes/base/colors/css/scss/calcite_vibrant_colors_dark.scss +124 -124
  34. package/assets/geoscene/themes/base/colors/css/scss/complete.scss +11 -11
  35. package/assets/geoscene/themes/base/colors/patterns_json/calcite_core_colors_dark.css +673 -673
  36. package/assets/geoscene/themes/base/colors/patterns_json/calcite_gray_colors_dark.css +169 -169
  37. package/assets/geoscene/themes/base/colors/patterns_json/calcite_highlight_colors_dark.css +169 -169
  38. package/assets/geoscene/themes/base/colors/patterns_json/calcite_vibrant_colors_dark.css +265 -265
  39. package/assets/geoscene/themes/base/colors/patterns_json/scss/calcite_core_colors_dark.scss +964 -964
  40. package/assets/geoscene/themes/base/colors/patterns_json/scss/calcite_gray_colors_dark.scss +263 -263
  41. package/assets/geoscene/themes/base/colors/patterns_json/scss/calcite_highlight_colors_dark.scss +234 -234
  42. package/assets/geoscene/themes/base/colors/patterns_json/scss/calcite_vibrant_colors_dark.scss +347 -347
  43. package/assets/geoscene/themes/base/colors/patterns_json/scss/complete.scss +11 -11
  44. package/assets/geoscene/themes/base/fonts/cdn.scss +2 -2
  45. package/assets/geoscene/themes/base/icons/fonts/CalciteWebCoreIcons.svg +196 -196
  46. package/assets/geoscene/themes/base/widgets/_AreaMeasurement2D.scss +7 -7
  47. package/assets/geoscene/themes/base/widgets/_AreaMeasurement3D.scss +7 -7
  48. package/assets/geoscene/themes/base/widgets/_DirectLineMeasurement3D.scss +7 -7
  49. package/assets/geoscene/themes/base/widgets/_DistanceMeasurement2D.scss +7 -7
  50. package/assets/geoscene/themes/base/widgets/_Measurement.scss +7 -7
  51. package/assets/geoscene/themes/light/view.scss +9 -9
  52. package/assets/geoscene/views/3d/analysis/images/heading-rotate.ts.svg +10 -10
  53. package/assets/geoscene/views/3d/analysis/images/tilt-rotate.ts.svg +11 -11
  54. package/assets/geoscene/views/3d/webgl-engine/lib/intersectorUtils.svg +117 -117
  55. package/assets/geoscene/views/magnifier/mask.ts.svg +5 -5
  56. package/assets/geoscene/views/magnifier/overlay.ts.svg +36 -36
  57. package/copyright.txt +1700 -1700
  58. package/core/Accessor.js +1 -1
  59. package/geometry/operators/graphicBufferOperator.d.ts +4 -4
  60. package/geometry/support/meshUtils.js +1 -1
  61. package/layers/MapImageTileLayer.js +1 -1
  62. package/package.json +34 -34
  63. package/rest/networks/queryAssociations.js +1 -1
  64. package/symbols/WebStyleSymbol.js +1 -1
  65. package/views/View2D.js +1 -1
package/core/Accessor.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
4
4
  */
5
- import{deprecatedFunction as e}from"./deprecate.js";import t from"./Handles.js";import r from"./Logger.js";import{destroyMaybe as s}from"./maybe.js";import{beforeDestroySymbol as o}from"./accessorSupport/beforeDestroy.js";import{get as c}from"./accessorSupport/get.js";import{Lifecycle as i}from"./accessorSupport/Lifecycle.js";import{getPropertiesMetadata as a}from"./accessorSupport/metadata.js";import n from"./accessorSupport/Properties.js";import{set as _}from"./accessorSupport/set.js";import{getAccessorInterceptor as h}from"./accessorSupport/testSupport.js";import{removeTarget as p,watch as l}from"./accessorSupport/watch.js";import{property as u}from"./accessorSupport/decorators/property.js";import{subclass as d}from"./accessorSupport/decorators/subclass.js";var f,y;function m(e){if(null==e)return{value:e};if(Array.isArray(e))return{type:[e[0]],value:null};switch(typeof e){case"object":return e.constructor?.__accessorMetadata__||e instanceof Date?{type:e.constructor,value:e}:e;case"boolean":return{type:Boolean,value:e};case"string":return{type:String,value:e};case"number":return{type:Number,value:e};case"function":return{type:e,value:null};default:return}}const v=Symbol("Accessor-Handles"),g=Symbol("Accessor-Initialized");class b{static{f=v,y=g}static createSubclass(e={}){if(Array.isArray(e))throw new Error("Multi-inheritance unsupported since 4.16");const{properties:t,declaredClass:r,constructor:s}=e;delete e.declaredClass,delete e.properties,delete e.constructor;const o=this;class c extends o{constructor(...e){super(...e),this.inherited=null,s&&s.apply(this,e)}}a(c.prototype);for(const i in e){const t=e[i];c.prototype[i]="function"==typeof t?function(...e){const r=this.inherited;let s;this.inherited=function(...e){if(o.prototype[i])return o.prototype[i].apply(this,e)};try{s=t.apply(this,e)}catch(c){throw this.inherited=r,c}return this.inherited=r,s}:e[i]}for(const i in t){const e=m(t[i]);u(e)(c.prototype,i)}return d(r)(c)}static freeze(e){return e instanceof b?e.__accessor__.mutable=!1:Object.freeze(e),e}static isFrozen(e){return e instanceof b?!e.__accessor__.mutable:Object.isFrozen(e)}constructor(...e){if(this[f]=null,this[y]=!1,this.constructor===b)throw new Error("[accessor] cannot instantiate Accessor. This can be fixed by creating a subclass of Accessor");const t=new n(this);Object.defineProperty(this,"__accessor__",{enumerable:!1,value:t}),e.length>0&&(t.ctorArgs=this.normalizeCtorArgs?.apply(this,e)??e[0]),h()?.onInstanceConstruct(this)}postscript(){const e=this.__accessor__,t=e.ctorArgs;e.initialize(),t&&(this.set(t),e.ctorArgs=null),e.constructed(),this.initialize(),this[g]=!0}initialize(){}[o](){this[v]=s(this[v])}destroy(){this.destroyed||(p(this),this.__accessor__.destroy(),h()?.onInstanceDestroy(this))}[Symbol.dispose](){this.destroy()}get constructed(){return this.__accessor__&&this.__accessor__.initialized||!1}get initialized(){return this[g]}get destroyed(){return this.__accessor__?.lifecycle===i.DESTROYED||!1}get destroying(){return this.__accessor__?.lifecycle===i.DESTROYING||!1}commitProperty(e){c(this,e)}hasOwnProperty(e){return this.__accessor__?this.__accessor__.has(e):Object.prototype.hasOwnProperty.call(this,e)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(e,t){return _(this,e,t),this}watch(t,s,o){return e(r.getLogger(this),"`watch` is deprecated in favor of reactiveUtils.watch",{replacement:"reactiveUtils.watch",version:"4.32",see:"https://arcg.is/1vaqf42#watch",warnOnce:!0}),l(this,t,s,o)}addHandles(e,r){if(this.destroyed){const t=Array.isArray(e)?e:[e];for(const e of t)e.remove();return}(this[v]??=new t).add(e,r)}removeHandles(e){this[v]?.remove(e)}removeAllHandles(){this[v]?.removeAll()}removeHandlesReference(e){this[v]?.removeReference(e)}hasHandles(e){return!0===this[v]?.has(e)}_override(e,t){void 0===t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_clearOverride(e){return this.__accessor__.clearOverride(e)}_overrideIfSome(e,t){null==t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_isOverridden(e){return this.__accessor__.isOverridden(e)}notifyChange(e){this.__accessor__.notifyChange(e)}_get(e){return this.__accessor__.internalGet(e)}_set(e,t){return this.__accessor__.internalSet(e,t),this}}export{b as default};
5
+ import{deprecatedFunction as e}from"./deprecate.js";import t from"./Handles.js";import r from"./Logger.js";import{destroyMaybe as s}from"./maybe.js";import{beforeDestroySymbol as o}from"./accessorSupport/beforeDestroy.js";import{get as c}from"./accessorSupport/get.js";import{Lifecycle as i}from"./accessorSupport/Lifecycle.js";import{getPropertiesMetadata as a}from"./accessorSupport/metadata.js";import n from"./accessorSupport/Properties.js";import{set as _}from"./accessorSupport/set.js";import{getAccessorInterceptor as h}from"./accessorSupport/testSupport.js";import{removeTarget as p,watch as l}from"./accessorSupport/watch.js";import{property as u}from"./accessorSupport/decorators/property.js";import{subclass as d}from"./accessorSupport/decorators/subclass.js";var f,y;function m(e){if(null==e)return{value:e};if(Array.isArray(e))return{type:[e[0]],value:null};switch(typeof e){case"object":return e.constructor?.__accessorMetadata__||e instanceof Date?{type:e.constructor,value:e}:e;case"boolean":return{type:Boolean,value:e};case"string":return{type:String,value:e};case"number":return{type:Number,value:e};case"function":return{type:e,value:null};default:return}}const v=Symbol("Accessor-Handles"),g=Symbol("Accessor-Initialized");class b{static{f=v,y=g}static createSubclass(e={}){if(Array.isArray(e))throw new Error("Multi-inheritance unsupported since 4.16");const{properties:t,declaredClass:r,constructor:s}=e;delete e.declaredClass,delete e.properties,delete e.constructor;const o=this;class c extends o{constructor(...e){super(...e),this.inherited=null,s&&s.apply(this,e)}}a(c.prototype);for(const i in e){const t=e[i];c.prototype[i]="function"==typeof t?function(...e){const r=this.inherited;let s;this.inherited=function(...e){if(o.prototype[i])return o.prototype[i].apply(this,e)};try{s=t.apply(this,e)}catch(c){throw this.inherited=r,c}return this.inherited=r,s}:e[i]}for(const i in t){const e=m(t[i]);u(e)(c.prototype,i)}return d(r)(c)}static freeze(e){return e instanceof b?e.__accessor__.mutable=!1:Object.freeze(e),e}static isFrozen(e){return e instanceof b?!e.__accessor__.mutable:Object.isFrozen(e)}constructor(...e){if(this[f]=null,this[y]=!1,this.constructor===b)throw new Error("[accessor] cannot instantiate Accessor. This can be fixed by creating a subclass of Accessor");const t=new n(this);Object.defineProperty(this,"__accessor__",{enumerable:!1,value:t}),e.length>0&&(t.ctorArgs=this.normalizeCtorArgs?.apply(this,e)??e[0]),h()?.onInstanceConstruct(this)}postscript(){const e=this.__accessor__,t=e.ctorArgs;e.initialize(),t&&(this.set(t),e.ctorArgs=null),e.constructed(),this.initialize(),this[g]=!0}initialize(){}[o](){this[v]=s(this[v])}destroy(){this.destroyed||(p(this),this.__accessor__.destroy(),h()?.onInstanceDestroy(this))}[Symbol.dispose](){this.destroy()}get constructed(){return this.__accessor__&&this.__accessor__.initialized||!1}get initialized(){return this[g]}get destroyed(){return this.__accessor__?.lifecycle===i.DESTROYED||!1}get destroying(){return this.__accessor__?.lifecycle===i.DESTROYING||!1}commitProperty(e){c(this,e)}hasOwnProperty(e){return this.__accessor__?this.__accessor__.has(e):Object.prototype.hasOwnProperty.call(this,e)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(e,t){return _(this,e,t),this}watch(t,s,o){return e(r.getLogger(this),"`watch` is deprecated in favor of reactiveUtils.watch",{replacement:"reactiveUtils.watch",version:"4.32",see:"",warnOnce:!0}),l(this,t,s,o)}addHandles(e,r){if(this.destroyed){const t=Array.isArray(e)?e:[e];for(const e of t)e.remove();return}(this[v]??=new t).add(e,r)}removeHandles(e){this[v]?.remove(e)}removeAllHandles(){this[v]?.removeAll()}removeHandlesReference(e){this[v]?.removeReference(e)}hasHandles(e){return!0===this[v]?.has(e)}_override(e,t){void 0===t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_clearOverride(e){return this.__accessor__.clearOverride(e)}_overrideIfSome(e,t){null==t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_isOverridden(e){return this.__accessor__.isOverridden(e)}notifyChange(e){this.__accessor__.notifyChange(e)}_get(e){return this.__accessor__.internalGet(e)}_set(e,t){return this.__accessor__.internalSet(e,t),this}}export{b as default};
@@ -1,4 +1,4 @@
1
- import "../../interfaces";
2
-
3
- export const supportsCurves: __esri.graphicBufferOperator["supportsCurves"];
4
- export const executeMany: __esri.graphicBufferOperator["executeMany"];
1
+ import "../../interfaces";
2
+
3
+ export const supportsCurves: __esri.graphicBufferOperator["supportsCurves"];
4
+ export const executeMany: __esri.graphicBufferOperator["executeMany"];
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
4
4
  */
5
- import{deprecatedFunction as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import s from"../Mesh.js";import{georeference as o,ungeoreference as n}from"./meshUtils/georeference.js";import{merge as c}from"./meshUtils/merge.js";const i=()=>r.getLogger("geoscene.geometry.support.meshUtils");async function a(e,r,s){const o=await import("./meshUtils/elevation.js");return t(s),o.create(e,r,s)}async function m(e,r){await e.load();return(await import("./meshUtils/elevationSampler.js")).create(e,r)}function p(r,t,s){return e(i(),"`meshUtils.georeference` is deprecated in favor of 'meshUtils.convertVertexSpace'",{replacement:"meshUtils.convertVertexSpace",version:"4.30",see:"https://arcg.is/1yHayr0#convertVertexSpace",warnOnce:!0}),o(r,t,s)}function l(r,t,s){return e(i(),"`meshUtils.ungeoreference` is deprecated in favor of 'meshUtils.convertVertexSpace'",{replacement:"meshUtils.convertVertexSpace",version:"4.30",see:"https://arcg.is/1yHayr0#convertVertexSpace",warnOnce:!0}),n(r,t,s)}function f(e){const r=c(e);return null!=r?new s(r):null}async function h(e,r,s){const{convertMeshVertexSpace:o}=await import("./meshUtils/convertMeshVertexSpace.js");return t(s),o(e,r,s)}export{h as convertVertexSpace,m as createElevationSampler,a as createFromElevation,p as georeference,f as merge,l as ungeoreference};
5
+ import{deprecatedFunction as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import s from"../Mesh.js";import{georeference as o,ungeoreference as n}from"./meshUtils/georeference.js";import{merge as c}from"./meshUtils/merge.js";const i=()=>r.getLogger("geoscene.geometry.support.meshUtils");async function a(e,r,s){const o=await import("./meshUtils/elevation.js");return t(s),o.create(e,r,s)}async function m(e,r){await e.load();return(await import("./meshUtils/elevationSampler.js")).create(e,r)}function p(r,t,s){return e(i(),"`meshUtils.georeference` is deprecated in favor of 'meshUtils.convertVertexSpace'",{replacement:"meshUtils.convertVertexSpace",version:"4.30",see:"",warnOnce:!0}),o(r,t,s)}function l(r,t,s){return e(i(),"`meshUtils.ungeoreference` is deprecated in favor of 'meshUtils.convertVertexSpace'",{replacement:"meshUtils.convertVertexSpace",version:"4.30",see:"",warnOnce:!0}),n(r,t,s)}function f(e){const r=c(e);return null!=r?new s(r):null}async function h(e,r,s){const{convertMeshVertexSpace:o}=await import("./meshUtils/convertMeshVertexSpace.js");return t(s),o(e,r,s)}export{h as convertVertexSpace,m as createElevationSampler,a as createFromElevation,p as georeference,f as merge,l as ungeoreference};
@@ -1 +1 @@
1
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as a,objectToQuery as l,makeAbsolute as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/SpatialReference.js";import y from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as g}from"./mixins/ArcGISMapService.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as L}from"./mixins/SublayersOwner.js";import{parse as R,isHostedAgolService as U,isArcGISUrl as P}from"./support/arcgisLayerUrl.js";import{url as x}from"./support/commonProperties.js";import{createTileBitmap as A}from"./support/imageBitmapUtils.js";import I from"./support/Sublayer.js";import Z from"../layers/MapImageLayer.js";import Y from"../geometry/Extent.js";import*as Q from"../core/reactiveUtils.js";import M from"../symbols/support/ElevationInfo.js";var W;const B=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let C=W=class extends(_(O(L(v(g(b(T(S(i(w(f(j(y))))))))))))){constructor(...e){super(...e),this.listMode="show",this.elevationInfo=new M({mode:"on-the-ground"}),this.isReference=null,this.operationalLayerType="ArcGISMapServiceTileLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="base-tile",this.__init_error_info={title:`Failed to create layerview for layer title:'${this.title}', id: '${this.id}' of type '${this.type}'.`,name:"tilingscheme:tile-info-missing_or_invalid",message:"Tiling scheme must have valid tiling information",details:["方法一:先在 Map 组件上加载一个 TileLayer 类型的地图服务图层,从而获取到这个图层的 spatialReference,fullExtent 和 tileInfo 属性值",`方法二:直接对这个${this.declaredClass}类型的图层的 spatialReference,fullExtent 和 tileInfo 属性进行赋值`]},this.url=e[0]?.url,this.url?(this._coreLayer=new Z({url:this.url}),this._coreLayer.load()):this._coreLayer=new Z,e[0]&&Object.keys(e[0]).forEach((r=>{this._coreLayer[r]=e[0][r]}))}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){this._coreLayer.url=this.url,this._coreLayer.url&&this._coreLayer.load().then((e=>{var r=this;Q.whenOnce((()=>r.parent.allLayers.find((e=>{const t="base-tile"!=e.type&&1==e.loaded;return t&&(r.firstLayer=e),t})))).then((()=>{try{r.firstLayer?.spatialReference&&r.firstLayer?.fullExtent&&r.firstLayer?.tileInfo?(r.spatialReference=r.firstLayer.spatialReference,r.fullExtent=r.firstLayer.fullExtent,r.tileInfo=r.firstLayer.tileInfo):r._throwMapLoadError()}catch(e){r._showMapLoadError(e)}})),Q.whenOnce((()=>e.loaded)).then((()=>{r.sublayers=e.sublayers}))}));const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(o).then((()=>this._fetchService(r)))),Promise.resolve(this)}get attributionDataUrl(){const e=this.parsedUrl?.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){return(e=e||r.tileInfo?.spatialReference)&&d.fromJSON(e)}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray(),o=[],a={writeSublayerStructure:!1,...i};s.forEach((e=>{const r=e.write({},a);o.push(r)})),o.some((e=>Object.keys(e).length>1))&&(r.layers=o)}get tileServers(){return this._getDefaultTileServers(this.parsedUrl?.path)}castTileServers(e){return Array.isArray(e)?e.map((e=>a(e).path)):null}fetchTile(e,r,t,i={}){return this.getTileImage(e,r,t,i)}async fetchImageBitmapTile(e,r,t,i={}){const{signal:s}=i,o=await this.getTileImage(e,r,t,i);return A(o,e,r,t,s)}getTileImage(e,r,t,i={}){const s=this.tileInfo.origin.x+t*this.tileInfo.lods[e].resolution*this.tileInfo.size[0],o=this.tileInfo.origin.y-r*this.tileInfo.lods[e].resolution*this.tileInfo.size[1],a=this.tileInfo.origin.x+(t+1)*this.tileInfo.lods[e].resolution*this.tileInfo.size[0],l=this.tileInfo.origin.y-(r+1)*this.tileInfo.lods[e].resolution*this.tileInfo.size[1],n=new Y({xmin:s,ymin:l,xmax:a,ymax:o,spatialReference:this.spatialReference});return this._coreLayer.fetchImage(n,this.tileInfo.size[0],this.tileInfo.size[1],i)}getTileUrl(e,r,t){const i=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=l({...this.parsedUrl?.query,blankTile:!i&&null,...this.customParameters,token:this.apiKey}),o=this.tileServers;return`${o&&o.length?o[r%o.length]:this.parsedUrl?.path}/tile/${e}/${r}/${t}${s?"?"+s:""}`}loadAll(){return s(this,(e=>{e(this.allSublayers)}))}_fetchService(e){return new Promise(((i,s)=>{if(this.sourceJSON){if(null!=this.sourceJSON.bandCount&&null!=this.sourceJSON.pixelSizeX)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void i({data:this.sourceJSON})}if(!this.parsedUrl)throw new t("tile-layer:undefined-url","layer's url is not defined");const o=R(this.parsedUrl.path);if(null!=o&&"ImageServer"===o.serverType)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(i,s)})).then((r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),10.1===this.version&&!U(t))return this._fetchServerVersion(t,e).then((e=>{this.read({currentVersion:e})})).catch((()=>{}))}))}_fetchServerVersion(e,i){if(!P(e))return Promise.reject();const s=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return r(s,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{if(e.data?.currentVersion)return e.data.currentVersion;throw new t("tile-layer:version-not-available","Server did not provide a version")}))}_getMapName(e){}_getDefaultAttribution(e){return null}_getDefaultTileServers(e){return[]}get hasOverriddenFetchTile(){return!this.fetchTile[N]}_throwMapLoadError(){throw new t(this.__init_error_info.name,this.__init_error_info.message,this.__init_error_info.details)}_showMapLoadError(e){}findSublayerById(e){return this._coreLayer?.findSublayerById(e)}createExportImageParameters(e,r,t,i){return this._coreLayer?.createExportImageParameters(e,r,t,i)}findSublayerByTitle(e){return this._coreLayer?.allSublayers.items.find((r=>r.title===e))}};e([p({readOnly:!0})],C.prototype,"attributionDataUrl",null),e([p({type:["show","hide","hide-children"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"elevationInfo",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({readOnly:!0,type:["ArcGISMapServiceTileLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean})],C.prototype,"resampling",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({type:d})],C.prototype,"spatialReference",void 0),e([u("spatialReference",["spatialReference","tileInfo"])],C.prototype,"readSpatialReference",null),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],C.prototype,"path",void 0),e([p()],C.prototype,"sublayers",void 0),e([h("sublayers",{layers:{type:[I]}})],C.prototype,"writeSublayers",null),e([p({json:{read:!1,write:!1}})],C.prototype,"popupEnabled",void 0),e([p()],C.prototype,"tileServers",null),e([c("tileServers")],C.prototype,"castTileServers",null),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p(x)],C.prototype,"url",void 0),C=W=e([m("geoscene.layers.MapImageTileLayer")],C);const N=Symbol("default-fetch-tile");C.prototype.fetchTile[N]=!1;const k=C;export{k as default};
1
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as a,objectToQuery as l,makeAbsolute as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/SpatialReference.js";import y from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as g}from"./mixins/ArcGISMapService.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as L}from"./mixins/SublayersOwner.js";import{parse as R,isHostedAgolService as U,isArcGISUrl as P}from"./support/arcgisLayerUrl.js";import{url as x}from"./support/commonProperties.js";import{createTileBitmap as A}from"./support/imageBitmapUtils.js";import I from"./support/Sublayer.js";import Z from"../layers/MapImageLayer.js";import Y from"../geometry/Extent.js";import*as Q from"../core/reactiveUtils.js";import M from"../symbols/support/ElevationInfo.js";var W;const B=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let C=W=class extends(_(O(L(v(g(b(T(S(i(w(f(j(y))))))))))))){constructor(...e){super(...e),this.listMode="show",this.elevationInfo=new M({mode:"on-the-ground"}),this.isReference=null,this.operationalLayerType="ArcGISMapServiceTileLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="base-tile",this.__init_error_info={title:`Failed to create layerview for layer title:'${this.title}', id: '${this.id}' of type '${this.type}'.`,name:"tilingscheme:tile-info-missing_or_invalid",message:"Tiling scheme must have valid tiling information",details:["方法一:先在 Map 组件上加载一个 TileLayer 类型的地图服务图层,从而获取到这个图层的 spatialReference,fullExtent 和 tileInfo 属性值",`方法二:直接对这个${this.declaredClass}类型的图层的 spatialReference,fullExtent 和 tileInfo 属性进行赋值`]},this.url=e[0]?.url,this.url?(this._coreLayer=new Z({url:this.url}),this._coreLayer.load()):this._coreLayer=new Z,e[0]&&Object.keys(e[0]).forEach((r=>{this._coreLayer[r]=e[0][r]}))}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(o).then((()=>this._fetchService(r)))),this._coreLayer.url||(this._coreLayer.url=this.url,this._coreLayer.load()),Q.whenOnce((()=>this.parent.allLayers.find((e=>{const r="base-tile"!=e.type&&1==e.loaded;return r&&(this.firstLayer=e),r})))).then((()=>{try{this.firstLayer?.spatialReference&&this.firstLayer?.fullExtent&&this.firstLayer?.tileInfo?(this.spatialReference=this.firstLayer.spatialReference,this.fullExtent=this.firstLayer.fullExtent,this.tileInfo=this.firstLayer.tileInfo):this._throwMapLoadError()}catch(e){this._showMapLoadError(e)}})),Q.whenOnce((()=>this._coreLayer.loaded)).then((()=>{this.sublayers=this._coreLayer.sublayers})),Promise.resolve(this)}get attributionDataUrl(){const e=this.parsedUrl?.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){return(e=e||r.tileInfo?.spatialReference)&&d.fromJSON(e)}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray(),o=[],a={writeSublayerStructure:!1,...i};s.forEach((e=>{const r=e.write({},a);o.push(r)})),o.some((e=>Object.keys(e).length>1))&&(r.layers=o)}get tileServers(){return this._getDefaultTileServers(this.parsedUrl?.path)}castTileServers(e){return Array.isArray(e)?e.map((e=>a(e).path)):null}fetchTile(e,r,t,i={}){return this.getTileImage(e,r,t,i)}async fetchImageBitmapTile(e,r,t,i={}){const{signal:s}=i,o=await this.getTileImage(e,r,t,i);return A(o,e,r,t,s)}getTileImage(e,r,t,i={}){const s=this.tileInfo.origin.x+t*this.tileInfo.lods[e].resolution*this.tileInfo.size[0],o=this.tileInfo.origin.y-r*this.tileInfo.lods[e].resolution*this.tileInfo.size[1],a=this.tileInfo.origin.x+(t+1)*this.tileInfo.lods[e].resolution*this.tileInfo.size[0],l=this.tileInfo.origin.y-(r+1)*this.tileInfo.lods[e].resolution*this.tileInfo.size[1],n=new Y({xmin:s,ymin:l,xmax:a,ymax:o,spatialReference:this.spatialReference});return this._coreLayer.fetchImage(n,this.tileInfo.size[0],this.tileInfo.size[1],i)}getTileUrl(e,r,t){const i=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=l({...this.parsedUrl?.query,blankTile:!i&&null,...this.customParameters,token:this.apiKey}),o=this.tileServers;return`${o&&o.length?o[r%o.length]:this.parsedUrl?.path}/tile/${e}/${r}/${t}${s?"?"+s:""}`}loadAll(){return s(this,(e=>{e(this.allSublayers)}))}_fetchService(e){return new Promise(((i,s)=>{if(this.sourceJSON){if(null!=this.sourceJSON.bandCount&&null!=this.sourceJSON.pixelSizeX)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void i({data:this.sourceJSON})}if(!this.parsedUrl)throw new t("tile-layer:undefined-url","layer's url is not defined");const o=R(this.parsedUrl.path);if(null!=o&&"ImageServer"===o.serverType)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(i,s)})).then((r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),10.1===this.version&&!U(t))return this._fetchServerVersion(t,e).then((e=>{this.read({currentVersion:e})})).catch((()=>{}))}))}_fetchServerVersion(e,i){if(!P(e))return Promise.reject();const s=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return r(s,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{if(e.data?.currentVersion)return e.data.currentVersion;throw new t("tile-layer:version-not-available","Server did not provide a version")}))}_getMapName(e){}_getDefaultAttribution(e){return null}_getDefaultTileServers(e){return[]}get hasOverriddenFetchTile(){return!this.fetchTile[N]}_throwMapLoadError(){throw new t(this.__init_error_info.name,this.__init_error_info.message,this.__init_error_info.details)}_showMapLoadError(e){}findSublayerById(e){return this._coreLayer?.findSublayerById(e)}createExportImageParameters(e,r,t,i){return this._coreLayer?.createExportImageParameters(e,r,t,i)}findSublayerByTitle(e){return this._coreLayer?.allSublayers.items.find((r=>r.title===e))}};e([p({readOnly:!0})],C.prototype,"attributionDataUrl",null),e([p({type:["show","hide","hide-children"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"elevationInfo",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({readOnly:!0,type:["ArcGISMapServiceTileLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean})],C.prototype,"resampling",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({type:d})],C.prototype,"spatialReference",void 0),e([u("spatialReference",["spatialReference","tileInfo"])],C.prototype,"readSpatialReference",null),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],C.prototype,"path",void 0),e([p()],C.prototype,"sublayers",void 0),e([h("sublayers",{layers:{type:[I]}})],C.prototype,"writeSublayers",null),e([p({json:{read:!1,write:!1}})],C.prototype,"popupEnabled",void 0),e([p()],C.prototype,"tileServers",null),e([c("tileServers")],C.prototype,"castTileServers",null),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p(x)],C.prototype,"url",void 0),C=W=e([m("geoscene.layers.MapImageTileLayer")],C);const N=Symbol("default-fetch-tile");C.prototype.fetchTile[N]=!1;const k=C;export{k as default};
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@geoscene/core",
3
- "version": "4.33.14",
4
- "homepage": "https://js.geoscene.cn",
5
- "description": "GeoScene Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
- "keywords": [
7
- "GeoScene",
8
- "javascript",
9
- "map",
10
- "3D",
11
- "2D",
12
- "visualization",
13
- "analytics",
14
- "spatial",
15
- "data-driven",
16
- "gis"
17
- ],
18
- "license": "SEE LICENSE IN copyright.txt",
19
- "browser": {
20
- "buffer": false,
21
- "crypto": false,
22
- "fs": false,
23
- "path": false,
24
- "process": false
25
- },
26
- "dependencies": {
27
- "@esri/arcgis-html-sanitizer": "~4.1.0",
28
- "@esri/calcite-components": "^3.2.1",
29
- "@vaadin/grid": "~24.7.6",
30
- "@zip.js/zip.js": "~2.7.62",
31
- "luxon": "~3.6.1",
32
- "marked": "~15.0.12"
33
- },
34
- "type": "module"
1
+ {
2
+ "name": "@geoscene/core",
3
+ "version": "4.33.16",
4
+ "homepage": "https://js.geoscene.cn",
5
+ "description": "GeoScene Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
+ "keywords": [
7
+ "GeoScene",
8
+ "javascript",
9
+ "map",
10
+ "3D",
11
+ "2D",
12
+ "visualization",
13
+ "analytics",
14
+ "spatial",
15
+ "data-driven",
16
+ "gis"
17
+ ],
18
+ "license": "SEE LICENSE IN copyright.txt",
19
+ "browser": {
20
+ "buffer": false,
21
+ "crypto": false,
22
+ "fs": false,
23
+ "path": false,
24
+ "process": false
25
+ },
26
+ "dependencies": {
27
+ "@esri/arcgis-html-sanitizer": "~4.1.0",
28
+ "@esri/calcite-components": "^3.2.1",
29
+ "@vaadin/grid": "~24.7.6",
30
+ "@zip.js/zip.js": "~2.7.62",
31
+ "luxon": "~3.6.1",
32
+ "marked": "~15.0.12"
33
+ },
34
+ "type": "module"
35
35
  }
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import o from"../../core/Logger.js";import{associationTypeKebabDict as r}from"../../networks/support/typeUtils.js";import{parseUrl as n,encode as s,asValidOptions as i}from"../utils.js";import c from"./support/QueryAssociationsResult.js";function a(e){const{returnDeletes:t,elements:o,gdbVersion:n,moment:s}=e.toJSON();return{returnDeletes:t,elements:JSON.stringify(o.map((e=>({globalId:e.globalId,networkSourceId:e.networkSourceId,terminalId:e.terminalId})))),types:JSON.stringify(e.types.map((e=>r.toJSON(e)))).replaceAll('"connectivity"','"junctionJunctionConnectivity"'),gdbVersion:n,moment:s??Date.now()}}async function p(r,p,m){const u=n(r),l={...a(p),f:"json"},y=s({...u.query,...l}),d=i(y,{...m,method:"post"}),f=`${u.path}/associations/query`,{data:g}=await e(f,d),j=c.fromJSON(g);return p.types.includes("connectivity")&&t(o.getLogger("geoscene/rest/networks/support/QueryAssociationsParameters"),"types",{replacement:"Please use 'junction-junction-connectivity' instead of 'connectivity'.",see:"https://arcg.is/11Tr8a#types",version:"4.29",warnOnce:!0}),j}export{p as queryAssociations};
5
+ import e from"../../request.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import o from"../../core/Logger.js";import{associationTypeKebabDict as r}from"../../networks/support/typeUtils.js";import{parseUrl as n,encode as s,asValidOptions as i}from"../utils.js";import c from"./support/QueryAssociationsResult.js";function a(e){const{returnDeletes:t,elements:o,gdbVersion:n,moment:s}=e.toJSON();return{returnDeletes:t,elements:JSON.stringify(o.map((e=>({globalId:e.globalId,networkSourceId:e.networkSourceId,terminalId:e.terminalId})))),types:JSON.stringify(e.types.map((e=>r.toJSON(e)))).replaceAll('"connectivity"','"junctionJunctionConnectivity"'),gdbVersion:n,moment:s??Date.now()}}async function p(r,p,m){const u=n(r),l={...a(p),f:"json"},y=s({...u.query,...l}),d=i(y,{...m,method:"post"}),f=`${u.path}/associations/query`,{data:g}=await e(f,d),j=c.fromJSON(g);return p.types.includes("connectivity")&&t(o.getLogger("geoscene/rest/networks/support/QueryAssociationsParameters"),"types",{replacement:"Please use 'junction-junction-connectivity' instead of 'connectivity'.",see:"",version:"4.29",warnOnce:!0}),j}export{p as queryAssociations};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import{deprecatedFunction as e}from"../core/deprecate.js";import o from"../core/Error.js";import r from"../core/Logger.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{w as a,r as c}from"../chunks/persistableUrlUtils.js";import y from"./Symbol.js";import{Thumbnail as n}from"./support/Thumbnail.js";var h;let u=h=class extends y{constructor(t){super(t),this.color=null,this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=null!=this.portal?this.portal:p.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e?.portal,super.read(t,e)}clone(){return new h({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol(t)}async fetchCIMSymbol(t){e(r.getLogger(this),"WebStyleSymbol.fetchCIMSymbol is deprecated in favour of WebStyleSymbol.fetchSymbol which now supports both web and cim symbology",{version:"4.33",replacement:"WebStyleSymbol.fetchSymbol",see:"https://arcg.is/0CXPTr#fetchSymbol",warnOnce:!0});const s=await this._fetchSymbol({...t,acceptedFormats:["cim"]});if("cim"!==s?.type)throw new o("webstylesymbol:fetchCIMSymbol","Resolved web style symbol is not of type 'cim'");return s}async _fetchSymbol(t){const e=null!=t?t.cache:null,o=e?this._fetchCacheKey:null;if(null!=e){const t=o&&e.get(o);if(t)return t.clone()}const{resolveWebStyleSymbol:l}=await import("./support/webStyleSymbolUtils.js");s(t);const i=l(this,{portal:this.portal},t);i.catch((t=>{r.getLogger(this).error("#fetchSymbol()","Failed to create symbol from style",t)}));const m=await i;return null!=e&&e.set(o,m.clone()),m}};t([l({json:{write:!1}})],u.prototype,"color",void 0),t([l({type:String,json:{write:!0}})],u.prototype,"styleName",void 0),t([l({type:p,json:{write:!1}})],u.prototype,"portal",void 0),t([l({type:String,json:{read:c,write:a}})],u.prototype,"styleUrl",void 0),t([l({type:n,json:{read:!1}})],u.prototype,"thumbnail",void 0),t([l({type:String,json:{write:!0}})],u.prototype,"name",void 0),t([i({styleSymbolReference:"web-style"},{readOnly:!0})],u.prototype,"type",void 0),t([l()],u.prototype,"_fetchCacheKey",null),u=h=t([m("geoscene.symbols.WebStyleSymbol")],u);export{u as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import{deprecatedFunction as e}from"../core/deprecate.js";import o from"../core/Error.js";import r from"../core/Logger.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{w as a,r as c}from"../chunks/persistableUrlUtils.js";import y from"./Symbol.js";import{Thumbnail as n}from"./support/Thumbnail.js";var h;let u=h=class extends y{constructor(t){super(t),this.color=null,this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=null!=this.portal?this.portal:p.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e?.portal,super.read(t,e)}clone(){return new h({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol(t)}async fetchCIMSymbol(t){e(r.getLogger(this),"WebStyleSymbol.fetchCIMSymbol is deprecated in favour of WebStyleSymbol.fetchSymbol which now supports both web and cim symbology",{version:"4.33",replacement:"WebStyleSymbol.fetchSymbol",see:"",warnOnce:!0});const s=await this._fetchSymbol({...t,acceptedFormats:["cim"]});if("cim"!==s?.type)throw new o("webstylesymbol:fetchCIMSymbol","Resolved web style symbol is not of type 'cim'");return s}async _fetchSymbol(t){const e=null!=t?t.cache:null,o=e?this._fetchCacheKey:null;if(null!=e){const t=o&&e.get(o);if(t)return t.clone()}const{resolveWebStyleSymbol:l}=await import("./support/webStyleSymbolUtils.js");s(t);const i=l(this,{portal:this.portal},t);i.catch((t=>{r.getLogger(this).error("#fetchSymbol()","Failed to create symbol from style",t)}));const m=await i;return null!=e&&e.set(o,m.clone()),m}};t([l({json:{write:!1}})],u.prototype,"color",void 0),t([l({type:String,json:{write:!0}})],u.prototype,"styleName",void 0),t([l({type:p,json:{write:!1}})],u.prototype,"portal",void 0),t([l({type:String,json:{read:c,write:a}})],u.prototype,"styleUrl",void 0),t([l({type:n,json:{read:!1}})],u.prototype,"thumbnail",void 0),t([l({type:String,json:{write:!0}})],u.prototype,"name",void 0),t([i({styleSymbolReference:"web-style"},{readOnly:!0})],u.prototype,"type",void 0),t([l()],u.prototype,"_fetchCacheKey",null),u=h=t([m("geoscene.symbols.WebStyleSymbol")],u);export{u as default};
package/views/View2D.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import u from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projectionUtils.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import M from"./View.js";import{Viewport2DBaseMixin as b}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as v}from"./Viewport2DMixin.js";import _ from"./2d/AnimationManager.js";import{layerView2DImporter as j}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{ManagedCanvas as R}from"./2d/engine/ManagedCanvas.js";import O from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as T}from"./2d/layers/support/util.js";import{clipContainsPoint as C}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as k,setDefaultHighlightOptions as x}from"./2d/support/highlightOptionsUtils.js";import{hitTest as D}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as E,takeScreenshot as P}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import U from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import z from"./support/HighlightOptions.js";import{check as A}from"./support/WebGLRequirements.js";import I from"./ui/DefaultUI.js";import N from"./ui/2d/DefaultUI2D.js";import{isWebMap as W}from"../webmap/utils.js";import $ from"../webmap/background/ColorBackground.js";let F,H,B,Z,J,K,Q;async function X(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);H=e,B=t,Z=i,J=r,K=s,Q=a,F=n}let Y=class extends(v(b(f(V(w(M)))))){constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new U({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new N,this.test={takeScreenshot:async e=>E(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new O(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return W(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get highlightOptions(){return k(this)}set highlightOptions(e){x(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resolution(){return this.stateManager.resolution??0}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating))||e);if(has("geoscene-2d-log-updating")){const i=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get visibleArea(){const e=this.stateManager.visibleArea;return e?new u({rings:[e.map((e=>[e[0],e[1]]))],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return D(this,e,t)}async takeScreenshot(e){return P(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return W(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return W(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return j.hasLayerViewModule(e)}importLayerView(e){return j.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter((i=>i.clips.every((i=>C(this,i,e,t))))).reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=A(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return X()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??d,m=o.scale??g;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new R(this.surface),i=new F(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new K,this._magnifierView.magnifier=this.magnifier,this._gridView=new Q;const r=new Z({view:this});this._set("labelManager",r);const s=new _({view:this});this._set("animationManager",s);const a=new J({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>i.stationary=e),l),o((()=>this.background),(e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.grid),(e=>this._gridView.grid=e),l),o((()=>this.renderingOptions),(e=>i.renderingOptions=e),l),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})))),(()=>{i.highlightGradient=T(i.highlightGradient,this.highlights.items)}),l),o((()=>this.state.id),(()=>i.state=this.state),l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new S(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new H({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new B(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],Y.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],Y.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],Y.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],Y.prototype,"graphicsTileStore",null),e([h()],Y.prototype,"graphicsView",void 0),e([h()],Y.prototype,"constraintsInfo",null),e([h()],Y.prototype,"initialExtentRequired",null),e([h()],Y.prototype,"labelManager",void 0),e([h({type:U,nonNullable:!0})],Y.prototype,"navigation",void 0),e([h({constructOnly:!0})],Y.prototype,"renderCanvas",void 0),e([h()],Y.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],Y.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],Y.prototype,"supportsGround",void 0),e([h()],Y.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],Y.prototype,"typeSpecificPreconditionsReady",null),e([h({type:$})],Y.prototype,"background",null),e([h()],Y.prototype,"center",null),e([h({type:i})],Y.prototype,"floors",void 0),e([h()],Y.prototype,"grid",void 0),e([h({type:z})],Y.prototype,"highlightOptions",null),e([h()],Y.prototype,"map",void 0),e([h()],Y.prototype,"padding",null),e([h({readOnly:!0})],Y.prototype,"rendering",null),e([h({readOnly:!0})],Y.prototype,"resolution",null),e([h()],Y.prototype,"scale",null),e([h({constructOnly:!0})],Y.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],Y.prototype,"tileInfo",null),e([h({type:G,readOnly:!0})],Y.prototype,"timeline",void 0),e([h({readOnly:!0})],Y.prototype,"type",void 0),e([h({readOnly:!0})],Y.prototype,"updating",null),e([h({readOnly:!0})],Y.prototype,"view2dType",void 0),e([h({readOnly:!0})],Y.prototype,"visibleArea",null),e([h()],Y.prototype,"zoom",null),e([h({readOnly:!0})],Y.prototype,"navigating",null),e([h(),d((e=>e instanceof I?e:c(N,e)))],Y.prototype,"ui",void 0),Y=e([g("geoscene.views.View2D")],Y);const ee=Y;export{ee as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import u from"../geometry/Polygon.js";import{isLoadedOrLoadFor as m}from"../geometry/projectionUtils.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as V}from"./PopupView.js";import M from"./View.js";import{Viewport2DBaseMixin as b}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as v}from"./Viewport2DMixin.js";import _ from"./2d/AnimationManager.js";import{layerView2DImporter as j}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{ManagedCanvas as R}from"./2d/engine/ManagedCanvas.js";import O from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as T}from"./2d/layers/support/util.js";import{clipContainsPoint as C}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as k,setDefaultHighlightOptions as x}from"./2d/support/highlightOptionsUtils.js";import{hitTest as D}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as E,takeScreenshot as P}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import U from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import z from"./support/HighlightOptions.js";import{check as A}from"./support/WebGLRequirements.js";import I from"./ui/DefaultUI.js";import N from"./ui/2d/DefaultUI2D.js";import{isWebMap as W}from"../webmap/utils.js";import $ from"../webmap/background/ColorBackground.js";let F,H,B,Z,J,K,Q;async function X(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);H=e,B=t,Z=i,J=r,K=s,Q=a,F=n}let Y=class extends(v(b(f(V(w(M)))))){constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new U({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.floors=new i,this.grid=null,this.map=null,this.spatialReferenceLocked=!1,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new N,this.test={takeScreenshot:async e=>E(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new O(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}get background(){return W(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get highlightOptions(){return k(this)}set highlightOptions(e){x(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resolution(){return this.stateManager.resolution??0}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating))||e);if(has("geoscene-2d-log-updating")){const i=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get visibleArea(){const e=this.stateManager.visibleArea;return e?new u({rings:[e.map((e=>[e[0],e[1]]))],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return D(this,e,t)}async takeScreenshot(e){return P(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return W(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return W(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return j.hasLayerViewModule(e)}importLayerView(e){return j.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter((i=>i.clips.every((i=>C(this,i,e,t))))).reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=A(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return X()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??d,m=o.scale??g;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new R(this.surface),i=new F(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new K,this._magnifierView.magnifier=this.magnifier,this._gridView=new Q;const r=new Z({view:this});this._set("labelManager",r);const s=new _({view:this});this._set("animationManager",s);const a=new J({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>i.stationary=e),l),o((()=>this.background),(e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.grid),(e=>this._gridView.grid=e),l),o((()=>this.renderingOptions),(e=>i.renderingOptions=e),l),o((()=>this.highlights.items.map((e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})))),(()=>{i.highlightGradient=T(i.highlightGradient,this.highlights.items)}),l),o((()=>this.state.id),(()=>i.state=this.state),l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new S(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new H({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new B(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],Y.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],Y.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],Y.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],Y.prototype,"graphicsTileStore",null),e([h()],Y.prototype,"graphicsView",void 0),e([h()],Y.prototype,"constraintsInfo",null),e([h()],Y.prototype,"initialExtentRequired",null),e([h()],Y.prototype,"labelManager",void 0),e([h({type:U,nonNullable:!0})],Y.prototype,"navigation",void 0),e([h({constructOnly:!0})],Y.prototype,"renderCanvas",void 0),e([h()],Y.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],Y.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],Y.prototype,"supportsGround",void 0),e([h()],Y.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],Y.prototype,"typeSpecificPreconditionsReady",null),e([h({type:$})],Y.prototype,"background",null),e([h()],Y.prototype,"center",null),e([h({type:i})],Y.prototype,"floors",void 0),e([h()],Y.prototype,"grid",void 0),e([h({type:z})],Y.prototype,"highlightOptions",null),e([h()],Y.prototype,"map",void 0),e([h()],Y.prototype,"padding",null),e([h({readOnly:!0})],Y.prototype,"rendering",null),e([h({readOnly:!0})],Y.prototype,"resolution",null),e([h()],Y.prototype,"scale",null),e([h({constructOnly:!0})],Y.prototype,"spatialReferenceLocked",void 0),e([h({readOnly:!0})],Y.prototype,"tileInfo",null),e([h({type:G,readOnly:!0})],Y.prototype,"timeline",void 0),e([h({readOnly:!0})],Y.prototype,"type",void 0),e([h({readOnly:!0})],Y.prototype,"updating",null),e([h({readOnly:!0})],Y.prototype,"view2dType",void 0),e([h({readOnly:!0})],Y.prototype,"visibleArea",null),e([h()],Y.prototype,"zoom",null),e([h({readOnly:!0})],Y.prototype,"navigating",null),e([h(),d((e=>e instanceof I?e:c(N,e)))],Y.prototype,"ui",void 0),Y=e([g("geoscene.views.View2D")],Y);const ee=Y;export{ee as default};