@arcgis/core 5.2.0-next.150 → 5.2.0-next.151

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.150/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.151/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
@@ -26,7 +26,9 @@ export function simplifyOGCExecute(geometry: GeometryUnion): GeometryWithoutMesh
26
26
  /**
27
27
  * Performs OGC simplification on a single geometry.
28
28
  *
29
- * @deprecated use [simplifyOGCExecute()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCExecute)
29
+ * @deprecated
30
+ * since 5.2. Refactor using \@arcgis/codemod or manually replace usages
31
+ * with [simplifyOGCExecute()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCExecute).
30
32
  * @param geometry - The geometry to simplify.
31
33
  * @returns The simplified geometry, or `null` if the input contains non-finite x- or y-values, or infinite z-values.
32
34
  * NaN z-values are set to 0.
@@ -52,7 +54,9 @@ export function simplifyOGCExecuteMany(geometries: GeometryUnion[]): (GeometryWi
52
54
  /**
53
55
  * Performs OGC simplification on a collection of geometries.
54
56
  *
55
- * @deprecated use [simplifyOGCExecuteMany()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCExecuteMany)
57
+ * @deprecated
58
+ * since 5.2. Refactor using \@arcgis/codemod or manually replace usages
59
+ * with [simplifyOGCExecuteMany()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCExecuteMany).
56
60
  * @param geometries - The geometries to simplify. All geometries must have the same spatial reference.
57
61
  * @returns An array of simplified geometries. Geometries with non-finite x- or y-values, or infinite z-values return `null`.
58
62
  * NaN z-values are set to 0.
@@ -120,7 +124,7 @@ export function simplifyOGCIsSimple(geometry: GeometryUnion): boolean;
120
124
  *
121
125
  * @deprecated
122
126
  * since 5.2. Refactor using \@arcgis/codemod or manually replace usages
123
- * with [simplifyOGCExecute()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCExecute).
127
+ * with [simplifyOGCIsSimple()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCIsSimple).
124
128
  * @param geometry - The input geometry.
125
129
  * @returns Returns whether the geometry is simple.
126
130
  * @example
@@ -142,6 +146,8 @@ export const simplifyOGCSupportsCurves: boolean;
142
146
  * Indicates if the operator supports input geometries that contain curves.
143
147
  * The value will always be `true`.
144
148
  *
145
- * @deprecated use [simplifyOGCSupportsCurves](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCSupportsCurves)
149
+ * @deprecated
150
+ * since 5.2. Refactor using \@arcgis/codemod or manually replace usages
151
+ * with [simplifyOGCSupportsCurves](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/#simplifyOGCSupportsCurves).
146
152
  */
