@arcgis/core 4.24.0-next.20220331 → 4.24.0-next.20220401

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 (124) hide show
  1. package/WebScene.js +1 -1
  2. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  3. package/analysis/LineOfSightAnalysisTarget.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
  6. package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
  7. package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{19cb7315d403a4cd4f59.js → 2530e8ccf6e12787ce76.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{302c68c5b91d1ab4fd47.js → 560234694f3e53802aff.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
  11. package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
  12. package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
  13. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
  14. package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
  15. package/assets/esri/core/workers/chunks/{9a32f129f0d67547e44c.js → 831dc0187f71e658550c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d162d1b7b97a58e97d8c.js → 8958cd555f4887526e8b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{a5b54e134ae59629d6d1.js → 93067e27eea5844edc6c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{0b63c9d5d9c004923a97.js → b26bd8fde2fc65bb67fb.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b81e1df3a47b61421295.js → b34ba22c7a5adce8a7a2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e1408ff1b8343674e6ef.js → c59b0b58e24e6a60cf3e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{f4e79769297ad9c1d508.js → c7cee13a962396b23a5e.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{cb38754110b7a0e901f6.js → cd3679fa86129ebabfdf.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
  26. package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
  27. package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fbb7a121a45f8ca7d89c.js → f4fc165420d449e442b8.js} +1 -1
  29. package/assets/esri/themes/base/widgets/_Widget.scss +2 -2
  30. package/assets/esri/themes/dark/main.css +1 -1
  31. package/assets/esri/themes/dark-blue/main.css +1 -1
  32. package/assets/esri/themes/dark-green/main.css +1 -1
  33. package/assets/esri/themes/dark-purple/main.css +1 -1
  34. package/assets/esri/themes/dark-red/main.css +1 -1
  35. package/assets/esri/themes/light/main.css +1 -1
  36. package/assets/esri/themes/light/view.css +1 -1
  37. package/assets/esri/themes/light-blue/main.css +1 -1
  38. package/assets/esri/themes/light-green/main.css +1 -1
  39. package/assets/esri/themes/light-purple/main.css +1 -1
  40. package/assets/esri/themes/light-red/main.css +1 -1
  41. package/core/AsyncUpdate.js +1 -1
  42. package/exports/csv.js +1 -1
  43. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  44. package/geometry/support/normalizeUtils.js +1 -1
  45. package/interfaces.d.ts +120 -0
  46. package/layers/MapImageLayer.js +1 -1
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/VectorTileLayer.js +1 -1
  49. package/layers/graphics/editingSupport.js +1 -1
  50. package/layers/mixins/ArcGISImageService.js +1 -1
  51. package/layers/support/RasterJobHandler.js +1 -1
  52. package/layers/support/SpriteSource.js +1 -1
  53. package/layers/support/Sublayer.js +1 -1
  54. package/layers/support/TilemapCache.js +1 -1
  55. package/layers/support/vectorTileLayerLoader.js +1 -1
  56. package/libs/i3s/I3SModule.js +1 -1
  57. package/libs/vxl/VxlModule.js +1 -1
  58. package/package.json +1 -1
  59. package/portal/support/layersLoader.js +1 -1
  60. package/portal/support/portalLayers.js +1 -1
  61. package/renderers/support/DictionaryLoader.js +1 -1
  62. package/rest/query/operations/query.js +1 -1
  63. package/rest/query/operations/queryTopFeatures.js +1 -1
  64. package/rest/support/DirectionLine.js +1 -1
  65. package/rest/support/DirectionPoint.js +1 -1
  66. package/rest/support/PointBarrier.js +1 -1
  67. package/rest/support/PolygonBarrier.js +1 -1
  68. package/rest/support/PolylineBarrier.js +1 -1
  69. package/rest/support/RouteInfo.js +1 -1
  70. package/rest/support/Stop.js +1 -1
  71. package/smartMapping/labels/clusters.js +1 -1
  72. package/smartMapping/renderers/color.js +1 -1
  73. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  74. package/support/elevationInfoUtils.js +1 -1
  75. package/support/revision.js +1 -1
  76. package/symbols/support/previewSymbol3D.js +1 -1
  77. package/symbols/support/symbolLayerUtils.js +1 -1
  78. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  79. package/views/2d/engine/webgl/util/Lock.js +1 -1
  80. package/views/2d/layers/RouteLayerView2D.js +1 -1
  81. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  82. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  83. package/views/2d/layers/support/webStyleUtils.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  86. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  87. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  88. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  89. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  90. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  91. package/views/3d/layers/RouteLayerView3D.js +1 -1
  92. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  93. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  94. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  95. package/views/3d/support/debugFlags.js +1 -1
  96. package/views/3d/terrain/TerrainSurface.js +1 -1
  97. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  98. package/views/SceneView.js +1 -1
  99. package/views/layers/ImageryTileLayerView.js +1 -1
  100. package/views/layers/MapImageLayerView.js +1 -1
  101. package/views/layers/TileLayerView.js +1 -1
  102. package/views/support/DefaultsFromMap.js +1 -1
  103. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  104. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  105. package/widgets/Directions/DirectionsViewModel.js +1 -1
  106. package/widgets/Directions.js +1 -1
  107. package/widgets/Editor.js +1 -1
  108. package/widgets/Feature/support/featureUtils.js +1 -1
  109. package/widgets/FeatureForm/InputField.js +1 -1
  110. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  111. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  112. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  113. package/widgets/Popup/actionUtils.js +1 -1
  114. package/widgets/Search/SearchViewModel.js +1 -1
  115. package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
  116. package/assets/esri/core/workers/chunks/1e590d63187ada4f5ff7.js +0 -1
  117. package/assets/esri/core/workers/chunks/391a330182c616cfffaf.js +0 -1
  118. package/assets/esri/core/workers/chunks/3a85312fd7d0cda9ce93.js +0 -1
  119. package/assets/esri/core/workers/chunks/3c00e38d3b16f4a53a4f.js +0 -1
  120. package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
  121. package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
  122. package/assets/esri/core/workers/chunks/bbfc98e33d4630eb9e5c.js +0 -1
  123. package/assets/esri/core/workers/chunks/bd725783b85f308e2c89.js +0 -1
  124. package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{screenPointObjectToArray as o}from"../../../../core/screenUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as c,g as a,n as p,a as m}from"../../../../chunks/vec3.js";import{d as l,c as d}from"../../../../chunks/vec3f64.js";import{create as u,copy as y,fromPoints as f}from"../../../../geometry/support/ray.js";import{sv2d as h}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as g}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as I}from"./LineOfSightIntersectionResult.js";import{isI3sIntersectorResult as j}from"../../layers/i3s/Intersector.js";import{fromScreen as w}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as v}from"../../terrain/Intersector.js";import{tilesAreRelated as R}from"../../terrain/tileUtils.js";import{newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as C,IntersectorType as S}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as T}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let U=class extends t{constructor(e){super(e)}initialize(){this.intersector=b(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=C.MIN}getScreenPointIntersection(e){const t=o(e,h.get()),r=w(this.view.state.camera,t,O);return this._getRayIntersection(r)}_getRayIntersection(e){if(r(e))return null;this.view.sceneIntersectionHelper.intersectToolIntersectorRay(e,this.intersector);const t=this.intersector.results.min;if(!t.getIntersectionPoint(_))return null;const o=this.view.renderCoordsHelper.fromRenderCoords(_,this.view.spatialReference),i=l(t.normal),n=c(i,e.direction)>0?-1:1;if(a(i,i,n),j(t))return new I({type:S.OBJECT,id:`${t.target.layerUid}/${t.target.nodeIndex}/${t.target.componentIndex}`,point:o,normal:i,ray:y(e)});if(v(t))return new I({type:S.TERRAIN,id:t.target.lij.slice(),point:o,normal:i,ray:y(e)});const p=T(t,this.view);if(s(p)){const t=p.layer,r=p.sourceLayer;let s;if(r)if("scene"===r.type)s=g(p,r.objectIdField);else s=p.uid;else s=p.uid;return new I({type:S.OBJECT,id:`${t.uid}/${s}`,point:o,normal:i,ray:y(e)})}return null}_canUpdateFromIntersectionResult(e,t){if(r(e)||!t||e.type!==t.type)return!1;switch(e.type){case S.TERRAIN:{const r=e.id,s=t.id;return r[0]===s[0]&&r[1]===s[1]&&r[2]===s[2]||R(r,s)}case S.OBJECT:case S.I3S:return e.id===t.id}}updateFromIntersectionResult(e){let t;if(e.type===S.TERRAIN&&s(e.point)){const r=_,s=A,o=E;this.view.renderCoordsHelper.toRenderCoords(e.point,s),this.view.renderCoordsHelper.worldUpAtPosition(s,o);const i=this.view.basemapTerrain.elevationBounds,n=this.view.renderCoordsHelper.getAltitude(s),c=i?Math.abs(i.max-i.min)/Math.abs(n):100,l=n>0?1:-1;p(o,o),a(o,o,l*c),m(r,s,o),f(r,s,O),t=this._getRayIntersection(O)}else t=this._getRayIntersection(e.ray);return this._canUpdateFromIntersectionResult(t,e)?t.point:null}};e([i()],U.prototype,"view",void 0),e([i()],U.prototype,"intersector",void 0),U=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],U);const _=d(),A=d(),E=d(),O=u();export{U as LineOfSightRayIntersector};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{screenPointObjectToArray as o}from"../../../../core/screenUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as c,g as a,n as p,a as l,c as m}from"../../../../chunks/vec3.js";import{d,a as u,c as h}from"../../../../chunks/vec3f64.js";import{create as y,copy as f,fromPoints as g}from"../../../../geometry/support/ray.js";import{sv2d as I}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as w}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as v}from"./LineOfSightIntersectionResult.js";import{isI3sIntersectorResult as j}from"../../layers/i3s/Intersector.js";import{fromScreen as R}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as b}from"../../terrain/Intersector.js";import{tilesAreRelated as C}from"../../terrain/tileUtils.js";import{newIntersector as T}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as U,IntersectorType as H}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as S}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let A=class extends t{constructor(e){super(e)}initialize(){this.intersector=T(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=U.MIN}getScreenPointIntersection(e){const t=o(e,I.get()),r=R(this.view.state.camera,t,F);return this._getRayIntersection(r)}_getRayIntersection(e){if(r(e)||r(this.view.sceneIntersectionHelper))return null;this.view.sceneIntersectionHelper.intersectToolIntersectorRay(e,this.intersector);const t=this.intersector.results.min;if(!t.getIntersectionPoint(_))return null;const o=this.view.renderCoordsHelper.fromRenderCoords(_,this.view.spatialReference),i=d(t.normal),n=c(i,e.direction)>0?-1:1;if(a(i,i,n),j(t))return new v({type:H.OBJECT,id:`${t.target.layerUid}/${t.target.nodeIndex}/${t.target.componentIndex}`,point:o,normal:i,ray:f(e),graphic:null});if(b(t))return new v({type:H.TERRAIN,id:t.target.lij.slice(),point:o,normal:i,ray:f(e),graphic:null});const p=S(t,this.view);if(s(p)){const t=p.layer,r=p.sourceLayer;let s;if(r)if("scene"===r.type)s=w(p,r.objectIdField);else s=p.uid;else s=p.uid;return new v({type:H.OBJECT,id:`${t.uid}/${s}`,point:o,normal:i,ray:f(e),graphic:p})}return null}_canUpdateFromIntersectionResult(e,t){if(r(e)||!t||e.type!==t.type)return!1;switch(e.type){case H.TERRAIN:{const r=e.id,s=t.id;return r[0]===s[0]&&r[1]===s[1]&&r[2]===s[2]||C(r,s)}case H.OBJECT:case H.I3S:return e.id===t.id}}updateFromIntersectionResult(e){let t;if(e.type===H.TERRAIN&&s(e.point)){const r=_,s=x,o=E;this.view.renderCoordsHelper.toRenderCoords(e.point,s),this.view.renderCoordsHelper.worldUpAtPosition(s,o);const i=this.view.basemapTerrain.elevationBounds,n=this.view.renderCoordsHelper.getAltitude(s),c=i?Math.abs(i.max-i.min)/Math.abs(n):100,m=n>0?1:-1;p(o,o),a(o,o,m*c),l(r,s,o),g(r,s,F),t=this._getRayIntersection(F)}else t=this._getRayIntersection(e.ray);return this._canUpdateFromIntersectionResult(t,e)?t.point:null}adjustFromGroundIntersection(e,t){const r=_,o=x,i=E;m(o,e),this.view.renderCoordsHelper.worldUpAtPosition(o,i);const n=this.view.basemapTerrain.elevationBounds,c=this.view.renderCoordsHelper.getAltitude(o),d=n?Math.abs(n.max-n.min):100,h=c>0?1:-1;p(i,i),a(i,i,h*d),l(r,o,i),g(r,o,F);const y=this._getRayIntersection(F);return s(y)&&s(y.point)?(this.view.renderCoordsHelper.toRenderCoords(y.point,t),u(y.normal)):(m(t,e),null)}};e([i()],A.prototype,"view",void 0),e([i()],A.prototype,"intersector",void 0),A=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],A);const _=h(),x=h(),E=h(),F=y();export{A as LineOfSightRayIntersector};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../../core/Collection.js";import s from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../../core/handleUtils.js";import l from"../../../../../core/Logger.js";import{destroyMaybe as c,isSome as h,removeMaybe as p,isNone as u,applySome as d}from"../../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}from"../../../../../core/reactiveUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as T}from"../../../../../geometry/support/lineSegment.js";import{LineOfSightRayIntersector as f}from"../../../analysis/LineOfSight/LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as M}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as w,createSphereManipulatorRenderObjects as C}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as L}from"../../visualElements/LaserlineVisualElement.js";import{createManipulatorDragEventPipeline as k}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as S}from"../../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as V}from"../../../../interactive/interfaces.js";var O;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(O||(O={}));const E=a.ofType(r),j=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let P=class extends S{constructor(e){super(e),this.configuration=new M,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new f({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===O.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?h(this._grabbedManipulator)?O.Created:O.Creating:h(this.analysis.observer)&&h(this.analysis.observer.position)?O.Created:O.Ready}get cursor(){return!this._someManipulatorsFocused&&this.active&&this._showTracker?"crosshair":null}get updating(){return!!h(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&h(this.analysis.observer)&&h(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){this.analysis.visible=!0}onHide(){this.analysis.visible=!1}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=p(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=p(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void j.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);u(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void j.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);h(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),h(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_createTargetTracker(e){this.analysisView.cursorTarget=new r({position:e.point,intersection:e})}_clearTargetTracker(){h(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=w(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return h(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;u(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=C(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return u(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return k(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return k(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(h(this.analysis.observer)?(this.analysis.observer.position=e.intersection.point,this.analysis.observer.intersection=e.intersection):this.analysis.observer=new i({position:e.intersection.point,intersection:e.intersection}),e)}_cancelObserverDragStep(){const e=h(this.analysis.observer)&&h(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{const i=t.intersection.point;return e.metadata.target.position=i,e.metadata.target.intersection=t.intersection,h(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone())),i=e.intersection;return r=>(e.position=t,e.intersection=i,r)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?V.Custom1:V.Custom2:V.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(u(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=h(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&h(this.analysis.observer)&&h(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&h(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=T(this._observerManipulator.renderLocation,t.renderLocation,H):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new L({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){h(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){u(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){h(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);u(t)||u(t.point)||(h(this.analysis.observer)&&h(this.analysis.observer.position)?(this._clearTargetTracker(),this.analysis.targets.add(new r({position:t.point,intersection:t}))):this.analysis.observer=new i({position:t.point,intersection:t}))}_clickHandler(e){this.active&&(this._addPointFromClickEvent({x:e.x,y:e.y}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||u(this.analysis.observer)||u(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);h(i)&&h(i.point)&&(h(this.analysisView.cursorTarget)?(this.analysisView.cursorTarget.position=i.point,this.analysisView.cursorTarget.intersection=i):this._createTargetTracker(i),this._updateLaserLineRenderer())}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],P.prototype,"view",void 0),e([v({constructOnly:!0})],P.prototype,"analysis",void 0),e([v({readOnly:!0})],P.prototype,"state",null),e([v({readOnly:!0})],P.prototype,"cursor",null),e([v({readOnly:!0})],P.prototype,"updating",null),e([v({type:M})],P.prototype,"configuration",void 0),e([v({constructOnly:!0})],P.prototype,"analysisView",void 0),e([v({readOnly:!0})],P.prototype,"_showTracker",null),e([v()],P.prototype,"_latestPointerMovePointerType",void 0),e([v()],P.prototype,"_shouldRenderTracker",null),e([v()],P.prototype,"_someManipulatorsFocused",void 0),e([v()],P.prototype,"_laserlineVisualElement",void 0),e([v()],P.prototype,"_grabbedManipulator",void 0),P=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],P);const H=b();export{E as LineOfSightTargetCollection,P as LineOfSightTool};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../../core/Collection.js";import s from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../../core/handleUtils.js";import l from"../../../../../core/Logger.js";import{destroyMaybe as c,isSome as h,removeMaybe as u,isNone as p,applySome as d}from"../../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}from"../../../../../core/reactiveUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as f}from"../../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as T,getConvertedElevation as M}from"../../../../../support/elevationInfoUtils.js";import w from"../../../../../symbols/support/ElevationInfo.js";import{LineOfSightRayIntersector as C}from"../../../analysis/LineOfSight/LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as L}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as k,createSphereManipulatorRenderObjects as S}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as V}from"../../visualElements/LaserlineVisualElement.js";import{IntersectorType as O}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as I}from"../../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as j}from"../../../../interactive/interfaces.js";var P;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(P||(P={}));const R=a.ofType(r),H=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let F=class extends I{constructor(e){super(e),this.configuration=new L,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new C({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===P.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?h(this._grabbedManipulator)?P.Created:P.Creating:h(this.analysis.observer)&&h(this.analysis.observer.position)?P.Created:P.Ready}get cursor(){return!this._someManipulatorsFocused&&this.active&&this._showTracker?"crosshair":null}get updating(){return!!h(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&h(this.analysis.observer)&&h(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){this.analysis.visible=!0}onHide(){this.analysis.visible=!1}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=u(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=u(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void H.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);p(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void H.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);h(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),h(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearTargetTracker(){h(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=k(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return h(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;p(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=S(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return p(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return E(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return E(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(h(e.intersection.point)?(p(this.analysis.observer)&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=h(this.analysis.observer)&&h(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.point;return h(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone())),i=e.intersection;return r=>(e.position=t,e.intersection=i,r)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?j.Custom1:j.Custom2:j.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(p(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=h(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&h(this.analysis.observer)&&h(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&h(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=f(this._observerManipulator.renderLocation,t.renderLocation,D):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new V({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){h(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){p(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){h(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(!p(t)&&!p(t.point))if(h(this.analysis.observer)&&h(this.analysis.observer.position)){this._clearTargetTracker();const e=new r;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&(this._addPointFromClickEvent({x:e.x,y:e.y}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||p(this.analysis.observer)||p(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);h(i)&&h(i.point)&&(p(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=new r),this._updateFromIntersection(this.analysisView.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(p(t.point))return e.elevationInfo=null,e.position=null,void(e.intersection=null);switch(t.type){case O.OBJECT:if(h(t.graphic)){const i=T(t.graphic);"on-the-ground"===i.mode&&(i.mode="relative-to-ground",i.offset=0),e.elevationInfo=new w(i)}else e.elevationInfo=null;break;case O.TERRAIN:case O.I3S:e.elevationInfo=new w({mode:"on-the-ground"});break;default:e.elevationInfo=null}const i=t.point.clone();i.z=M(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i,e.intersection=t}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],F.prototype,"view",void 0),e([v({constructOnly:!0})],F.prototype,"analysis",void 0),e([v({readOnly:!0})],F.prototype,"state",null),e([v({readOnly:!0})],F.prototype,"cursor",null),e([v({readOnly:!0})],F.prototype,"updating",null),e([v({type:L})],F.prototype,"configuration",void 0),e([v({constructOnly:!0})],F.prototype,"analysisView",void 0),e([v({readOnly:!0})],F.prototype,"_showTracker",null),e([v()],F.prototype,"_latestPointerMovePointerType",void 0),e([v()],F.prototype,"_shouldRenderTracker",null),e([v()],F.prototype,"_someManipulatorsFocused",void 0),e([v()],F.prototype,"_laserlineVisualElement",void 0),e([v()],F.prototype,"_grabbedManipulator",void 0),F=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],F);const D=b();export{R as LineOfSightTargetCollection,F as LineOfSightTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{applySome as s,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as h,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{applyFilterMode as b}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as w}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as v}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as E}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as _}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as x}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as S,getIndexCrs as j}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as I}from"./support/DefinitionExpressionSceneLayerView.js";import Q from"../../layers/BuildingComponentSublayerView.js";import{getRequiredFields as q,getFetchPopupTemplate as R}from"../../layers/support/popupUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";const O=i.getLogger("esri.views.3d.layers.BuildingComponentSublayerView3D");let V=class extends(I(F(m(Q)))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.lodFactor=1,this.progressiveLoadFactor=1,this._queryEngine=null}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}initialize(){this.updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this.updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,s(this.viewFilter,(({parsedWhereClause:e,parsedGeometry:r,sortedObjectIds:t})=>[e,r,t]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=d.create(e,this.sublayer.fieldsIndex)}catch(l){return O.error("Failed to parse filterExpression: "+l),null}if(!t.isStandardized)return O.error("filterExpression is using non standard function"),null;const i=[],s=t.fieldNames;return S(s,this.sublayer.fields,{missingFields:i}),i.length>0?(O.error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return l(this.viewFilter)?this.viewFilter.filter:null}set filter(e){!o(e)&&v.checkSupport(e)?l(this.viewFilter)?this.viewFilter.filter=e:this.viewFilter=new v({filter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError)}):this.viewFilter=null}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return b(t,l)}catch(i){this.logError(i)}return b(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),[]))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...h(r,i),...t]}return y(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)return Promise.reject(t);if(o(r)||!r.clientGraphics||0===r.clientGraphics.length)return[];const i=[],s=[],n=l(this.sublayer.associatedLayer)?await this.sublayer.associatedLayer.load():this.sublayer,a=h(this.sublayer.fieldsIndex,await q(n,R(this.sublayer,r))),u=new Set;for(const l of r.clientGraphics)c(a,l,u)?s.push(l):i.push(l);return 0===s.length?Promise.resolve(i):(l(this.sublayer.associatedLayer)&&await this.sublayer.associatedLayer.load().catch((()=>O.warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(s,Array.from(u)).catch((()=>s)).then((e=>i.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?R(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),l(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return l(this.filter)?this.filter.createQuery(e):new f(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),null==r?void 0:r.signal).then((e=>{if(null==e||!e.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),null==r?void 0:r.signal)}_ensureQueryEngine(){return o(this._queryEngine)&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=w(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new E({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new x({featureAdapter:new _({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:j(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():f.from(e))}};e([a({aliasOf:"sublayer"})],V.prototype,"i3slayer",void 0),e([a()],V.prototype,"layerView",void 0),e([a()],V.prototype,"suspended",void 0),e([a({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.3dObject.lodFactor"})],V.prototype,"lodFactor",void 0),e([a({readOnly:!0})],V.prototype,"parsedFilterExpressions",null),e([a({type:p})],V.prototype,"filter",null),e([a()],V.prototype,"viewFilter",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"filterExpressionFields",null),e([a({type:[String],readOnly:!0})],V.prototype,"requiredFields",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"availableFields",null),V=e([u("esri.views.3d.layers.BuildingComponentSublayerView3D")],V);const A=V;export{A as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{applySome as s,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as h,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{applyFilterMode as b}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as w}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as v}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as E}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as _}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as x}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as S,getIndexCrs as j}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as I}from"./support/DefinitionExpressionSceneLayerView.js";import Q from"../../layers/BuildingComponentSublayerView.js";import{getRequiredFields as q,getFetchPopupTemplate as R}from"../../layers/support/popupUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";const O=i.getLogger("esri.views.3d.layers.BuildingComponentSublayerView3D");let V=class extends(I(F(m(Q)))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.lodFactor=1,this.progressiveLoadFactor=1,this._queryEngine=null}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}initialize(){this.updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this.updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,s(this.viewFilter,(({parsedWhereClause:e,parsedGeometry:r,sortedObjectIds:t})=>[e,r,t]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=d.create(e,this.sublayer.fieldsIndex)}catch(l){return O.error("Failed to parse filterExpression: "+l),null}if(!t.isStandardized)return O.error("filterExpression is using non standard function"),null;const i=[],s=t.fieldNames;return S(s,this.sublayer.fields,{missingFields:i}),i.length>0?(O.error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return l(this.viewFilter)?this.viewFilter.filter:null}set filter(e){!o(e)&&v.checkSupport(e)?l(this.viewFilter)?this.viewFilter.filter=e:this.viewFilter=new v({filter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError)}):this.viewFilter=null}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return b(t,l)}catch(i){this.logError(i)}return b(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),[]))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...h(r,i),...t]}return y(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(o(r)||!r.clientGraphics||0===r.clientGraphics.length)return[];const i=[],s=[],n=l(this.sublayer.associatedLayer)?await this.sublayer.associatedLayer.load():this.sublayer,a=h(this.sublayer.fieldsIndex,await q(n,R(this.sublayer,r))),u=new Set;for(const l of r.clientGraphics)c(a,l,u)?s.push(l):i.push(l);return 0===s.length?i:(l(this.sublayer.associatedLayer)&&await this.sublayer.associatedLayer.load().catch((()=>O.warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(s,Array.from(u)).catch((()=>s)).then((e=>i.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?R(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),l(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return l(this.filter)?this.filter.createQuery(e):new f(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),null==r?void 0:r.signal).then((e=>{if(null==e||!e.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),null==r?void 0:r.signal)}_ensureQueryEngine(){return o(this._queryEngine)&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=w(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new E({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new x({featureAdapter:new _({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:j(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():f.from(e))}};e([a({aliasOf:"sublayer"})],V.prototype,"i3slayer",void 0),e([a()],V.prototype,"layerView",void 0),e([a()],V.prototype,"suspended",void 0),e([a({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.3dObject.lodFactor"})],V.prototype,"lodFactor",void 0),e([a({readOnly:!0})],V.prototype,"parsedFilterExpressions",null),e([a({type:p})],V.prototype,"filter",null),e([a()],V.prototype,"viewFilter",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"filterExpressionFields",null),e([a({type:[String],readOnly:!0})],V.prototype,"requiredFields",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"availableFields",null),V=e([u("esri.views.3d.layers.BuildingComponentSublayerView3D")],V);const A=V;export{A 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,get as s,isNone as i}from"../../../core/maybe.js";import{initial as o,whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as u}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import c from"../../../rest/support/Query.js";import{DrapeSourceType as h}from"./interfaces.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as y}from"./graphics/QueryEngine.js";import{HeatmapFeatureProcessor as m}from"./support/HeatmapFeatureProcessor.js";import{toViewIfLocal as g}from"./support/projectExtentUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as v}from"../../support/Scheduler.js";const E=E=>{let b=class extends E{constructor(){super(...arguments),this.controller=null,this.updatePolicy=f.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=h.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),o),this.addResolvingPromise((async()=>{const e=await g(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.queryEngine=new y({layerView:this,priority:v.FEATURE_QUERY_ENGINE}),this.notifyChange("updating"))}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=t(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var r;let t=null;return null==(r=this.loadedGraphics)||r.forEach((r=>{r.uid===e&&(t=p(r,this.layer))})),t}whenGraphicBounds(e,r){var t;return null==(t=this.processor)?void 0:t.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),s(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(r,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():c.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,r,t;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await n((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":return Promise.reject(new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType}))}}_recreateProcessor(e){var r,t;const s="heatmap"===(null==e?void 0:e.type),i="heatmap"===(null==(r=this.processor)?void 0:r.type),o=this.processor;if(o&&s===i)return;const n=s?new m({owner:this}):new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",n),null==o||o.destroy(),null==(t=this.queryEngine)||t.clear(),this.addResolvingPromise(n.setup())}_getResourceInfo(){var e,r;const t=this.controller instanceof u?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==t?void 0:t.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(r=null==t?void 0:t.serviceDataCount)?r:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([l()],b.prototype,"loadedGraphics",void 0),e([l()],b.prototype,"suspended",void 0),e([l({readOnly:!0})],b.prototype,"legendEnabled",null),e([l()],b.prototype,"updating",void 0),e([l()],b.prototype,"controller",void 0),e([l()],b.prototype,"processor",void 0),e([l({readOnly:!0})],b.prototype,"updatePolicy",void 0),e([l({readOnly:!0})],b.prototype,"suspendResumeExtentMode",void 0),e([l({type:Boolean})],b.prototype,"slicePlaneEnabled",void 0),e([l({readOnly:!0})],b.prototype,"suspendInfo",void 0),e([l()],b.prototype,"graphics3DProcessor",null),e([l()],b.prototype,"heatmapProcessor",null),b=e([a("esri.views.3d.layers.FeatureLikeLayerView3D")],b),b};export{E as FeatureLikeLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,get as s,isNone as i}from"../../../core/maybe.js";import{initial as o,whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as u}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import c from"../../../rest/support/Query.js";import{DrapeSourceType as h}from"./interfaces.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as y}from"./graphics/QueryEngine.js";import{HeatmapFeatureProcessor as m}from"./support/HeatmapFeatureProcessor.js";import{toViewIfLocal as g}from"./support/projectExtentUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as v}from"../../support/Scheduler.js";const E=E=>{let b=class extends E{constructor(){super(...arguments),this.controller=null,this.updatePolicy=f.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=h.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),o),this.addResolvingPromise((async()=>{const e=await g(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.queryEngine=new y({layerView:this,priority:v.FEATURE_QUERY_ENGINE}),this.notifyChange("updating"))}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=t(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var r;let t=null;return null==(r=this.loadedGraphics)||r.forEach((r=>{r.uid===e&&(t=p(r,this.layer))})),t}whenGraphicBounds(e,r){var t;return null==(t=this.processor)?void 0:t.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),s(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(r,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():c.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,r,t;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await n((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}_recreateProcessor(e){var r,t;const s="heatmap"===(null==e?void 0:e.type),i="heatmap"===(null==(r=this.processor)?void 0:r.type),o=this.processor;if(o&&s===i)return;const n=s?new m({owner:this}):new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",n),null==o||o.destroy(),null==(t=this.queryEngine)||t.clear(),this.addResolvingPromise(n.setup())}_getResourceInfo(){var e,r;const t=this.controller instanceof u?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==t?void 0:t.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(r=null==t?void 0:t.serviceDataCount)?r:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([l()],b.prototype,"loadedGraphics",void 0),e([l()],b.prototype,"suspended",void 0),e([l({readOnly:!0})],b.prototype,"legendEnabled",null),e([l()],b.prototype,"updating",void 0),e([l()],b.prototype,"controller",void 0),e([l()],b.prototype,"processor",void 0),e([l({readOnly:!0})],b.prototype,"updatePolicy",void 0),e([l({readOnly:!0})],b.prototype,"suspendResumeExtentMode",void 0),e([l({type:Boolean})],b.prototype,"slicePlaneEnabled",void 0),e([l({readOnly:!0})],b.prototype,"suspendInfo",void 0),e([l()],b.prototype,"graphics3DProcessor",null),e([l()],b.prototype,"heatmapProcessor",null),b=e([a("esri.views.3d.layers.FeatureLikeLayerView3D")],b),b};export{E as FeatureLikeLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t}from"../../../core/maybe.js";import{debounce as a}from"../../../core/promiseUtils.js";import{when as i}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./DynamicLayerView3D.js";import o from"../../layers/ImageryLayerView.js";let n=class extends(o(s)){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=a((async e=>{this.redraw(((e,t)=>this._redrawImage(e,t)),e)}),2e3)}initialize(){this.handles.add([i((()=>this.view.basemapTerrain.ready),(()=>this._initializeMaximumDataResolution()),{once:!0,initial:!0}),this.layer.on("redraw",(()=>this.updatingHandles.addPromise(this.redrawDebounced())))]),this.updatingHandles.add((()=>{var e,t;return null==(e=this.layer)||null==(t=e.exportImageServiceParameters)?void 0:t.version}),(()=>{this.updatingHandles.addPromise(this.refreshDebounced())})),this.updatingHandles.add((()=>this.timeExtent),(()=>this.updatingHandles.addPromise(this.refreshDebounced())))}_initializeMaximumDataResolution(){const e=this.view.basemapTerrain.spatialReference,t=this.layer.fullExtent;!t||e.equals(t.spatialReference),this.maximumDataResolution={x:this.layer.pixelSizeX,y:this.layer.pixelSizeY}}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageElement?e.image=t.imageElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,a){if(!(e.image instanceof HTMLCanvasElement)||t(e.pixelData))return Promise.reject();const i=e.image,r=i.getContext("2d"),s=await this.layer.applyRenderer(e.pixelData,{signal:a}),o=this.layer.applyFilter(s).pixelBlock;if(t(o))return Promise.reject();i.width=o.width,i.height=o.height;const n=r.createImageData(o.width,o.height);n.data.set(o.getAsRGBA()),r.putImageData(n,0,0)}};n=e([r("esri.views.3d.layers.ImageryLayerView3D")],n);const m=n;export{m as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t}from"../../../core/maybe.js";import{debounce as a}from"../../../core/promiseUtils.js";import{when as i}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./DynamicLayerView3D.js";import o from"../../layers/ImageryLayerView.js";let n=class extends(o(s)){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=a((async e=>{this.redraw(((e,t)=>this._redrawImage(e,t)),e)}),2e3)}initialize(){this.handles.add([i((()=>this.view.basemapTerrain.ready),(()=>this._initializeMaximumDataResolution()),{once:!0,initial:!0}),this.layer.on("redraw",(()=>this.updatingHandles.addPromise(this.redrawDebounced())))]),this.updatingHandles.add((()=>{var e,t;return null==(e=this.layer)||null==(t=e.exportImageServiceParameters)?void 0:t.version}),(()=>{this.updatingHandles.addPromise(this.refreshDebounced())})),this.updatingHandles.add((()=>this.timeExtent),(()=>this.updatingHandles.addPromise(this.refreshDebounced())))}_initializeMaximumDataResolution(){const e=this.view.basemapTerrain.spatialReference,t=this.layer.fullExtent;!t||e.equals(t.spatialReference),this.maximumDataResolution={x:this.layer.pixelSizeX,y:this.layer.pixelSizeY}}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageElement?e.image=t.imageElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,a){if(!(e.image instanceof HTMLCanvasElement)||t(e.pixelData))throw new Error;const i=e.image,r=i.getContext("2d"),s=await this.layer.applyRenderer(e.pixelData,{signal:a}),o=this.layer.applyFilter(s).pixelBlock;if(t(o))throw new Error;i.width=o.width,i.height=o.height;const n=r.createImageData(o.width,o.height);n.data.set(o.getAsRGBA()),r.putImageData(n,0,0)}};n=e([r("esri.views.3d.layers.ImageryLayerView3D")],n);const m=n;export{m 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Collection.js";import s from"../../../core/CollectionFlattener.js";import{destroyMaybe as i,isSome as o}from"../../../core/maybe.js";import{when as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{DrapeSourceType as p}from"./interfaces.js";import{LayerView3D as u}from"./LayerView3D.js";import{GraphicsProcessor as c}from"./graphics/GraphicsProcessor.js";import{toViewIfLocal as d}from"./support/projectExtentUtils.js";import{EventedSet as h}from"../support/EventedSet.js";import{UpdatePolicy as m}from"../webgl-engine/lib/basicInterfaces.js";import y from"../../layers/LayerView.js";let g=class extends(u(y)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new h,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.drapeSourceType=p.Features,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new c({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.setup()),this.updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),{initial:!0}),this.addResolvingPromise(d(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.handles.add(n((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready}),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",i(this.processor))}get _routeItems(){return new s({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,o(this.layer.routeInfo)?new t([this.layer.routeInfo]):null]})}_routeItemsChanged(e){e.removed.length&&this.loadedGraphics.removeMany(e.removed.map((e=>{const r=this._byObjectID.get(e);return this._byObjectID.delete(e),r}))),this.loadedGraphics.addMany(e.added.map((e=>{const t=r.fromJSON(e.toPortalJSON());return this._byObjectID.set(e,t),t})))}get legendEnabled(){var e;return this.canResume()&&!(null!=(e=this.processor)&&e.frustumVisibilitySuspended)}getSuspendInfo(){var e,r,t,s;const i=super.getSuspendInfo();return i.outsideScaleRange=null!=(e=null==(r=this.processor)?void 0:r.scaleVisibilitySuspended)&&e,i.outsideOfView=null!=(t=null==(s=this.processor)?void 0:s.frustumVisibilitySuspended)&&t,i}async fetchPopupFeatures(e,r){return o(r)?r.clientGraphics:null}getGraphicFromGraphicUid(e){return this.processor.getGraphicFromGraphicUid(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}async queryGraphics(){return new t(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}get updatePolicy(){var e;return(null==(e=this.processor)?void 0:e.graphicsCore.effectiveUpdatePolicy)||m.SYNC}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}isUpdating(){var e,r,t;return!(!(null!=(e=this.processor)&&e.updating||null==(r=this.view)||null==(t=r.basemapTerrain))&&t.ready)}get performanceInfo(){var e,r,t;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:null!=(e=null==(r=this.processor)?void 0:r.elevationAlignment.updating)&&e,visibilityFrustum:!(null!=(t=this.processor)&&t.frustumVisibilitySuspended)}}};e([a()],g.prototype,"_routeItems",null),e([a()],g.prototype,"loadedGraphics",void 0),e([a({readOnly:!0})],g.prototype,"legendEnabled",null),e([a()],g.prototype,"layer",void 0),e([a({readOnly:!0})],g.prototype,"processor",void 0),e([a({type:Boolean})],g.prototype,"slicePlaneEnabled",void 0),g=e([l("esri.views.3d.layers.RouteLayerView3D")],g);const f=g;export{f as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/CollectionFlattener.js";import{destroyMaybe as s,isSome as i}from"../../../core/maybe.js";import{when as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{DrapeSourceType as l}from"./interfaces.js";import{LayerView3D as p}from"./LayerView3D.js";import{GraphicsProcessor as u}from"./graphics/GraphicsProcessor.js";import{toViewIfLocal as c}from"./support/projectExtentUtils.js";import{EventedSet as d}from"../support/EventedSet.js";import{UpdatePolicy as h}from"../webgl-engine/lib/basicInterfaces.js";import m from"../../layers/LayerView.js";let y=class extends(p(m)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new d,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.drapeSourceType=l.Features,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new u({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.setup()),this.updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),{initial:!0}),this.addResolvingPromise(c(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.handles.add(o((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready}),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",s(this.processor))}get _routeItems(){return new t({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,i(this.layer.routeInfo)?new r([this.layer.routeInfo]):null]})}_routeItemsChanged(e){e.removed.length&&this.loadedGraphics.removeMany(e.removed.map((e=>{const r=this._byObjectID.get(e);return this._byObjectID.delete(e),r}))),this.loadedGraphics.addMany(e.added.map((e=>{const r=e.toGraphic();return this._byObjectID.set(e,r),r})))}get legendEnabled(){var e;return this.canResume()&&!(null!=(e=this.processor)&&e.frustumVisibilitySuspended)}getSuspendInfo(){var e,r,t,s;const i=super.getSuspendInfo();return i.outsideScaleRange=null!=(e=null==(r=this.processor)?void 0:r.scaleVisibilitySuspended)&&e,i.outsideOfView=null!=(t=null==(s=this.processor)?void 0:s.frustumVisibilitySuspended)&&t,i}async fetchPopupFeatures(e,r){return i(r)?r.clientGraphics:null}getGraphicFromGraphicUid(e){return this.processor.getGraphicFromGraphicUid(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}async queryGraphics(){return new r(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}get updatePolicy(){var e;return(null==(e=this.processor)?void 0:e.graphicsCore.effectiveUpdatePolicy)||h.SYNC}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}isUpdating(){var e,r,t;return!(!(null!=(e=this.processor)&&e.updating||null==(r=this.view)||null==(t=r.basemapTerrain))&&t.ready)}get performanceInfo(){var e,r,t;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:null!=(e=null==(r=this.processor)?void 0:r.elevationAlignment.updating)&&e,visibilityFrustum:!(null!=(t=this.processor)&&t.frustumVisibilitySuspended)}}};e([n()],y.prototype,"_routeItems",null),e([n()],y.prototype,"loadedGraphics",void 0),e([n({readOnly:!0})],y.prototype,"legendEnabled",null),e([n()],y.prototype,"layer",void 0),e([n({readOnly:!0})],y.prototype,"processor",void 0),e([n({type:Boolean})],y.prototype,"slicePlaneEnabled",void 0),y=e([a("esri.views.3d.layers.RouteLayerView3D")],y);const g=y;export{g 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c}from"../../../chunks/vec3.js";import{f as p,c as g}from"../../../chunks/vec3f64.js";import{projectBuffer as m,projectVectorToVector as f,projectBoundingRect as y}from"../../../geometry/projection.js";import{create as _}from"../../../geometry/support/aaBoundingRect.js";import{extentContainsCoords3D as b}from"../../../geometry/support/contains.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{makeDehydratedPoint as E,estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as I}from"../../../layers/graphics/hydratedFeatures.js";import S from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import D from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{DrapeSourceType as F}from"./interfaces.js";import{LayerView3D as j}from"./LayerView3D.js";import A from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as C}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as N,processAttributeEdits as T}from"./i3s/attributeEditing.js";import{I3SAttributeOverrides as V}from"./i3s/I3SAttributeOverrides.js";import{checkSpatialReferences as G,containsDraco as M,whenGraphicAttributes as P,getCachedAttributeValue as R}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as L}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import{PopupSceneLayerView as q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import Q from"../support/debugFlags.js";import{GraphicsMap as k}from"../support/GraphicsMap.js";import{compute as B}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{UpdatePolicy as W}from"../webgl-engine/lib/basicInterfaces.js";import K from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const Y=i.getLogger("esri.views.3d.layers.SceneLayerGraphicsView3D"),J=H();let $=class extends(L(q(j(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this.drapeSourceType=F.Features,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new k,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){var e,t;const r=this.layer;this.addResolvingPromise(r.indexInfo),this._attributeOverrides=new V(this.layer,null==(e=this.view.resourceController)?void 0:e.memoryController),G(r,this.view.spatialReference,this.view.viewingMode),this.fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>r.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>r.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.excludeObjectIdsSorted]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged())),this.handles.add(l((()=>Q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new A({owner:this,preferredUpdatePolicy:W.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,dataExtent:r.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),null==(t=this.processor.elevationAlignment)||t.events.on("invalidate-elevation",(e=>this._invalidateElevation(e))),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",r.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.setup()),this._memCache=this.view.resourceController.memoryController.newCache(r.uid),this._controller=new S({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._queryEngine=new C({layerView:this,priority:Z.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._attributeOverrides=s(this._attributeOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this._nodesAddedToStage.clear(),this.fieldsHelper=s(this.fieldsHelper)}get requiredFields(){var e,t;return null!=(e=null==(t=this.fieldsHelper)?void 0:t.requiredFields)?e:[]}get maximumNumberOfFeatures(){var e,t,r;const i=null==(e=this.processor)||null==(t=e.graphicsCore)?void 0:t.displayFeatureLimit;return null!=(r=null==i?void 0:i.maximumNumberOfFeatures)?r:0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!(null==(e=this._controller)||!e.useMaximumNumberOfFeatures||this._controller.leavesReached)}get excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return P(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getGraphicFromGraphicUid(e){if(!this.loadedGraphics)return null;const t=I(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,t):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){var e,t,r;return!!(null!=(e=this._controller)&&e.updating||null!=(t=this.processor)&&t.updating||null!=(r=this.fieldsHelper)&&r.updating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return N(this.attributeEditingContext,e)}async _extractBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};return o(this._worker)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this._worker.invoke(r,t).then((e=>{if(a(e)){return{positionData:e.positions,featureIds:e.featureIds}}throw new Error("Failed to decompress Draco point data")}))}_checkExtent(e,t){e&&!b(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&Y.error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&Y.error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,r){if(!te(t)&&!ee(t))return Promise.reject();if(this._nodesAddedToStage.has(e.index))return void Y.error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?ie(this.layer.fullExtent.clone(),.5):null,s=this._controller.crsVertex,o=[],n={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(te(t)?await this._addNodeBinaryPointData(e,n,t,i,o,r):ee(t)&&this._addNodeLegacyPointData(e,n,t,i,o),await this._attributeOverrides.apply(n.featureIds,t.attributeDataInfo,r),e.numFeatures=n.graphics.length,this._updateNodeMemory(e),re(n),o.length>0&&(this._computeObb(e,o,s),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return this._cacheNodeData(n),Promise.resolve();if(a(this._verticalScale))for(const a of n.graphics)this._verticalScale(a.geometry);return this._nodesAddedToStage.set(e.index,n),this.loadedGraphics.addMany(n.graphics),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;m(t,r,0,t,s,0,t.length/3);const o={data:t,size:3};e.serviceObb=B(o),i.isGeographic&&f(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,r,i,s,o,d){const l=await this._extractBinaryPointData(i,d);if(null==l)return Promise.reject();const u=this._getObjectIdField(),h=this._controller.crsVertex,g=this.view.spatialReference,f=this.processor.graphicsCore,{positionData:y,featureIds:_}=l,b=3,v=y.length/b,x=new Array;for(let I=0;I<v;I++){const r=a(e.serviceObb)?e.serviceObb.center:[0,0,0],i=I*b,d=p(y[i+0],y[i+1],y[i+2]);c(d,d,r),e.serviceObb||o.push(d[0],d[1],d[2]),a(s)&&this._checkExtent(s,d);const l=_[I],v={};null!=l&&(v[u]=l);const S=null==l?t.generateUID():l;m(d,h,0,oe,g,0,1);const w=E(oe[0],oe[1],oe[2],g),D=this.loadedGraphics.get(S);if(a(D))D.level<e.level&&(ae.property="geometry",ae.graphic=D,ae.oldValue=n(D.geometry),ae.newValue=w,D.geometry=w,f.graphicUpdateHandler(ae)),x.push(D);else{const r=t.generateUID();x.push({objectId:S,uid:r,geometry:w,attributes:v,visible:!0,level:e.level})}}r.graphics=x,r.featureIds=Array.from(_)}_addNodeLegacyPointData(e,r,i,s,o){const n=this._getObjectIdField(),d=this._controller.crsVertex,l=this.view.spatialReference,u=[0,0,0],h=new Array,c=new Array;for(const p of i.pointData){const r=p.featureDataPosition,i=r.length,g=p.geometries&&p.geometries[0]||se[i],f=p.featureIds[0];if("points"!==g.params.type)continue;a(s)&&this._checkExtent(s,r);const y={};null!=f&&(y[n]=f);const _=null==f?t.generateUID():f;let b;"Embedded"===g.type&&(b=g.params.vertexAttributes.position);for(let s=0;s<b.length;s+=i){for(let e=0;e<i;e++)u[e]=r[e]+b[s+e];const n=3===i;e.serviceObb||o.push(u[0],u[1],n?u[2]:0),m(u,d,0,oe,l,0,1);const h=E(oe[0],oe[1],n?oe[2]:void 0,l),p=this.loadedGraphics.get(_);a(p)?c.push(p):c.push({objectId:_,uid:t.generateUID(),geometry:h,attributes:y,visible:!0})}h.push(f)}r.graphics=c,r.featureIds=h}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>x(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach((e=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){if(!this._nodesAddedToStage.has(e.index))return this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve();Y.error("I3S node "+e.id+" already added")}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this._nodesAddedToStage.get(e);i&&(await this._attributeOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(re(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||"OBJECTID"}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&Y.warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this.excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(ae.graphic=a,ae.property="visible",ae.oldValue=e,ae.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ae))}}_invalidateElevation(e){const t=this._controller.crsIndex;y(e.extent,e.spatialReference,ne,t),this._controller.updateElevationChanged(ne,t)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new D(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),null==t?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),null==t?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),null==t?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),null==t?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():D.from(e))}getUsedMemory(){var e,t,r;return null!=(e=null==(t=this.processor)||null==(r=t.graphicsCore)?void 0:r.usedMemory)?e:0}getUnloadedMemory(){var e,t,r,i,s;return.8*((null!=(e=null==(t=this._controller)?void 0:t.unloadedMemoryEstimate)?e:0)+(null!=(r=null==(i=this.processor)||null==(s=i.graphicsCore)?void 0:s.unprocessedMemoryEstimate)?r:0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){T(this.attributeEditingContext,e)}get attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this._attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this._nodesAddedToStage.get(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,numFeatures:this.loadedGraphics.length}}};e([u()],$.prototype,"processor",void 0),e([u({type:w})],$.prototype,"filter",void 0),e([u()],$.prototype,"loadedGraphics",void 0),e([u({aliasOf:"layer"})],$.prototype,"i3slayer",void 0),e([u()],$.prototype,"_controller",void 0),e([u()],$.prototype,"updating",void 0),e([u()],$.prototype,"suspended",void 0),e([u()],$.prototype,"holeFilling",void 0),e([u(z)],$.prototype,"updatingProgress",void 0),e([u({aliasOf:"_controller.updatingProgress"})],$.prototype,"updatingProgressValue",void 0),e([u(J.requiredFields)],$.prototype,"requiredFields",null),e([u(J.availableFields)],$.prototype,"availableFields",void 0),e([u()],$.prototype,"fieldsHelper",void 0),e([u({type:Number})],$.prototype,"maximumNumberOfFeatures",null),e([u({readOnly:!0})],$.prototype,"maximumNumberOfFeaturesExceeded",null),e([u()],$.prototype,"excludeObjectIdsSorted",null),e([u({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.point.lodFactor"})],$.prototype,"lodFactor",void 0),e([u({readOnly:!0})],$.prototype,"hasM",null),e([u({readOnly:!0})],$.prototype,"hasZ",null),$=e([h("esri.views.3d.layers.SceneLayerGraphicsView3D")],$);const X=$;function ee(e){return"pointData"in e}function te(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function re(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const i=e.graphics[r];if(i.attributes||(i.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=R(t.attributeData[e],r))}}function ie(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const se={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},oe=g(),ae={graphic:null,property:null,oldValue:null,newValue:null},ne=_();export{X as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c}from"../../../chunks/vec3.js";import{f as p,c as g}from"../../../chunks/vec3f64.js";import{projectBuffer as m,projectVectorToVector as f,projectBoundingRect as y}from"../../../geometry/projection.js";import{create as _}from"../../../geometry/support/aaBoundingRect.js";import{extentContainsCoords3D as b}from"../../../geometry/support/contains.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{makeDehydratedPoint as E,estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as I}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import S from"../../../layers/support/FeatureFilter.js";import D from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{DrapeSourceType as F}from"./interfaces.js";import{LayerView3D as A}from"./LayerView3D.js";import C from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as j}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as N,processAttributeEdits as T}from"./i3s/attributeEditing.js";import{I3SAttributeOverrides as V}from"./i3s/I3SAttributeOverrides.js";import{checkSpatialReferences as G,containsDraco as M,whenGraphicAttributes as R,getCachedAttributeValue as L}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as P}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import{PopupSceneLayerView as q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import Q from"../support/debugFlags.js";import{GraphicsMap as k}from"../support/GraphicsMap.js";import{compute as B}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{UpdatePolicy as W}from"../webgl-engine/lib/basicInterfaces.js";import K from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const Y=i.getLogger("esri.views.3d.layers.SceneLayerGraphicsView3D"),J=H();let $=class extends(P(q(A(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this.drapeSourceType=F.Features,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new k,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){var e,t;const r=this.layer;this.addResolvingPromise(r.indexInfo),this._attributeOverrides=new V(this.layer,null==(e=this.view.resourceController)?void 0:e.memoryController),G(r,this.view.spatialReference,this.view.viewingMode),this.fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>r.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>r.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.excludeObjectIdsSorted]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged())),this.handles.add(l((()=>Q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new C({owner:this,preferredUpdatePolicy:W.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,dataExtent:r.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),null==(t=this.processor.elevationAlignment)||t.events.on("invalidate-elevation",(e=>this._invalidateElevation(e))),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",r.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.setup()),this._memCache=this.view.resourceController.memoryController.newCache(r.uid),this._controller=new w({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._queryEngine=new j({layerView:this,priority:Z.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._attributeOverrides=s(this._attributeOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this._nodesAddedToStage.clear(),this.fieldsHelper=s(this.fieldsHelper)}get requiredFields(){var e,t;return null!=(e=null==(t=this.fieldsHelper)?void 0:t.requiredFields)?e:[]}get maximumNumberOfFeatures(){var e,t,r;const i=null==(e=this.processor)||null==(t=e.graphicsCore)?void 0:t.displayFeatureLimit;return null!=(r=null==i?void 0:i.maximumNumberOfFeatures)?r:0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!(null==(e=this._controller)||!e.useMaximumNumberOfFeatures||this._controller.leavesReached)}get excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return R(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getGraphicFromGraphicUid(e){if(!this.loadedGraphics)return null;const t=I(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,t):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){var e,t,r;return!!(null!=(e=this._controller)&&e.updating||null!=(t=this.processor)&&t.updating||null!=(r=this.fieldsHelper)&&r.updating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return N(this.attributeEditingContext,e)}async _extractBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};return o(this._worker)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this._worker.invoke(r,t).then((e=>{if(a(e)){return{positionData:e.positions,featureIds:e.featureIds}}throw new Error("Failed to decompress Draco point data")}))}_checkExtent(e,t){e&&!b(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&Y.error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&Y.error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,r){if(!te(t)&&!ee(t))throw new Error;if(this._nodesAddedToStage.has(e.index))return void Y.error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?ie(this.layer.fullExtent.clone(),.5):null,s=this._controller.crsVertex,o=[],n={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(te(t)?await this._addNodeBinaryPointData(e,n,t,i,o,r):ee(t)&&this._addNodeLegacyPointData(e,n,t,i,o),await this._attributeOverrides.apply(n.featureIds,t.attributeDataInfo,r),e.numFeatures=n.graphics.length,this._updateNodeMemory(e),re(n),o.length>0&&(this._computeObb(e,o,s),this._controller.updateVisibility(e.index)),this._controller.isGeometryVisible(e)){if(a(this._verticalScale))for(const e of n.graphics)this._verticalScale(e.geometry);this._nodesAddedToStage.set(e.index,n),this.loadedGraphics.addMany(n.graphics),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update()}else this._cacheNodeData(n)}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;m(t,r,0,t,s,0,t.length/3);const o={data:t,size:3};e.serviceObb=B(o),i.isGeographic&&f(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,r,i,s,o,d){const l=await this._extractBinaryPointData(i,d);if(null==l)throw new Error;const u=this._getObjectIdField(),h=this._controller.crsVertex,g=this.view.spatialReference,f=this.processor.graphicsCore,{positionData:y,featureIds:_}=l,b=3,v=y.length/b,x=new Array;for(let I=0;I<v;I++){const r=a(e.serviceObb)?e.serviceObb.center:[0,0,0],i=I*b,d=p(y[i+0],y[i+1],y[i+2]);c(d,d,r),e.serviceObb||o.push(d[0],d[1],d[2]),a(s)&&this._checkExtent(s,d);const l=_[I],v={};null!=l&&(v[u]=l);const w=null==l?t.generateUID():l;m(d,h,0,oe,g,0,1);const S=E(oe[0],oe[1],oe[2],g),D=this.loadedGraphics.get(w);if(a(D))D.level<e.level&&(ae.property="geometry",ae.graphic=D,ae.oldValue=n(D.geometry),ae.newValue=S,D.geometry=S,f.graphicUpdateHandler(ae)),x.push(D);else{const r=t.generateUID();x.push({objectId:w,uid:r,geometry:S,attributes:v,visible:!0,level:e.level})}}r.graphics=x,r.featureIds=Array.from(_)}_addNodeLegacyPointData(e,r,i,s,o){const n=this._getObjectIdField(),d=this._controller.crsVertex,l=this.view.spatialReference,u=[0,0,0],h=new Array,c=new Array;for(const p of i.pointData){const r=p.featureDataPosition,i=r.length,g=p.geometries&&p.geometries[0]||se[i],f=p.featureIds[0];if("points"!==g.params.type)continue;a(s)&&this._checkExtent(s,r);const y={};null!=f&&(y[n]=f);const _=null==f?t.generateUID():f;let b;"Embedded"===g.type&&(b=g.params.vertexAttributes.position);for(let s=0;s<b.length;s+=i){for(let e=0;e<i;e++)u[e]=r[e]+b[s+e];const n=3===i;e.serviceObb||o.push(u[0],u[1],n?u[2]:0),m(u,d,0,oe,l,0,1);const h=E(oe[0],oe[1],n?oe[2]:void 0,l),p=this.loadedGraphics.get(_);a(p)?c.push(p):c.push({objectId:_,uid:t.generateUID(),geometry:h,attributes:y,visible:!0})}h.push(f)}r.graphics=c,r.featureIds=h}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>x(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach((e=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){this._nodesAddedToStage.has(e.index)?Y.error("I3S node "+e.id+" already added"):(this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this._nodesAddedToStage.get(e);i&&(await this._attributeOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(re(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||"OBJECTID"}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&Y.warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this.excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(ae.graphic=a,ae.property="visible",ae.oldValue=e,ae.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ae))}}_invalidateElevation(e){const t=this._controller.crsIndex;y(e.extent,e.spatialReference,ne,t),this._controller.updateElevationChanged(ne,t)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new D(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),null==t?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),null==t?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),null==t?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),null==t?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():D.from(e))}getUsedMemory(){var e,t,r;return null!=(e=null==(t=this.processor)||null==(r=t.graphicsCore)?void 0:r.usedMemory)?e:0}getUnloadedMemory(){var e,t,r,i,s;return.8*((null!=(e=null==(t=this._controller)?void 0:t.unloadedMemoryEstimate)?e:0)+(null!=(r=null==(i=this.processor)||null==(s=i.graphicsCore)?void 0:s.unprocessedMemoryEstimate)?r:0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){T(this.attributeEditingContext,e)}get attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this._attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this._nodesAddedToStage.get(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,numFeatures:this.loadedGraphics.length}}};e([u()],$.prototype,"processor",void 0),e([u({type:S})],$.prototype,"filter",void 0),e([u()],$.prototype,"loadedGraphics",void 0),e([u({aliasOf:"layer"})],$.prototype,"i3slayer",void 0),e([u()],$.prototype,"_controller",void 0),e([u()],$.prototype,"updating",void 0),e([u()],$.prototype,"suspended",void 0),e([u()],$.prototype,"holeFilling",void 0),e([u(z)],$.prototype,"updatingProgress",void 0),e([u({aliasOf:"_controller.updatingProgress"})],$.prototype,"updatingProgressValue",void 0),e([u(J.requiredFields)],$.prototype,"requiredFields",null),e([u(J.availableFields)],$.prototype,"availableFields",void 0),e([u()],$.prototype,"fieldsHelper",void 0),e([u({type:Number})],$.prototype,"maximumNumberOfFeatures",null),e([u({readOnly:!0})],$.prototype,"maximumNumberOfFeaturesExceeded",null),e([u()],$.prototype,"excludeObjectIdsSorted",null),e([u({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.point.lodFactor"})],$.prototype,"lodFactor",void 0),e([u({readOnly:!0})],$.prototype,"hasM",null),e([u({readOnly:!0})],$.prototype,"hasZ",null),$=e([h("esri.views.3d.layers.SceneLayerGraphicsView3D")],$);const X=$;function ee(e){return"pointData"in e}function te(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function re(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const i=e.graphics[r];if(i.attributes||(i.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=L(t.attributeData[e],r))}}function ie(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const se={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},oe=g(),ae={graphic:null,property:null,oldValue:null,newValue:null},ne=_();export{X 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import{clone as i}from"../../../../core/lang.js";import{isNone as o,isSome as s}from"../../../../core/maybe.js";import{eachAlways as n,isAbortError as a}from"../../../../core/promiseUtils.js";import{makeAbsolute as u}from"../../../../core/urlUtils.js";import{TextureEncoding as l}from"./enums.js";import{readBinaryAttribute as f,createGeometryDescriptor as d}from"./I3SBinaryReader.js";import{getMaterialAndTextures as c,getMaterialAndTexturesFromShared as m,selectEncoding as h}from"./I3SMaterialUtil.js";class g{constructor(e,t,r,i,o,s){if(this.streamDataController=t,this.logger=r,this.defaultGeometrySchema=i,this.requiredAttributes=o,this.options=s,this.logLayer=e,this.layerUrl=e.parsedUrl.path,this.geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this.materialAndTextures=e.materialDefinitions.map((e=>c(t,e)))}}_load(e,t,r){return this.streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this.layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then((e=>f(t,e)))}loadAttributes(e,t,r){return n(t.map((t=>this._loadAttribute(e,t.attributeStorageInfo,r)))).then((r=>{const i={};for(let o=0;o<t.length;++o)if(r[o].value)i[t[o].name]=r[o].value;else{if(a(r[o].error))throw r[o].error;this.logger.error("#loadAttributes",this.logLayer,`Failed to load attributeData for '${t[o].name}' on node '${e.id}'`,r[o].error)}return i}))}async loadNodeData(r,i){const n=null!=this.requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this.requiredAttributes,i)):null,{bufferDefinition:a,bufferIndex:u}=x(this.geometryDefinitions,r),l=!!r.resources.geometry,f=l?e(this._loadGeometry(r.resources.geometry,u,i)):null,c=r.resources.hasSharedResource?await this._loadShared(r,i):null,h=this.materialAndTextures&&r.resources.materialDefinition>=0?this.materialAndTextures[r.resources.materialDefinition]:null!=c?m(c):null,g=h&&h.material,A=h&&h.textures,_=`${r.id}`,T=!l&&this.options.loadFeatureData,$=T?await this._loadFeatureData(_,i):null,w=T?b($):y(g),j=o(w)&&D($),I=null!=A&&A.length>0?e(this.loadTextures(r,A,i)):null;let U=null,S=null;if(f){U=t(await f);const e=p(this.defaultGeometrySchema,c);S=d(a,e)}const q=I?t(await I):null,v=n?t(await n):{},B=v?{attributeData:v,loadedAttributes:this.requiredAttributes}:null;return s(w)?{geometryData:w,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q}:s(j)?{pointData:j,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q}:Promise.reject()}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map((e=>u(e,t))):e.hrefConcat=u(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.substring(0,5)&&(e.encoding[t]=r.substring(5))}else{const t=e.encoding;"data:"===t.substring(0,5)&&(e.encoding=t.substring(5))}}}_loadShared(e,t){const r=`${this.layerUrl}/nodes/${e.resources.geometry}/shared`;return this._load(r,"json",t).then((e=>(g._fixTextureEncodings(e),g._addAbsoluteHrefTexture(e,r),e)))}_loadTexture(e,t,r,i,o,s){let n=!1;return o===l.DDS_S3TC||o===l.KTX2||o===l.Basis?this._load(e,"binary",s).then((e=>({id:t,usage:r,data:e,encoding:o,downsampled:n}))):this._load(e,"image",s).then((e=>{let s=e;const a=4096,u=2;if(i&&e.width*e.height>=a){const t=Math.ceil(e.width/u),r=Math.ceil(e.height/u),i=document.createElement("canvas");i.width=t,i.height=r;i.getContext("2d").drawImage(e,0,0,t,r),s=i,n=!0}return{id:t,usage:r,data:s,encoding:o,downsampled:n}}))}loadTextures(e,t,r){const i=this.options.uncompressedTextureDownsamplingEnabled,o=this.options.textureUsageMask;return Promise.all(t.map((t=>{if(0==(t.usage&o))return null;const s=h(t.encodings,this.options.textureEncodings);if(null==s)return this.logger.error("#loadTextures",this.logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const n=e.resources.texture||e.id,a=`${this.layerUrl}/nodes/${n}/textures/${s.name}`;return this._loadTexture(a,t.id,t.usage,i,s.encoding,r)})))}_loadFeatureData(e,t){const r=`${this.layerUrl}/nodes/${e}/features/0`;return this._load(r,"json",t)}_loadGeometry(e,t,r){const i=`${this.layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,"binary",r)}}function y(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function b(e){for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function D(e){const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:null});return t}function p(e,t){if(!e||!t||!t.materialDefinitions)return e;const r=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[r].params.vertexRegions&&e.vertexAttributes.region&&delete(e=i(e)).vertexAttributes.region,e}function x(e,t){const i={bufferDefinition:null,bufferIndex:0};if(null==e||t.resources.geometryDefinition<0)return i;const o=t.resources.geometryDefinition>=0?e[t.resources.geometryDefinition].geometryBuffers:null;if(null==o)return i;for(let s=0;s<o.length;s++){const e=o[s];if(null==e.compressedAttributes)i.bufferIndex=s,i.bufferDefinition=o[s];else if("draco"===e.compressedAttributes.encoding&&!r("disable-feature:i3s-draco"))return i.bufferIndex=s,i.bufferDefinition=e,i}return i}export{g as default};
5
+ import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import{clone as i}from"../../../../core/lang.js";import{isNone as o,isSome as n}from"../../../../core/maybe.js";import{eachAlways as s,isAbortError as a}from"../../../../core/promiseUtils.js";import{makeAbsolute as u}from"../../../../core/urlUtils.js";import{TextureEncoding as l}from"./enums.js";import{readBinaryAttribute as f,createGeometryDescriptor as d}from"./I3SBinaryReader.js";import{getMaterialAndTextures as c,getMaterialAndTexturesFromShared as m,selectEncoding as h}from"./I3SMaterialUtil.js";class g{constructor(e,t,r,i,o,n){if(this.streamDataController=t,this.logger=r,this.defaultGeometrySchema=i,this.requiredAttributes=o,this.options=n,this.logLayer=e,this.layerUrl=e.parsedUrl.path,this.geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this.materialAndTextures=e.materialDefinitions.map((e=>c(t,e)))}}_load(e,t,r){return this.streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this.layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then((e=>f(t,e)))}loadAttributes(e,t,r){return s(t.map((t=>this._loadAttribute(e,t.attributeStorageInfo,r)))).then((r=>{const i={};for(let o=0;o<t.length;++o)if(r[o].value)i[t[o].name]=r[o].value;else{if(a(r[o].error))throw r[o].error;this.logger.error("#loadAttributes",this.logLayer,`Failed to load attributeData for '${t[o].name}' on node '${e.id}'`,r[o].error)}return i}))}async loadNodeData(r,i){const s=null!=this.requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this.requiredAttributes,i)):null,{bufferDefinition:a,bufferIndex:u}=x(this.geometryDefinitions,r),l=!!r.resources.geometry,f=l?e(this._loadGeometry(r.resources.geometry,u,i)):null,c=r.resources.hasSharedResource?await this._loadShared(r,i):null,h=this.materialAndTextures&&r.resources.materialDefinition>=0?this.materialAndTextures[r.resources.materialDefinition]:null!=c?m(c):null,g=h&&h.material,A=h&&h.textures,_=`${r.id}`,w=!l&&this.options.loadFeatureData,T=w?await this._loadFeatureData(_,i):null,$=w?b(T):y(g),j=o($)&&D(T),I=null!=A&&A.length>0?e(this.loadTextures(r,A,i)):null;let U=null,S=null;if(f){U=t(await f);const e=p(this.defaultGeometrySchema,c);S=d(a,e)}const q=I?t(await I):null,v=s?t(await s):{},B=v?{attributeData:v,loadedAttributes:this.requiredAttributes}:null;if(n($))return{geometryData:$,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q};if(n(j))return{pointData:j,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map((e=>u(e,t))):e.hrefConcat=u(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.substring(0,5)&&(e.encoding[t]=r.substring(5))}else{const t=e.encoding;"data:"===t.substring(0,5)&&(e.encoding=t.substring(5))}}}_loadShared(e,t){const r=`${this.layerUrl}/nodes/${e.resources.geometry}/shared`;return this._load(r,"json",t).then((e=>(g._fixTextureEncodings(e),g._addAbsoluteHrefTexture(e,r),e)))}_loadTexture(e,t,r,i,o,n){let s=!1;return o===l.DDS_S3TC||o===l.KTX2||o===l.Basis?this._load(e,"binary",n).then((e=>({id:t,usage:r,data:e,encoding:o,downsampled:s}))):this._load(e,"image",n).then((e=>{let n=e;const a=4096,u=2;if(i&&e.width*e.height>=a){const t=Math.ceil(e.width/u),r=Math.ceil(e.height/u),i=document.createElement("canvas");i.width=t,i.height=r;i.getContext("2d").drawImage(e,0,0,t,r),n=i,s=!0}return{id:t,usage:r,data:n,encoding:o,downsampled:s}}))}loadTextures(e,t,r){const i=this.options.uncompressedTextureDownsamplingEnabled,o=this.options.textureUsageMask;return Promise.all(t.map((t=>{if(0==(t.usage&o))return null;const n=h(t.encodings,this.options.textureEncodings);if(null==n)return this.logger.error("#loadTextures",this.logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const s=e.resources.texture||e.id,a=`${this.layerUrl}/nodes/${s}/textures/${n.name}`;return this._loadTexture(a,t.id,t.usage,i,n.encoding,r)})))}_loadFeatureData(e,t){const r=`${this.layerUrl}/nodes/${e}/features/0`;return this._load(r,"json",t)}_loadGeometry(e,t,r){const i=`${this.layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,"binary",r)}}function y(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function b(e){for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function D(e){const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:null});return t}function p(e,t){if(!e||!t||!t.materialDefinitions)return e;const r=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[r].params.vertexRegions&&e.vertexAttributes.region&&delete(e=i(e)).vertexAttributes.region,e}function x(e,t){const i={bufferDefinition:null,bufferIndex:0};if(null==e||t.resources.geometryDefinition<0)return i;const o=t.resources.geometryDefinition>=0?e[t.resources.geometryDefinition].geometryBuffers:null;if(null==o)return i;for(let n=0;n<o.length;n++){const e=o[n];if(null==e.compressedAttributes)i.bufferIndex=n,i.bufferDefinition=o[n];else if("draco"===e.compressedAttributes.encoding&&!r("disable-feature:i3s-draco"))return i.bufferIndex=n,i.bufferDefinition=e,i}return i}export{g 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Error.js";import{isSome as s}from"../../../../core/maybe.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/set.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as o,populateMissingFields as p}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as a,getRequiredFields as i}from"../../../layers/support/popupUtils.js";const c=c=>{let u=class extends c{_validateFetchPopupFeatures(e){const{layer:s}=this,{popupEnabled:t}=s;if(!t)return new r("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:s});return a(s,e)?void 0:new r("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:s})}async prepareFetchPopupFeatures(e){}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)return Promise.reject(t);const c=s(r)?r.clientGraphics:null;if(!c||0===c.length)return Promise.resolve([]);const u="scene"===this.layer.type&&s(this.layer.associatedLayer)?this.layer.associatedLayer:this.layer,n=o(this.layer.fieldsIndex,await i(u,a(this.layer,r)));await this.prepareFetchPopupFeatures(n);const l=new Set,h=[],y=[];for(const s of c)p(n,s,l)?y.push(s):h.push(s);return 0===y.length?Promise.resolve(h):this.whenGraphicAttributes(y,[...l]).catch((()=>y)).then((e=>h.concat(e)))}};return u=e([t("esri.views.3d.layers.support.PopupSceneLayerView")],u),u};export{c as PopupSceneLayerView};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Error.js";import{isSome as s}from"../../../../core/maybe.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/set.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as o,populateMissingFields as p}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as a,getRequiredFields as i}from"../../../layers/support/popupUtils.js";const c=c=>{let u=class extends c{_validateFetchPopupFeatures(e){const{layer:s}=this,{popupEnabled:t}=s;if(!t)return new r("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:s});return a(s,e)?void 0:new r("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:s})}async prepareFetchPopupFeatures(e){}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;const c=s(r)?r.clientGraphics:null;if(!c||0===c.length)return[];const u="scene"===this.layer.type&&s(this.layer.associatedLayer)?this.layer.associatedLayer:this.layer,n=o(this.layer.fieldsIndex,await i(u,a(this.layer,r)));await this.prepareFetchPopupFeatures(n);const l=new Set,h=[],y=[];for(const s of c)p(n,s,l)?y.push(s):h.push(s);return 0===y.length?h:this.whenGraphicAttributes(y,[...l]).catch((()=>y)).then((e=>h.concat(e)))}};return u=e([t("esri.views.3d.layers.support.PopupSceneLayerView")],u),u};export{c as PopupSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as E}from"../../../chunks/tslib.es6.js";import _ from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";let t=class extends _{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.SCENEVIEW_LOCKING_LOG=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.TESTS_DISABLE_OPTIMIZATIONS=!1,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1}};E([o()],t.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),E([o()],t.prototype,"SCENEVIEW_LOCKING_LOG",void 0),E([o()],t.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),E([o()],t.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),E([o()],t.prototype,"DECONFLICTOR_SHOW_GRID",void 0),E([o()],t.prototype,"LABELS_SHOW_BORDER",void 0),E([o()],t.prototype,"TEXT_SHOW_BASELINE",void 0),E([o()],t.prototype,"TEXT_SHOW_BORDER",void 0),E([o()],t.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),E([o()],t.prototype,"OVERLAY_SHOW_CENTER",void 0),E([o()],t.prototype,"SHOW_POI",void 0),E([o()],t.prototype,"TESTS_DISABLE_OPTIMIZATIONS",void 0),E([o()],t.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),E([o()],t.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),E([o()],t.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),E([o()],t.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),E([o()],t.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),E([o()],t.prototype,"I3S_TREE_SHOW_TILES",void 0),E([o()],t.prototype,"I3S_SHOW_MODIFICATIONS",void 0),E([o()],t.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),E([o()],t.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),E([o()],t.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),E([o()],t.prototype,"LINE_WIREFRAMES",void 0),t=E([S("esri.views.3d.support.DebugFlags")],t);const T=new t;export{T as default};
5
+ import{_ as E}from"../../../chunks/tslib.es6.js";import _ from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";let T=class extends _{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.TESTS_DISABLE_OPTIMIZATIONS=!1,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1}};E([o()],T.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),E([o()],T.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),E([o()],T.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),E([o()],T.prototype,"DECONFLICTOR_SHOW_GRID",void 0),E([o()],T.prototype,"LABELS_SHOW_BORDER",void 0),E([o()],T.prototype,"TEXT_SHOW_BASELINE",void 0),E([o()],T.prototype,"TEXT_SHOW_BORDER",void 0),E([o()],T.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),E([o()],T.prototype,"OVERLAY_SHOW_CENTER",void 0),E([o()],T.prototype,"SHOW_POI",void 0),E([o()],T.prototype,"TESTS_DISABLE_OPTIMIZATIONS",void 0),E([o()],T.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),E([o()],T.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),E([o()],T.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),E([o()],T.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),E([o()],T.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),E([o()],T.prototype,"I3S_TREE_SHOW_TILES",void 0),E([o()],T.prototype,"I3S_SHOW_MODIFICATIONS",void 0),E([o()],T.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),E([o()],T.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),E([o()],T.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),E([o()],T.prototype,"LINE_WIREFRAMES",void 0),T=E([S("esri.views.3d.support.DebugFlags")],T);const t=new T;export{t as default};