@arcgis/core 4.33.0-next.20250512 → 4.33.0-next.20250513

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0766ecb677d667e5fb83.js.LICENSE.txt +1 -1
  3. package/assets/esri/core/workers/chunks/0f57b6a3a85a47ebd9d0.js +346 -0
  4. package/assets/esri/core/workers/chunks/218a66d53f7cf4f285aa.js.LICENSE.txt +1 -1
  5. package/assets/esri/core/workers/chunks/{a5e746e10239a3bfe237.js → 30f3014c0ac6e2bc14bf.js} +1 -1
  6. package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js.LICENSE.txt +1 -1
  7. package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
  8. package/assets/esri/core/workers/chunks/90ae15ce22a49bd84876.js.LICENSE.txt +1 -1
  9. package/assets/esri/core/workers/chunks/{fbcd94f60f92257a7303.js → aa82925ffb00babb0543.js} +2 -2
  10. package/assets/esri/core/workers/chunks/{fbcd94f60f92257a7303.js.LICENSE.txt → aa82925ffb00babb0543.js.LICENSE.txt} +1 -1
  11. package/assets/esri/core/workers/chunks/b4f38fe9cc948a39ad87.js.LICENSE.txt +1 -1
  12. package/assets/esri/core/workers/chunks/{0aca29f7156b2b412f2e.js → d1f7bfb8daf11ecada9f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js.LICENSE.txt +1 -1
  14. package/assets/esri/core/workers/chunks/e9b1349a2b3a3f300808.js +1 -0
  15. package/assets/esri/core/workers/chunks/{a8b42d8c0b76c234c09f.js → fef1a5f8a6fd3502b33b.js} +56 -57
  16. package/assets/esri/themes/base/widgets/_FeatureTable.scss +4 -0
  17. package/assets/esri/themes/dark/main.css +1 -1
  18. package/assets/esri/themes/light/main.css +1 -1
  19. package/assets/esri/themes/light/view.css +1 -1
  20. package/chunks/LineSeries.js +1 -1
  21. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  22. package/chunks/ShadowHighlight.glsl.js +5 -5
  23. package/chunks/Theme.js +1 -1
  24. package/chunks/Tick.js +1 -1
  25. package/interfaces.d.ts +114 -11
  26. package/layers/VideoLayer.js +1 -1
  27. package/layers/knowledgeGraph/supportUtils.js +1 -1
  28. package/layers/video/VideoController.js +1 -1
  29. package/package.json +3 -4
  30. package/support/revision.js +1 -1
  31. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  32. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  33. package/views/3d/layers/SceneLayerView3D.js +1 -1
  34. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  35. package/views/3d/layers/graphics/pipeline/FeatureProcessingContext.js +1 -1
  36. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  37. package/views/3d/layers/graphics/pipeline/TileLocks.js +5 -0
  38. package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
  39. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +1 -1
  40. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  41. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  42. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  43. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -27
  44. package/views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js +29 -0
  45. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  46. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  47. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  48. package/views/SceneView.js +1 -1
  49. package/views/View.js +1 -1
  50. package/views/analysis/analysisViewUtils.js +1 -1
  51. package/views/support/LayerViewManager.js +1 -1
  52. package/webscene/Slide.js +1 -1
  53. package/widgets/Editor/Edits.js +1 -1
  54. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  55. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  56. package/widgets/Editor/support/SketchController.js +1 -1
  57. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  58. package/widgets/FeatureTable/Grid/Column.js +1 -1
  59. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  60. package/widgets/Slice/SliceViewModel.js +1 -1
  61. package/widgets/Slice.js +1 -1
  62. package/widgets/support/iconUtils.js +1 -1
  63. package/assets/esri/core/workers/chunks/83d6a1b3db7d364d156b.js +0 -1
  64. package/assets/esri/core/workers/chunks/92cbe9af8a6c061bfb57.js +0 -346
  65. package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250512",
3
+ "version": "4.33.0-next.20250513",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -27,9 +27,8 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
29
  "@esri/calcite-components": "^3.2.0-next.15",
30
- "@petamoriken/float16": "~3.9.2",
31
- "@vaadin/grid": "~24.7.5",
32
- "@zip.js/zip.js": "~2.7.60",
30
+ "@vaadin/grid": "~24.7.6",
31
+ "@zip.js/zip.js": "~2.7.61",
33
32
  "luxon": "~3.6.1",
34
33
  "marked": "~15.0.11"
35
34
  },
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const d="20250512",a="d172edfc7a2f54d477d227286a9ae9d78ba55687";export{d as buildDate,a as commitHash};
5
+ const d="20250513",e="df6d6990d5716d44fb964e1638a5c63b4058a92e";export{d as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,when as l,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{createScreenPoint as p,screenPointObjectToArray as u}from"../../../../core/screenUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as _,fromScaling as v,multiply as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{e as y,l as m,c as w,g,f,t as M,n as D,i as V}from"../../../../chunks/vec32.js";import{create as b,clone as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as E,ZEROS as k}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{d as S,a as x,n as j,f as H}from"../../../../chunks/boundedPlane.js";import{signedDistance as C,create as R,intersectRay as O,getNormal as I}from"../../../../geometry/support/plane.js";import{create as z}from"../../../../geometry/support/ray.js";import{sv3d as G,sm4d as L,sv2d as U}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as A,getTiltRotateTexture as K}from"../images/Factory.js";import{ResizeManipulator as B}from"./ResizeManipulator.js";import{RotateManipulator as F}from"./RotateManipulator.js";import{getOutlineColor as N,planeColor as q}from"./settings.js";import{ShiftManipulator as Z,OffsetMode as W}from"./ShiftManipulator.js";import{pointerMoveTimerMs as J,planePreviewOutlineWidth as Q,forceVerticalModifier as X,forceHorizontalModifier as Y,previewFadeDurationSeconds as $,previewFadeDotThreshold as tt,initialDepthOffsetFrac as et}from"./sliceToolConfig.js";import{createGridVisualElement as it,createOutlineVisualElement as at,planeToShape as st,createRotatePlane as nt,RotationAxis as rt,resizePlane as lt,calculatePlaneHalfSize as ot,SliceOrientation as ht,createPlane as pt,DidPointerMoveRecentlyFlag as ut,calculateBoundedPlaneTranslateRotate as ct,updateShiftRestartHandle as dt,updateRotateHeadingHandle as _t,updateRotateTiltHandle as vt,updateResizeHandle as Pt,createShiftPlane as yt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as mt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as gt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as ft}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Mt}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Dt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Vt}from"../../../support/screenUtils.js";var bt;let Tt=class extends ft{static{bt=this}constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=J,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=S(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=p(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Dt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new Z(this.view,W.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new F(this.view,((t,e)=>A(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new F(this.view,((t,e)=>K(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new B(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=it(this.view),this._previewPlaneOutlineVisualElement=at(this.view),this._previewPlaneOutlineVisualElement.width=Q,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r)),this.addHandles([l((()=>"sliced"===this.state),(()=>{this.finishToolCreation(),this.stop()}),o),n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}static{this.disableEngineLayers=!1}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}stop(){this.active&&(this.view.activeTool=null)}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.stop())}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!kt(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!kt(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!kt(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Vt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Vt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Vt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Vt(t),a=S();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=gt(this.view.state.camera,i,xt);this.inputState=Et(e,t.pointerId,a.origin,a)}return x(a,this._startPlane),this.analysis.shape=st(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Vt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===X||t.key===Y)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==X&&t.key!==Y||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=gt(this.view.state.camera,t.screenPoint,xt);x(this.analysisViewData.plane,this._startPlane),this.inputState=Et(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(y(j(this.analysisViewData.plane),e.ray.direction)/m(e.ray.direction)))/i,1),s=-C(this._startPlane.plane,e.renderEnd),n=-C(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=w(G.get(),this._startPlane.origin),i=w(G.get(),j(this._startPlane));g(i,i,-t.depth),f(i,i,e);const a=H(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,S());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.HEADING,R()),i=gt(this.view.state.camera,t.screenPoint,xt),a=b();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.TILT,R()),i=gt(this.view.state.camera,t.screenPoint,xt),a=b();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=I(t.rotatePlane),a=mt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=_(L.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=M(G.get(),this._startPlane.basis1,e),a=M(G.get(),this._startPlane.basis2,e),s=H(this.analysisViewData.plane.origin,i,a,S());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=gt(this.view.state.camera,t.screenPoint,xt),a=G.get();O(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:T(a)})}_createResizeDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=x(this.analysisViewData.plane,S());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=lt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:S();if(i=null!=i?x(i,St):null,this._pickPlane(t,!0,e,a)){const t=tt;let e=!1;null!=i&&(e=y(I(i.plane),I(a.plane))<t||y(D(G.get(),i.basis1),D(G.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=h({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=u(t,U.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=G.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(G.get()),l=this.view.state.camera;y(r,l.viewForward)>0&&g(r,r,-1);const o=ot(n,l),h=(e?1:-1)*o*et,p=g(G.get(),r,h);f(p,p,n);const u=this.analysis.tiltEnabled?ht.TILTED:ht.HORIZONTAL_OR_VERTICAL,c=i[X]?ht.VERTICAL:i[Y]?ht.HORIZONTAL:u;return pt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ut,this.rotateHeadingManipulator.state|=ut,this.rotateTiltManipulator.state|=ut,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ut,this.rotateHeadingManipulator.state&=~ut,this.rotateTiltManipulator.state&=~ut}),this._pointerMoveTimerMs)}_updateManipulators(){if(bt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ct(t,L.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),dt(this.shiftManipulator,i,t,this.view.state.camera),_t(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),vt(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>Pt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=V(G.get(),m(t.basis1),m(t.basis2),1),s=v(L.get(),a),n=P(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=N(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=E(q);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=k}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Et(t,e,i,a){const s=yt(i,j(a),t.direction,R()),n=b();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function kt(t){return"mouse"!==t.pointerType||0===t.button}t([c()],Tt.prototype,"_clock",void 0),t([c({constructOnly:!0})],Tt.prototype,"view",void 0),t([c()],Tt.prototype,"analysisViewData",void 0),t([c({readOnly:!0})],Tt.prototype,"state",null),t([c({readOnly:!0})],Tt.prototype,"cursor",null),t([c()],Tt.prototype,"analysis",null),t([c()],Tt.prototype,"removeIncompleteOnCancel",void 0),t([c()],Tt.prototype,"_layersMode",void 0),t([c()],Tt.prototype,"layersMode",null),t([c({value:null})],Tt.prototype,"inputState",null),t([c()],Tt.prototype,"_isPlacingSlicePlane",null),t([c()],Tt.prototype,"_creatingPointerId",null),Tt=bt=t([d("esri.views.3d.analysis.Slice.SliceTool")],Tt);const St=S(),xt=z();export{Tt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,when as l,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{createScreenPoint as p,screenPointObjectToArray as u}from"../../../../core/screenUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as _,fromScaling as v,multiply as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{e as P,l as y,c as w,g,f,t as M,n as T,i as D}from"../../../../chunks/vec32.js";import{create as V,clone as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as k,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{d as E,a as x,n as C,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as R,intersectRay as I,getNormal as O}from"../../../../geometry/support/plane.js";import{create as z}from"../../../../geometry/support/ray.js";import{sv3d as G,sm4d as A,sv2d as U}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as L,getTiltRotateTexture as K}from"../images/Factory.js";import{ResizeManipulator as B}from"./ResizeManipulator.js";import{RotateManipulator as F}from"./RotateManipulator.js";import{getOutlineColor as N,planeColor as q}from"./settings.js";import{ShiftManipulator as Z,OffsetMode as W}from"./ShiftManipulator.js";import{pointerMoveTimerMs as J,planePreviewOutlineWidth as Q,forceVerticalModifier as X,forceHorizontalModifier as Y,previewFadeDurationSeconds as $,previewFadeDotThreshold as tt,initialDepthOffsetFrac as et}from"./sliceToolConfig.js";import{createGridVisualElement as it,createOutlineVisualElement as at,planeToShape as st,createRotatePlane as nt,RotationAxis as rt,resizePlane as lt,calculatePlaneHalfSize as ot,SliceOrientation as ht,createPlane as pt,DidPointerMoveRecentlyFlag as ut,calculateBoundedPlaneTranslateRotate as ct,updateShiftRestartHandle as dt,updateRotateHeadingHandle as _t,updateRotateTiltHandle as vt,updateResizeHandle as mt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as gt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as ft}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Mt}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Tt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=class extends ft{static{Vt=this}constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._mode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=J,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=E(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=p(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Tt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new Z(this.view,W.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new F(this.view,((t,e)=>L(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new F(this.view,((t,e)=>K(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new B(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=it(this.view),this._previewPlaneOutlineVisualElement=at(this.view),this._previewPlaneOutlineVisualElement.width=Q,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r)),this.addHandles([l((()=>"sliced"===this.state),(()=>{this.finishToolCreation(),this.stop()}),o),n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this.active?this._placingSlicePlane||"exclude"===this.mode?"crosshair":null!=this._creatingPointerId?"grabbing":null:null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&"place"===this._mode}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}start(t){this._finishToolCreationIfValid(),this._mode=t,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),"none"===this._mode&&null==this.analysisViewData.plane&&(this._mode="place")}onDeactivate(){this._mode="none",this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!St(t))return;this._placingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!St(t))return;"exclude"===this._mode?t.defer((async()=>{await this._onClickExcludeLayer(t)&&t.stopPropagation()})):this._onClickPlacePlane(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if(!this._placingSlicePlane)return!1;const i=Dt(t),a=E();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=gt(this.view.state.camera,i,xt);this.inputState=kt(e,t.pointerId,a.origin,a)}return x(a,this._startPlane),this.analysis.shape=st(a,this.view,this.view.spatialReference,new e),"pointer-drag"!==t.type&&this.stop(),!0}return!1}async _onClickExcludeLayer(t){if("exclude"!==this.mode)return!1;const e=await this.view.hitTest(Dt(t)),i=e.results.at(0);if(i){const t="graphic"===i.type&&i.graphic;if(t){const e=t.sourceLayer||t.layer;e&&this.analysis.excludedLayers.push(e)}}else e.ground.layer?this.analysis.excludedLayers.push(e.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(t){return(t.key===X||t.key===Y)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==X&&t.key!==Y||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=gt(this.view.state.camera,t.screenPoint,xt);x(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,E()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(C(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=w(G.get(),this._startPlane.origin),i=w(G.get(),C(this._startPlane));g(i,i,-t.depth),f(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,E());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.HEADING,R()),i=gt(this.view.state.camera,t.screenPoint,xt),a=V();I(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,E()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.TILT,R()),i=gt(this.view.state.camera,t.screenPoint,xt),a=V();I(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,E()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=_(A.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=M(G.get(),this._startPlane.basis1,e),a=M(G.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,E());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=gt(this.view.state.camera,t.screenPoint,xt),a=G.get();I(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:b(a)})}_createResizeDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=x(this.analysisViewData.plane,E());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=lt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){if("exclude"===this.mode)return;let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(this.active){const a=null!=i?i:E();if(i=null!=i?x(i,Et):null,this._pickPlane(t,!0,e,a)){const t=tt;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(T(G.get(),i.basis1),T(G.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=h({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=u(t,U.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=G.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(G.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&g(r,r,-1);const o=ot(n,l),h=(e?1:-1)*o*et,p=g(G.get(),r,h);f(p,p,n);const u=this.analysis.tiltEnabled?ht.TILTED:ht.HORIZONTAL_OR_VERTICAL,c=i[X]?ht.VERTICAL:i[Y]?ht.HORIZONTAL:u;return pt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ut,this.rotateHeadingManipulator.state|=ut,this.rotateTiltManipulator.state|=ut,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ut,this.rotateHeadingManipulator.state&=~ut,this.rotateTiltManipulator.state&=~ut}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e,i=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=this._previewPlane??t,i=!1;else{if(null==this._previewPlane)return this._setManipulatorVisibility(!1),void this._setPreviewPlaneVisibility(!1);e=t=this._previewPlane,i=!0}if(this._setManipulatorVisibility(!i),!i){const e=ct(t,A.get());dt(this.shiftManipulator,e,t,this.view.state.camera),_t(this.rotateHeadingManipulator,e,t,this.view.renderCoordsHelper),vt(this.rotateTiltManipulator,e,t),this.resizeManipulators.forEach(((i,a)=>mt(i,this._resizeHandles[a],e,t)))}this._setPreviewPlaneVisibility(!this._creatingPointerId&&(i||"place"===this._mode)),this._updatePreviewPlaneTransform(e),this._updateMaterials()}_setManipulatorVisibility(t){this.shiftManipulator.available=t,this.rotateHeadingManipulator.available=t,this.rotateTiltManipulator.available=t&&this.analysis.tiltEnabled,this.resizeManipulators.forEach((e=>e.available=t))}_updatePreviewPlaneTransform(t){const e=ct(t,A.get()),i=D(G.get(),y(t.basis1),y(t.basis2),1),a=v(A.get(),i),s=m(a,e,a);this._previewPlaneOutlineVisualElement.transform=s,this._previewPlaneGridVisualElement.transform=s}_setPreviewPlaneVisibility(t){const e=this._previewPlaneOutlineVisualElement,i=this._previewPlaneGridVisualElement;t&&(e.attached=!0,i.attached=!0),e.visible=t,i.visible=t}_updateMaterials(){const t=N(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=k(q);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=S}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function kt(t,e,i,a){const s=Pt(i,C(a),t.direction,R()),n=V();return I(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function St(t){return"mouse"!==t.pointerType||0===t.button}t([c()],bt.prototype,"_clock",void 0),t([c({constructOnly:!0})],bt.prototype,"view",void 0),t([c()],bt.prototype,"analysisViewData",void 0),t([c({readOnly:!0})],bt.prototype,"state",null),t([c({readOnly:!0})],bt.prototype,"cursor",null),t([c()],bt.prototype,"analysis",null),t([c()],bt.prototype,"removeIncompleteOnCancel",void 0),t([c()],bt.prototype,"_mode",void 0),t([c()],bt.prototype,"mode",null),t([c({value:null})],bt.prototype,"inputState",null),t([c()],bt.prototype,"_placingSlicePlane",null),t([c()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([d("esri.views.3d.analysis.Slice.SliceTool")],bt);const Et=E(),xt=z();export{bt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import t from"../../../core/Error.js";import"../../../core/has.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as e}from"./AnalysisView3D.js";import{SliceController as r}from"./Slice/SliceController.js";import n from"./Slice/SliceTool.js";import{SliceVisualization as p}from"./Slice/SliceVisualization.js";import{connectAnalysisViewToTool as y,removeAnalysisViewTool as h,startExclusiveInteractiveOperation as c}from"../../analysis/analysisViewUtils.js";let u=class extends(e(s)){constructor(i){super(i),this.type="slice-view-3d",this.analysis=null,this.tool=null,this.plane=null,this.active=!0,this.userOperation=null,this._analysisVisualization=null,this._analysisController=null}initialize(){this._analysisVisualization=new p({view:this.view,analysis:this.analysis,analysisViewData:this}),this._analysisController=new r({view:this.view,analysis:this.analysis,analysisViewData:this}),this.addHandles(y(this,n))}destroy(){h(this),this._analysisVisualization=a(this._analysisVisualization),this._analysisController=a(this._analysisController)}get editable(){return!this._analysisVisualization.preview}set editable(i){this._analysisVisualization.preview=!i}get showGrid(){return this._analysisVisualization?.showGrid??!1}set showGrid(i){this._analysisVisualization&&(this._analysisVisualization.showGrid=i)}get testData(){}async place(i){if(this.analysis.valid)throw new t("SliceAnalysisView3D:place","Cannot place slice plane when analysis already has a valid shape.");return this.active=!0,c(this,{abortOptions:i})}};i([o({readOnly:!0})],u.prototype,"type",void 0),i([o({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),i([o()],u.prototype,"tool",void 0),i([o()],u.prototype,"plane",void 0),i([o()],u.prototype,"active",void 0),i([o()],u.prototype,"editable",null),i([o()],u.prototype,"showGrid",null),i([o()],u.prototype,"userOperation",void 0),i([o()],u.prototype,"_analysisVisualization",void 0),i([o()],u.prototype,"_analysisController",void 0),u=i([l("esri.views.3d.analysis.SliceAnalysisView3D")],u);const d=u;export{d as default};
5
+ import{_ as i}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as e}from"./AnalysisView3D.js";import{SliceController as l}from"./Slice/SliceController.js";import r from"./Slice/SliceTool.js";import{SliceVisualization as n}from"./Slice/SliceVisualization.js";import{connectAnalysisViewToTool as p,removeAnalysisViewTool as y,startExclusiveInteractiveOperation as c}from"../../analysis/analysisViewUtils.js";let h=class extends(e(s)){constructor(i){super(i),this.type="slice-view-3d",this.analysis=null,this.tool=null,this.plane=null,this.active=!0,this.userOperation=null,this._analysisVisualization=null,this._analysisController=null}initialize(){this._analysisVisualization=new n({view:this.view,analysis:this.analysis,analysisViewData:this}),this._analysisController=new l({view:this.view,analysis:this.analysis,analysisViewData:this}),this.addHandles(p(this,r))}destroy(){y(this),this._analysisVisualization=t(this._analysisVisualization),this._analysisController=t(this._analysisController)}get editable(){return!this._analysisVisualization.preview}set editable(i){this._analysisVisualization.preview=!i}get showGrid(){return this._analysisVisualization?.showGrid??!1}set showGrid(i){this._analysisVisualization&&(this._analysisVisualization.showGrid=i)}get testData(){}async place(i){return this.active=!0,c(this,{abortOptions:i,onToolActivated:i=>i.start("place")})}async pickLayerToExclude(i){return this.active=!0,c(this,{abortOptions:i,onToolActivated:i=>i.start("exclude")})}};i([o({readOnly:!0})],h.prototype,"type",void 0),i([o({constructOnly:!0,nonNullable:!0})],h.prototype,"analysis",void 0),i([o()],h.prototype,"tool",void 0),i([o()],h.prototype,"plane",void 0),i([o()],h.prototype,"active",void 0),i([o()],h.prototype,"editable",null),i([o()],h.prototype,"showGrid",null),i([o()],h.prototype,"userOperation",void 0),i([o()],h.prototype,"_analysisVisualization",void 0),i([o()],h.prototype,"_analysisController",void 0),h=i([a("esri.views.3d.analysis.SliceAnalysisView3D")],h);const u=h;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveSet.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../core/sql/WhereClause.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as u}from"../../../layers/support/floorFilterUtils.js";import h from"../../../rest/support/Query.js";import{isNumber as p}from"../../../support/guards.js";import{I3SMeshView3D as c}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as y}from"./II3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as f,normalizeEditResultsEvent as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as b}from"./i3s/I3SNode.js";import{I3SOverrides as j}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as I}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S,I3SQueryFeature as E}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as O}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as H,getIndexCrs as x,objectIdFilter as C}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as Q}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as V}from"./support/fieldProperties.js";import{PopupSceneLayerView as R}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import{updatingProgress as A}from"../support/updatingProperties.js";import D from"../../layers/SceneLayerView.js";import{hasPopupTemplate as G}from"../../layers/support/popupUtils.js";import{defaultHighlightName as U}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as P}from"../../support/layerViewUtils.js";import{TaskPriority as M}from"../../support/Scheduler.js";const T=V();let N=class extends(c(L(Q(R(g(D)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.viewFilter=null,this._setVisibilityHiddenObjectIds=new s,this.progressiveLoadFactor=1,this._elevationContext="scene",this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{H(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new j({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&G(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=u(this);return null!=e?a.create(e,{fieldsIndex:this.layer.fieldsIndex}):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort(((e,t)=>e-t)):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort(((e,t)=>e-t)):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.object?.lodFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return P(this.i3slayer.effectiveScaleRange,this.view.scale)}initialize(){this._fieldsHelper=new q({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this._updatingHandles.add((()=>this.layer.renderer),(e=>this._updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>this._floorFilterClause),e),this._updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this._updatingHandles.add((()=>this._setVisibilityHiddenObjectIdsSorted),e),this._updatingHandles.add((()=>this.viewFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this.viewFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter})),(({layerViewFilter:e,layerFilter:t})=>{if(null==e&&null==t)return void this._set("viewFilter",null);const i=this.viewFilter;if(i)return i.viewFilter=e,i.layerFilter=t,void this._filterChange();this._set("viewFilter",new w({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))})),this.i3sOverrides.is3DOFL&&this._updatingHandles.add((()=>this.i3sOverrides.sortedGeometryChangedObjectIds),e),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new h(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const i of e.features)i.layer=t,i.sourceLayer=t;return e}))}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(p)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new I({layerView:this,priority:M.FEATURE_QUERY_ENGINE,spatialIndex:new O({featureAdapter:new S({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,i,r)=>e(new E(t,i,r))),t,y.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:x(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e,t){const i=this._highlights,r=t?.name??U;if(e instanceof h){const{set:t,handle:s}=i.acquireSet(r);return this.queryObjectIds(e).then((e=>i.setFeatureIds(t,e))),s}return super.highlight(e,t)}createInteractiveEditSession(e){return f(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer})}getFilters(){const e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push(((e,t)=>{t.node.index>=0&&C(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)}));const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push((e=>C(t,!1,e)));const i=this._excludeObjectIdsSorted;return null!=i&&e.push((e=>C(i,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(null==e?this.createQuery():h.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(i.getLogger(this).warn("query: outSpatialReference different from the view's spatial reference is not supported"),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes((t=>null!=t?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=this._attributeEditingContext,i=await m(t,e);_(t,i),F(t,i)}get hasGeometryFilter(){return null!=this.viewFilter?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?b.Unmodified:b.Culled}};e([n()],N.prototype,"i3slayer",null),e([n(A)],N.prototype,"updatingProgress",void 0),e([n({type:d})],N.prototype,"filter",null),e([n({readOnly:!0})],N.prototype,"viewFilter",void 0),e([n(T.requiredFields)],N.prototype,"requiredFields",null),e([n(T.availableFields)],N.prototype,"availableFields",void 0),e([n()],N.prototype,"_fieldsHelper",void 0),e([n()],N.prototype,"_floorFilterClause",null),e([n()],N.prototype,"_excludeObjectIdsSorted",null),e([n()],N.prototype,"_setVisibilityHiddenObjectIds",void 0),e([n()],N.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([n()],N.prototype,"lodFactor",null),e([n()],N.prototype,"updatingProgressValue",null),e([n({readOnly:!0})],N.prototype,"visibleAtCurrentScale",null),N=e([o("esri.views.3d.layers.SceneLayerView3D")],N);const z=N;export{z as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveSet.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../core/sql/WhereClause.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as u}from"../../../layers/support/floorFilterUtils.js";import h from"../../../rest/support/Query.js";import{isNumber as p}from"../../../support/guards.js";import{I3SMeshView3D as c}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as y}from"./II3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as f,normalizeEditResultsEvent as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as b}from"./i3s/I3SNode.js";import{I3SOverrides as j}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as I}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S,I3SQueryFeature as E}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as O}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as H,getIndexCrs as x,objectIdFilter as C}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as Q}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as V}from"./support/fieldProperties.js";import{PopupSceneLayerView as R}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import{updatingProgress as A}from"../support/updatingProperties.js";import D from"../../layers/SceneLayerView.js";import{hasPopupTemplate as G}from"../../layers/support/popupUtils.js";import{defaultHighlightName as U}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as P}from"../../support/layerViewUtils.js";import{TaskPriority as M}from"../../support/Scheduler.js";const T=V();let N=class extends(c(L(Q(R(g(D)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.viewFilter=null,this._setVisibilityHiddenObjectIds=new s,this.progressiveLoadFactor=1,this._elevationContext="scene",this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{H(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new j({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&G(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=u(this);return null!=e?a.create(e,{fieldsIndex:this.layer.fieldsIndex}):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort(((e,t)=>e-t)):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort(((e,t)=>e-t)):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.object?.lodFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return P(this.i3slayer.effectiveScaleRange,this.view.scale)}initialize(){this._fieldsHelper=new q({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this._updatingHandles.add((()=>this.layer.renderer),(e=>this._updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>this._floorFilterClause),e),this._updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this._updatingHandles.add((()=>this._setVisibilityHiddenObjectIdsSorted),e),this._updatingHandles.add((()=>this.viewFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this.viewFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter})),(({layerViewFilter:e,layerFilter:t})=>{if(null==e&&null==t)return void this._set("viewFilter",null);const i=this.viewFilter;if(i)return i.viewFilter=e,i.layerFilter=t,void this._filterChange();this._set("viewFilter",new w({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))}),l),this.i3sOverrides.is3DOFL&&this._updatingHandles.add((()=>this.i3sOverrides.sortedGeometryChangedObjectIds),e),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new h(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const i of e.features)i.layer=t,i.sourceLayer=t;return e}))}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(p)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new I({layerView:this,priority:M.FEATURE_QUERY_ENGINE,spatialIndex:new O({featureAdapter:new S({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,i,r)=>e(new E(t,i,r))),t,y.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:x(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e,t){const i=this._highlights,r=t?.name??U;if(e instanceof h){const{set:t,handle:s}=i.acquireSet(r);return this.queryObjectIds(e).then((e=>i.setFeatureIds(t,e))),s}return super.highlight(e,t)}createInteractiveEditSession(e){return f(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer})}getFilters(){const e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push(((e,t)=>{t.node.index>=0&&C(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)}));const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push((e=>C(t,!1,e)));const i=this._excludeObjectIdsSorted;return null!=i&&e.push((e=>C(i,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(null==e?this.createQuery():h.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(i.getLogger(this).warn("query: outSpatialReference different from the view's spatial reference is not supported"),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes((t=>null!=t?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=this._attributeEditingContext,i=await m(t,e);_(t,i),F(t,i)}get hasGeometryFilter(){return null!=this.viewFilter?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?b.Unmodified:b.Culled}};e([n()],N.prototype,"i3slayer",null),e([n(A)],N.prototype,"updatingProgress",void 0),e([n({type:d})],N.prototype,"filter",null),e([n({readOnly:!0})],N.prototype,"viewFilter",void 0),e([n(T.requiredFields)],N.prototype,"requiredFields",null),e([n(T.availableFields)],N.prototype,"availableFields",void 0),e([n()],N.prototype,"_fieldsHelper",void 0),e([n()],N.prototype,"_floorFilterClause",null),e([n()],N.prototype,"_excludeObjectIdsSorted",null),e([n()],N.prototype,"_setVisibilityHiddenObjectIds",void 0),e([n()],N.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([n()],N.prototype,"lodFactor",null),e([n()],N.prototype,"updatingProgressValue",null),e([n({readOnly:!0})],N.prototype,"visibleAtCurrentScale",null),N=e([o("esri.views.3d.layers.SceneLayerView3D")],N);const z=N;export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import s from"../../../../../geometry/Extent.js";import{initializeProjection as c,project as l}from"../../../../../geometry/projection.js";import d from"../../../../../geometry/SpatialReference.js";import{QueryEngine as m}from"../../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as h}from"./FeatureProcessingContext.js";import{joinCommands as y,PipelineCommand as p}from"./PipelineCommand.js";import{Tile3DManager as f}from"./Tile3DManager.js";import{TileActionSynchronizer as _,TileActionType as C}from"./TileActionSynchronizer.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as S}from"../../../support/RenderCoordsHelper.js";import{assert as R}from"../../../webgl-engine/lib/Util.js";let v=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._actionSynchronizer=new _(y,(e=>this._createCommand(e))),this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:i,layerViewInfo:o}){const y=d.fromJSON(e);this._viewSpatialReference=y;const p=d.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,u.fromJSON(i.baseQuery),i.url,i.objectIdField,i.capabilities),this._queryEngine=new m({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:i.objectIdField,fieldsIndex:i.fieldIndex,availableFields:[i.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:i.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const _=S.create(r,p),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new h(y,p,this._mainThreadDelegate,_,C,i,o);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(i.renderer),this._defaultQueryJSON=new u({outSpatialReference:y}).toJSON();let R=null;if(null!=i.fullExtent){const e=s.fromJSON(i.fullExtent);await c(e.spatialReference,y),R=l(e,y)}return this._tileManager=new f({loadTile:(e,t)=>this._fetcher.fetch(e,t),synchronizer:this._actionSynchronizer,extent:R}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),null!=this._renderer&&await this._renderer.load(),F}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(F)}async onElevationChange(e){return F}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return F;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),F}async onRendererChange(e){const{_context:t}=this,r=await this._createDestroyRendererCommand();await r.execute();const a=t.symbolRendererFactory.createSymbolRendererFromJSON(e);this._renderer=a,await this._renderer.load();const n=[];this._tileManager.forEachTile((e=>{n.push(a.createAddCommand(e))}));const i=await Promise.all(n),o=t.joinPipelineCommands(i);return await o.execute(),F}async _createDestroyRendererCommand(){const e=this._renderer;if(null==e)return p.create(this._renderCommandContext);const t=await e.createDestroyCommand();return t.appendPipelineStateCommand((()=>{R(this._renderer===e),this._renderer=null})),t}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=this._renderer;let i;return i=null!=n?await n.createAddCommand(e):p.create(this._renderCommandContext),r(t),i.appendPipelineStateCommand((()=>{a.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):p.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer;let n;return n=null!=a?await a.createUpdateVisibilityCommand(e):p.create(this._renderCommandContext),r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}async _createCommand(e){switch(e.type){case C.ADD:return await this._createAddFeatureDataCommand(e.data);case C.REMOVE:return await this._createRemoveFeatureDataCommand(e.data.id);case C.UPDATE_VISIBILITY:return await this._createUpdateFeatureDataVisibilityCommand(e.data)}}};e([i()],v.prototype,"updating",null),v=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],v);const j=v,F={result:void 0};export{j as default};
5
+ import{b as e,c as t,_ as r}from"../../../../../chunks/tslib.es6.js";import a from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projection.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const s=u.fromJSON(e);this._viewSpatialReference=s;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:a.objectIdField,fieldsIndex:a.fieldIndex,availableFields:[a.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:a.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const f=v.create(r,l),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new p(s,l,this._mainThreadDelegate,f,C,a,n);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(a.renderer),this._defaultQueryJSON=new y({outSpatialReference:s}).toJSON();let R=null;if(null!=a.fullExtent){const e=c.fromJSON(a.fullExtent);await d(e.spatialReference,s),R=m(e,s)}return this._tileManager=new _({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),tileLocks:this._tileLocks,extent:R}),this.addHandles(i((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),o),null!=this._renderer&&await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(j)}async onElevationChange(e){return j}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return j;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),j}async onRendererChange(r){const{_context:a}=this,n=a.symbolRendererFactory.createSymbolRendererFromJSON(r);await n.load();const i=this._renderer;this._renderer=n;const o=[...this._tileManager.loadedTiles()],s=o.map((e=>e.tileId));{const r={stack:[],error:void 0,hasError:!1};try{e(r,await this._tileLocks.lock(s),!1);const t=o.flatMap((e=>[i.createRemoveCommand(e.id),n.createAddCommand(e)])),l=await Promise.all(t),c=a.joinPipelineCommands(l);await c.execute()}catch(c){r.error=c,r.hasError=!0}finally{t(r)}}const l=await i.createDestroyCommand();return await l.execute(),j}async _createAddFeatureDataCommand(e,t){const r=this._featureStore,a=this._renderer;let i;return i=null!=a?await a.createAddCommand(e):f.create(this._renderCommandContext),n(t),i.appendPipelineStateCommand((()=>{r.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):f.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const r=this._renderer;let a;return a=null!=r?await r.createUpdateVisibilityCommand(e):f.create(this._renderCommandContext),n(t),a}_ensureQuery(e){return e??this._defaultQueryJSON}};r([s()],R.prototype,"updating",null),R=r([l("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const S=R,j={result:void 0};export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{read as e}from"../../../../../renderers/support/jsonUtils.js";import{PipelineCommand as r}from"./PipelineCommand.js";import{createDefaultIconSymbolLayer as t}from"./symbolization/factoryUtils.js";import{IconSymbolLayerRenderer as o}from"./symbolization/IconSymbolLayerRenderer.js";import{Point3DSymbolRenderer as n}from"./symbolization/Point3DSymbolRenderer.js";import{SimpleFeatureRenderer as i}from"./symbolization/SimpleFeatureRenderer.js";import{UniqueValueFeatureRenderer as s}from"./symbolization/UniqueValueFeatureRenderer.js";class a{constructor(e,r,t,o,n,i,s){this.viewSpatialReference=e,this.renderSpatialReference=r,this.mainThreadDelegate=t,this.renderCoordsHelper=o,this.renderCommandContext=n,this.layerInfo=i,this.layerViewInfo=s,this.symbolRendererFactory=new m(this)}createPipelineCommand(e=this.renderCommandContext.createRenderCommandBuffer(),t=[]){return new r(this.renderCommandContext,e,t)}joinPipelineCommands(e){if(0===e.length)return this.createPipelineCommand();return e.filter((e=>null!=e)).reduce(((e,r)=>(e.append(r),e)))}}class m{constructor(e){this.context=e}createSymbolRendererFromJSON(r){const t=e(r??l)??void 0;if(!t)throw new Error("Failed to create renderer");const o=t.type;switch(o){case"simple":return new i(t,this.context);case"unique-value":return new s(t,this.context);default:return console.warn(`Unable to create symbolrenderer for renderer of ${o}`),this.createSymbolRendererFromJSON(l)}}createSymbolRendererFromSymbol(e){const r=e?.type;switch(r){case"point-3d":return new n(e,this.context);case"picture-marker":return new o(t(),this.context);default:return console.warn(`Unable to create symbolrenderer for symbol of ${r}`),null}}createSymbolRendererFromSymbolLayer(e){const r=e.type;return"icon"===r?new o(e,this.context):(console.warn(`Unable to create symbolrenderer for symbolLayer of ${r}`),null)}}const l={type:"simple"};export{a as FeatureProcessingContext,m as SymbolRendererFactory};
5
+ import{read as e}from"../../../../../renderers/support/jsonUtils.js";import{PipelineCommand as r}from"./PipelineCommand.js";import{createDefaultIconSymbolLayer as t}from"./symbolization/factoryUtils.js";import{IconSymbolLayerRenderer as o}from"./symbolization/IconSymbolLayerRenderer.js";import{Point3DSymbolRenderer as n}from"./symbolization/Point3DSymbolRenderer.js";import{SimpleFeatureRenderer as i}from"./symbolization/SimpleFeatureRenderer.js";import{UniqueValueFeatureRenderer as s}from"./symbolization/UniqueValueFeatureRenderer.js";class a{constructor(e,r,t,o,n,i,s){this.viewSpatialReference=e,this.renderSpatialReference=r,this.mainThreadDelegate=t,this.renderCoordsHelper=o,this.renderCommandContext=n,this.layerInfo=i,this.layerViewInfo=s,this.symbolRendererFactory=new m(this)}createPipelineCommand(e=this.renderCommandContext.createRenderCommandBuffer(),t=[]){return new r(this.renderCommandContext,e,t)}joinPipelineCommands(e){if(0===e.length)return this.createPipelineCommand();return e.filter((e=>null!=e)).reduce(((e,r)=>(e.append(r),e)))}}class m{constructor(e){this.context=e}createSymbolRendererFromJSON(r){const t=e(r??l)??void 0;if(!t)throw new Error("Failed to create renderer");const o=t.type;switch(o){case"simple":return new i(t,this.context);case"unique-value":return new s(t,this.context);default:return console.warn(`Unable to create symbolrenderer for renderer of ${o}`),this.createSymbolRendererFromJSON(l)}}createSymbolRendererFromSymbol(e){const r=e?.type;switch(r){case"point-3d":return new n(e,this.context);case"picture-marker":case"simple-marker":return new o(t(),this.context);default:return console.warn(`Unable to create symbolrenderer for symbol of ${r}`),null}}createSymbolRendererFromSymbolLayer(e){const r=e.type;return"icon"===r?new o(e,this.context):(console.warn(`Unable to create symbolrenderer for symbolLayer of ${r}`),null)}}const l={type:"simple"};export{a as FeatureProcessingContext,m as SymbolRendererFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as i,throwIfNotAbortError as o}from"../../../../../core/promiseUtils.js";import a from"../../../../../core/ReactiveMap.js";import{whenOnce as n}from"../../../../../core/reactiveUtils.js";import{waitTick as r}from"../../../../../core/scheduling.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as d,intersects as u}from"../../../../../geometry/support/aaBoundingRect.js";import{TileAction as h,TileActionType as f}from"./TileActionSynchronizer.js";import{FeatureData as p}from"./featureData/FeatureData.js";let _=class extends t{constructor(e){super(e),this.extent=null,this._tileHandles=new a,this._wanted=new a,this._updateRequested=!1,this._synchronizationTask=null,this._requestedTiles=new Array}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updateRequested||!(this._synchronizationTask?.finished??1)}get _boundingRect(){const{extent:e}=this;return null==e?null:d(e)}get _missingTiles(){const e=new Array,t=this._wanted,s=this._tileHandles;for(const i of t.values())null==s.get(i.id)?.featureData&&e.push(i);return e}onTileTreeChange({tiles:e}){this._requestedTiles=e,this._scheduleTilesSync()}_scheduleTilesSync(){if(this._updateRequested)return;this._updateRequested=!0;const e=this._synchronizationTask,t=s((async()=>{try{await n((()=>e?.finished??!0)),await r(),this._updateRequested=!1,await this._synchronizeTiles()}finally{this._synchronizationTask===t&&(this._synchronizationTask=null)}}));this._synchronizationTask=t}async _synchronizeTiles(){const e=this._requestedTiles,t=this._tileHandles,s=new Array;for(const u of e)t.has(u.id)||s.push(u);const i=new Array;for(const u of t.values()){const{id:t}=u;e.every((e=>e.id!==t))&&i.push(u.descriptor)}const o=this._tileHandles,{_boundingRect:a}=this,n=null!=a?s.filter((e=>u(a,e.extent))):s,r=this._wanted,l=new Array;for(const{id:u}of i)r.delete(u);for(const u of n)r.set(u.id,u);const c=this._missingTiles;for(const u of i){const{id:e}=u;if(c.some((e=>y(e,u)||y(u,e))))continue;const t=o.get(e);null!=t&&l.push(this._removeTile(t))}for(const u of n)l.push(this._addTile(u));const d=await Promise.allSettled(l);for(const u of d)"rejected"===u.status&&console.error(u.reason)}forEachTile(e){for(const t of this._tileHandles.values()){const s=t.featureData;null!=s&&e(s)}}async _removeTile(e){e.loadTask.abort(),this._tileHandles.delete(e.id),this._validate();const{featureData:t}=e;null!=t&&await this.synchronizer.enqueueActions([new h(e.id,f.REMOVE,t)])}async _addTile(e){const{_tileHandles:t}=this,a=t.get(e.id);if(null!=a){if(!w(a)||a.featureData.isFullyEnabled)return;return a.featureData.enableAll(),void await this._onTileLoad(a)}const n=new m(e,s((async t=>{const s=await this.loadTile(e,t);return i(t),new p(s)})));this._tileHandles.set(n.id,n);try{await n.loadTask.promise}catch(r){return void o(r)}T(n),await this._onTileLoad(n)}async _onTileLoad(e){const{_wanted:t,_tileHandles:s,_missingTiles:i}=this,o=e.descriptor,a=new Array,n=new Set;for(const r of s.values()){if(r===e)continue;const{descriptor:l,id:c}=r;if(t.has(c)||i.some((e=>y(e,l)||y(l,e)))){if(w(r)){if(y(o,l)){const e=r.featureData;for(const t of e.objectIds())n.add(t)}if(y(l,o)){const t=e.featureData,s=new Set(t.objectIds()),{featureData:i}=r;i.disableObjectIds(s),a.push(new h(c,f.UPDATE_VISIBILITY,i)),this._validateRemoval(i,s)}}}else{s.delete(c),r.loadTask.abort();const{featureData:e}=r;null!=e&&a.push(new h(c,f.REMOVE,e))}}n.size>0&&(e.featureData.disableObjectIds(n),this._validateRemoval(e.featureData,n)),this._validate(),a.push(new h(e.id,f.ADD,e.featureData)),await this.synchronizer.enqueueActions(a)}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const e=new Array;for(const t of this._tileHandles.values()){if(!w(t))continue;const{featureData:s}=t;e.push({featureData:s,objectIds:new Set(s.enabledObjectIds())})}for(let t=0;t<e.length;++t){const{featureData:s,objectIds:i}=e[t];for(let o=t+1;o<e.length;++o){const{featureData:t,objectIds:a}=e[o];for(const e of a)if(i.has(e))throw new Error(`${s.id} and ${t.id} both contain ${e}.`)}}}_validateRemoval(e,t){if(has("feature-pipeline-3d-test-validation"))for(const s of e.enabledObjectIds())if(t.has(s))throw new Error(`Failed to remove ${s} from ${e.id}!`)}};function y({lij:[e,t,s]},{lij:[i,o,a]}){const n=i-e;return n>=0&&t===o>>n&&s===a>>n}e([l()],_.prototype,"updating",null),e([l({constructOnly:!0})],_.prototype,"loadTile",void 0),e([l({constructOnly:!0})],_.prototype,"synchronizer",void 0),e([l()],_.prototype,"extent",void 0),e([l()],_.prototype,"_boundingRect",null),e([l()],_.prototype,"_missingTiles",null),e([l()],_.prototype,"_updateRequested",void 0),e([l()],_.prototype,"_synchronizationTask",void 0),_=e([c("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],_);class m{constructor(e,t){this.descriptor=e,this.loadTask=t}get id(){return this.descriptor.id}get featureData(){return this.loadTask.value}}function w(e){return null!=e.featureData}function T(e){if(!w(e))throw new Error}export{_ as Tile3DManager};
5
+ import{b as t,c as e,_ as s}from"../../../../../chunks/tslib.es6.js";import o from"../../../../../core/Accessor.js";import{isSome as a}from"../../../../../core/arrayUtils.js";import{createTask as i}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as r,throwIfNotAbortError as n}from"../../../../../core/promiseUtils.js";import l from"../../../../../core/ReactiveMap.js";import{whenOnce as c}from"../../../../../core/reactiveUtils.js";import{waitTick as d}from"../../../../../core/scheduling.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as f,intersects as p}from"../../../../../geometry/support/aaBoundingRect.js";import{joinCommands as m}from"./PipelineCommand.js";import{FeatureData as y}from"./featureData/FeatureData.js";let _=class extends o{constructor(t){super(t),this.extent=null,this._tileHandles=new l,this._wanted=new l,this._updateRequested=!1,this._synchronizationTask=null,this._requestedTiles=new Array}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updateRequested||!(this._synchronizationTask?.finished??1)}get _boundingRect(){const{extent:t}=this;return null==t?null:f(t)}get _missingTiles(){const t=new Array,e=this._wanted,s=this._tileHandles;for(const o of e.values())null==s.get(o.id)?.featureData&&t.push(o);return t}onTileTreeChange({tiles:t}){this._requestedTiles=t,this._scheduleTilesSync()}_scheduleTilesSync(){if(this._updateRequested)return;this._updateRequested=!0;const t=this._synchronizationTask,e=i((async()=>{try{await c((()=>t?.finished??!0)),await d(),this._updateRequested=!1,await this._synchronizeTiles()}finally{this._synchronizationTask===e&&(this._synchronizationTask=null)}}));this._synchronizationTask=e}async _synchronizeTiles(){const t=this._requestedTiles,e=this._tileHandles,s=new Array;for(const u of t)e.has(u.id)||s.push(u);const o=new Array;for(const u of e.values()){const{id:e}=u;t.every((t=>t.id!==e))&&o.push(u.descriptor)}const a=this._tileHandles,{_boundingRect:i}=this,r=null!=i?s.filter((t=>p(i,t.extent))):s,n=this._wanted,l=new Array;for(const{id:u}of o)n.delete(u);for(const u of r)n.set(u.id,u);const c=this._missingTiles;for(const u of o){const{id:t}=u;if(c.some((t=>w(t,u)||w(u,t))))continue;const e=a.get(t);null!=e&&l.push(this._removeTile(e))}for(const u of r)l.push(this._addTile(u));const d=await Promise.allSettled(l);for(const u of d)"rejected"===u.status&&console.error(u.reason)}forEachTile(t){for(const e of this._tileHandles.values()){const s=e.featureData;null!=s&&t(s)}}*loadedTiles(){for(const t of this._tileHandles.values()){const e=t.featureData;null!=e&&(yield e)}}async _removeTile(s){s.loadTask.abort(),this._tileHandles.delete(s.id),this._validate();const{featureData:o}=s;if(null!=o){const s={stack:[],error:void 0,hasError:!1};try{t(s,await this.tileLocks.lock([o.tileId]),!1);const e=await this.createRemoveCommand(o.id);await(e?.execute())}catch(a){s.error=a,s.hasError=!0}finally{e(s)}}}async _addTile(t){const{_tileHandles:e}=this,s=e.get(t.id);if(null!=s){if(!T(s)||s.featureData.isFullyEnabled)return;return s.featureData.enableAll(),void await this._onTileLoad(s)}const o=new v(t,i((async e=>{const s=await this.loadTile(t,e);return r(e),new y(s)})));this._tileHandles.set(o.id,o);try{await o.loadTask.promise}catch(a){return void n(a)}g(o),await this._onTileLoad(o)}async _onTileLoad(s){const o={stack:[],error:void 0,hasError:!1};try{const{_wanted:e,_tileHandles:i,_missingTiles:r}=this,n=s.descriptor,l=new Array,c=new Array,d=new Array,u=new Set;for(const t of i.values()){if(t===s)continue;const{descriptor:o,id:a}=t;if(e.has(a)||r.some((t=>w(t,o)||w(o,t)))){if(T(t)){if(w(n,o)){const e=t.featureData;for(const t of e.objectIds())u.add(t)}if(w(o,n)){const{featureData:e}=t;c.push(e)}}}else{i.delete(a),t.loadTask.abort();const{featureData:e}=t;null!=e&&l.push(e)}}u.size>0&&(s.featureData.disableObjectIds(u),this._validateRemoval(s.featureData,u)),this._validate(),d.push(s.featureData);const h=[...d,...l,...c].map((t=>t.tileId));t(o,await this.tileLocks.lock(h),!1);if(0!==c.length){const t=s.featureData,e=new Set(t.objectIds());for(const s of c)s.disableObjectIds(e),this._validateRemoval(s,e)}const f=l.map((t=>this.createRemoveCommand(t.id))),p=d.map((t=>this.createAddCommand(t))),y=c.map((t=>this.createUpdateCommand(t))),_=await Promise.all([...f,...p,...y]),v=m(_.filter(a));await(v?.execute())}catch(i){o.error=i,o.hasError=!0}finally{e(o)}}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!T(e))continue;const{featureData:s}=e;t.push({featureData:s,objectIds:new Set(s.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:s,objectIds:o}=t[e];for(let a=e+1;a<t.length;++a){const{featureData:e,objectIds:i}=t[a];for(const t of i)if(o.has(t))throw new Error(`${s.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const s of t.enabledObjectIds())if(e.has(s))throw new Error(`Failed to remove ${s} from ${t.id}!`)}};function w({lij:[t,e,s]},{lij:[o,a,i]}){const r=o-t;return r>=0&&e===a>>r&&s===i>>r}s([u()],_.prototype,"updating",null),s([u({constructOnly:!0})],_.prototype,"loadTile",void 0),s([u({constructOnly:!0})],_.prototype,"createAddCommand",void 0),s([u({constructOnly:!0})],_.prototype,"createRemoveCommand",void 0),s([u({constructOnly:!0})],_.prototype,"createUpdateCommand",void 0),s([u({constructOnly:!0})],_.prototype,"tileLocks",void 0),s([u()],_.prototype,"extent",void 0),s([u()],_.prototype,"_boundingRect",null),s([u()],_.prototype,"_missingTiles",null),s([u()],_.prototype,"_updateRequested",void 0),s([u()],_.prototype,"_synchronizationTask",void 0),_=s([h("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],_);class v{constructor(t,e){this.descriptor=t,this.loadTask=e}get id(){return this.descriptor.id}get featureData(){return this.loadTask.value}}function T(t){return null!=t.featureData}function g(t){if(!T(t))throw new Error}export{_ as Tile3DManager};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{isSome as o}from"../../../../../core/arrayUtils.js";import{disposable as r,makeHandle as t}from"../../../../../core/handleUtils.js";import{createResolver as s}from"../../../../../core/promiseUtils.js";class e{constructor(){this._previousActions=new Map}async lock(e){const{_previousActions:i}=this,l=e.map((o=>i.get(o))).filter(o),c=Promise.allSettled(l),a=s(),n=t((()=>a.resolve())),m=a.promise.finally((()=>{for(const o of e)i.get(o)===m&&i.delete(o)}));for(const o of e)i.set(o,m);return await c,r(n)}}export{e as TileLocks};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{baseObjectMemory as t,estimateStringMemory as e}from"../../../../../../core/memoryEstimations.js";import{generateId as r}from"../utils.js";import{FeatureDataSubset as i}from"./FeatureDataSubset.js";class s{constructor(t){this._tile=t,this.id=r(`featureData-${t.id}-`),this._enabled=new Array(t.featureCount).fill(!0)}get featureCount(){return this._tile.featureCount}get usedMemory(){return t+e(this.id)}get extent(){return this._tile.descriptor.extent}get isFullyEnabled(){return this._enabled.every((t=>t))}getObjectId(t){return this._tile.getObjectId(t)}getAttribute(t,e){return this._tile.getAttribute(t,e)}getAttributeAsTimestamp(t,e){return this._tile.getAttribute(t,e)}getAttributes(t){return this._tile.getAttributes(t)}getCoordinates(t,e,r){return this._tile.getCoordinates(t,e,r)}getOptimizedGeometry(t){return this._tile.getOptimizedGeometry(t)}getCentroid(t,e){return this._tile.getCentroid(t,e)}getBounds(t){return this._tile.getBounds(t)}getBoundingBox(t){return this._tile.getBoundingBox(t)}getObjectIdsArray(t,e,r){return this._tile.getObjectIdsArray(t,e,r)}getCoordinatesArray(t,e,r){return this._tile.getCoordinatesArray(t,e,r)}objectIds(t){return this._tile.objectIds(t)}subset(t){return new i(this,t)}disableObjectIds(t){if(0===t.size)return;const{_enabled:e}=this,r=new Array;for(const i of this._allFeatureIndices())e[i]&&t.has(this.getObjectId(i))&&r.push(i);if(0!==r.length)for(const i of r)e[i]=!1}setEnabled(t,e){this._enabled[t]=e}getEnabled(t){return this._enabled[t]}enableAll(){this._enabled.fill(!0)}getVisibilityArray(t,e=this._allFeatureIndices(),r=0){const{_enabled:i}=this;for(const s of e)t[r++]=Number(i[s]);return r}*enabledObjectIds(t=this._allFeatureIndices()){const{_enabled:e}=this;for(const r of t)e[r]&&(yield this.getObjectId(r))}*_allFeatureIndices(){const{featureCount:t}=this;for(let e=0;e<t;++e)yield e}}export{s as FeatureData};
5
+ import{baseObjectMemory as t,estimateStringMemory as e}from"../../../../../../core/memoryEstimations.js";import{generateId as r}from"../utils.js";import{FeatureDataSubset as i}from"./FeatureDataSubset.js";class s{constructor(t){this._tile=t,this.id=r(`featureData-${t.id}-`),this._enabled=new Array(t.featureCount).fill(!0)}get tileId(){return this._tile.id}get featureCount(){return this._tile.featureCount}get usedMemory(){return t+e(this.id)}get extent(){return this._tile.descriptor.extent}get isFullyEnabled(){return this._enabled.every((t=>t))}getObjectId(t){return this._tile.getObjectId(t)}getAttribute(t,e){return this._tile.getAttribute(t,e)}getAttributeAsTimestamp(t,e){return this._tile.getAttribute(t,e)}getAttributes(t){return this._tile.getAttributes(t)}getCoordinates(t,e,r){return this._tile.getCoordinates(t,e,r)}getOptimizedGeometry(t){return this._tile.getOptimizedGeometry(t)}getCentroid(t,e){return this._tile.getCentroid(t,e)}getBounds(t){return this._tile.getBounds(t)}getBoundingBox(t){return this._tile.getBoundingBox(t)}getObjectIdsArray(t,e,r){return this._tile.getObjectIdsArray(t,e,r)}getCoordinatesArray(t,e,r){return this._tile.getCoordinatesArray(t,e,r)}objectIds(t){return this._tile.objectIds(t)}subset(t){return new i(this,t)}disableObjectIds(t){if(0===t.size)return;const{_enabled:e}=this,r=new Array;for(const i of this._allFeatureIndices())e[i]&&t.has(this.getObjectId(i))&&r.push(i);if(0!==r.length)for(const i of r)e[i]=!1}setEnabled(t,e){this._enabled[t]=e}getEnabled(t){return this._enabled[t]}enableAll(){this._enabled.fill(!0)}getVisibilityArray(t,e=this._allFeatureIndices(),r=0){const{_enabled:i}=this;for(const s of e)t[r++]=Number(i[s]);return r}*enabledObjectIds(t=this._allFeatureIndices()){const{_enabled:e}=this;for(const r of t)e[r]&&(yield this.getObjectId(r))}*_allFeatureIndices(){const{featureCount:t}=this;for(let e=0;e<t;++e)yield e}}export{s as FeatureData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{baseObjectMemory as t}from"../../../../../../core/memoryEstimations.js";import{generateId as e}from"../utils.js";class s{constructor(t,s){this._parent=t,this._subsetIndices=s,this.id=e(`featureDataSubset-${t.id}-`)}get extent(){return this._parent.extent}get featureCount(){return this._subsetIndices.length}get usedMemory(){return this._parent.usedMemory+t+this._subsetIndices.byteLength}get isFullyEnabled(){for(const t of this._subsetIndices)if(!this._parent.getEnabled(t))return!1;return!0}getObjectId(t){return this._parent.getObjectId(this._subsetIndices[t])}getAttribute(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributeAsTimestamp(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributes(t){return this._parent.getAttributes(this._subsetIndices[t])}getCoordinates(t,e,s){return this._parent.getCoordinates(this._subsetIndices[t],e,s)}getOptimizedGeometry(t){return this._parent.getOptimizedGeometry(this._subsetIndices[t])}getCentroid(t,e){return this._parent.getCentroid(this._subsetIndices[t],e)}getBounds(t){return this._parent.getBounds(this._subsetIndices[t])}getBoundingBox(t){return this._parent.getBoundingBox(this._subsetIndices[t])}getObjectIdsArray(t,e,s){return this._parent.getObjectIdsArray(t,this._translatedIndices(e),s)}getCoordinatesArray(t,e,s){return this._parent.getCoordinatesArray(t,this._translatedIndices(e),s)}objectIds(t){return this._parent.objectIds(this._translatedIndices(t))}subset(t){const{_subsetIndices:e}=this,n=new Uint32Array(t.length);for(let s=0;s<n.length;++s)n[s]=e[t[s]];return new s(this._parent,n)}disableObjectIds(t){if(0===t.size)return;const{featureCount:e}=this,s=new Array;for(let n=0;n<e;++n)this.getEnabled(n)&&t.has(this.getObjectId(n))&&s.push(n);if(0!==s.length)for(const n of s)this.setEnabled(n,!1)}setEnabled(t,e){this._parent.setEnabled(this._subsetIndices[t],e)}getEnabled(t){return this._parent.getEnabled(this._subsetIndices[t])}enableAll(){const{_subsetIndices:t,_parent:e}=this;for(const s of t)e.setEnabled(s,!0)}getVisibilityArray(t,e,s){return this._parent.getVisibilityArray(t,this._translatedIndices(e),s)}enabledObjectIds(t){return this._parent.enabledObjectIds(this._translatedIndices(t))}*_translatedIndices(t){const{_subsetIndices:e}=this;if(null!=t)for(const s of t)yield e[s];else yield*e}}export{s as FeatureDataSubset};
5
+ import{baseObjectMemory as t}from"../../../../../../core/memoryEstimations.js";import{generateId as e}from"../utils.js";class s{constructor(t,s){this._parent=t,this._subsetIndices=s,this.id=e(`featureDataSubset-${t.id}-`)}get tileId(){return this._parent.tileId}get extent(){return this._parent.extent}get featureCount(){return this._subsetIndices.length}get usedMemory(){return this._parent.usedMemory+t+this._subsetIndices.byteLength}get isFullyEnabled(){for(const t of this._subsetIndices)if(!this._parent.getEnabled(t))return!1;return!0}getObjectId(t){return this._parent.getObjectId(this._subsetIndices[t])}getAttribute(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributeAsTimestamp(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributes(t){return this._parent.getAttributes(this._subsetIndices[t])}getCoordinates(t,e,s){return this._parent.getCoordinates(this._subsetIndices[t],e,s)}getOptimizedGeometry(t){return this._parent.getOptimizedGeometry(this._subsetIndices[t])}getCentroid(t,e){return this._parent.getCentroid(this._subsetIndices[t],e)}getBounds(t){return this._parent.getBounds(this._subsetIndices[t])}getBoundingBox(t){return this._parent.getBoundingBox(this._subsetIndices[t])}getObjectIdsArray(t,e,s){return this._parent.getObjectIdsArray(t,this._translatedIndices(e),s)}getCoordinatesArray(t,e,s){return this._parent.getCoordinatesArray(t,this._translatedIndices(e),s)}objectIds(t){return this._parent.objectIds(this._translatedIndices(t))}subset(t){const{_subsetIndices:e}=this,r=new Uint32Array(t.length);for(let s=0;s<r.length;++s)r[s]=e[t[s]];return new s(this._parent,r)}disableObjectIds(t){if(0===t.size)return;const{featureCount:e}=this,s=new Array;for(let r=0;r<e;++r)this.getEnabled(r)&&t.has(this.getObjectId(r))&&s.push(r);if(0!==s.length)for(const r of s)this.setEnabled(r,!1)}setEnabled(t,e){this._parent.setEnabled(this._subsetIndices[t],e)}getEnabled(t){return this._parent.getEnabled(this._subsetIndices[t])}enableAll(){const{_subsetIndices:t,_parent:e}=this;for(const s of t)e.setEnabled(s,!0)}getVisibilityArray(t,e,s){return this._parent.getVisibilityArray(t,this._translatedIndices(e),s)}enabledObjectIds(t){return this._parent.enabledObjectIds(this._translatedIndices(t))}*_translatedIndices(t){const{_subsetIndices:e}=this;if(null!=t)for(const s of t)yield e[s];else yield*e}}export{s as FeatureDataSubset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as o,result as n}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as p,createResolver as g}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";import{isTimeoutError as I}from"../../../../support/requestUtils.js";import{ViewingMode as F}from"../../../ViewingMode.js";let A=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=S,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new G(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f((()=>this.layer.definitionExpression),(async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i((e=>this._queryAndAddGeometryOverrides(e))),await this._applyGeometryOverridesTask.promise)}),_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally((()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}))}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort(((e,t)=>e-t)):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new x(e,(()=>{t.remove(r)}));return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await p(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:o}=t;if(null==o||null==i||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of s)n.has(d.index)||(o.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:o},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=s;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const o=new Set,n=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(o.add(r),n.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(o),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:o}=s,n=[o,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=n,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:o},spatialReference:n}=this.view,a=o===F.Global,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,k(i,n,this.view.viewingMode,E.Mode)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,k(i,n,this.view.viewingMode,E.Mode)),null;if(!(O(i,n)||a&&n.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,k(i,n,this.view.viewingMode,E.SpatialReference)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:p,extractMesh:g}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:o}=e;if(null==t)continue;const n=p(s,t);for(const a of r){const e=g(a,o,i,s,n),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const n=C(e);t=[...t].sort(((e,t)=>e-t));const a=s(t,n).map((t=>{const s=r.clone();return s.objectIds=t,o(w(e,s,{signal:i}))}));return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=r.map((t=>(t in i||(i[t]=new Array(e.length)),i[t]))),d=new Map(s.map((e=>[e.name,e.index]))),c=r.map((e=>d.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const l of t){const e=l.attributes[n];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),o=l.attributes[r[t]];a[t][i]=o,this._cacheAttributeValue(e,s,o)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const o=s.layerId,a=this.is3DOFL,d={f:"json",returnIdsOnly:!0,layers:`[${o}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:o,serverGen:i}])};if(a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await n(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:M,signal:e}));if(!h.ok&&I(h.error)){const e=this.layer.title;c.getLogger(this).warn("extractChanges:timeout",e,`${e} could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.`)}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],o=r?.updates??[],n=r?.deletes??[],d=[...i,...o,...n],c=a?[...i,...s??o,...n]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort(((e,t)=>e-t));for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=g(),i=s.promise;for(const o of e)t.set(o,i);return d((()=>{for(const r of e)t.delete(r);s.resolve()}))}get test(){}};e([b({constructOnly:!0})],A.prototype,"view",void 0),e([b({constructOnly:!0})],A.prototype,"layer",void 0),e([b({readOnly:!0})],A.prototype,"is3DOFL",null),e([b()],A.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],A.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],A.prototype,"geometryOverrides",void 0),e([b()],A.prototype,"_clientGeometryCache",void 0),e([b()],A.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],A.prototype,"memoryController",void 0),e([b()],A.prototype,"_attributeChangedObjectIds",void 0),e([b()],A.prototype,"_geometryChangedObjectIds",void 0),e([b()],A.prototype,"hasGeometryChanges",null),e([b()],A.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],A.prototype,"_pendingFetchAbortController",void 0),e([b()],A.prototype,"_applyGeometryOverridesTask",void 0),e([b()],A.prototype,"updating",null),e([b()],A.prototype,"isEmpty",null),A=e([v("esri.views.3d.layers.i3s.I3SOverrides")],A);class x{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class G{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new L(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class L{constructor(e){this.value=e,this.cachedMemory="string"==typeof e?u(e):m}}const M=1e4,S=5e4;var E;function k(e,t,r,s){return`Displaying the edits of a SceneLayer with a${s===E.Mode?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${s===E.SpatialReference?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${s===E.Mode?"viewing mode":"view spatial reference"} to display edits.`}!function(e){e[e.Mode=0]="Mode",e[e.SpatialReference=1]="SpatialReference"}(E||(E={}));export{A as I3SOverrides};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as o,result as n}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as p,createResolver as g}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";import{isTimeoutError as I}from"../../../../support/requestUtils.js";import{ViewingMode as F}from"../../../ViewingMode.js";let A=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=S,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new G(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f((()=>this.layer.definitionExpression),(async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i((e=>this._queryAndAddGeometryOverrides(e))),await this._applyGeometryOverridesTask.promise)}),_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally((()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}))}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort(((e,t)=>e-t)):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new x(e,(()=>{t.remove(r)}));return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await p(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:o}=t;if(null==o||null==i||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of s)n.has(d.index)||(o.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:o},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=s;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const o=new Set,n=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(o.add(r),n.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(o),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:o}=s,n=[o,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=n,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:o},spatialReference:n}=this.view,a=o===F.Global,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,k(i,n,this.view.viewingMode,E.Mode)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,k(i,n,this.view.viewingMode,E.Mode)),null;if(!(O(i,n)||a&&n.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,k(i,n,this.view.viewingMode,E.SpatialReference)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:p,extractMesh:g}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:o}=e;if(null==t)continue;const n=p(s,t);for(const a of r){const e=g(a,o,i,s,n),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const n=C(e);t=[...t].sort(((e,t)=>e-t));const a=s(t,n).map((t=>{const s=r.clone();return s.objectIds=t,o(w(e,s,{signal:i}))}));return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=r.map((t=>(t in i||(i[t]=new Array(e.length)),i[t]))),d=new Map(s.map((e=>[e.name,e.index]))),c=r.map((e=>d.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const l of t){const e=l.attributes[n];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),o=l.attributes[r[t]];a[t][i]=o,this._cacheAttributeValue(e,s,o)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const o=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${o}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:o,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await n(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:M,signal:e}));if(!h.ok&&I(h.error)){const e=this.layer.title;c.getLogger(this).warn("extractChanges:timeout",e,`${e} could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.`)}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],o=r?.updates??[],n=r?.deletes??[],d=[...i,...o,...n],c=a?[...i,...s??o,...n]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort(((e,t)=>e-t));for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=g(),i=s.promise;for(const o of e)t.set(o,i);return d((()=>{for(const r of e)t.delete(r);s.resolve()}))}get test(){}};e([b({constructOnly:!0})],A.prototype,"view",void 0),e([b({constructOnly:!0})],A.prototype,"layer",void 0),e([b({readOnly:!0})],A.prototype,"is3DOFL",null),e([b()],A.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],A.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],A.prototype,"geometryOverrides",void 0),e([b()],A.prototype,"_clientGeometryCache",void 0),e([b()],A.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],A.prototype,"memoryController",void 0),e([b()],A.prototype,"_attributeChangedObjectIds",void 0),e([b()],A.prototype,"_geometryChangedObjectIds",void 0),e([b()],A.prototype,"hasGeometryChanges",null),e([b()],A.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],A.prototype,"_pendingFetchAbortController",void 0),e([b()],A.prototype,"_applyGeometryOverridesTask",void 0),e([b()],A.prototype,"updating",null),e([b()],A.prototype,"isEmpty",null),A=e([v("esri.views.3d.layers.i3s.I3SOverrides")],A);class x{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class G{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new L(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class L{constructor(e){this.value=e,this.cachedMemory="string"==typeof e?u(e):m}}const M=1e4,S=5e4;var E;function k(e,t,r,s){return`Displaying the edits of a SceneLayer with a${s===E.Mode?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${s===E.SpatialReference?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${s===E.Mode?"viewing mode":"view spatial reference"} to display edits.`}!function(e){e[e.Mode=0]="Mode",e[e.SpatialReference=1]="SpatialReference"}(E||(E={}));export{A as I3SOverrides};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as r}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBOResource.js";import{ColorFormat as h,isDepthFormat as o,DepthTextureFormats as s,ColorFormats as i,DepthFormat as n}from"./FBOCacheFormats.js";import{FBOPool as l}from"./FBOPool.js";import{ColorAttachment0 as u,DepthStencilAttachment as m}from"../../../webgl/enums.js";import{FramebufferObject as d}from"../../../webgl/FramebufferObject.js";import{Texture as p}from"../../../webgl/Texture.js";class f{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new l(e.newCache,"FBOCache"),this._depthCache=new l(e.newCache,"DepthAttachmentCache"),this._colorCache=new l(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===c.FBO&&e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(t,r,c,s=h.RGBA8UNORM){const i=_(s,t,r);let l=this._cache.pop(i);const{rctx:p}=this;if(l){l.retain(),l.setName(c);const{fbo:t}=l;if(!t)throw new e("renderer","attempt to use a not existing framebuffer");p.temporaryBindFramebufferObject(t,(()=>{p.setDrawBuffers([u]),p.unbindTexture(t.colorTexture)}))}else{const e=new d(p),f=(e,a,c)=>{a??=h.RGBA8UNORM;const o=this._acquireColor(a,t,r,c??`${l.name} color ${e}`);return this.rctx.unbindTexture(o.attachment),l.attachColor(o,e),o.release(),l},C=e=>{e??=n.DEPTH24_STENCIL8;const a=this.acquireDepth(e,t,r,`${l.name} depth`);return l.attachDepth(a),a.release(),l},_=()=>{this.debugCallback?.(l.name,l.fbo),this._acquired.delete(l);const e=o(s);!e&&null!=l?.getAttachment(u)||e&&null!=l?.getAttachment(m)?(e?(l.fbo?.invalidateAttachments([m]),l.detachAllColors()):(l.fbo?.invalidateAttachments([u],!0),l.detachAllButColor0()),this._cache.put(l)):l?.dispose()};l=new a(i,c,e,f,C,_),o(s)?l.acquireDepth(s):l.acquireColor(u,s,c)}return this._trackHandle(l)}acquireDepth(e,t,a,c){const h=_(e,t,a);let o=this._depthCache.pop(h);if(o)o.retain();else{const c=new p(this.rctx,{...s[e],width:t,height:a});o=new r(h,c,(()=>this._depthCache.put(o)))}return o.name=c,o}_acquireColor(e,r,a,c){const h=_(e,r,a),o=this._colorCache.pop(h);if(o)return o.retain(),o.name=c,o;const s=new t(h,new p(this.rctx,{...i[e],width:r,height:a}),(()=>{this._colorCache.put(s)}));return s.name=c,s}_trackHandle(e){return this._acquired.add(e),e}}const C=new a("default","default",null,(()=>C),(()=>C),(()=>{}));function _(e,t,r){return`${e}x${t}x${r}`}C.release=()=>!1;export{f as FBOCache,C as defaultWebGLFBO};
5
+ import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as r}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBOResource.js";import{ColorFormat as h,isDepthFormat as o,DepthTextureFormats as s,ColorFormats as n,DepthFormat as i}from"./FBOCacheFormats.js";import{FBOPool as l}from"./FBOPool.js";import{DepthStencilAttachment as m,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as d}from"../../../webgl/FramebufferObject.js";import{Texture as p}from"../../../webgl/Texture.js";class f{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new l(e.newCache,"FBOCache"),this._depthCache=new l(e.newCache,"DepthAttachmentCache"),this._colorCache=new l(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===c.FBO&&e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(t,r,c,s=h.RGBA8UNORM){const n=C(s,t,r);let l=this._cache.pop(n);const{rctx:p}=this;if(l){l.retain(),l.setName(c);const t=l.getAttachment(m);t&&(t.name=`${c}.depth`);const r=l.getAttachment(u);r&&(r.name=`${c}.color_0`);const{fbo:a}=l;if(!a)throw new e("renderer","attempt to use a none existing framebuffer");p.temporaryBindFramebufferObject(a,(()=>{p.setDrawBuffers([u]),p.unbindTexture(a.colorTexture)}))}else{const e=new d(p),f=(e,a,c)=>{a??=h.RGBA8UNORM;const o=this._acquireColor(a,t,r,c??`${l.name}.color_${e-u}`);return this.rctx.unbindTexture(o.attachment),l.attachColor(o,e),o.release(),l},_=e=>{e??=i.DEPTH24_STENCIL8;const a=this.acquireDepth(e,t,r,`${l.name} depth`);return l.attachDepth(a),a.release(),l},C=()=>{this.debugCallback?.(l.name,l.fbo),this._acquired.delete(l);const e=o(s);!e&&null!=l?.getAttachment(u)||e&&null!=l?.getAttachment(m)?(e?(l.fbo?.invalidateAttachments([m]),l.detachAllColors()):(l.fbo?.invalidateAttachments([u],!0),l.detachAllButColor0()),this._cache.put(l)):l?.dispose()};l=new a(n,c,e,f,_,C),o(s)?l.acquireDepth(s):l.acquireColor(u,s,c)}return this._trackHandle(l)}acquireDepth(e,t,a,c){const h=C(e,t,a);let o=this._depthCache.pop(h);if(o)o.retain();else{const c=new p(this.rctx,{...s[e],width:t,height:a});o=new r(h,c,(()=>this._depthCache.put(o)))}return o.name=c,o}_acquireColor(e,r,a,c){const h=C(e,r,a),o=this._colorCache.pop(h);if(o)return o.retain(),o.name=c,o;const s=new t(h,new p(this.rctx,{...n[e],width:r,height:a}),(()=>{this._colorCache.put(s)}));return s.name=c,s}_trackHandle(e){return this._acquired.add(e),e}}const _=new a("default","default",null,(()=>_),(()=>_),(()=>{}));function C(e,t,r){return`${t}x${r}:${e}`}_.release=()=>!1;export{f as FBOCache,_ as defaultWebGLFBO};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{PixelFormat as T,SizedPixelFormat as E,TextureWrapMode as R,TextureSamplingMode as N,PixelType as e,SizedDepthStencilFormat as n,SizedDepthFormat as t,UnsizedDepthFormat as a}from"../../../webgl/enums.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as _}from"../../../webgl/textureUtils.js";var M,O;function r(T){return T>=M.COUNT}!function(T){T[T.R8UNORM=0]="R8UNORM",T[T.R8UINT=1]="R8UINT",T[T.RG8UNORM=2]="RG8UNORM",T[T.RG8UINT=3]="RG8UINT",T[T.RGBA4UNORM=4]="RGBA4UNORM",T[T.RGBA8UNORM=5]="RGBA8UNORM",T[T.RGBA8UNORM_MIPMAP=6]="RGBA8UNORM_MIPMAP",T[T.R16FLOAT=7]="R16FLOAT",T[T.RGBA16FLOAT=8]="RGBA16FLOAT",T[T.R32FLOAT=9]="R32FLOAT",T[T.COUNT=10]="COUNT"}(M||(M={})),function(T){T[T.DEPTH16=10]="DEPTH16",T[T.DEPTH24_STENCIL8=11]="DEPTH24_STENCIL8"}(O||(O={}));const A=new o;A.pixelFormat=T.RED,A.internalFormat=E.R8,A.wrapMode=R.CLAMP_TO_EDGE;const G=new o;G.pixelFormat=T.RED_INTEGER,G.internalFormat=E.R8UI,G.wrapMode=R.CLAMP_TO_EDGE,G.samplingMode=N.NEAREST;const p=new o;p.pixelFormat=T.RG,p.internalFormat=E.RG8,p.wrapMode=R.CLAMP_TO_EDGE;const F=new o;F.pixelFormat=T.RG_INTEGER,F.internalFormat=E.RG8UI,F.wrapMode=R.CLAMP_TO_EDGE,F.samplingMode=N.NEAREST;const P=new o;P.internalFormat=E.RGBA4,P.dataType=e.UNSIGNED_SHORT_4_4_4_4,P.wrapMode=R.CLAMP_TO_EDGE;const i=new o;i.wrapMode=R.CLAMP_TO_EDGE;const m=new o;m.wrapMode=R.CLAMP_TO_EDGE,m.samplingMode=N.LINEAR_MIPMAP_LINEAR,m.hasMipmap=!0,m.maxAnisotropy=8;const D=new o;D.pixelFormat=T.RED,D.dataType=e.HALF_FLOAT,D.internalFormat=E.R16F,D.samplingMode=N.NEAREST;const L=new o;L.dataType=e.HALF_FLOAT,L.internalFormat=E.RGBA16F,L.wrapMode=R.CLAMP_TO_EDGE;const U=new o;U.pixelFormat=T.RED,U.dataType=e.FLOAT,U.internalFormat=E.R32F,U.samplingMode=N.NEAREST;const I={[M.R8UNORM]:A,[M.R8UINT]:G,[M.RG8UNORM]:p,[M.RG8UINT]:F,[M.RGBA4UNORM]:P,[M.RGBA8UNORM]:i,[M.RGBA8UNORM_MIPMAP]:m,[M.R16FLOAT]:D,[M.RGBA16FLOAT]:L,[M.R32FLOAT]:U,[M.COUNT]:null},l={[t.DEPTH_COMPONENT16]:e.UNSIGNED_SHORT,[t.DEPTH_COMPONENT24]:e.UNSIGNED_INT,[t.DEPTH_COMPONENT32F]:e.FLOAT,[n.DEPTH24_STENCIL8]:e.UNSIGNED_INT_24_8,[n.DEPTH32F_STENCIL8]:e.FLOAT_32_UNSIGNED_INT_24_8_REV},s={[O.DEPTH24_STENCIL8]:C(n.DEPTH24_STENCIL8),[O.DEPTH16]:C(t.DEPTH_COMPONENT16)};function C(T){const E=new o;return E.pixelFormat=_(T)?a.DEPTH_COMPONENT:a.DEPTH_STENCIL,E.dataType=l[T],E.samplingMode=N.NEAREST,E.wrapMode=R.CLAMP_TO_EDGE,E.internalFormat=T,E.hasMipmap=!1,E.isImmutable=!0,E}export{M as ColorFormat,I as ColorFormats,O as DepthFormat,s as DepthTextureFormats,r as isDepthFormat};
5
+ import{PixelFormat as R,SizedPixelFormat as T,TextureWrapMode as E,TextureSamplingMode as N,PixelType as A,SizedDepthStencilFormat as M,SizedDepthFormat as O,UnsizedDepthFormat as n}from"../../../webgl/enums.js";import{TextureDescriptor as e}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as t}from"../../../webgl/textureUtils.js";var o,_;!function(R){R[R.R8UNORM=0]="R8UNORM",R[R.R8UINT=1]="R8UINT",R[R.RG8UNORM=2]="RG8UNORM",R[R.RG8UINT=3]="RG8UINT",R[R.RGBA4UNORM=4]="RGBA4UNORM",R[R.RGBA8UNORM=5]="RGBA8UNORM",R[R.RGBA8UNORM_MIPMAP=6]="RGBA8UNORM_MIPMAP",R[R.R16FLOAT=7]="R16FLOAT",R[R.RGBA16FLOAT=8]="RGBA16FLOAT",R[R.R32FLOAT=9]="R32FLOAT",R[R.COUNT=10]="COUNT"}(o||(o={})),function(R){R[R.DEPTH16=10]="DEPTH16",R[R.DEPTH24_STENCIL8=11]="DEPTH24_STENCIL8"}(_||(_={}));const a={[o.R8UNORM]:"R8",[o.R8UINT]:"R8UI",[o.R16FLOAT]:"R16F",[o.R32FLOAT]:"R32F",[o.RG8UNORM]:"RG8",[o.RG8UINT]:"RG8UI",[o.RGBA8UNORM]:"RGBA8",[o.RGBA4UNORM]:"RGBA4",[o.RGBA8UNORM_MIPMAP]:"RGBA8_MM",[o.RGBA16FLOAT]:"RGBA16F",[_.DEPTH16]:"D16",[_.DEPTH24_STENCIL8]:"D24S8"};function G(R){return R>=o.COUNT}const r=new e;r.pixelFormat=R.RED,r.internalFormat=T.R8,r.wrapMode=E.CLAMP_TO_EDGE;const F=new e;F.pixelFormat=R.RED_INTEGER,F.internalFormat=T.R8UI,F.wrapMode=E.CLAMP_TO_EDGE,F.samplingMode=N.NEAREST;const U=new e;U.pixelFormat=R.RG,U.internalFormat=T.RG8,U.wrapMode=E.CLAMP_TO_EDGE;const P=new e;P.pixelFormat=R.RG_INTEGER,P.internalFormat=T.RG8UI,P.wrapMode=E.CLAMP_TO_EDGE,P.samplingMode=N.NEAREST;const D=new e;D.internalFormat=T.RGBA4,D.dataType=A.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=E.CLAMP_TO_EDGE;const I=new e;I.wrapMode=E.CLAMP_TO_EDGE;const L=new e;L.wrapMode=E.CLAMP_TO_EDGE,L.samplingMode=N.LINEAR_MIPMAP_LINEAR,L.hasMipmap=!0,L.maxAnisotropy=8;const p=new e;p.pixelFormat=R.RED,p.dataType=A.HALF_FLOAT,p.internalFormat=T.R16F,p.samplingMode=N.NEAREST;const i=new e;i.dataType=A.HALF_FLOAT,i.internalFormat=T.RGBA16F,i.wrapMode=E.CLAMP_TO_EDGE;const m=new e;m.pixelFormat=R.RED,m.dataType=A.FLOAT,m.internalFormat=T.R32F,m.samplingMode=N.NEAREST;const l={[o.R8UNORM]:r,[o.R8UINT]:F,[o.RG8UNORM]:U,[o.RG8UINT]:P,[o.RGBA4UNORM]:D,[o.RGBA8UNORM]:I,[o.RGBA8UNORM_MIPMAP]:L,[o.R16FLOAT]:p,[o.RGBA16FLOAT]:i,[o.R32FLOAT]:m,[o.COUNT]:null},s={[O.DEPTH_COMPONENT16]:A.UNSIGNED_SHORT,[O.DEPTH_COMPONENT24]:A.UNSIGNED_INT,[O.DEPTH_COMPONENT32F]:A.FLOAT,[M.DEPTH24_STENCIL8]:A.UNSIGNED_INT_24_8,[M.DEPTH32F_STENCIL8]:A.FLOAT_32_UNSIGNED_INT_24_8_REV},C={[_.DEPTH24_STENCIL8]:w(M.DEPTH24_STENCIL8),[_.DEPTH16]:w(O.DEPTH_COMPONENT16)};function w(R){const T=new e;return T.pixelFormat=t(R)?n.DEPTH_COMPONENT:n.DEPTH_STENCIL,T.dataType=s[R],T.samplingMode=N.NEAREST,T.wrapMode=E.CLAMP_TO_EDGE,T.internalFormat=R,T.hasMipmap=!1,T.isImmutable=!0,T}export{o as ColorFormat,l as ColorFormats,_ as DepthFormat,C as DepthTextureFormats,a as format2String,G as isDepthFormat};
@@ -2,35 +2,10 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{calculateUVZShadowPass as e,calculateUVZShadowDraw as o,ReadShadowMapOrigin as s}from"./calculateUVZShadow.glsl.js";import{glsl as d}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as t}from"../../shaderModules/Texture2DBindUniform.js";import{NoParameters as r}from"../../../../../webgl/NoParameters.js";class h extends s{}class i extends r{constructor(){super(...arguments),this.origin=a()}}function l(a,o){o.receiveShadows&&(a.include(e),v(a))}function p(a,e){e.receiveShadows&&(a.include(o),v(a))}function v(a){const{fragment:e}=a;e.uniforms.add(new t("shadowMap",(a=>a.shadowMap.depthTexture))).code.add(d`float readShadowMapDepth(ivec2 uv, sampler2D _shadowMap) {
6
- return texelFetch(_shadowMap, uv, 0).r;
7
- }
8
- float posIsInShadow(ivec2 uv, float lvposZ, sampler2D _shadowMap) {
9
- return readShadowMapDepth(uv, _shadowMap) < lvposZ ? 1.0 : 0.0;
10
- }
11
- float filterShadow(vec3 uvzShadow, sampler2D _shadowMap) {
12
- vec2 texSize = vec2(textureSize(_shadowMap, 0));
13
- vec2 uv = uvzShadow.xy;
14
- vec2 uvScaledMidPixel = uv * texSize - vec2(0.5);
15
- vec2 st = fract(uvScaledMidPixel);
16
- ivec2 base = ivec2(uvScaledMidPixel);
17
- float lvposZ = uvzShadow.z;
18
- float s00 = posIsInShadow(ivec2(base.x, base.y ), lvposZ, _shadowMap);
19
- float s10 = posIsInShadow(ivec2(base.x + 1, base.y ), lvposZ, _shadowMap);
20
- float s11 = posIsInShadow(ivec2(base.x + 1, base.y + 1), lvposZ, _shadowMap);
21
- float s01 = posIsInShadow(ivec2(base.x, base.y + 1), lvposZ, _shadowMap);
22
- return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
23
- }
24
- bool posIsInShadowF(vec3 uvzShadow, sampler2D _shadowMap) {
25
- ivec2 texSize = textureSize(_shadowMap, 0);
26
- ivec2 iuvShadow = ivec2(uvzShadow.xy * vec2(texSize));
27
- float depthShadow = readShadowMapDepth(iuvShadow, _shadowMap);
28
- return depthShadow < uvzShadow.z;
29
- }
30
- float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{calculateUVZShadowPass as o,calculateUVZShadowDraw as r,ReadShadowMapOrigin as a}from"./calculateUVZShadow.glsl.js";import{ShadowmapFiltering as s}from"./ShadowmapFiltering.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as d}from"../../shaderModules/Texture2DBindUniform.js";import{NoParameters as i}from"../../../../../webgl/NoParameters.js";class l extends a{}class n extends i{constructor(){super(...arguments),this.origin=e()}}function c(e,r){r.receiveShadows&&(e.include(o),h(e))}function u(e,o){o.receiveShadows&&(e.include(r),h(e))}function h(e){e.include(s);const{fragment:o}=e;o.uniforms.add(new d("shadowMap",(e=>e.shadowMap.depthTexture))),o.code.add(t`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
31
6
  vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap,0));
32
7
  if (uvzShadow.z < 0.0) {
33
8
  return 0.0;
34
9
  }
35
10
  return filterShadow(uvzShadow, shadowMap);
36
- }`)}export{p as ReadShadowMapDraw,h as ReadShadowMapDrawParameters,l as ReadShadowMapPass,i as ReadShadowMapPassParameters};
11
+ }`)}export{u as ReadShadowMapDraw,l as ReadShadowMapDrawParameters,c as ReadShadowMapPass,n as ReadShadowMapPassParameters};
@@ -0,0 +1,29 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{ReadShadowMapOrigin as a}from"./calculateUVZShadow.glsl.js";import{glsl as e}from"../../shaderModules/glsl.js";class o extends a{}function s(a){a.fragment.code.add(e`float readShadowMapDepth(ivec2 uv, sampler2D _shadowMap) {
6
+ return texelFetch(_shadowMap, uv, 0).r;
7
+ }
8
+ float posIsInShadowAsFloat(ivec2 uv, float lvposZ, sampler2D _shadowMap) {
9
+ return readShadowMapDepth(uv, _shadowMap) < lvposZ ? 1.0 : 0.0;
10
+ }
11
+ float filterShadow(vec3 uvzShadow, sampler2D _shadowMap) {
12
+ vec2 texSize = vec2(textureSize(_shadowMap, 0));
13
+ vec2 uv = uvzShadow.xy;
14
+ vec2 uvScaledMidPixel = uv * texSize - vec2(0.5);
15
+ vec2 st = fract(uvScaledMidPixel);
16
+ ivec2 base = ivec2(uvScaledMidPixel);
17
+ float lvposZ = uvzShadow.z;
18
+ float s00 = posIsInShadowAsFloat(ivec2(base.x, base.y ), lvposZ, _shadowMap);
19
+ float s10 = posIsInShadowAsFloat(ivec2(base.x + 1, base.y ), lvposZ, _shadowMap);
20
+ float s11 = posIsInShadowAsFloat(ivec2(base.x + 1, base.y + 1), lvposZ, _shadowMap);
21
+ float s01 = posIsInShadowAsFloat(ivec2(base.x, base.y + 1), lvposZ, _shadowMap);
22
+ return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
23
+ }
24
+ bool posIsInShadow(vec3 uvzShadow, sampler2D _shadowMap) {
25
+ ivec2 texSize = textureSize(_shadowMap, 0);
26
+ ivec2 iuvShadow = ivec2(uvzShadow.xy * vec2(texSize));
27
+ float depthShadow = readShadowMapDepth(iuvShadow, _shadowMap);
28
+ return depthShadow < uvzShadow.z;
29
+ }`)}export{o as ReadShadowMapDrawParameters,s as ShadowmapFiltering};