147
153
  export const supportsCurves: ReturnType<typeof Boolean>;
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.0-next.150`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}has(`host-webworker`)||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has(`host-webworker`);export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
2
+ import has from"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.0-next.151`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}has(`host-webworker`)||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has(`host-webworker`);export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import n from"../core/Accessor.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as o,isAborted as s,isAbortError as c}from"../core/promiseUtils.js";import l from"../core/ReactiveMap.js";import{watch as u}from"../core/reactiveUtils.js";import{signal as d}from"../core/signal.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import m from"../geometry/SpatialReference.js";import{isGeographic as h}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,elevQueriesFull as v,elevQueriesGenericFail as y,invalidLayerView as b}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as x}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as S}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as C}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as w}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as T}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{Yield as D}from"../views/support/Yield.js";const O=3857,k=4326,A=5773;let j=class extends n{get _frozen(){return this._frozenLayerViewCount>0}constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._frozenLayerViewCount=0,this._elevationQueries=new l,this._pendingJobCompleted=[],this._pendingJobFailed=[],this._pendingRenderableCreated=[],this._pulseDeferred=d(!1),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded=`method requiring WASM was called when WASM isn't loaded`,this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,n,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){let e=r?`[js] ${n}`:`${n}`;t===0||t===1?i.getLogger(this).error(e):t===2&&i.getLogger(this).warn(e),i.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(i.getLogger(this).level=`info`),this._debugLog(0,3,`Lyr3DWasmPerSceneView.initialize()`),this.addHandles([u(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),u(()=>this.view.state?.contentCamera.relativeElevation,()=>this._updateWasmCameraElevation()),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(E.LYR3D,this)}destroy(){this._debugLog(0,3,`Lyr3DWasmPerSceneView.destroy()`),this._lyr3DMain&&=(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(o())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;let e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),D}_hasPendingPulseWork(){return this._lyr3DMain?!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)):!1}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,`Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized`),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._is3DTilesIMLayerView(e)&&e.freeze&&this.decrementFrozenLayerViewCount(e),this._doRemoveLayerView(e);let t=this._layers.size;return t===0&&(this._debugLog(0,3,`Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying`),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_enabled(e.wasmLayerId,t),n.needMemoryUsageUpdate=!0;let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);n&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),n.needFrame=!0,n.layerView.updatingFlagChanged())}getAttributionText(){return this._lyr3DMain?this._lyr3DMain.get_current_attribution_text().split(`|`):(this._debugLog(0,1,this._wasmNotLoaded),[])}onRenderableEvicted(e,t,n){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,n)}setMeshModifications(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;let t=this._layers.get(e);return t?this._isUpdating(t):!1}incrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount+=1)}decrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&--this._frozenLayerViewCount}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,`Lyr3DWasmPerSceneView.initializeWasm()`),this._lyr3DMainPromise||=C().then(n=>{this._lyr3DMain=n,this._lyr3DMainPromise=null;let r=this._lyr3DMain.addFunction(this._onNewJob.bind(this),`vi`),i=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),`vi`),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),`vi`),o=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),`vi`),s=this._lyr3DMain.addFunction(this._onWasmError.bind(this),`viiii`),c=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),`vi`);if(!this.view.renderSpatialReference){this._lyr3DMain=null;return}this._viewSR=this.view.renderSpatialReference?.toJSON();let l=this.view.viewingMode===`global`?6:4;l===6?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A,this._viewSR.wkt=``):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=S(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=O,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):this.view.renderSpatialReference?.wkid===32662?(this._viewSR.wkid=this._viewSR.latestWkid=k,l=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):!this._viewSR.vcsWkid&&!this._viewSR.latestVcsWkid&&(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));let u=has(`esri-lyr3D-max-concurrent-requests`)??16;if(!this._lyr3DMain.initialize_lyr3d_wasm(s,r,i,a,o,c,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),u)){this._lyr3DMain=null,this._debugLog(0,0,`Lyr3d Main WASM failed to initialize`,!1);return}if(this._workerHandle=new x(T(this.view.resourceController)),this._workerHandle.promise)return this._workerHandle.promise}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)}),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);let n=this._layers.get(e.wasmLayerId);n&&(n.needFrame=!0,n.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{e.layerView.type===`gaussian-splat-3d`&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,n){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(t.coordinates.length===0)return Promise.reject(`no coordinates for elevation query`);let r=this.view.viewingMode===`global`?m.WGS84:this._viewSR.wkid===O?m.WebMercator:m.PlateCarree,i=t.projectSync(r);i&&(t=i);let a=t.coordinates.length*2,o=this._lyr3DMain._malloc(a*8),s=new Float64Array(this._lyr3DMain.HEAPF64.buffer,o,a);for(let e=0;e<t.coordinates.length;++e){let n=t.coordinates[e];s[e*2]=n.x,s[e*2+1]=n.y}let c=n?.maxGeometricError??0,l=this._lyr3DMain.create_elevation_query(e.wasmLayerId,c,o,a);if(this._lyr3DMain._free(o),l===v)return Promise.reject(`max mesh elevation query limit exceeded`);if(l===y)return Promise.reject(`elevation query failed`);let u={wasmLayerId:e.wasmLayerId,descriptor:t,signal:n?.signal,resolveCallback:null,rejectCallback:null},d=new Promise((e,t)=>{u.resolveCallback=e,u.rejectCallback=t});return this._elevationQueries.set(l,u),d}_checkForAbortedElevationQueries(){let e=[];this._elevationQueries.forEach((t,n)=>{s(t.signal)&&(this._lyr3DMain.cancel_elevation_query(n),t.rejectCallback(o()),e.push(n))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){let t=[];this._elevationQueries.forEach((n,r)=>{n.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(r),n.rejectCallback(o()),t.push(r))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){let t=this._lyr3DMain;if(t){if(this._frozen){this._checkForAbortedElevationQueries(),this._flushPendingWasmCalls(e);return}if(this._cameraDirty){let e=this.view.state?.contentCamera;if(e){let{eye:n,center:r,up:i,near:a,far:o,fovY:s}=e,c=[e.screenViewport[2],e.screenViewport[3]],l={eye:n,center:r,up:i,near:a,far:o,fov:s,aspectRatio:e.width/e.height,viewport:c};t.set_camera_parameters(l),this._cameraDirty=!1}}if(this._cameraElevationDirty){let e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}if(this._checkForAbortedElevationQueries(),!this._pulseDeferred.value&&(this._flushPendingWasmCalls(e),e.done))return;let n=0,r=0;this._layers.forEach(e=>{n+=e.layerView.usedMemory,r+=e.layerView.cachedMemory}),n/=1048576,r/=1048576;let i=this.view.resourceController.memoryController,a=i.usedMemory*i.maxMemory-n-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,n,r,a,i.maxMemory),this._pulseDeferred.value=!1,this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange(`isTerrainReady`)),e.madeProgress(),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||!this._frozen&&(e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._pulseDeferred.value||this._lyr3DBusyCount>0)}_incrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);e.outstandingJobCount+=1,n||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);--e.outstandingJobCount,n!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){let t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){let t=this._isUpdating(e);--e.outstandingRenderableCount,t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){let n=e.shift();this._pulseDeferred.value=!0,n(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,n){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_onJobSucceeded(e,t,n){if(e.layerView.destroyed){this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n);return}let{data:r}=t;this._lyr3DMain?this._pendingJobCompleted.push(i=>{try{let e=r.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(i.HEAPU8.buffer,a,e).set(r),i.on_job_completed(n.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr?this._jobDataBufferPtr:(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e,this._jobDataBufferPtr)}_getRequestPromises(e,n,r,i){let a=[];for(let o of e){let e=new URL(o);if(i.type===`integrated-mesh-3dtiles`){if(e.origin===r.origin&&e.pathname===r.pathname){if(i.rootTileset){a.push(Promise.resolve(i.rootTileset.slice()));continue}}else i.session&&e.searchParams.set(`session`,i.session)}a.push(t(e.toString(),n).then(e=>e.data))}return a}_getInitialPromise(e,t,n,r,i,a,o){let s=this._getRequestPromises(e.urls,t,n,r);return Promise.all(s).then(e=>(i.inputs=e,this._workerHandle.invoke(i,a))).then(e=>e).catch(t=>{let n=1;return c(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&t.details?.httpStatus===400?(n=3,this._debugLog(1,2,`Session expired, trying to create new Session.`)):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:n,error:``,jobDescJson:``,data:new Uint8Array,missingInputUrls:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);let n=this._layers.get(t.layerId);if(!n)return;this._incrementJobCount(n,t);let r=n.abortController.signal,i=n.layerView.layer,a=i.type===`integrated-mesh-3dtiles`?i.key:null,o=i.type===`integrated-mesh-3dtiles`?i.session:null,s={responseType:`array-buffer`,signal:r,query:{...n.customParameters,token:n.apiKey,key:a}},l={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},u=new URL(i.url),d=e=>{if(e.status===1)this._onJobFailed(n,e,t);else if(e.status===0)this._onJobSucceeded(n,e,t);else if(e.status===2){let a=this._getRequestPromises(e.missingInputUrls,s,u,i);Promise.all(a).then(t=>{l.jobDescJson=e.jobDescJson,e.originalInputs?l.inputs=e.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(let e of t)l.inputs.push(e);return this._workerHandle.invoke(l,r)}).then(e=>{e.status===1?this._onJobFailed(n,e,t):e.status===0&&this._onJobSucceeded(n,e,t)}).catch(e=>{c(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)})}};try{let e=await this._getInitialPromise(t,s,u,i,l,r,o);e.status===3&&i.type===`integrated-mesh-3dtiles`?(o===i.session&&i.session!==null&&await i.requestRootAndSession(r),d(await this._getInitialPromise(t,s,u,i,l,r,i.session))):d(e)}catch(e){e&&this._debugLog(1,1,e.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onNewRenderable(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);n&&(this._incrementRenderableCount(n),n.layerView.createRenderable(t).then(e=>{if(this._lyr3DMain&&!n.layerView.destroyed){this._pendingRenderableCreated.push(r=>{try{let{layerId:n,handle:i}=t,a=e();r.on_renderable_created(!0,n,i,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(n)}});return}this._decrementRenderableCountIfLayerExists(n)}).catch(e=>{if(c(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),this._lyr3DMain&&!n.layerView.destroyed){this._pendingRenderableCreated.push(e=>{try{let{layerId:n,handle:r}=t;e.on_renderable_created(!1,n,r,0,0)}finally{this._decrementRenderableCountIfLayerExists(n)}});return}this._decrementRenderableCountIfLayerExists(n)}))}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_freeRenderables(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||!n)return;let r=n.layerView;for(let e=0;e<t.handles.length;++e)r.freeRenderable(t.handles[e])}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_setRenderableVisibility(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!n)return;let r=n.layerView,i=[],a=[];for(let e=0;e<t.handles.length;++e)i.push(t.handles[e]),a.push(!!(t.visibility[e]&1));r.setRenderableVisibility(i,a,t.handles.length)}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onWasmError(e,t,n,r){if(this._lyr3DMain)try{this._debugLog(n,r,this._lyr3DMain.UTF8ToString(e,t),!1)}catch{}}_onElevQueryComplete(e){try{let t=this._lyr3DMain.Emval.toValue(e),{queryId:n}=t,i=this._elevationQueries.get(n);if(!i){this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${n}.`);return}if(!t.succeeded||!t.zs)i.rejectCallback(new r(`elevation-query:error`,t?.error??`Elevation query failed`)),this._elevationQueries.delete(n);else{let{zs:e}=t,r=i.descriptor.clone();for(let t=0;t<e.length;++t)r.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${n}, number points ${e.length}.`),i.resolveCallback(r),this._elevationQueries.delete(n)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_doRemoveLayerView(e){let t=this._layers.get(e.wasmLayerId);return t?(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)),this._layers.delete(e.wasmLayerId),!0):!1}_is3DTilesIMLayerView(e){return e.layer.type===`integrated-mesh-3dtiles`}_is3DTilesIMLayer(e){return e.type===`integrated-mesh-3dtiles`}_isGaussianSplatLayerView(e){return e.layer.type===`gaussian-splat`}_isGaussianSplatLayer(e){return e.type===`gaussian-splat`}_toWasmQuality(e){switch(e){case`low`:return 1;case`medium`:return 2;case`high`:return 3}}_addLayerView(e){let t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:b};let n=t.type===`integrated-mesh-3dtiles`?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),n);if(r.errorCode!==0)return{wasmLayerId:b,check:r};let a=this._lyr3DMain.get_next_layer_id(),o=new AbortController;this._layers.set(a,{layerView:e,abortController:o,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});let s=w(t.elevationInfo),c=this._toWasmQuality(this.view?.qualityProfile),l=e=>i.getLogger(this).error(`add-spatial-reference-error`,`Error when adding SR:`,e),u=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let n=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){n=t.esriCrsSpatialReference;let r=h(n),i=1,a=1;!r&&n.wkid&&n.wkid!==-1&&(i=g.values[g[n.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(n)),r,i,a).catch(l),!this._haveAddedViewSRForNoOpPrj&&n.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==-1&&this._viewSR.vcsWkid!==n.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(l),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?u=this._lyr3DMain.add_gaussian_splat_layer(c,t.url,a,s):this._is3DTilesIMLayerView(e)&&(u=this._lyr3DMain.add_3dtiles_layer(c,t.url,a,s,e.replacesTerrain),u&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)))}return u?(this._updateWasmCamera(),this._is3DTilesIMLayerView(e)&&e.freeze&&this.incrementFrozenLayerViewCount(e),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:b})}_updateWasmCamera(){this.view.state?.contentCamera&&this._lyr3DMain&&(this._cameraDirty=!0,this._frozen||this._markAllLayerViewsUpdating())}_updateWasmCameraElevation(){this._cameraElevationDirty=!0,this._frozen||this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{let t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??``}}_cleanUpSR(e){return e?.wkid===-1&&e.latestWkid&&e.latestWkid!==-1?e.wkid=e.latestWkid:e?.latestWkid===-1&&e.wkid&&e.wkid!==-1&&(e.latestWkid=e.wkid),e?.vcsWkid===-1&&e.latestVcsWkid&&e.latestVcsWkid!==-1?e.vcsWkid=e.latestVcsWkid:e?.latestVcsWkid===-1&&e.vcsWkid&&e.vcsWkid!==-1&&(e.latestVcsWkid=e.vcsWkid),e}};e([f({constructOnly:!0})],j.prototype,`view`,void 0),e([f()],j.prototype,`updating`,null),e([f({readOnly:!0})],j.prototype,`isTerrainReady`,null),j=e([p(`esri.layers.Lyr3DWasmPerSceneView`)],j);const M=j;export{M as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import n from"../core/Accessor.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as o,isAborted as s,isAbortError as c}from"../core/promiseUtils.js";import l from"../core/ReactiveMap.js";import{watch as u}from"../core/reactiveUtils.js";import{signal as d}from"../core/signal.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import m from"../geometry/SpatialReference.js";import{isGeographic as h}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,elevQueriesFull as v,elevQueriesGenericFail as y,invalidLayerView as b}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as x}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as S}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as C}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as w}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as T}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{Yield as D}from"../views/support/Yield.js";const O=3857,k=4326,A=5773;let j=class extends n{get _frozen(){return this._frozenLayerViewCount>0}constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._frozenLayerViewCount=0,this._elevationQueries=new l,this._pendingJobCompleted=[],this._pendingJobFailed=[],this._pendingRenderableCreated=[],this._pulseDeferred=d(!1),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded=`method requiring WASM was called when WASM isn't loaded`,this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,n,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){let e=r?`[js] ${n}`:`${n}`;t===0||t===1?i.getLogger(this).error(e):t===2&&i.getLogger(this).warn(e),i.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(i.getLogger(this).level=`info`),this._debugLog(0,3,`Lyr3DWasmPerSceneView.initialize()`),this.addHandles([u(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),u(()=>this.view.state?.contentCamera.relativeElevation,()=>this._updateWasmCameraElevation()),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(E.LYR3D,this)}destroy(){this._debugLog(0,3,`Lyr3DWasmPerSceneView.destroy()`),this._lyr3DMain&&=(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(o())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;let e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),D}_hasPendingPulseWork(){return this._lyr3DMain?!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)):!1}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,`Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized`),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._is3DTilesIMLayerView(e)&&e.freeze&&this.decrementFrozenLayerViewCount(e),this._doRemoveLayerView(e);let t=this._layers.size;return t===0&&(this._debugLog(0,3,`Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying`),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_enabled(e.wasmLayerId,t),n.needMemoryUsageUpdate=!0;let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);n&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),n.needFrame=!0,n.layerView.updatingFlagChanged())}getAttributionText(){return this._lyr3DMain?this._lyr3DMain.get_current_attribution_text().split(`|`):(this._debugLog(0,1,this._wasmNotLoaded),[])}onRenderableEvicted(e,t,n){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,n)}setMeshModifications(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;let t=this._layers.get(e);return t?this._isUpdating(t):!1}incrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount+=1)}decrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&--this._frozenLayerViewCount}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,`Lyr3DWasmPerSceneView.initializeWasm()`),this._lyr3DMainPromise||=C().then(n=>{this._lyr3DMain=n,this._lyr3DMainPromise=null;let r=this._lyr3DMain.addFunction(this._onNewJob.bind(this),`vi`),i=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),`vi`),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),`vi`),o=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),`vi`),s=this._lyr3DMain.addFunction(this._onWasmError.bind(this),`viiii`),c=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),`vi`);if(!this.view.renderSpatialReference){this._lyr3DMain=null;return}this._viewSR=this.view.renderSpatialReference?.toJSON();let l=this.view.viewingMode===`global`?6:4;l===6?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A,this._viewSR.wkt=``):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=S(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=O,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):this.view.renderSpatialReference?.wkid===32662?(this._viewSR.wkid=this._viewSR.latestWkid=k,l=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):!this._viewSR.vcsWkid&&!this._viewSR.latestVcsWkid&&(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));let u=has(`esri-lyr3D-max-concurrent-requests`)??16;if(!this._lyr3DMain.initialize_lyr3d_wasm(s,r,i,a,o,c,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),u)){this._lyr3DMain=null,this._debugLog(0,0,`Lyr3d Main WASM failed to initialize`,!1);return}if(this._workerHandle=new x(T(this.view.resourceController)),this._workerHandle.promise)return this._workerHandle.promise}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)}),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);let n=this._layers.get(e.wasmLayerId);n&&(n.needFrame=!0,n.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{e.layerView.type===`gaussian-splat-3d`&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,n){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(t.coordinates.length===0)return Promise.reject(`no coordinates for elevation query`);let r=this.view.viewingMode===`global`?m.WGS84:this._viewSR.wkid===O?m.WebMercator:m.PlateCarree,i=t.projectSync(r);i&&(t=i);let a=t.coordinates.length*2,o=this._lyr3DMain._malloc(a*8),s=new Float64Array(this._lyr3DMain.HEAPF64.buffer,o,a);for(let e=0;e<t.coordinates.length;++e){let n=t.coordinates[e];s[e*2]=n.x,s[e*2+1]=n.y}let c=n?.maxGeometricError??0,l=this._lyr3DMain.create_elevation_query(e.wasmLayerId,c,o,a);if(this._lyr3DMain._free(o),l===v)return Promise.reject(`max mesh elevation query limit exceeded`);if(l===y)return Promise.reject(`elevation query failed`);let u={wasmLayerId:e.wasmLayerId,descriptor:t,signal:n?.signal,resolveCallback:null,rejectCallback:null},d=new Promise((e,t)=>{u.resolveCallback=e,u.rejectCallback=t});return this._elevationQueries.set(l,u),d}_checkForAbortedElevationQueries(){let e=[];this._elevationQueries.forEach((t,n)=>{s(t.signal)&&(this._lyr3DMain.cancel_elevation_query(n),t.rejectCallback(o()),e.push(n))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){let t=[];this._elevationQueries.forEach((n,r)=>{n.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(r),n.rejectCallback(o()),t.push(r))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){let t=this._lyr3DMain;if(t){if(this._frozen){this._checkForAbortedElevationQueries(),this._flushPendingWasmCalls(e);return}if(this._cameraDirty){let e=this.view.state?.contentCamera;if(e){let{eye:n,center:r,up:i,near:a,far:o,fovY:s}=e,c=[e.screenViewport[2],e.screenViewport[3]],l={eye:n,center:r,up:i,near:a,far:o,fov:s,aspectRatio:e.width/e.height,viewport:c};t.set_camera_parameters(l),this._cameraDirty=!1}}if(this._cameraElevationDirty){let e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}if(this._checkForAbortedElevationQueries(),!this._pulseDeferred.value&&(this._flushPendingWasmCalls(e),e.done))return;let n=0,r=0;this._layers.forEach(e=>{n+=e.layerView.usedMemory,r+=e.layerView.cachedMemory}),n/=1048576,r/=1048576;let i=this.view.resourceController.memoryController,a=i.usedMemory*i.maxMemory-n-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,n,r,a,i.maxMemory),this._pulseDeferred.value=!1,this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange(`isTerrainReady`)),e.madeProgress(),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||!this._frozen&&(e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._pulseDeferred.value||this._lyr3DBusyCount>0)}_incrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);e.outstandingJobCount+=1,n||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);--e.outstandingJobCount,n!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){let t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){let t=this._isUpdating(e);--e.outstandingRenderableCount,t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){let n=e.shift();this._pulseDeferred.value=!0,n(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,n){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_onJobSucceeded(e,t,n){if(e.layerView.destroyed){this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n);return}let{data:r}=t;this._lyr3DMain?this._pendingJobCompleted.push(i=>{try{let e=r.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(i.HEAPU8.buffer,a,e).set(r),i.on_job_completed(n.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr?this._jobDataBufferPtr:(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e,this._jobDataBufferPtr)}_getRequestPromises(e,n,r,i){let a=[];for(let o of e){let e=new URL(o);if(i.type===`integrated-mesh-3dtiles`){if(e.origin===r.origin&&e.pathname===r.pathname){if(i.rootTileset){a.push(Promise.resolve(i.rootTileset.slice()));continue}}else i.session&&e.searchParams.set(`session`,i.session)}a.push(t(e.toString(),n).then(e=>e.data))}return a}_getInitialPromise(e,t,n,r,i,a,o){let s=this._getRequestPromises(e.urls,t,n,r);return Promise.all(s).then(e=>(i.inputs=e,this._workerHandle.invoke(i,a))).then(e=>e).catch(t=>{let n=1;return c(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&t.details?.httpStatus===400?(n=3,this._debugLog(1,2,`Session expired, trying to create new Session.`)):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:n,error:``,jobDescJson:``,data:new Uint8Array,missingInputUrls:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);let n=this._layers.get(t.layerId);if(!n)return;this._incrementJobCount(n,t);let r=n.abortController.signal,i=n.layerView.layer,a=i.type===`integrated-mesh-3dtiles`?i.key:null,o=i.type===`integrated-mesh-3dtiles`?i.session:null,s={responseType:`array-buffer`,signal:r,query:{...n.customParameters,token:n.apiKey,key:a}},l={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},u=new URL(i.url),d=e=>{if(e.status===1)this._onJobFailed(n,e,t);else if(e.status===0)this._onJobSucceeded(n,e,t);else if(e.status===2){let a=this._getRequestPromises(e.missingInputUrls,s,u,i);Promise.all(a).then(t=>{l.jobDescJson=e.jobDescJson,e.originalInputs?l.inputs=e.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(let e of t)l.inputs.push(e);return this._workerHandle.invoke(l,r)}).then(e=>{e.status===1?this._onJobFailed(n,e,t):e.status===0&&this._onJobSucceeded(n,e,t)}).catch(e=>{c(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)})}};try{let e=await this._getInitialPromise(t,s,u,i,l,r,o);e.status===3&&i.type===`integrated-mesh-3dtiles`?(o===i.session&&i.session!==null&&await i.requestRootAndSession(r),d(await this._getInitialPromise(t,s,u,i,l,r,i.session))):d(e)}catch(e){e&&this._debugLog(1,1,e.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onNewRenderable(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);n&&(this._incrementRenderableCount(n),n.layerView.createRenderable(t).then(e=>{if(this._lyr3DMain&&!n.layerView.destroyed){this._pendingRenderableCreated.push(r=>{try{let{layerId:n,handle:i}=t,a=e();r.on_renderable_created(!0,n,i,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(n)}});return}this._decrementRenderableCountIfLayerExists(n)}).catch(e=>{if(c(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),this._lyr3DMain&&!n.layerView.destroyed){this._pendingRenderableCreated.push(e=>{try{let{layerId:n,handle:r}=t;e.on_renderable_created(!1,n,r,0,0)}finally{this._decrementRenderableCountIfLayerExists(n)}});return}this._decrementRenderableCountIfLayerExists(n)}))}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_freeRenderables(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||!n)return;let r=n.layerView;for(let e=0;e<t.handles.length;++e)r.freeRenderable(t.handles[e])}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_setRenderableVisibility(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!n)return;let r=n.layerView,i=[],a=[];for(let e=0;e<t.handles.length;++e)i.push(t.handles[e]),a.push(!!(t.visibility[e]&1));r.setRenderableVisibility(i,a,t.handles.length)}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onWasmError(e,t,n,r){if(this._lyr3DMain)try{this._debugLog(n,r,this._lyr3DMain.UTF8ToString(e,t),!1)}catch{}}_onElevQueryComplete(e){try{let t=this._lyr3DMain.Emval.toValue(e),{queryId:n}=t,i=this._elevationQueries.get(n);if(!i){this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${n}.`);return}if(!t.succeeded||!t.zs)i.rejectCallback(new r(`elevation-query:error`,t?.error??`Elevation query failed`)),this._elevationQueries.delete(n);else{let{zs:e}=t,r=i.descriptor.clone();for(let t=0;t<e.length;++t)r.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${n}, number points ${e.length}.`),i.resolveCallback(r),this._elevationQueries.delete(n)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_doRemoveLayerView(e){let t=this._layers.get(e.wasmLayerId);return t?(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)),this._layers.delete(e.wasmLayerId),!0):!1}_is3DTilesIMLayerView(e){return e.layer.type===`integrated-mesh-3dtiles`}_is3DTilesIMLayer(e){return e.type===`integrated-mesh-3dtiles`}_isGaussianSplatLayerView(e){return e.layer.type===`gaussian-splat`}_isGaussianSplatLayer(e){return e.type===`gaussian-splat`}_toWasmQuality(e){switch(e){case`low`:return 1;case`medium`:return 2;case`high`:return 3}}_addLayerView(e){let t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:b};let n=t.type===`integrated-mesh-3dtiles`?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),n);if(r.errorCode!==0)return{wasmLayerId:b,check:r};let a=this._lyr3DMain.get_next_layer_id(),o=new AbortController;this._layers.set(a,{layerView:e,abortController:o,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});let s=w(t.elevationInfo),c=this._toWasmQuality(this.view?.qualityProfile),l=e=>i.getLogger(this).error(`add-spatial-reference-error`,`Error when adding SR:`,e),u=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let n=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){n=t.esriCrsSpatialReference;let r=h(n),i=1,a=1;!r&&n.wkid&&n.wkid!==-1&&(i=g.values[g[n.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(n)),r,i,a).catch(l),!this._haveAddedViewSRForNoOpPrj&&n.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==-1&&this._viewSR.vcsWkid!==n.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(l),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?u=this._lyr3DMain.add_gaussian_splat_layer(c,t.url,a,s):this._is3DTilesIMLayerView(e)&&(u=this._lyr3DMain.add_3dtiles_layer(c,t.url,a,s,e.replacesTerrain),u&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)))}return u?(this._updateWasmCamera(),this._is3DTilesIMLayerView(e)&&e.freeze&&this.incrementFrozenLayerViewCount(e),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:b})}_updateWasmCamera(){this.view.state?.contentCamera&&this._lyr3DMain&&(this._cameraDirty=!0,this._frozen||this._markAllLayerViewsUpdating())}_updateWasmCameraElevation(){this._cameraElevationDirty=!0,this._frozen||this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{let t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??``}}_cleanUpSR(e){return e?.wkid===-1&&e.latestWkid&&e.latestWkid!==-1?e.wkid=e.latestWkid:e?.latestWkid===-1&&e.wkid&&e.wkid!==-1&&(e.latestWkid=e.wkid),e?.vcsWkid===-1&&e.latestVcsWkid&&e.latestVcsWkid!==-1?e.vcsWkid=e.latestVcsWkid:e?.latestVcsWkid===-1&&e.vcsWkid&&e.vcsWkid!==-1&&(e.latestVcsWkid=e.vcsWkid),e}};e([f({constructOnly:!0})],j.prototype,`view`,void 0),e([f()],j.prototype,`updating`,null),e([f({readOnly:!0})],j.prototype,`isTerrainReady`,null),j=e([p(`esri.layers.Lyr3DWasmPerSceneView`)],j);const M=j;export{M as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.150",
3
+ "version": "5.2.0-next.151",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.20.8",
23
- "@arcgis/toolkit": "5.2.0-next.150",
23
+ "@arcgis/toolkit": "5.2.0-next.151",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0-next.89",
26
26
  "@vaadin/grid": "~25.3.2",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as n}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{ClipMesh as i}from"../../engine/webgl/ClipMesh.js";import{effectFlag0 as a,filterFlag0 as o}from"../../engine/webgl/definitions.js";import s from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as c}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as l}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";import{createHittestQuery as f}from"../../support/hitTestUtils.js";import p from"../../../layers/support/Path.js";class m{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class h{constructor(e){this.level=e,this.id=performance.now(),this.messages=[]}}class g{constructor(e,t){this.id=e,this.version=t}}class _ extends r{constructor(e){super(e.view.featuresTilingScheme),this.referenceScale=null,this._updatingChildren=n(!1),this._hitTestsRequests=[],this._firstDrawTime=null,this._renderState=n(null),this._renderStateNext=n(null),this._store=new s,this._subscriptions=new Map,this._presentation=new l,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has(`featurelayer-strict-draw-order`)?1:has(`featurelayer-force-marker-text-draw-order`)?2:0}get firstDrawTime(){return this._firstDrawTime}get updating(){let e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,n=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||n||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return this.labelSchema!==null}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e+=this.labelStore.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw Error(`InternalError: DeconflictionInfo not defined. Was update called?`);return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(this._instanceStore==null||!(e.drawPhase&c.heatmap.drawPhase))return null;for(let e of this._instanceStore.values())if(v(e))return e;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){let e=new Set;for(let t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(let t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(let e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this.labelStore.upload(e.context),this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 8:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&this._schema?.mesh.factory.symbology.type!==`dictionary`,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,n){return this._updateResolver=new m({schema:e,deconflictionInfo:t,invalidateMesh:n}),this.requestRender(),e.mesh.factory.referenceScale&&(this.referenceScale=e.mesh.factory.referenceScale),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e)}updateSubscriptions(e){for(let{tileId:t,version:n}of e.subscribe){if(!this._subscriptions.has(t)){let e=new g(t,n);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=n}for(let t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){let t=this.attributeView.getFilterFlags(e),n=t&o,r=this._layerView.featureEffectView.featureEffect==null||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&a;return!(n&&r)}getDisplayStatistics(e,t){let n=this._statisticsByLevel.get(e);return n?n.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates){this._updateStatisticsRequests.push({level:e,statistics:t});return}let n=this._statisticsByLevel.get(e);n||(n=new Map,this._statisticsByLevel.set(e,n));for(let e of t)n.set(e.fieldName,{minValue:e.minValue,maxValue:e.maxValue})}beginLevelMeshUpdate(e){if(this._pendingLevelUpdate!=null)throw Error(`InternalError: Pending level mesh update in progress`);return this._pendingLevelUpdate=new h(e),has(`esri-2d-update-debug`)&&console.debug(`FeatureContainer.beginLevelMeshUpdate(level=${e}, id=${this._pendingLevelUpdate.id})`),this._pendingLevelUpdate.id}applyLevelMeshUpdate(e){if(this._pendingLevelUpdate==null)throw Error(`InternalError: No level mesh update to apply`);if(this._pendingLevelUpdate.id!==e)throw Error(`InternalError: Unexpected id`);if(has(`esri-2d-update-debug`)){let{id:e,level:t}=this._pendingLevelUpdate;console.debug(`FeatureContainer.applyLevelMeshUpdate(level=${t}, id=${e})`)}let{level:t,messages:n}=this._pendingLevelUpdate,r=this._renderStateNext.value??this._renderState.value;if(!r)throw Error(`InternalError: No renderState defined`);r.enqueueLevelReplace(t,n),this._pendingLevelUpdate=null,this.requestRender()}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&=(this.attributeView.unlockTextureUploads()&&this.hasLabels&&this.requestDeclutter(),!1),this._lockStatisticUpdates=!1;for(let e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw Error(`InternalError: renderStateNext already exists`);has(`esri-2d-update-debug`)&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this.tilingScheme,this.labelStore)}async swapRenderState(){if(!this._renderStateNext.value)throw Error(`InternalError: renderStateNext not yet created`);if(this._renderStateSwapResolver)throw Error(`InternalError: renderState swap already in progress`);this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,n){if(t(n),this._pendingLevelUpdate){this._pendingLevelUpdate.messages.push(e);return}return this._applyMessage(e)}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}async hitTest(e,t){let n=f(e,t);if(!n)return console.warn(`Unexpected hittest input:`,e),{trueHitIds:[],candidateHitIds:[]};let r=this._hitTestsRequests.find(({query:e})=>n.hittestType===e.hittestType&&n.input===e.input&&n.options===e.options),a=Promise.withResolvers();if(r)r.resolvers.push(a);else{if(n.hittestType===`polygon`&&(n.polygonMesh=await i.create(new p({path:[n.input.map(e=>[e.x,e.y])]})),!n.polygonMesh))return a.resolve({trueHitIds:[],candidateHitIds:[]}),a.promise;this._hitTestsRequests.push({query:n,resolvers:[a]})}return this.requestRender(),a.promise}getSortKeys(e){let t=new Set(e),n=new Map;for(let e of this.children)if(e.getSortKeys(t).forEach((e,t)=>n.set(t,e)),n.size===t.size)break;return n}get hasAnimation(){return this.hasLabels}doRender(e){let{minScale:t,maxScale:n}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=n&&super.doRender(e)}setStencilReference(e){if(this._getHeatmapInstance(e)!=null){for(let e of this.children)e.stencilRef=c.heatmap.getStencilReference(e);return}super.setStencilReference(e)}createRenderParams(e){let t=super.createRenderParams(e);return t.referenceScale=this.referenceScale,t}_applyMessage(e){let t=e.inner;if(!this._subscriptions.has(t.id))return;let n=this._subscriptions.get(t.id);if(n.version!==t.subscriptionVesrion){if(has(`esri-2d-update-debug`)){let e=`${t.subscriptionVesrion} != ${n.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}let r=this._renderStateNext.value??this._renderState.value;if(!r)throw Error(`InternalError: No renderState defined`);r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.enqueueUpdate(e),this.requestRender()}_finializeUpdate(){if(!this._updateResolver)return;let{schema:e,deconflictionInfo:t,invalidateMesh:n}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads()&&this.hasLabels&&this.requestDeclutter(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),n&&(this.restartAllAnimations(),this.swapRenderState());let r=e.mesh.factory.symbology.type===`heatmap`?`target-defer`:`eager`;this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has(`esri-2d-update-debug`)&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);let e=this._renderState.value,t=new Set,n=new Set;for(let r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&n.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(let e of this._renderState.value.tiles())t.has(e.id)&&(e.decluttering=!0),n.has(e.id)&&(e.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&d(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){let t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){let t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){let t=e.painter.effects.hittest,n=this._hitTestsRequests.shift(),r=n.query.hittestType;t.prepareResources(e,r),t.render(e,n,e=>{let r=t.getHittestableTiles(e,this.children,n.query);for(let t of r)this._renderTile(t,e,0)}),r===`polygon`&&n.query.polygonMesh&&n.query.polygonMesh.destroy(),t.readback(e,n)}_renderFeatures(e,t){let n=this._getHeatmapInstance(e);n==null?this._renderGeometryFeatures(e,t):this._renderHeatmapFeatures(e,t,n)}_renderGeometryFeatures(e,t){for(let n of this.children)n.visible&&this._renderTile(n,e,t)}_renderHeatmapFeatures(e,t,n){for(let n of this.children)n.visible&&this._renderTile(n,e,t,19);n.techniqueRef.renderResolvePass(e,n)}_renderTile(e,t,n,r){t.selection=n;let i=e.getDisplayList()?.render(t,r)??!1;this._firstDrawTime==null&&i&&t.drawPhase===1&&(this._firstDrawTime=performance.now(),this._layerView.emitFirstDraw(this._firstDrawTime))}}function v(e){return e.techniqueRef.type===19}export{_ as FeatureContainer};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as n}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{ClipMesh as i}from"../../engine/webgl/ClipMesh.js";import{effectFlag0 as a,filterFlag0 as o}from"../../engine/webgl/definitions.js";import s from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as c}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as l}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";import{createHittestQuery as f}from"../../support/hitTestUtils.js";import p from"../../../layers/support/Path.js";class m{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class h{constructor(e){this.level=e,this.id=performance.now(),this.messages=[]}}class g{constructor(e,t){this.id=e,this.version=t}}class _ extends r{constructor(e){super(e.view.featuresTilingScheme),this.referenceScale=null,this._updatingChildren=n(!1),this._hitTestsRequests=[],this._firstDrawTime=null,this._renderState=n(null),this._renderStateNext=n(null),this._store=new s,this._subscriptions=new Map,this._presentation=new l,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){this.removeAllChildren(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value),super.destroy()}get batching(){return has(`featurelayer-strict-draw-order`)?1:has(`featurelayer-force-marker-text-draw-order`)?2:0}get firstDrawTime(){return this._firstDrawTime}get updating(){let e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,n=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||n||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return this.labelSchema!==null}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e+=this.labelStore.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw Error(`InternalError: DeconflictionInfo not defined. Was update called?`);return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(this._instanceStore==null||!(e.drawPhase&c.heatmap.drawPhase))return null;for(let e of this._instanceStore.values())if(v(e))return e;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){let e=new Set;for(let t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(let t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(let e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this.labelStore.upload(e.context),this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 8:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&this._schema?.mesh.factory.symbology.type!==`dictionary`,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,n){return this._updateResolver=new m({schema:e,deconflictionInfo:t,invalidateMesh:n}),this.requestRender(),e.mesh.factory.referenceScale&&(this.referenceScale=e.mesh.factory.referenceScale),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e)}updateSubscriptions(e){for(let{tileId:t,version:n}of e.subscribe){if(!this._subscriptions.has(t)){let e=new g(t,n);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=n}for(let t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){let t=this.attributeView.getFilterFlags(e),n=t&o,r=this._layerView.featureEffectView.featureEffect==null||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&a;return!(n&&r)}getDisplayStatistics(e,t){let n=this._statisticsByLevel.get(e);return n?n.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates){this._updateStatisticsRequests.push({level:e,statistics:t});return}let n=this._statisticsByLevel.get(e);n||(n=new Map,this._statisticsByLevel.set(e,n));for(let e of t)n.set(e.fieldName,{minValue:e.minValue,maxValue:e.maxValue})}beginLevelMeshUpdate(e){if(this._pendingLevelUpdate!=null)throw Error(`InternalError: Pending level mesh update in progress`);return this._pendingLevelUpdate=new h(e),has(`esri-2d-update-debug`)&&console.debug(`FeatureContainer.beginLevelMeshUpdate(level=${e}, id=${this._pendingLevelUpdate.id})`),this._pendingLevelUpdate.id}applyLevelMeshUpdate(e){if(this._pendingLevelUpdate==null)throw Error(`InternalError: No level mesh update to apply`);if(this._pendingLevelUpdate.id!==e)throw Error(`InternalError: Unexpected id`);if(has(`esri-2d-update-debug`)){let{id:e,level:t}=this._pendingLevelUpdate;console.debug(`FeatureContainer.applyLevelMeshUpdate(level=${t}, id=${e})`)}let{level:t,messages:n}=this._pendingLevelUpdate,r=this._renderStateNext.value??this._renderState.value;if(!r)throw Error(`InternalError: No renderState defined`);r.enqueueLevelReplace(t,n),this._pendingLevelUpdate=null,this.requestRender()}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&=(this.attributeView.unlockTextureUploads()&&this.hasLabels&&this.requestDeclutter(),!1),this._lockStatisticUpdates=!1;for(let e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw Error(`InternalError: renderStateNext already exists`);has(`esri-2d-update-debug`)&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this.tilingScheme,this.labelStore)}async swapRenderState(){if(!this._renderStateNext.value)throw Error(`InternalError: renderStateNext not yet created`);if(this._renderStateSwapResolver)throw Error(`InternalError: renderState swap already in progress`);this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,n){if(t(n),this._pendingLevelUpdate){this._pendingLevelUpdate.messages.push(e);return}return this._applyMessage(e)}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}async hitTest(e,t){let n=f(e,t);if(!n)return console.warn(`Unexpected hittest input:`,e),{trueHitIds:[],candidateHitIds:[]};let r=this._hitTestsRequests.find(({query:e})=>n.hittestType===e.hittestType&&n.input===e.input&&n.options===e.options),a=Promise.withResolvers();if(r)r.resolvers.push(a);else{if(n.hittestType===`polygon`&&(n.polygonMesh=await i.create(new p({path:[n.input.map(e=>[e.x,e.y])]})),!n.polygonMesh))return a.resolve({trueHitIds:[],candidateHitIds:[]}),a.promise;this._hitTestsRequests.push({query:n,resolvers:[a]})}return this.requestRender(),a.promise}getSortKeys(e){let t=new Set(e),n=new Map;for(let e of this.children)if(e.getSortKeys(t).forEach((e,t)=>n.set(t,e)),n.size===t.size)break;return n}get hasAnimation(){return this.hasLabels}doRender(e){let{minScale:t,maxScale:n}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=n&&super.doRender(e)}setStencilReference(e){if(this._getHeatmapInstance(e)!=null){for(let e of this.children)e.stencilRef=c.heatmap.getStencilReference(e);return}super.setStencilReference(e)}createRenderParams(e){let t=super.createRenderParams(e);return t.referenceScale=this.referenceScale,t}_applyMessage(e){let t=e.inner;if(!this._subscriptions.has(t.id))return;let n=this._subscriptions.get(t.id);if(n.version!==t.subscriptionVesrion){if(has(`esri-2d-update-debug`)){let e=`${t.subscriptionVesrion} != ${n.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}let r=this._renderStateNext.value??this._renderState.value;if(!r)throw Error(`InternalError: No renderState defined`);r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.enqueueUpdate(e),this.requestRender()}_finializeUpdate(){if(!this._updateResolver)return;let{schema:e,deconflictionInfo:t,invalidateMesh:n}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads()&&this.hasLabels&&this.requestDeclutter(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),n&&(this.restartAllAnimations(),this.swapRenderState());let r=e.mesh.factory.symbology.type===`heatmap`?`target-defer`:`eager`;this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has(`esri-2d-update-debug`)&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);let e=this._renderState.value,t=new Set,n=new Set;for(let r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&n.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(let e of this._renderState.value.tiles())t.has(e.id)&&(e.decluttering=!0),n.has(e.id)&&(e.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&d(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){let t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){let t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){let t=e.painter.effects.hittest,n=this._hitTestsRequests.shift(),r=n.query.hittestType;t.prepareResources(e,r),t.render(e,n,e=>{let r=t.getHittestableTiles(e,this.children,n.query);for(let t of r)this._renderTile(t,e,0)}),r===`polygon`&&n.query.polygonMesh&&n.query.polygonMesh.destroy(),t.readback(e,n)}_renderFeatures(e,t){let n=this._getHeatmapInstance(e);n==null?this._renderGeometryFeatures(e,t):this._renderHeatmapFeatures(e,t,n)}_renderGeometryFeatures(e,t){for(let n of this.children)n.visible&&this._renderTile(n,e,t)}_renderHeatmapFeatures(e,t,n){for(let n of this.children)n.visible&&this._renderTile(n,e,t,19);n.techniqueRef.renderResolvePass(e,n)}_renderTile(e,t,n,r){t.selection=n;let i=e.getDisplayList()?.render(t,r)??!1;this._firstDrawTime==null&&i&&t.drawPhase===1&&(this._firstDrawTime=performance.now(),this._layerView.emitFirstDraw(this._firstDrawTime))}}function v(e){return e.techniqueRef.type===19}export{_ as FeatureContainer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../../core/Logger.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{TrackLevelState as n}from"./TrackLevelState.js";import{TrackSendState as r}from"./TrackSendState.js";import{FeatureMetadata as i}from"../../support/FeatureMetadata.js";const a=()=>e.getLogger(`esri.views.2d.layers.features.processor.TrackStrategy`);class o{constructor(e,n,r,a,o,s,c,l){let u=n.metadata.weakCloneWithAdditionalFields([{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`}]),d=i.createFeature({geometryType:`esriGeometryPolyline`,featureIdInfo:{type:`object-id`,fieldName:`aggregateId`},fieldsIndex:{fields:[...n.metadata.fieldsIndex.fields,...o,{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`},{name:`aggregateId`,alias:`aggregateId`,type:`esriFieldTypeOID`}],timeZoneByFieldName:null},globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:n.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1});this.metadata=u,this._trackContext={schema:e,source:n,attributeStore:r,spatialReference:a,metadata:u,trackLineMetadata:d,aggregateFields:o,arcadeContextInfo:c,sqlOptions:l,featureFilter:s,isStream:n.isStream}}createSendState(e){return new r(e)}createLevelState(e){return new n(e.level,this._trackContext)}async applyOverrideUpdate(e,t){return a().error(`Applying override to tracks is not supported`),null}afterUpdateLevelState(e,t,n){}}export{o as TrackAdapter};
2
+ import e from"../../../../../../core/Logger.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{TrackLevelState as n}from"./TrackLevelState.js";import{TrackSendState as r}from"./TrackSendState.js";import{FeatureMetadata as i}from"../../support/FeatureMetadata.js";const a=()=>e.getLogger(`esri.views.2d.layers.features.processor.TrackStrategy`);class o{constructor(e,n,r,a,o,s,c,l){let u=n.metadata.weakCloneWithAdditionalFields([{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`}]),d=n.metadata.fieldsIndex.toJSON();d.fields.push(...o,{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`},{name:`aggregateId`,alias:`aggregateId`,type:`esriFieldTypeOID`});let f=i.createFeature({geometryType:`esriGeometryPolyline`,featureIdInfo:{type:`object-id`,fieldName:`aggregateId`},fieldsIndex:d,globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:n.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1});this.metadata=u,this._trackContext={schema:e,source:n,attributeStore:r,spatialReference:a,metadata:u,trackLineMetadata:f,aggregateFields:o,arcadeContextInfo:c,sqlOptions:l,featureFilter:s,isStream:n.isStream}}createSendState(e){return new r(e)}createLevelState(e){return new n(e.level,this._trackContext)}async applyOverrideUpdate(e,t){return a().error(`Applying override to tracks is not supported`),null}afterUpdateLevelState(e,t,n){}}export{o as TrackAdapter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class n{static minimal(e,r,i=[],a=!1,o=!1){return new n({geometryType:e,hasZ:a,hasM:o,fieldsIndex:new t(i).toJSON(),featureIdInfo:{type:`object-id`,fieldName:r},subtypes:null,subtypeField:null,types:null,globalIdField:null,spatialReference:null,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,layerType:void 0})}static createFeature(e){return new n(e)}constructor(n){this._options=n,this._fieldsIndex=t.fromJSON(n.fieldsIndex),n.spatialReference&&(this._spatialReference=n.spatialReference instanceof e?n.spatialReference:e.fromJSON(n.spatialReference)),n.outSpatialReference&&(this._outSpatialReference=n.outSpatialReference instanceof e?n.outSpatialReference:e.fromJSON(n.outSpatialReference)),n.attributeSpatialReference&&(this._attributeSpatialReference=n.attributeSpatialReference instanceof e?n.attributeSpatialReference:e.fromJSON(n.attributeSpatialReference));let r;n.featureIdInfo.type===`object-id`&&(r=n.featureIdInfo.fieldName),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:r,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0,datesInUnknownTimezone:this._options.timeReferenceUnknownClient??void 0,dateFieldsTimeZone:this._options.dateFieldsTimeZone??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType===`esriGeometryMultiPatch`?`esriGeometryPolygon`:this._options.geometryType}get hasZ(){return this._options.hasZ}get hasM(){return this._options.hasM}get serviceGeometryType(){return this._options.geometryType}get subtypeField(){return this._options.subtypeField}get timeInfo(){return this._options.timeInfo}get featureIdInfo(){return this._options.featureIdInfo}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get outSpatialReference(){return this._outSpatialReference}get attributeSpatialReference(){return this._attributeSpatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}get layerType(){return this._options.layerType}weakCloneWithAdditionalFields(e){return new n({fieldsIndex:{fields:[...this._fieldsIndex.fields,...e],timeZoneByFieldName:null},geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.spatialReference,attributeSpatialReference:this.attributeSpatialReference,outSpatialReference:this.outSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types,layerType:this._options.layerType})}weakCloneWithResolvedSpatialReference(){return new n({fieldsIndex:{fields:this._fieldsIndex.fields,timeZoneByFieldName:null},geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.outSpatialReference,outSpatialReference:this.outSpatialReference,attributeSpatialReference:this.attributeSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types,layerType:this._options.layerType})}}class r extends n{static createGraphics(e){return new r({fieldsIndex:new t().toJSON(),featureIdInfo:{type:`object-id`,fieldName:`uid`},geometryType:null,hasZ:!1,hasM:!1,spatialReference:e,outSpatialReference:e,attributeSpatialReference:null,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,layerType:null})}}export{n as FeatureMetadata,r as GraphicsMetadata};
2
+ import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class n{static minimal(e,r,i=[],a=!1,o=!1){return new n({geometryType:e,hasZ:a,hasM:o,fieldsIndex:new t(i).toJSON(),featureIdInfo:{type:`object-id`,fieldName:r},subtypes:null,subtypeField:null,types:null,globalIdField:null,spatialReference:null,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,layerType:void 0})}static createFeature(e){return new n(e)}constructor(n){this._options=n,this._fieldsIndex=t.fromJSON(n.fieldsIndex),n.spatialReference&&(this._spatialReference=n.spatialReference instanceof e?n.spatialReference:e.fromJSON(n.spatialReference)),n.outSpatialReference&&(this._outSpatialReference=n.outSpatialReference instanceof e?n.outSpatialReference:e.fromJSON(n.outSpatialReference)),n.attributeSpatialReference&&(this._attributeSpatialReference=n.attributeSpatialReference instanceof e?n.attributeSpatialReference:e.fromJSON(n.attributeSpatialReference));let r;n.featureIdInfo.type===`object-id`&&(r=n.featureIdInfo.fieldName),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:r,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0,datesInUnknownTimezone:this._options.timeReferenceUnknownClient??void 0,dateFieldsTimeZone:this._options.dateFieldsTimeZone??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType===`esriGeometryMultiPatch`?`esriGeometryPolygon`:this._options.geometryType}get hasZ(){return this._options.hasZ}get hasM(){return this._options.hasM}get serviceGeometryType(){return this._options.geometryType}get subtypeField(){return this._options.subtypeField}get timeInfo(){return this._options.timeInfo}get featureIdInfo(){return this._options.featureIdInfo}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get outSpatialReference(){return this._outSpatialReference}get attributeSpatialReference(){return this._attributeSpatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}get layerType(){return this._options.layerType}weakCloneWithAdditionalFields(e){let t=this._fieldsIndex.toJSON();return t.fields.push(...e),new n({fieldsIndex:t,geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.spatialReference,attributeSpatialReference:this.attributeSpatialReference,outSpatialReference:this.outSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types,layerType:this._options.layerType})}weakCloneWithResolvedSpatialReference(){return new n({fieldsIndex:this._fieldsIndex.toJSON(),geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.outSpatialReference,outSpatialReference:this.outSpatialReference,attributeSpatialReference:this.attributeSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types,layerType:this._options.layerType})}}class r extends n{static createGraphics(e){return new r({fieldsIndex:new t().toJSON(),featureIdInfo:{type:`object-id`,fieldName:`uid`},geometryType:null,hasZ:!1,hasM:!1,spatialReference:e,outSpatialReference:e,attributeSpatialReference:null,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,layerType:null})}}export{n as FeatureMetadata,r as GraphicsMetadata};
@@ -20,12 +20,13 @@ export interface DOMContainerProperties extends Partial<Pick<DOMContainer, "aria
20
20
  */
21
21
  container?: HTMLDivElement | string | null;
22
22
  /**
23
- * Enables the keyboard shortcut for showing the focus region. Applications should enable
24
- * this only when they handle focus-region selection. When false, the shortcut does not change
25
- * focus-region visibility.
23
+ * Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
26
24
  *
27
25
  * @default false
28
26
  * @since 5.2
27
+ * @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
28
+ * @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
29
+ * @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
29
30
  */
30
31
  focusRegionShortcutEnabled?: boolean;
31
32
  /**
@@ -142,12 +143,13 @@ export abstract class DOMContainer {
142
143
  */
143
144
  get focusRegion(): ScreenRect | null;
144
145
  /**
145
- * Enables the keyboard shortcut for showing the focus region. Applications should enable
146
- * this only when they handle focus-region selection. When false, the shortcut does not change
147
- * focus-region visibility.
146
+ * Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
148
147
  *
149
148
  * @default false
150
149
  * @since 5.2
150
+ * @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
151
+ * @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
152
+ * @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
151
153
  */
152
154
  accessor focusRegionShortcutEnabled: boolean;
153
155
  /**
@@ -12,12 +12,13 @@ import type { NavigationProperties } from "./navigation/Navigation.js";
12
12
 
13
13
  export interface VideoViewProperties extends DOMContainerProperties, Partial<Pick<VideoView, "layer" | "map" | "operationalDataVisible" | "scale">> {
14
14
  /**
15
- * Enables the keyboard shortcut for showing the focus region. Applications should enable
16
- * this only when they handle focus-region selection. When false, the shortcut does not change
17
- * focus-region visibility.
15
+ * Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [DOMContainer.focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
18
16
  *
19
17
  * @internal
20
18
  * @since 5.2
19
+ * @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
20
+ * @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
21
+ * @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
21
22
  */
22
23
  focusRegionShortcutEnabled?: boolean;
23
24
  /**
@@ -96,12 +97,13 @@ export default class VideoView extends VideoViewSuperclass {
96
97
  */
97
98
  get focusRegion(): ScreenRect | null;
98
99
  /**
99
- * Enables the keyboard shortcut for showing the focus region. Applications should enable
100
- * this only when they handle focus-region selection. When false, the shortcut does not change
101
- * focus-region visibility.
100
+ * Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [DOMContainer.focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
102
101
  *
103
102
  * @internal
104
103
  * @since 5.2
104
+ * @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
105
+ * @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
106
+ * @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
105
107
  */
106
108
  accessor focusRegionShortcutEnabled: boolean;
107
109
  /**
package/views/View.d.ts CHANGED
@@ -421,12 +421,13 @@ export default abstract class View<TLayerView extends LayerView = LayerView> ext
421
421
  */
422
422
  get focusRegion(): ScreenRect | null;
423
423
  /**
424
- * Enables the keyboard shortcut for showing the focus region. Applications should enable
425
- * this only when they handle focus-region selection. When false, the shortcut does not change
426
- * focus-region visibility.
424
+ * Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionVisible) property.
427
425
  *
428
426
  * @default false
429
427
  * @since 5.2
428
+ * @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion)
429
+ * @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionVisible)
430
+ * @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
430
431
  */
431
432
  accessor focusRegionShortcutEnabled: boolean;
432
433
  /**