@arcgis/core 6.0.0-next.27 → 6.0.0-next.28

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 (119) hide show
  1. package/Map.d.ts +6 -0
  2. package/analysis/AreaMeasurementAnalysis.d.ts +4 -2
  3. package/analysis/DirectLineMeasurementAnalysis.d.ts +8 -4
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{0bd04bcd4b2710838d48.js → 03f33cb78b5405ab7e23.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{7c75a8ee266c36baa902.js → 5eec1c1162779574f46e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{9dd1fc56eb1ea6eb705e.js → 76e27e36050a3dd9d249.js} +1 -1
  8. package/assets/esri/core/workers/chunks/76f877e2d2493d56afab.js +1 -0
  9. package/assets/esri/core/workers/chunks/{00580a68835aac653038.js → 9c4961213ac6ec283dd9.js} +5 -5
  10. package/assets/esri/core/workers/chunks/{13c64087be3b2985a21b.js → dbda982485d3fe26c729.js} +1 -1
  11. package/assets/esri/core/workers/chunks/dc7aa0a1eb6c6e361f9f.js +1 -0
  12. package/chunks/BlendLayers.glsl.js +1 -1
  13. package/chunks/Component.glsl.js +9 -12
  14. package/chunks/GaussianSplat.glsl.js +65 -21
  15. package/chunks/GaussianSplatDepth.glsl.js +45 -4
  16. package/chunks/GaussianSplatShadow.glsl.js +73 -19
  17. package/chunks/GlobalIllumination.glsl.js +2 -17
  18. package/chunks/LineMarker.glsl.js +32 -31
  19. package/chunks/OITAddEmission.glsl.js +1 -1
  20. package/chunks/RasterColorizer.glsl.js +1 -1
  21. package/chunks/RibbonLine.glsl.js +34 -34
  22. package/chunks/Terrain.glsl.js +3 -4
  23. package/chunks/Water.glsl.js +22 -23
  24. package/config.js +1 -1
  25. package/form/elements/inputs/DynamicChoiceInput.d.ts +2 -2
  26. package/geometry/operators/containsOperator.d.ts +1 -1
  27. package/geometry/operators/densifyOperator.d.ts +1 -1
  28. package/geometry/operators/differenceOperator.d.ts +6 -4
  29. package/geometry/operators/distanceOperator.d.ts +1 -1
  30. package/geometry/operators/geodesicProximityOperator.d.ts +8 -8
  31. package/geometry/operators/graphicBufferOperator.d.ts +6 -6
  32. package/geometry/operators/integrateOperator.d.ts +2 -2
  33. package/geometry/operators/intersectsOperator.d.ts +3 -3
  34. package/geometry/operators/linesToPolygonsOperator.d.ts +2 -2
  35. package/geometry/operators/locateBetweenOperator.d.ts +2 -2
  36. package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
  37. package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
  38. package/geometry/operators/polygonSlicerOperator.d.ts +2 -2
  39. package/geometry/operators/projectOperator.d.ts +2 -2
  40. package/geometry/operators/proximityOperator.d.ts +15 -15
  41. package/geometry/operators/shapePreservingProjectOperator.d.ts +2 -2
  42. package/geometry/operators/simplifyOperator.d.ts +2 -2
  43. package/geometry/operators/support/GeographicTransformationStep.d.ts +3 -3
  44. package/geometry/operators/support/Transformation.d.ts +8 -8
  45. package/geometry/operators/support/geographicTransformationUtils.d.ts +3 -3
  46. package/geometry/operators/symmetricDifferenceOperator.d.ts +2 -2
  47. package/geometry/operators/withinOperator.d.ts +3 -3
  48. package/kernel.js +1 -1
  49. package/layers/GeospatialPDFLayer.d.ts +2 -2
  50. package/layers/ParquetLayer.d.ts +1 -1
  51. package/package.json +2 -2
  52. package/popup/FeaturesModel.js +1 -1
  53. package/popup/support/featureUtils.js +1 -1
  54. package/rest/featureService/FeatureService.d.ts +0 -5
  55. package/rest/networks/support/TraceLocation.d.ts +2 -1
  56. package/rest/networks/support/TraceResult.d.ts +0 -4
  57. package/rest/support/OutDistance.d.ts +0 -1
  58. package/smartMapping/statistics/histogramForTimeSeries.js +1 -1
  59. package/smartMapping/statistics/summaryStatisticsForTimeSeries.js +1 -1
  60. package/support/BasemapStyle.d.ts +2 -2
  61. package/symbols/cim/types.d.ts +7 -9
  62. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  63. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  64. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  65. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  66. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  67. package/views/3d/analysis/support/projectionUtils.js +1 -1
  68. package/views/3d/environment/SunLighting.d.ts +15 -2
  69. package/views/3d/environment/VirtualLighting.d.ts +15 -2
  70. package/views/3d/input/SceneInputManager.js +1 -1
  71. package/views/3d/input/handlers/ground/GroundMouseWheelMove.js +2 -0
  72. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  73. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  74. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  75. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  76. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  77. package/views/3d/navigation/Navigation3D.js +1 -1
  78. package/views/3d/state/controllers/GroundMouseWheelController.js +2 -0
  79. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  80. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  81. package/views/3d/terrain/BlendLayers.glsl.js +1 -1
  82. package/views/3d/terrain/RasterColorizer.glsl.js +1 -1
  83. package/views/3d/terrain/TileCompositor.js +1 -1
  84. package/views/3d/terrain/TileRenderer.js +1 -1
  85. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js +7 -8
  86. package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +3 -5
  87. package/views/3d/webgl-engine/core/shaderLibrary/shading/forwardLocalUp.glsl.js +6 -0
  88. package/views/3d/webgl-engine/core/shaderLibrary/shading/getLocalUp.glsl.js +4 -0
  89. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +1 -1
  90. package/views/3d/webgl-engine/core/shaderLibrary/terrain/{TileBackground.glsl.js → blendLayers.glsl.js} +10 -11
  91. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
  92. package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
  93. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  94. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  95. package/views/3d/webgl-engine/shaders/GaussianSplatDepth.glsl.js +1 -1
  96. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +61 -108
  97. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  98. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  99. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  100. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  101. package/views/draw/DrawOperation.js +1 -1
  102. package/views/draw/DrawScreenTool.js +1 -1
  103. package/views/input/types.d.ts +2 -4
  104. package/views/interactive/options/LabelOptions.d.ts +5 -5
  105. package/views/interactive/options/SnappingOptions.d.ts +2 -2
  106. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +0 -1
  107. package/widgets/Editor/VisibleElements.d.ts +4 -0
  108. package/widgets/Editor.d.ts +2 -0
  109. package/widgets/FeatureTable.js +1 -1
  110. package/widgets/Features/FeaturesViewModel.js +1 -1
  111. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  112. package/widgets/OrientedImageryViewer/support/NonPanoramicMedia.js +1 -1
  113. package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
  114. package/widgets/PanoramicViewer/utils.js +1 -1
  115. package/widgets/Search/LayerSearchSource.d.ts +1 -1
  116. package/widgets/Sketch/VisibleElements.d.ts +4 -0
  117. package/widgets/Sketch.d.ts +2 -0
  118. package/assets/esri/core/workers/chunks/c29091fe157564cffcf7.js +0 -1
  119. package/assets/esri/core/workers/chunks/c8eae00b0ec87d8b2ff3.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as n,getContrast as r,colorVectorEquals as i,colorVectorToColorAndOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{watch as s,initial as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as f}from"../../../../../geometry/support/lineSegment.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{createManipulatorMaterial as m}from"../../manipulatorUtils.js";import{RenderObject as h}from"../../RenderObject.js";import{LaserlineVisualElement as g}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as _}from"../../../webgl-engine/lib/GeometryUtil.js";let v=class extends t{constructor(e){super(e),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new g({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(s(()=>this._params,({laserLineGlowColor:e,laserLineInnerColor:t,laserLineGlobalAlpha:n})=>{let r=this._laserLine;r.style={...r.style,innerColor:t,glowColor:e,globalAlpha:n}}))}destroy(){this._laserLine=o(this._laserLine)}get _params(){let{accentColor:e}=this.view.effectiveTheme;return{laserLineGlowColor:e.toUnitRGB(),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:r(e).toUnitRGB(),laserLineInnerWidth:.75,laserLineGlobalAlpha:e.a*.75,handleColor:n(e,.5),handleRadius:5}}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){}get _cursorPosition(){let e=d(),t=this.cursorPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _startPosition(){let e=d(),t=this.analysis.startPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _endPosition(){let e=d(),t=this.analysis.endPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _laserLineParams(){let e=this._focusPosition,{active:t,lineState:n}=this.toolState,r=this.analysisViewData,i=this.laserLineEnabled&&!!e&&n!==`measured`&&t;if(!i||!this.visible||r==null||r.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};let a=r.actualVisualizedMeasurement,o=this.view.viewingMode!==`local`&&i&&!!this.analysis.startPoint&&a===`geodesic`,s=i&&r.viewMode===2;return{heightManifoldTarget:a===`euclidean`?e:null,pointDistanceLine:o?this._pointDistanceLine:null,lineVerticalPlaneSegment:s?f(this._startPosition,this._endPosition):null}}get _focusPosition(){let{lineState:e}=this.toolState,t=this.analysisViewData,n=t!=null&&!t.destroyed&&t.measurementMode===1&&t.viewMode===1;switch(e){case`drawing`:return n?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case`editing`:return n?this._lastDraggedHandle===`start`?this._endPosition:this._startPosition:this._lastDraggedHandle===`start`?this._startPosition:this._endPosition;default:return this.cursorPoint==null?null:this._cursorPosition}}get _pointDistanceLine(){return{origin:this.toolState.lineState===`drawing`||this._lastDraggedHandle===`end`?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){let e=this._params,{view:t}=this,n=()=>{let n=m(e.handleColor);n.setParameters({testsTransparentRenderOrder:5});let r=[new h(_(n,1,32,32))],i=new p({view:t,renderObjects:r});return i.available=!1,i.radius=e.handleRadius,[i,n]},[r,o]=n(),[c,l]=n(),u=new p({view:this.view,available:!1,interactive:!1});this.analysis.startPoint!=null&&(r.location=this.analysis.startPoint,r.available=!0),this.analysis.endPoint!=null&&(c.location=this.analysis.endPoint,c.available=!0);let d=()=>{let e=this._lastDraggedHandle;r.grabbing&&!c.grabbing&&(e=`start`),c.grabbing&&!r.grabbing&&(e=`end`),!r.grabbing&&!c.grabbing&&(e=null),this._lastDraggedHandle=e},f=r.events.on(`grab-changed`,d),g=c.events.on(`grab-changed`,d);return this.addHandles([f,g,s(()=>a(this._params.handleColor),e=>{o.setParameters({color:e}),l.setParameters({color:e})},{equals:i})],`manipulators`),{start:r,end:c,cursor:u}}show(){!this.destroyed&&!this._visible&&this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(`analysis-view`),this.addHandles([s(()=>this.analysisViewData?.destroyed,e=>{e&&this.removeHandles(`analysis-view`)},c),s(()=>[this.toolState.lineState===`measured`,this.analysisViewData],([e,t])=>{t!=null&&!t.destroyed&&(t.allowVisualElementsOrientationChange=!e)},c),s(()=>this._laserLineParams,e=>{let t=this._laserLine;t.heightManifoldTarget=e.heightManifoldTarget,t.pointDistanceLine=e.pointDistanceLine,t.lineVerticalPlaneSegment=e.lineVerticalPlaneSegment},c)],`analysis-view`)}_updateVisibility(e){this.initialized&&(this._visible=e,e&&(this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}),this._laserLine.visible=e)}};e([l({constructOnly:!0})],v.prototype,`view`,void 0),e([l()],v.prototype,`_params`,null),e([l({constructOnly:!0})],v.prototype,`analysis`,void 0),e([l({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([l()],v.prototype,`cursorPoint`,void 0),e([l()],v.prototype,`toolState`,void 0),e([l()],v.prototype,`visible`,null),e([l()],v.prototype,`testData`,null),e([l()],v.prototype,`_visible`,void 0),e([l()],v.prototype,`_laserLine`,void 0),e([l({constructOnly:!0})],v.prototype,`laserLineEnabled`,void 0),e([l()],v.prototype,`_cursorPosition`,null),e([l()],v.prototype,`_startPosition`,null),e([l()],v.prototype,`_endPosition`,null),e([l()],v.prototype,`_lastDraggedHandle`,void 0),e([l()],v.prototype,`_laserLineParams`,null),e([l()],v.prototype,`_focusPosition`,null),e([l()],v.prototype,`_pointDistanceLine`,null),v=e([u(`esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView`)],v);export{v as DirectLineMeasurement3DView};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as n,getContrast as r,colorVectorEquals as i,colorVectorToColorAndOpacity as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{watch as s,initial as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as f}from"../../../../../geometry/support/lineSegment.js";import{Manipulator3D as p}from"../../Manipulator3D.js";import{createManipulatorMaterial as m}from"../../manipulatorUtils.js";import{RenderObject as h}from"../../RenderObject.js";import{LaserlineVisualElement as g}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as _}from"../../../webgl-engine/lib/GeometryUtil.js";let v=class extends t{constructor(e){super(e),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new g({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(s(()=>this._params,({laserLineGlowColor:e,laserLineInnerColor:t,laserLineGlobalAlpha:n})=>{let r=this._laserLine;r.style={...r.style,innerColor:t,glowColor:e,globalAlpha:n}}))}destroy(){this._laserLine=o(this._laserLine)}get _params(){let{accentColor:e}=this.view.effectiveTheme;return{laserLineGlowColor:e.toUnitRGB(),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:r(e).toUnitRGB(),laserLineInnerWidth:.75,laserLineGlobalAlpha:e.a*.75,handleColor:n(e,.5),handleRadius:5}}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){}get _cursorPosition(){let e=d(),t=this.cursorPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _startPosition(){let e=d(),t=this.analysisViewData.elevationAlignedStartPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _endPosition(){let e=d(),t=this.analysisViewData.elevationAlignedEndPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _laserLineParams(){let e=this._focusPosition,{active:t,lineState:n}=this.toolState,r=this.analysisViewData,i=this.laserLineEnabled&&!!e&&n!==`measured`&&t;if(!i||!this.visible||r==null||r.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};let a=r.actualVisualizedMeasurement,o=this.view.viewingMode!==`local`&&i&&!!this.analysis.startPoint&&a===`geodesic`,s=i&&r.viewMode===2;return{heightManifoldTarget:a===`euclidean`?e:null,pointDistanceLine:o?this._pointDistanceLine:null,lineVerticalPlaneSegment:s?f(this._startPosition,this._endPosition):null}}get _focusPosition(){let{lineState:e}=this.toolState,t=this.analysisViewData,n=t!=null&&!t.destroyed&&t.measurementMode===1&&t.viewMode===1;switch(e){case`drawing`:return n?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case`editing`:return n?this._lastDraggedHandle===`start`?this._endPosition:this._startPosition:this._lastDraggedHandle===`start`?this._startPosition:this._endPosition;default:return this.cursorPoint==null?null:this._cursorPosition}}get _pointDistanceLine(){return{origin:this.toolState.lineState===`drawing`||this._lastDraggedHandle===`end`?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){let e=this._params,{view:t}=this,n=()=>{let n=m(e.handleColor);n.setParameters({testsTransparentRenderOrder:5});let r=[new h(_(n,1,32,32))],i=new p({view:t,renderObjects:r});return i.available=!1,i.radius=e.handleRadius,[i,n]},[r,o]=n(),[c,l]=n(),u=new p({view:this.view,available:!1,interactive:!1}),{elevationAlignedStartPoint:d,elevationAlignedEndPoint:f}=this.analysisViewData;d!=null&&(r.location=d,r.available=!0),f!=null&&(c.location=f,c.available=!0);let g=()=>{let e=this._lastDraggedHandle;r.grabbing&&!c.grabbing&&(e=`start`),c.grabbing&&!r.grabbing&&(e=`end`),!r.grabbing&&!c.grabbing&&(e=null),this._lastDraggedHandle=e},v=r.events.on(`grab-changed`,g),y=c.events.on(`grab-changed`,g);return this.addHandles([v,y,s(()=>a(this._params.handleColor),e=>{o.setParameters({color:e}),l.setParameters({color:e})},{equals:i})],`manipulators`),{start:r,end:c,cursor:u}}show(){!this.destroyed&&!this._visible&&this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(`analysis-view`),this.addHandles([s(()=>this.analysisViewData?.destroyed,e=>{e&&this.removeHandles(`analysis-view`)},c),s(()=>[this.toolState.lineState===`measured`,this.analysisViewData],([e,t])=>{t!=null&&!t.destroyed&&(t.allowVisualElementsOrientationChange=!e)},c),s(()=>this._laserLineParams,e=>{let t=this._laserLine;t.heightManifoldTarget=e.heightManifoldTarget,t.pointDistanceLine=e.pointDistanceLine,t.lineVerticalPlaneSegment=e.lineVerticalPlaneSegment},c)],`analysis-view`)}_updateVisibility(e){this.initialized&&(this._visible=e,e&&(this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}),this._laserLine.visible=e)}};e([l({constructOnly:!0})],v.prototype,`view`,void 0),e([l()],v.prototype,`_params`,null),e([l({constructOnly:!0})],v.prototype,`analysis`,void 0),e([l({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([l()],v.prototype,`cursorPoint`,void 0),e([l()],v.prototype,`toolState`,void 0),e([l()],v.prototype,`visible`,null),e([l()],v.prototype,`testData`,null),e([l()],v.prototype,`_visible`,void 0),e([l()],v.prototype,`_laserLine`,void 0),e([l({constructOnly:!0})],v.prototype,`laserLineEnabled`,void 0),e([l()],v.prototype,`_cursorPosition`,null),e([l()],v.prototype,`_startPosition`,null),e([l()],v.prototype,`_endPosition`,null),e([l()],v.prototype,`_lastDraggedHandle`,void 0),e([l()],v.prototype,`_laserLineParams`,null),e([l()],v.prototype,`_focusPosition`,null),e([l()],v.prototype,`_pointDistanceLine`,null),v=e([u(`esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView`)],v);export{v as DirectLineMeasurement3DView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as n,watch as r,sync as i}from"../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as s,projectDatasetExtent as c}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{LayerView3D as l}from"./LayerView3D.js";import{TiledLayerView3D as u}from"./TiledLayerView3D.js";import d from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as f}from"../terrain/RasterTile.js";import p from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as h}from"../../support/drapedUtils.js";import{getWebGLCapabilities as g}from"../../webgl/capabilities.js";let _=class extends m(u(l(p))){constructor(){super(...arguments),this._srcResolutions=[],this.type=`imagery-tile-3d`,this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),this.fullExtent??this.addResolvingPromise(Promise.reject(new t(`layerview:spatial-reference-incompatible`,`The layer extent cannot be projected to the view's spatial reference`,{layer:this.layer})));let e=n(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{let e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=[`png`,`png24`,`png32`,`jpg`,`mixed`].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this._srcResolutions=s(this.layer.serviceRasterInfo,this.tileInfo),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.consumePromise(this.doRefresh())},i),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),i)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}_setSubView(e){if(this.layer.type===`wcs`)return;let t=e?.type===`flow`,n=this._flowSubView;t&&n!=null||(n?.destroy(),this._flowSubView=t?new d({layerView:this}):null)}get _hasFlow(){return this._flowSubView!=null}get imageFormatIsOpaque(){return this.layer.tileInfo.format===`jpg`}get hasMixedImageFormats(){return this.layer.tileInfo.format===`mixed`}get dataLevelRange(){let e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,n=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,n)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.groundView?.spatialReference??this.view.spatialReference)}async fetchTile(e,n){if(this._isAlignedMapTile)return this.layer.fetchImageBitmapTile(e[0],e[1],e[2],{...n,allowDeriveTypeFromData:!0,imageOrientation:`flipY`});let r=this.tileInfo,i=this._canSymbolizeInWebGL(),a={tileInfo:r,requestRawData:i&&!this._hasFlow,signal:n.signal,timeExtent:this.timeExtent,requestProjectedLocalDirections:this._hasFlow,srcResolution:this._srcResolutions[e[0]],noClip:!1},{layer:o}=this,[s,c,l]=e,u=await o.fetchTile(s,c,l,a);if(u instanceof HTMLImageElement||u instanceof ImageBitmap)throw new t(`layerview:unexpected-tile-data`,`Expected fetchTile to return raster data, but received an image element. This may indicate a problem with the layer's fetchTile implementation.`);let d=u?.pixelBlock;if(d==null||!i&&!this._hasFlow&&(d=await o.applyRenderer(u),d==null))return null;let p=new f([s,c,l],d,r.size[0],r.size[1]);return i?(p.symbolizerRenderer=o.symbolizer.rendererJSON,p.symbolizerParameters=o.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(s)),p.transformGrid=u.transformGrid,p.bandIds=o.bandIds):(p.isRenderedSource=!0,p.bandIds=null),p.interpolation=o.interpolation,p}_getSymbolizerOptions(e){let t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:this.view.groundView?.spatialReference==null?this.view.spatialReference.isGeographic:this.view.groundView.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return h(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit(`data-changed`))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){let e=g(),{symbolizer:t}=this.layer,n=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,i=n&&n.length>(e.maxTextureSize||4096)*4;return t.canRenderInWebGL&&!i&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([a()],_.prototype,`fullExtent`,null),e([a()],_.prototype,`_hasFlow`,null),e([a({readOnly:!0})],_.prototype,`imageFormatIsOpaque`,null),e([a({readOnly:!0})],_.prototype,`hasMixedImageFormats`,null),e([a()],_.prototype,`_flowSubView`,void 0),e([a({readOnly:!0})],_.prototype,`dataLevelRange`,null),e([a({readOnly:!0})],_.prototype,`visibleAtCurrentScale`,null),_=e([o(`esri.views.3d.layers.ImageryTileLayerView3D`)],_);const v=_;export{v as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as n,watch as r,sync as i}from"../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{computeSrcResolutions as s,projectDatasetExtent as c}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{LayerView3D as l}from"./LayerView3D.js";import{TiledLayerView3D as u}from"./TiledLayerView3D.js";import d from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as f}from"../terrain/RasterTile.js";import p from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as h}from"../../support/drapedUtils.js";import{getWebGLCapabilities as g}from"../../webgl/capabilities.js";let _=class extends m(u(l(p))){constructor(){super(...arguments),this._srcResolutions=[],this.type=`imagery-tile-3d`,this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),this.fullExtent??this.addResolvingPromise(Promise.reject(new t(`layerview:spatial-reference-incompatible`,`The layer extent cannot be projected to the view's spatial reference`,{layer:this.layer})));let e=n(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{let e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=[`png`,`png24`,`png32`,`jpg`,`mixed`].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this._srcResolutions=s(this.layer.serviceRasterInfo,this.tileInfo),this.addHandles([r(()=>this.layer.renderer,e=>{this._setSubView(e),this._updatingHandles.consumePromise(this.doRefresh())},i),r(()=>[this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),i)])});this._setSubView(this.layer.renderer),this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}_setSubView(e){if(this.layer.type===`wcs`)return;let t=e?.type===`flow`,n=this._flowSubView;t&&n!=null||(n?.destroy(),this._flowSubView=t?new d({layerView:this}):null)}get _hasFlow(){return this._flowSubView!=null}get imageFormatIsOpaque(){return this.layer.tileInfo?.format===`jpg`}get hasMixedImageFormats(){return this.layer.tileInfo?.format===`mixed`}get dataLevelRange(){let e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,n=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,n)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return c(this.layer.serviceRasterInfo,this.view.groundView?.spatialReference??this.view.spatialReference)}async fetchTile(e,n){if(this._isAlignedMapTile)return this.layer.fetchImageBitmapTile(e[0],e[1],e[2],{...n,allowDeriveTypeFromData:!0,imageOrientation:`flipY`});let r=this.tileInfo,i=this._canSymbolizeInWebGL(),a={tileInfo:r,requestRawData:i&&!this._hasFlow,signal:n.signal,timeExtent:this.timeExtent,requestProjectedLocalDirections:this._hasFlow,srcResolution:this._srcResolutions[e[0]],noClip:!1},{layer:o}=this,[s,c,l]=e,u=await o.fetchTile(s,c,l,a);if(u instanceof HTMLImageElement||u instanceof ImageBitmap)throw new t(`layerview:unexpected-tile-data`,`Expected fetchTile to return raster data, but received an image element. This may indicate a problem with the layer's fetchTile implementation.`);let d=u?.pixelBlock;if(d==null||!i&&!this._hasFlow&&(d=await o.applyRenderer(u),d==null))return null;let p=new f([s,c,l],d,r.size[0],r.size[1]);return i?(p.symbolizerRenderer=o.symbolizer.rendererJSON,p.symbolizerParameters=o.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(s)),p.transformGrid=u.transformGrid,p.bandIds=o.bandIds):(p.isRenderedSource=!0,p.bandIds=null),p.interpolation=o.interpolation,p}_getSymbolizerOptions(e){let t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:this.view.groundView?.spatialReference==null?this.view.spatialReference.isGeographic:this.view.groundView.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return h(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit(`data-changed`))}isUpdating(){return super.isUpdating()||(this._flowSubView?.updating??!1)}_canSymbolizeInWebGL(){let e=g(),{symbolizer:t}=this.layer,n=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,i=n&&n.length>(e.maxTextureSize||4096)*4;return t.canRenderInWebGL&&!i&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([a()],_.prototype,`fullExtent`,null),e([a()],_.prototype,`_hasFlow`,null),e([a({readOnly:!0})],_.prototype,`imageFormatIsOpaque`,null),e([a({readOnly:!0})],_.prototype,`hasMixedImageFormats`,null),e([a()],_.prototype,`_flowSubView`,void 0),e([a({readOnly:!0})],_.prototype,`dataLevelRange`,null),e([a({readOnly:!0})],_.prototype,`visibleAtCurrentScale`,null),_=e([o(`esri.views.3d.layers.ImageryTileLayerView3D`)],_);const v=_;export{v as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{generateUID as p}from"../../../../core/uid.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as g}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as _,equals as v,clone as y,expand as b,toExtent as x,width as S,height as C}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as w,DehydratedFeatureClass as T,hasVertices as E,computeAABR as ee}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as te,transferGeometryKey as ne,identicalTransferGeometry as re,completeDehydratedFeatureFromTransfer as ie}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{FeatureMemory as A}from"./FeatureMemory.js";import{MultiFeatureReference as j,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new A(te),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?j:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(w(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?w(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(w(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=ne(e.geometry,n,t),a=this._memory.findGeometry(i,t=>re(e.geometry,n,t));a?e.geometry=a:ie(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),v(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=w(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=y(e.descriptor.extent),b(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(w(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let s=new Set(n.map(e=>w(e,this._objectIdField))),c=new Map,l=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>l,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=w(t,this._objectIdField);if(s.delete(e)){c.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>c.has(e))),!s.size)break}return s.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{o(t);let r=n.map(e=>{let t={...e.attributes,...c.get(w(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new T(p(),e.geometry,t);return n.objectId=w(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),o(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,s,c=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),l=!1;for await(let u of c){let{features:c,fields:d,missingAttributes:f}=u;if(l=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(c,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!l,r=r?.concat(c)??c,a=q(a,d),s=J(s,f),e.setFeatures(r,n,a,s),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return l?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),s=0;for(;;){o(n);let r=this._setPagingParameters(i,s,t(),a),c=await this._queryFeatures(i,e.fetchingResolution,n);o(n);let l=c.features.length>0;if(yield c,!r||!c.exceededTransferLimit||!l)return;s+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=x(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=f(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+g());n(e,({geometry:e})=>!e||!E(e)?!1:(ee(e,Q),S(Q)>r||C(Q)>r))}else n(e,({geometry:e})=>E(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let s=!1;t.then(t=>{o(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),a(t)?s=!0:i(t)}).then(()=>{s||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=w(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=w(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([m({constructOnly:!0})],B.prototype,`features`,void 0),e([m({constructOnly:!0})],B.prototype,`context`,void 0),e([m()],B.prototype,`tileDescriptors`,void 0),e([m({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([m({value:1})],B.prototype,`memoryFactor`,null),e([m({value:1})],B.prototype,`lodFactor`,null),e([m()],B.prototype,`useTileCount`,null),e([m({readOnly:!0})],B.prototype,`updating`,null),e([m({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([m({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([m({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([m({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([m()],B.prototype,`usedMemory`,null),e([m()],B.prototype,`usedMemoryPerFeature`,null),e([m({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([m({readOnly:!0})],B.prototype,`totalVertices`,null),e([m({readOnly:!0})],B.prototype,`totalFeatures`,null),e([m({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([m({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([m()],B.prototype,`filterExtent`,null),e([m()],B.prototype,`_dirty`,void 0),e([m()],B.prototype,`_suspended`,void 0),e([m()],B.prototype,`_pendingEdits`,void 0),e([m()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([m()],B.prototype,`_paused`,null),e([m()],B.prototype,`snappingComplexityExceeded`,void 0),e([m()],B.prototype,`_isFetching`,void 0),B=e([h(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=_(),Z=_(),Q=_(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{generateUID as p}from"../../../../core/uid.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as g}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as _,equals as v,clone as y,expand as b,toExtent as x,width as S,height as C}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as w,DehydratedFeatureClass as T,hasVertices as E,computeAABR as ee}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as te,transferGeometryKey as ne,identicalTransferGeometry as re,completeDehydratedFeatureFromTransfer as ie}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{FeatureMemory as A}from"./FeatureMemory.js";import{MultiFeatureReference as j,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new A(te),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?j:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(w(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?w(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(w(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=ne(e.geometry,n,t),a=this._memory.findGeometry(i,t=>re(e.geometry,n,t));a?e.geometry=a:ie(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),v(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=w(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution,n=new Set;this._featureTiles.forEach(r=>{if(r.displayingFeatures!=null&&e!==r&&L(e.descriptor.lij,r.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&r.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=y(e.descriptor.extent),b(e.extentIncludingBorrowedFeatures,r.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let i of r.displayingFeatures){let r=w(i,this._objectIdField);if(n.has(r))continue;n.add(r),e.displayingFeatures.push(i),this._memory.ref(i);let a=this._displayingFeatureReferences.get(r);a.ref(this._memory,a.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let s=new Set(n.map(e=>w(e,this._objectIdField))),c=new Map,l=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>l,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=w(t,this._objectIdField);if(s.delete(e)){c.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>c.has(e))),!s.size)break}return s.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{o(t);let r=n.map(e=>{let t={...e.attributes,...c.get(w(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new T(p(),e.geometry,t);return n.objectId=w(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),o(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,s,c=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),l=!1;for await(let u of c){let{features:c,fields:d,missingAttributes:f}=u;if(l=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(c,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!l,r=r?.concat(c)??c,a=q(a,d),s=J(s,f),e.setFeatures(r,n,a,s),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return l?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),s=0;for(;;){o(n);let r=this._setPagingParameters(i,s,t(),a),c=await this._queryFeatures(i,e.fetchingResolution,n);o(n);let l=c.features.length>0;if(yield c,!r||!c.exceededTransferLimit||!l)return;s+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=x(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=f(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+g());n(e,({geometry:e})=>!e||!E(e)?!1:(ee(e,Q),S(Q)>r||C(Q)>r))}else n(e,({geometry:e})=>E(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let s=!1;t.then(t=>{o(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),a(t)?s=!0:i(t)}).then(()=>{s||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=w(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=w(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([m({constructOnly:!0})],B.prototype,`features`,void 0),e([m({constructOnly:!0})],B.prototype,`context`,void 0),e([m()],B.prototype,`tileDescriptors`,void 0),e([m({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([m({value:1})],B.prototype,`memoryFactor`,null),e([m({value:1})],B.prototype,`lodFactor`,null),e([m()],B.prototype,`useTileCount`,null),e([m({readOnly:!0})],B.prototype,`updating`,null),e([m({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([m({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([m({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([m({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([m()],B.prototype,`usedMemory`,null),e([m()],B.prototype,`usedMemoryPerFeature`,null),e([m({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([m({readOnly:!0})],B.prototype,`totalVertices`,null),e([m({readOnly:!0})],B.prototype,`totalFeatures`,null),e([m({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([m({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([m()],B.prototype,`filterExtent`,null),e([m()],B.prototype,`_dirty`,void 0),e([m()],B.prototype,`_suspended`,void 0),e([m()],B.prototype,`_pendingEdits`,void 0),e([m()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([m()],B.prototype,`_paused`,null),e([m()],B.prototype,`snappingComplexityExceeded`,void 0),e([m()],B.prototype,`_isFetching`,void 0),B=e([h(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=_(),Z=_(),Q=_(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{ignoreAbortErrors as t}from"../../../core/promiseUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as a}from"./modes/DefaultNavigationMode3D.js";import{groundNavigationAdvance as o}from"../state/utils/groundNavigationUtils.js";import s from"../../navigation/Navigation.js";let c=class extends s{constructor(e){super(e),this.mode=new a,this.addHandles([n(()=>this.mode,(e,t)=>{t?.detach(),e.attach(this.view)},{sync:!0,initial:!0})])}get isInPlacementMode(){let{activeTool:e}=this.view;return e?`isGroundNavigationPlacementTool`in e:!1}zoom(e){switch(this.mode.type){case`default`:return t(this.view.goTo({zoomFactor:e?2:.5}));case`ground`:return t(o(this.view,e?5:-5));default:this.mode}throw Error(`Unknown navigation mode while calling navigation3D.zoom: ${this.mode}`)}};e([r({constructOnly:!0})],c.prototype,`view`,void 0),e([r()],c.prototype,`mode`,void 0),e([r()],c.prototype,`isInPlacementMode`,null),c=e([i(`esri.views.3d.navigation.Navigation3D`)],c);export{c as Navigation3D};
2
+ import{__decorate as e}from"tslib";import{ignoreAbortErrors as t}from"../../../core/promiseUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as a}from"./modes/DefaultNavigationMode3D.js";import{groundNavigationAdvance as o}from"../state/utils/groundNavigationUtils.js";import s from"../../navigation/Navigation.js";let c=class extends s{constructor(e){super(e),this.mode=new a,this.addHandles([n(()=>this.mode,(e,t)=>{t?.detach(),e.attach(this.view)},{sync:!0,initial:!0})])}get isInPlacementMode(){let{activeTool:e}=this.view;return e?`isGroundNavigationPlacementTool`in e:!1}zoom(e){switch(this.mode.type){case`default`:return t(this.view.goTo({zoomFactor:e?2:.5}));case`ground`:return t(o(this.view,this.view.state.camera.viewForward,e?5:-5));default:this.mode}throw Error(`Unknown navigation mode while calling navigation3D.zoom: ${this.mode}`)}};e([r({constructOnly:!0})],c.prototype,`view`,void 0),e([r()],c.prototype,`mode`,void 0),e([r()],c.prototype,`isInPlacementMode`,null),c=e([i(`esri.views.3d.navigation.Navigation3D`)],c);export{c as Navigation3D};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{Milliseconds as t,millisecondsFromSeconds as n}from"../../../../core/time.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{set as i,scaleAndAdd as a,length as o,scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{CameraController as l}from"./CameraController.js";import{advanceGroundNavigationCamera as u}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as d}from"../utils/OffsetCorrectionController.js";let f=class extends l{constructor(){super(...arguments),this._remainingMovement=c(),this._direction=c(),this._timeSinceLastInput=t(0)}initialize(){this._offsetCorrectionController=new d(this.view)}get canStop(){return!0}get isInteractive(){return!0}onControllerStart(){this.state=2}onControllerEnd(){i(this._remainingMovement,0,0,0)}addMovement(e,n){a(this._remainingMovement,this._remainingMovement,e,n),this._timeSinceLastInput=t(0)}stepController(e,r){if(!this.running||e<=0)return;if(this._timeSinceLastInput=t(this._timeSinceLastInput+n(e)),this._timeSinceLastInput>=200&&this._offsetCorrectionController.reset(),this.view.navigation.mode.type!==`ground`){this.finishController();return}let i=o(this._remainingMovement),a=i<=1e-5||!this.view.state.animationsEnabled,c=a?1:-Math.expm1(-(e/.08));i>0&&(s(this._direction,this._remainingMovement,1/i),u({view:this.view,camera:r,forwardDirection:this._direction,forwardDistance:i*c,detectCollisions:!1}),s(this._remainingMovement,this._remainingMovement,1-c));let l=this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:r,deltaTime:e});a&&l<=.01&&this.finishController()}};f=e([r(`esri.views.3d.state.controllers.GroundMouseWheelController`)],f);export{f as GroundMouseWheelController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import{applyConstraintsAndUpdateCenterRenderCamera as p}from"../../camera/constraintUtils.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";const h=.5,g=new Set([0,2,8]),_=new Set(g).add(7);class v{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new m(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a}=e,o=this._prepareMode(a);if(!o||!r)return 0;let s=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),c=this._prepareCameraAndPreviousIterationPosition(n,s,this._previousCameraPosition),l=this._prepareRays(n,s,c),u=this._intersectRays(o,s,l);if(!u.hasIntersection){let e=this._adjustCameraElevation(n,s,0,i);return this._previousCameraPosition=d(e),0}let f=this._filterRayResults(s,c,u),p=this._getSmoothedElevationCorrection(o,f,n,s,c,r),m=this._adjustCameraElevation(n,s,p,i);return this._previousCameraPosition=d(m),Math.abs(f-t(m,s))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];!d.hasIntersection||n(i.eye,f)>(s??1/0)?this._adjustCameraElevation(i,l,0,a):this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,h),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=y(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i){return n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff)),p(this._view,e,i),e.eye}}function y(e,t){return b(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?g:_}}function b(e){return e!=null&&e.size>0}export{v as OffsetCorrectionController};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import{applyConstraintsAndUpdateCenterRenderCamera as p}from"../../camera/constraintUtils.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";const h=.5,g=new Set([0,2,8]),_=new Set(g).add(7);class v{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new m(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a}=e,o=this._prepareMode(a);if(!o||!r)return 0;let s=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),c=this._prepareCameraAndPreviousIterationPosition(n,s,this._previousCameraPosition),l=this._prepareRays(n,s,c),u=this._intersectRays(o,s,l);if(!u.hasIntersection){let e=this._adjustCameraElevation(n,s,0,i);return this._previousCameraPosition=d(e),0}let f=this._filterRayResults(s,c,u),p=this._getSmoothedElevationCorrection(o,f,n,s,c,r),m=this._adjustCameraElevation(n,s,p,i);return this._previousCameraPosition=d(m),Math.abs(f-t(m,s))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];!d.hasIntersection||n(i.eye,f)>(s??1/0)?this._adjustCameraElevation(i,l,0,a):this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,h),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=y(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i){return n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff)),p(this._view,e,i),e.eye}reset(){this._previousCameraPosition=null}}function y(e,t){return b(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?g:_}}function b(e){return e!=null&&e.size>0}export{v as OffsetCorrectionController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as i,add as a,crossAndNormalize as o,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as d,length as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as h}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPositionAndNormal as _,distance as v,projectPoint as y,projectVector as b,intersectLineSegment as x}from"../../../../geometry/support/plane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as w}from"../../webgl.js";import{getVoxelWasm as T}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ee}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as A}from"../../webgl-engine/lib/Intersector.js";const j=1.5,M={xSpeedMultiplier:j,ySpeedMultiplier:j,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},N=p(),P=p(),re=t(),F=p(),I=g(),L=p(),R=p(),z=p(),B=p(),V=p(),ie=p(),H=p(),U=p(),W=p(),G=p(),K=t(),q=S(),J=new C,Y=p(),ae=g(),X=p(),oe=p();function se(e,t){return b(t,e.viewForward,N),a(P,e.eye,N),e.projectToScreen(P,re),re[1]}function ce(e,t,d){let f=e.eye;if(n(t.center,f)<t.radius)return r(V,f),i(ie,V,e.viewRight),a(P,f,ie),e.projectToScreen(P,K),K[1];let p=e.up;te(e,d,q);let m=t.radius;if(o(F,p,q.direction),_(f,F,I),v(I,t.center)>m)return null;y(I,t.center,L);let h=n(t.center,L),g=Math.sqrt(m**2-h**2);s(R,f,L),r(z,R),o(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),C=Math.sqrt(S**2-g**2),w=g**2/S**2,T=g/S**2*C,E=w*b,D=T*-x,O=w*x,k=T*b,ee=E+D,ne=E-D,A=O+k,j=O-k;return a(H,L,l(H,u(H,z,ee),B,A)),a(U,L,l(U,u(U,z,ne),B,j)),s(W,H,f),r(W,W),s(G,U,f),r(G,G),c(e.viewForward,W)>=c(e.viewForward,G)?e.projectToScreen(H,K):e.projectToScreen(U,K),K[1]}function le(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function ue(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(M.minimumHorizonPadding,M.relativeHorizonPadding*r)}function de(e,t){return[fe(e,t),pe(e,t)]}function fe(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function pe(e,t){return Math.max(0,t-Q(e,t))}function me(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function he(e){let{view:t}=e;return t.viewingMode===`global`?ge(e):_e(e)}function ge(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:f}=e,p=t.state.camera,h=me(s,c,l);J.radius=m(t.spatialReference).radius;let g=E(t,p,i,J.radius,1,u);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;d(Y,g.scenePickPoint),d(h.location,Y);let v=g.sphere;h.normal&&g.normal&&d(h.normal,g.normal);let y=ye(i,a,o,_),b=_?n(Y,p.eye):1/0;return y.wasAdjusted&&be({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let i=D(v,p,e,t);return i&&n&&r(n,t),i},output:h,intersectionOptions:u}),Se({view:t,screenPoint:y.adjustedScreenPoint,camera:p,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function _e(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,g=$(t),v=me(s,c,u);m.intersectIntersectorScreen(i,g,f);let y=g.results.min.getIntersectionPoint(Y),b=y?n(Y,h.eye):1/0;y&&(d(v.location,Y),v.normal&&d(v.normal,g.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),_(X,V,ae);let x=ye(i,a,o,y);return x.wasAdjusted&&be({view:t,screenAdjustment:x,intersector:g,fallbackCheck:(e,t,n)=>{let i=O(ae,h,e,t);return i&&n&&r(n,V),i},output:v,intersectionOptions:f}),Se({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function ve(e,t,n,r){return!r&&le(e,t)||r&&ue(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ye(e,n,r,i){let a=ve(e[1],n,r,i);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],a??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new A(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function be(e){let{view:t,screenAdjustment:n,fallbackCheck:r,intersector:i,output:a,intersectionOptions:o}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,i,{...o,requiresGroundFeedback:!0});let c=i.results.min.getIntersectionPoint(a.location);if(c){a.normal&&d(a.normal,i.results.min.normal);return}let l=xe(n);s.intersectIntersectorScreen(l,i,{...o,requiresGroundFeedback:!0}),c=i.results.min.getIntersectionPoint(a.location),c?a.normal&&d(a.normal,i.results.min.normal):(c=r(n.adjustedScreenPoint,a.location,a.normal),c||r(l,a.location,a.normal))}function xe(e){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=e,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return t(r[0],o)}function Se(e){Ce(e),we(e)}function Ce(e){let{view:t,camera:n,output:r}=e,{offset:i}=t.navigation.mode;if(!i)return;let{translation:a,location:o}=r;t.renderCoordsHelper.worldUpAtPosition(n.eye,V),l(X,n.eye,V,-i),_(X,V,I),x(I,h(n.eye,s(N,o,n.eye)),X)&&(d(o,X),s(a,o,n.eye))}function we(e){let{view:t,screenPoint:n,camera:i,initialDistance:o,depthSearchSize:c,output:l}=e,d=c>0?t.stage.renderView.getMinimalDepthForArea(T(t),n[0],n[1],i,c):null;s(l.translation,l.location,i.eye);let p=Math.min(f(l.translation),o);d&&d<=p&&(p=d),r(l.translation,l.translation),u(l.translation,l.translation,p),a(l.location,l.translation,i.eye)}async function Te(t,r){let i=t.navigation.mode;if(i.type!==`ground`){e.getLogger(`esri`).warn(`Can only advance while in ground navigation mode!`);return}let{camera:c}=t.state;t.renderCoordsHelper.worldUpAtPosition(c.eye,V);let l=t.sceneIntersectionHelper,p=$(t),m=o(N,V,c.viewRight);d(q.origin,c.eye),u(q.direction,m,r);let h=l.intersectRay(q,p,Y,{include:i.include,exclude:i.exclude}),g=new ne().copyFrom(c),_=s(oe,c.center,c.eye);return!h||n(Y,c.eye)>r?g.eye=a(N,q.origin,q.direction):(s(N,Y,c.eye),f(N)>2&&(Ee(N,N,.25,2),g.eye=a(N,c.eye,N))),g.center=a(N,g.eye,_),new ee(t).immediatelyCorrectGroundElevation({camera:g,correctionLimit:100}),t.goTo(w(t,g),{duration:500,liftOffDisabled:!0})}function Ee(e,t,n,r){let i=f(e),a=Math.min(n,Math.max(i-r,0)/i);u(t,e,a)}export{Q as computeHorizonPadding,de as computeHorizonPaddingLimits,he as findGroundNavigationGrabLocation,se as findPlaneHorizonY,ce as findSphereHorizonY,Te as groundNavigationAdvance,M as groundNavigationConstants,le as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,ue as shouldClampScreenY};
2
+ import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{crossAndNormalize as t,copy as n,scale as r,subtract as i,add as a,distance as o,normalize as s,cross as c,dot as l,scaleAndAdd as u,length as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as ee}from"../../webgl.js";import{getVoxelWasm as C}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as w,sphereOrPlanePointFromScreenPoint as T,intersectPlaneFromScreenPoint as E,searchAreaSize as D}from"./navigationUtils.js";import{OffsetCorrectionController as O}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as re}from"../../webgl-engine/lib/Intersector.js";const k=1.5,A={xSpeedMultiplier:k,ySpeedMultiplier:k,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},j=f(),M=f(),N=e(),P=f(),F=h(),I=f(),L=f(),R=f(),z=f(),B=f(),ie=f(),V=f(),H=f(),U=f(),W=f(),G=e(),K=x(),q=new S,J=f(),Y=h(),X=f(),ae=f();function oe(e,t){return y(t,e.viewForward,j),a(M,e.eye,j),e.projectToScreen(M,N),N[1]}function se(e,n,d){let f=e.eye;if(o(n.center,f)<n.radius)return s(B,f),c(ie,B,e.viewRight),a(M,f,ie),e.projectToScreen(M,G),G[1];let p=e.up;te(e,d,K);let m=n.radius;if(t(P,p,K.direction),g(f,P,F),_(F,n.center)>m)return null;v(F,n.center,I);let h=o(n.center,I),y=Math.sqrt(m**2-h**2);i(L,f,I),s(R,L),t(z,P,R);let b=l(L,R),x=l(L,z),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,ne=T+E,re=T-E,k=D+O,A=D-O;return a(V,I,u(V,r(V,R,ne),z,k)),a(H,I,u(H,r(H,R,re),z,A)),i(U,V,f),s(U,U),i(W,H,f),s(W,W),l(e.viewForward,U)>=l(e.viewForward,W)?e.projectToScreen(V,G):e.projectToScreen(H,G),G[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(A.minimumHorizonPadding,A.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.viewingMode===`global`?he(e):ge(e)}function he(e){let{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:c,outGrabLocation:l,outGrabNormal:u,intersectionOptions:d,depthSearchSize:f}=e,m=t.state.camera,h=pe(c,l,u);q.radius=p(t.spatialReference).radius;let g=w(t,m,r,q.radius,1,d);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;n(J,g.scenePickPoint),n(h.location,J);let v=g.sphere;h.normal&&g.normal&&n(h.normal,g.normal);let y=ve(r,i,a,_),b=_?o(J,m.eye):1/0;return y.wasAdjusted&&ye({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let r=T(v,m,e,t);return r&&n&&s(n,t),r},output:h,intersectionOptions:d}),xe({view:t,screenPoint:y.adjustedScreenPoint,camera:m,initialDistance:b,depthSearchSize:f??D,output:h}),!0}function ge(e){let{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:c,outGrabLocation:l,outGrabNormal:d,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,_=$(t),v=pe(c,l,d);m.intersectIntersectorScreen(r,_,f);let y=_.results.min.getIntersectionPoint(J),b=y?o(J,h.eye):1/0;y&&(n(v.location,J),v.normal&&n(v.normal,_.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,B),u(X,h.eye,B,-h.relativeElevation),g(X,B,Y);let x=ve(r,i,a,y);return x.wasAdjusted&&ye({view:t,screenAdjustment:x,intersector:_,fallbackCheck:(e,t,n)=>{let r=E(Y,h,e,t);return r&&n&&s(n,B),r},output:v,intersectionOptions:f}),xe({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??D,output:v}),!0}function _e(e,t,n,r){return!r&&ce(e,t)||r&&le(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ve(t,n,r,i){let a=_e(t[1],n,r,i);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],a??t[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new re(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function ye(e){let{view:t,screenAdjustment:r,fallbackCheck:i,intersector:a,output:o,intersectionOptions:s}=e,c=t.sceneIntersectionHelper;c.intersectIntersectorScreen(r.adjustedScreenPoint,a,{...s,requiresGroundFeedback:!0});let l=a.results.min.getIntersectionPoint(o.location);if(l){o.normal&&n(o.normal,a.results.min.normal);return}let u=be(r);c.intersectIntersectorScreen(u,a,{...s,requiresGroundFeedback:!0}),l=a.results.min.getIntersectionPoint(o.location),l?o.normal&&n(o.normal,a.results.min.normal):(l=i(r.adjustedScreenPoint,o.location,o.normal),l||i(u,o.location,o.normal))}function be(t){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=t,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return e(r[0],o)}function xe(e){Se(e),Ce(e)}function Se(e){let{view:t,camera:r,output:a}=e,{offset:o}=t.navigation.mode;if(!o)return;let{translation:s,location:c}=a;t.renderCoordsHelper.worldUpAtPosition(r.eye,B),u(X,r.eye,B,-o),g(X,B,F),b(F,m(r.eye,i(j,c,r.eye)),X)&&(n(c,X),i(s,c,r.eye))}function Ce(e){let{view:t,screenPoint:n,camera:o,initialDistance:c,depthSearchSize:l,output:u}=e,f=l>0?t.stage.renderView.getMinimalDepthForArea(C(t),n[0],n[1],o,l):null;i(u.translation,u.location,o.eye);let p=Math.min(d(u.translation),c);f&&f<=p&&(p=f),s(u.translation,u.translation),r(u.translation,u.translation,p),a(u.location,u.translation,o.eye)}async function we(e,t,n,r,i){let a=new ne().copyFrom(e.state.camera);if(Te({view:e,camera:a,forwardDirection:t,forwardDistance:n,detectCollisions:!0}))return r?r.smoothlyCorrectGroundElevation({camera:a,deltaTime:i}):new O(e).immediatelyCorrectGroundElevation({camera:a,correctionLimit:100}),e.goTo(ee(e,a),{duration:500,liftOffDisabled:!0})}function Te(e){let{view:s,camera:c,forwardDirection:l,forwardDistance:u,detectCollisions:f}=e,p=s.navigation.mode;if(p.type!==`ground`)return!1;s.renderCoordsHelper.worldUpAtPosition(c.eye,B);let m=s.sceneIntersectionHelper,h=$(s),g=t(j,B,t(j,l,B));n(K.origin,c.eye),r(K.direction,g,u);let _=m.intersectRay(K,h,J,{include:p.include,exclude:p.exclude}),v=i(ae,c.center,c.eye);return!f||!_||o(J,c.eye)>Math.abs(u)?c.eye=a(j,K.origin,K.direction):(i(j,J,c.eye),d(j)>2&&(Ee(j,j,.25,2),c.eye=a(j,c.eye,j))),c.center=a(j,c.eye,v),!0}function Ee(e,t,n,i){let a=d(e),o=Math.min(n,Math.max(a-i,0)/a);r(t,e,o)}export{Te as advanceGroundNavigationCamera,Q as computeHorizonPadding,ue as computeHorizonPaddingLimits,me as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,se as findSphereHorizonY,we as groundNavigationAdvance,A as groundNavigationConstants,ce as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,le as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/BlendLayers.glsl.js";
2
+ import"../webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/blendLayers.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/BlendLayers.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js";import"../webgl-engine/core/shaderLibrary/raster/Common.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/IntegerPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{a as ColorizerHillshadeUniforms,b as ColorizerStretchUniforms,C as ColorizerUniforms,c as build}from"../../../chunks/RasterColorizer.glsl.js";
2
+ import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js";import"../webgl-engine/core/shaderLibrary/raster/Common.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/blendLayers.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/IntegerPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{a as ColorizerHillshadeUniforms,b as ColorizerStretchUniforms,C as ColorizerUniforms,c as build}from"../../../chunks/RasterColorizer.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as r}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{updateUniformBufferObject as i}from"../../2d/engine/webgl/shaderGraph/uniformBufferUtils.js";import{tileInfoUniformBlockBinding as a,getTileInfoUniforms as o}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import{viewInfoUniformBlockBinding as s,getViewUniforms as c}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js";import{BlendLayersTechnique as l}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as u}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as d}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as f}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as p}from"./support/MultiSizeFramebuffer.js";import{BindParameters as m}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g}from"../../webgl/enums.js";import _ from"../../webgl/Texture.js";import{UniformBufferObject as v}from"../../webgl/UniformBufferObject.js";const y=()=>e.getLogger(`esri.views.3d.terrain`);class b{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new r,this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject=null,this._blendConfiguration=new u,this._current=0,this._lastUsedIds=[],this._lastCreatedBufferId=0,this._onHoldIds=[],this._vao=h(this._rctx,1),this._bindParameters=new m(null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper),this._tileInfoUniformBufferObject?.dispose(),this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject?.dispose(),this._viewInfoUniformBufferObject=null}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,n,r=!1,i=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=n,this._blendConfiguration.premultipliedAlphaSource=r,this._blendConfiguration.background=i,this._techniques.precompile(l,this._blendConfiguration),this._techniques.get(l,this._blendConfiguration)}drawBackground(e,t){let n=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),r=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(r)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(g.TRIANGLE_STRIP,0,this._vao.vertexCount(`geometry`))}drawGroup(e,t,n,r,i=!0){t===1&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(n).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(n).colorTexture,this.closeGroup(n);let a=e.baseOpacity<1,o=this._acquireBlendTechnique(r,t,a,i),s=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(s)}drawImageData(e,t,n,r,i=!1){if(e.texture==null)return;let a=e.baseOpacity<1;e.fboTexture=(t===4||r===0&&!a&&!i?null:this.switch(n).colorTexture)??this._rctx.emptyTexture;let o=this._acquireBlendTechnique(r,t,a,i),s=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(s)}drawRasterData(e,t,n,r,i){let a=i.sourceLayerInfo.data;if(!a.source)return;let o=i.tile.surface.layerViewByIndex(i.layerIndex,1);if(`ensureSymbolizerParameters`in o&&o.ensureSymbolizerParameters(a),!a.bind(this._rctx))return;let s=e.baseOpacity<1;e.fboTexture=(r===0&&!s?null:this.switch(n).colorTexture)??this._rctx.emptyTexture;let c=this._acquireRasterTechnique(a,t,r,s);if(!c)return;a.opacity=e.opacity;let l=a.getUniforms(this._rctx);l.scale=i.scale,l.offset=i.offset,l.backgroundColor=e.backgroundColor,l.fboTexture=e.fboTexture,l.baseOpacity=e.baseOpacity;let u=this._rctx.bindTechnique(c,this._bindParameters,l);this._render(u)}_acquireRasterTechnique(e,t,n,r){if(!this._rctx.capabilities.colorBufferFloat)return null;let i=e.symbolizerParameters,a=[`stretch`,`lut`,`hillshade`].indexOf(i.type);return this._rasterConfiguration??=new f,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=n,this._rasterConfiguration.applyBaseOpacity=r,this._rasterConfiguration.colorizerType=a,this._rasterConfiguration.applyColormap=!!i.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=+!e.hasStretchTypeNone(),this._techniques.precompile(d,this._rasterConfiguration),this._techniques.get(d,this._rasterConfiguration)}drawVectorData(e,t,r,i,a,o,s,c){let l=this._rctx,u=a.sourceLayerInfo.data,d=a.tile.surface.layerViewByIndex(a.layerIndex,1),{painter:f,schemaHelper:m,tilingScheme:h,contentZoom:g}=d,_=d.layer.styleRepository,v=Math.round(1/a.scale),b=e.baseOpacity<1,x=b||e.opacity<1||i!==0||t!==1,S=x,C=this._acquireBlendTechnique(i,t,b,S);l.setPipelineState(C.getPipeline(this._bindParameters,e));let w=null,T=null;x?(T=this.currentFBO(r),this._vtFBO??=new p(this._rctx),w=this._vtFBO.get(r),l.bindFramebuffer(w),this._clearCurrentFBO()):c&&l.clear(256);try{if(u||_.backgroundBucketIds.length>0){let e=this._vectorTileHelper.updateViewRenderParameters(l,a.sourceLod,u,f,m,h,v,a.offset,s,o,g);this._updateViewInfo(e),this._updateTileInfo(e)}this._vectorTileHelper.renderBackground(l,a.sourceLod,u,f,_,m,h),u&&this._vectorTileHelper.renderContent(l,u,a.vtlNeighborInfos,f,_)}catch(e){y().warnOnce(`A render call containing vector tiles did not resolve correctly.`,e)}return!w||(l.bindFramebuffer(T),e.texture=w.colorTexture,e.offset=n,e.scale=1,this.drawImageData(e,t,r,i,S),c)}_updateTileInfo(e){let t=this._tileInfoUniformBufferObject??=new v(this._rctx,a.descriptor);i(t,a,o(e)),this._rctx.bindUBO(a.bindingPoint,t)}_updateViewInfo(e){let t=this._viewInfoUniformBufferObject??=new v(this._rctx,s.descriptor);i(t,s,c(e)),this._rctx.bindUBO(s.bindingPoint,t)}copyFBOToTexture(e){let t=this._rctx,n=t.bindTexture(e.texture,_.TEXTURE_UNIT_FOR_UPDATES),r=e.descriptor;t.gl.copyTexImage2D(3553,0,r.pixelFormat,0,0,r.width,r.height,0),e.generateMipmap(),t.bindTexture(n,_.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,n){this._rctx.bindFramebuffer(e),n&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,n=!0){if(this._current=t,t>=this._fbos.length)for(let e=this._fbos.length;e<=t;e++)this._fbos.push(new p(this._rctx));this._initFBO(this._fbos[t].get(e),e,n)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){let t=this.currentFBO(e),n=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(n),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){let t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{b as TileCompositor};
2
+ import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as r}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{updateUniformBufferObject as i}from"../../2d/engine/webgl/shaderGraph/uniformBufferUtils.js";import{tileInfoUniformBlockBinding as a,getTileInfoUniforms as o}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import{viewInfoUniformBlockBinding as s,getViewUniforms as c}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js";import{BlendLayersTechnique as l}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as u}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as d}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as f}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as p}from"./support/MultiSizeFramebuffer.js";import{BindParameters as m}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g}from"../../webgl/enums.js";import _ from"../../webgl/Texture.js";import{UniformBufferObject as v}from"../../webgl/UniformBufferObject.js";const y=()=>e.getLogger(`esri.views.3d.terrain`);class b{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new r,this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject=null,this._blendConfiguration=new u,this._current=0,this._lastUsedIds=[],this._lastCreatedBufferId=0,this._onHoldIds=[],this._vao=h(this._rctx,1),this._bindParameters=new m(null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper),this._tileInfoUniformBufferObject?.dispose(),this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject?.dispose(),this._viewInfoUniformBufferObject=null}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,n,r=!1,i=0){this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=n,this._blendConfiguration.premultipliedAlphaSource=r,this._blendConfiguration.background=i,++this._techniques.precompiling;let a=this._techniques.get(l,this._blendConfiguration);return--this._techniques.precompiling,a}drawBackground(e,t){let n=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),r=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(r)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(g.TRIANGLE_STRIP,0,this._vao.vertexCount(`geometry`))}drawGroup(e,t,n,r,i=!0){t===1&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(n).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(n).colorTexture,this.closeGroup(n);let a=e.baseOpacity<1,o=this._acquireBlendTechnique(r,t,a,i),s=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(s)}drawImageData(e,t,n,r,i=!1){if(e.texture==null)return;let a=e.baseOpacity<1;e.fboTexture=(t===4||r===0&&!a&&!i?null:this.switch(n).colorTexture)??this._rctx.emptyTexture;let o=this._acquireBlendTechnique(r,t,a,i),s=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(s)}drawRasterData(e,t,n,r,i){let a=i.sourceLayerInfo.data;if(!a.source)return;let o=i.tile.surface.layerViewByIndex(i.layerIndex,1);if(`ensureSymbolizerParameters`in o&&o.ensureSymbolizerParameters(a),!a.bind(this._rctx))return;let s=e.baseOpacity<1;e.fboTexture=(r===0&&!s?null:this.switch(n).colorTexture)??this._rctx.emptyTexture;let c=this._acquireRasterTechnique(a,t,r,s);if(!c)return;a.opacity=e.opacity;let l=a.getUniforms(this._rctx);l.scale=i.scale,l.offset=i.offset,l.backgroundColor=e.backgroundColor,l.fboTexture=e.fboTexture,l.baseOpacity=e.baseOpacity;let u=this._rctx.bindTechnique(c,this._bindParameters,l);this._render(u)}_acquireRasterTechnique(e,t,n,r){if(!this._rctx.capabilities.colorBufferFloat)return null;let i=e.symbolizerParameters,a=[`stretch`,`lut`,`hillshade`].indexOf(i.type);this._rasterConfiguration??=new f,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=n,this._rasterConfiguration.applyBaseOpacity=r,this._rasterConfiguration.colorizerType=a,this._rasterConfiguration.applyColormap=!!i.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=+!e.hasStretchTypeNone(),++this._techniques.precompiling;let o=this._techniques.get(d,this._rasterConfiguration);return--this._techniques.precompiling,o}drawVectorData(e,t,r,i,a,o,s,c){let l=this._rctx,u=a.sourceLayerInfo.data,d=a.tile.surface.layerViewByIndex(a.layerIndex,1),{painter:f,schemaHelper:m,tilingScheme:h,contentZoom:g}=d,_=d.layer.styleRepository,v=Math.round(1/a.scale),b=e.baseOpacity<1,x=b||e.opacity<1||i!==0||t!==1,S=x,C=this._acquireBlendTechnique(i,t,b,S);l.setPipelineState(C.getPipeline(this._bindParameters,e));let w=null,T=null;x?(T=this.currentFBO(r),this._vtFBO??=new p(this._rctx),w=this._vtFBO.get(r),l.bindFramebuffer(w),this._clearCurrentFBO()):c&&l.clear(256);try{if(u||_.backgroundBucketIds.length>0){let e=this._vectorTileHelper.updateViewRenderParameters(l,a.sourceLod,u,f,m,h,v,a.offset,s,o,g);this._updateViewInfo(e),this._updateTileInfo(e)}this._vectorTileHelper.renderBackground(l,a.sourceLod,u,f,_,m,h),u&&this._vectorTileHelper.renderContent(l,u,a.vtlNeighborInfos,f,_)}catch(e){y().warnOnce(`A render call containing vector tiles did not resolve correctly.`,e)}return!w||(l.bindFramebuffer(T),e.texture=w.colorTexture,e.offset=n,e.scale=1,this.drawImageData(e,t,r,i,S),c)}_updateTileInfo(e){let t=this._tileInfoUniformBufferObject??=new v(this._rctx,a.descriptor);i(t,a,o(e)),this._rctx.bindUBO(a.bindingPoint,t)}_updateViewInfo(e){let t=this._viewInfoUniformBufferObject??=new v(this._rctx,s.descriptor);i(t,s,c(e)),this._rctx.bindUBO(s.bindingPoint,t)}copyFBOToTexture(e){let t=this._rctx,n=t.bindTexture(e.texture,_.TEXTURE_UNIT_FOR_UPDATES),r=e.descriptor;t.gl.copyTexImage2D(3553,0,r.pixelFormat,0,0,r.width,r.height,0),e.generateMipmap(),t.bindTexture(n,_.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,n){this._rctx.bindFramebuffer(e),n&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,n=!0){if(this._current=t,t>=this._fbos.length)for(let e=this._fbos.length;e<=t;e++)this._fbos.push(new p(this._rctx));this._initFBO(this._fbos[t].get(e),e,n)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){let t=this.currentFBO(e),n=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(n),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){let t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{b as TileCompositor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as n,copy as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as o,isGroupLayer as s,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as l}from"../support/flowUtils.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{isBlendableLayerView as d,isVectorTileLayerView as f,isVectorTileRenderInfo as p,isImageryTileRenderInfo as m,isImageSourceRenderInfo as h,isTextureTileRenderInfo as g,isVectorTilePerLayerInfo as _}from"./terrainUtils.js";import{TextureReference as v}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as x,TileTexture as S}from"./TileTexture.js";import{fallsWithinLayerView as C}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as T}from"../../support/TextureCompressionWorkerHandle.js";import E from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";class O{constructor(e,t,n,r,i,a){this._surface=e,this._rctx=t,this.tileSize=n,this._techniques=r,this._cache=i,this._compressionTracker=a,this._passParameters=new u,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._sharedBackground=t(this._sharedBackground)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;let n=this._prepareComposite(e),r=n.targetTextureSize/this.tileSize;n.numTexturedLayers===0||n.firstTexturedLayerIndex===null?this._useBackgroundTexture(e,n,t!==0):(n.numTexturedLayers!==1||n.backgroundVTLIndex!=null||n.foundBlendMode||!this._useLayerTexture(e,n.firstTexturedLayerIndex??0))&&this._composeLayers(e,t,r,F,n)}_prepareComposite(e){let t=this._surface,n=t.baseOpacity,r=t.view.state.contentPixelRatio,i=e.layerInfo[1],a=new P(e.lij,this.tileSize);F.clear(),I.length=0;for(let u=0;u<i.length;u++){let p=t.layerViewByIndex(u,1),m=p.layer,h=!C(e,p),g=m.opacity,_=p.fullOpacity;if(a.hasBasemapLayers=a.hasBasemapLayers||o(m),l(p))continue;if(d(p)){let e=p.layer.blendMode!==`normal`;if(s(m.parent)){let t=m.parent.uid;t!=null&&t!==``&&(e=j(m.parent)||e)}e&&(a.foundBlendMode=e,a.backgroundCovered=!1)}if(this._canSkipLayer(g,h,a.foundBlendMode)){this._clearTexturePendingUpdates(i[u]);continue}++a.numVisibleLayers;let v=f(p);a.backgroundVTLIndex==null&&v&&p.layer.styleRepository.backgroundBucketIds.length>0&&(a.backgroundVTLIndex=u);let y=k(e,u,v);if(!(!y||(this._clearTexturePendingUpdates(i[u]),!y.sourceLayerInfo.data))){if(s(m.parent)){let e=m.parent.uid;e!=null&&e!==``&&M(m.parent,u)}if(v)a.targetTextureSize=Math.max(a.targetTextureSize,this.tileSize*r);else{let e=this._prepareTextureForBackgroundCoverageCheck(y,c(m));n===1&&_===1&&(p.isOpaque||e?.descriptor.isOpaque===!0)&&(a.backgroundCovered=!0)}++a.numTexturedLayers,a.firstTexturedLayerIndex??=u}}return a.lastLayerIndex=i.length-1,a}_canSkipLayer(e,t,n){return this._isLayerNonContributing(e,t)&&!n}_isLayerNonContributing(e,t){return e===0||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._sharedBackground&&this._drawBackgroundTexture(this._sharedBackground))}_drawBackgroundTexture(e,t,n){if(this._passParameters.offset=i,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.bind(this.tileSize),n?.backgroundVTLIndex==null||t==null)this._compositor.drawBackground(this._passParameters,this.backgroundColor!=null);else{let e=k(t,n.backgroundVTLIndex,!0);this._passParameters.opacity=this._surface.layerViewByIndex(n.backgroundVTLIndex,1).layer.opacity,this._compositor.drawVectorData(this._passParameters,this.backgroundIsGrid?3:2,n.targetTextureSize,0,e,n.targetTextureSize/this.tileSize,this.tileSize,!1)}this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,n){let r=e.renderData,i=!n&&!r.textureReference?.isBackground&&(this._surface.view.layerViewManager.updating||t.numVisibleLayers>0)?5e3:0;r.setTextureReference(new v(this._composeBackground(e,t),!0,0,R,this._surface.baseOpacity,0,1),i)}_composeBackground(e,t){if(t?.backgroundVTLIndex==null)return this._sharedBackground??(this._sharedBackground=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._sharedBackground)),this._sharedBackground;let n=e.renderData.ensureTexture(this.tileSize,!1,0,()=>this._buildTexture(this.tileSize,!1,9987));return this._drawBackgroundTexture(n,e,t),n}_useLayerTexture(e,t){let n=this._surface.layerViewByIndex(t,1),r=o(n.layer),i=r?this._surface.baseOpacity:1,s=r?1:this._surface.baseOpacity,l=n.fullOpacity,u=k(e,t,!1);return this._dataToTexture(u,c(n.layer))?(e.renderData.setTextureReference(new v(u.sourceLayerInfo.data,!1,0,a(u.offset[0],u.offset[1],u.scale,u.scale),i,s,l)),!0):!1}_composeLayers(e,t,n,r,a){let{lastLayerIndex:s,hasBasemapLayers:u,targetTextureSize:h,backgroundCovered:g,foundBlendMode:_,backgroundVTLIndex:y}=a;this._compositor.ensureBuffer(h);let b=!g||_,x=this._surface.baseOpacity,S=!1,T=9987,E=!1,D=0;for(let t=s;t>=0;t--){let a=this._surface.layerViewByIndex(t,1);if(l(a))continue;let s=a.layer,g=f(a),v=k(e,t,g),O=s.opacity,j=!C(e,a),M=!v?.sourceLayerInfo.data&&t===y;if(!v?.sourceLayerInfo.data&&!M||this._canSkipLayer(O,j,_))continue;let N=!o(s)&&!S;S||=N;let P=this._openGroupsAtLayer(t,h,x,u,b,N,r),F=P?4:b&&D===0?this.backgroundIsGrid?3:2:1,L=w[d(a)?a.layer.blendMode:`normal`];for(this._passParameters.baseOpacity=N&&!P&&x<1?x:1,this._passParameters.opacity=O,M||p(v)?E=this._compositor.drawVectorData(this._passParameters,F,h,L,v,n,this.tileSize,E):m(v)?(this._compositor.drawRasterData(this._passParameters,F,h,L,v),A(v)&&(T=9728)):this._dataToTexture(v,c(s))&&(this._passParameters.texture=v.sourceLayerInfo.data.texture,this._passParameters.offset=v.offset,this._passParameters.scale=v.scale,this._compositor.drawImageData(this._passParameters,F,h,L));I.length>0&&I[I.length-1].end===t;){let e=I.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=i,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,h,w[e.blendMode])}D++}let O=e.renderData,j=_||S&&x<1,M=O.ensureTexture(h,j,t,()=>this._buildTexture(h,j,T));this._compositor.copyFBOToTexture(M),this._compositor.unbind(),O.setTextureReference(new v(M,!1,t,R,S?1:x,0,1))}_openGroupsAtLayer(e,t,n,r,i,a,o){let s=!1;return o.forEach(o=>{o.start===e&&(o.output=r?1:i&&a?this.backgroundIsGrid?3:2:1,o.baseOpacity=a?n:1,I.push(o),this._compositor.openGroup(t),s=!0)}),s}_dataToTexture(e,t){if(h(e)){let n=e.sourceLayerInfo,r=!t;n.data=this._buildTexture(n.data,!0,r,e.scale!==1,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return g(e)}_buildTexture(e,t,n=9987,r=!1,i=()=>{}){return e==null?null:typeof e==`number`?this._buildTextureFromSize(e,t,n):this._buildTextureFromImage(e,t,n,r,i)}_buildTextureFromSize(e,t,n){let r=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);r.width=r.height=e;let i=this._buildTileTexture(r);return this._generateTextureMipmap(i),i}_buildTextureFromImage(e,t,n,r,i){let a=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);a.isOpaque=e.isOpaque,a.isOpaque&&(a.pixelFormat=6407);let{bitmap:o}=e;a.width=o.width,a.height=o.height;let s=typeof n==`boolean`&&n,c=this._buildTileTexture(a,s,r,i,o);return this._generateTextureMipmap(c),c}_createTextureDescriptor(e,t){let n=new D;return n.wrapMode=33071,n.samplingMode=t,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,e||(n.pixelFormat=6407),n}_generateTextureMipmap(e){let t=this._rctx,n=t.bindTexture(e.texture,E.TEXTURE_UNIT_FOR_UPDATES);e.generateMipmap(),t.bindTexture(n,E.TEXTURE_UNIT_FOR_UPDATES)}_buildTileTexture(e,t=!1,n=!1,r=()=>{},i){let a=this._cache.pop(x(e,!1))??this._cache.pop(x(e,!0));if(t&&=T(i,e),a)return a.retain(),t?a.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}):a.texture.disableCompression(),a.texture.setData(i),a;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}:void 0;let o=new E(this._rctx,e,i);return new S(o,this._cache)}get test(){}}function k(e,t,i){L.layerIndex=t,L.vtlNeighborInfos.clear();let a=e.layerInfo[1][t];if(n(L.offset,0,0),L.tile=e,L.scale=1,L.sourceLod=e.lij,L.sourceLayerInfo=a,a.data)return i&&e.forEachLoadedNeighbor((n,r)=>{if(n.level!==e.level)return;let i=n.layerInfo[1][t];if(!_(i)||a.data===i.data)return;let o=L.vtlNeighborInfos.pushNew();o.offset=z[r],o.sourceLod=n.lij,o.sourceLayerInfo=i}),L;let o=a.upsampleInfo,s=o?.tile?.layerInfo[1][t];return s&&o.tile?(L.tile=o.tile,r(L.offset,o.offset),L.scale=o.scale,L.sourceLod=o.tile.lij,L.sourceLayerInfo=s,L):i?L:null}function A(e){let t=e.sourceLayerInfo.data;return t.source?t.interpolation===`nearest`:!1}function j(e){let t=e.blendMode!==`normal`;return s(e.parent)&&(t=j(e.parent)||t),t}function M(e,t){s(e.parent)&&M(e.parent,t);let n=e.uid;if(n!=null&&n!==``){let r=F.get(n);r?r.start=t:F.set(n,new N(t,t,e.blendMode,e.opacity,1,1))}}class N{constructor(e,t,n,r,i,a){this.start=e,this.end=t,this.blendMode=n,this.opacity=r,this.output=i,this.baseOpacity=a}}class P{constructor(e,t){this.lij=e,this.targetTextureSize=t,this.numTexturedLayers=0,this.numVisibleLayers=0,this.backgroundCovered=!1,this.hasBasemapLayers=!1,this.foundBlendMode=!1,this.lastLayerIndex=0}}const F=new Map,I=[],L=new b,R=a(0,0,1,1),z=[];function B(){L.sourceLayerInfo=null,L.tile=null,L.vtlNeighborInfos.prune()}z[0]=[0,-1],z[1]=[-1,-1],z[2]=[-1,0],z[3]=[-1,1],z[4]=[0,1],z[5]=[1,1],z[6]=[1,0],z[7]=[1,-1];export{N as GroupInfo,O as TileRenderer,B as cleanupTileRenderer};
2
+ import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as n,copy as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as o,isGroupLayer as s,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as l}from"../support/flowUtils.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{isBlendableLayerView as d,isVectorTileLayerView as f,isVectorTileRenderInfo as p,isImageryTileRenderInfo as m,isImageSourceRenderInfo as h,isTextureTileRenderInfo as g,isVectorTilePerLayerInfo as _}from"./terrainUtils.js";import{TextureReference as v}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as x,TileTexture as S}from"./TileTexture.js";import{fallsWithinLayerView as C}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as T}from"../../support/TextureCompressionWorkerHandle.js";import E from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";class O{constructor(e,t,n,r,i,a){this._surface=e,this._rctx=t,this.tileSize=n,this._techniques=r,this._cache=i,this._compressionTracker=a,this._passParameters=new u,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._sharedBackground=t(this._sharedBackground)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;let n=this._prepareComposite(e),r=n.targetTextureSize/this.tileSize;n.numTexturedLayers===0||n.firstTexturedLayerIndex===null?this._useBackgroundTexture(e,n,t!==0):(n.numTexturedLayers!==1||n.backgroundVTLIndex!=null||n.foundBlendMode||!this._useLayerTexture(e,n.firstTexturedLayerIndex??0))&&this._composeLayers(e,t,r,F,n)}_prepareComposite(e){let t=this._surface,n=t.baseOpacity,r=t.view.state.contentPixelRatio,i=e.layerInfo[1],a=new P(e.lij,this.tileSize);F.clear(),I.length=0;for(let u=0;u<i.length;u++){let p=t.layerViewByIndex(u,1),m=p.layer,h=!C(e,p),g=m.opacity,_=p.fullOpacity;if(a.hasBasemapLayers=a.hasBasemapLayers||o(m),l(p))continue;if(d(p)){let e=p.layer.blendMode!==`normal`;if(s(m.parent)){let t=m.parent.uid;t!=null&&t!==``&&(e=j(m.parent)||e)}e&&(a.foundBlendMode=e,a.backgroundCovered=!1)}if(this._canSkipLayer(g,h,a.foundBlendMode)){this._clearTexturePendingUpdates(i[u]);continue}++a.numVisibleLayers;let v=f(p);a.backgroundVTLIndex==null&&v&&p.layer.styleRepository.backgroundBucketIds.length>0&&(a.backgroundVTLIndex=u);let y=k(e,u,v);if(!(!y||(this._clearTexturePendingUpdates(i[u]),!y.sourceLayerInfo.data))){if(s(m.parent)){let e=m.parent.uid;e!=null&&e!==``&&M(m.parent,u)}if(v)a.targetTextureSize=Math.max(a.targetTextureSize,this.tileSize*r);else{let e=this._prepareTextureForBackgroundCoverageCheck(y,c(m));n===1&&_===1&&(p.isOpaque||e?.descriptor.isOpaque===!0)&&(a.backgroundCovered=!0)}++a.numTexturedLayers,a.firstTexturedLayerIndex??=u}}return a.lastLayerIndex=i.length-1,a}_canSkipLayer(e,t,n){return this._isLayerNonContributing(e,t)&&!n}_isLayerNonContributing(e,t){return e===0||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._sharedBackground&&this._drawBackgroundTexture(this._sharedBackground))}_drawBackgroundTexture(e,t,n){if(this._passParameters.offset=i,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.bind(this.tileSize),n?.backgroundVTLIndex==null||t==null)this._compositor.drawBackground(this._passParameters,this.backgroundColor!=null);else{let e=k(t,n.backgroundVTLIndex,!0);this._passParameters.opacity=this._surface.layerViewByIndex(n.backgroundVTLIndex,1).layer.opacity,this._compositor.drawVectorData(this._passParameters,this.backgroundIsGrid?3:2,n.targetTextureSize,0,e,n.targetTextureSize/this.tileSize,this.tileSize,!1)}this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,n){let r=e.renderData,i=!n&&!r.textureReference?.isBackground&&(this._surface.view.layerViewManager.updating||t.numVisibleLayers>0)?5e3:0;r.setTextureReference(new v(this._composeBackground(e,t),!0,0,R,this._surface.baseOpacity,0,1),i)}_composeBackground(e,t){if(t?.backgroundVTLIndex==null)return this._sharedBackground??(this._sharedBackground=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._sharedBackground)),this._sharedBackground;let n=e.renderData.ensureTexture(this.tileSize,!1,0,()=>this._buildTexture(this.tileSize,!1,9987));return this._drawBackgroundTexture(n,e,t),n}_useLayerTexture(e,t){let n=this._surface.layerViewByIndex(t,1),r=o(n.layer),i=r?this._surface.baseOpacity:1,s=r?1:this._surface.baseOpacity,l=n.fullOpacity,u=k(e,t,!1);return this._dataToTexture(u,c(n.layer))?(e.renderData.setTextureReference(new v(u.sourceLayerInfo.data,!1,0,a(u.offset[0],u.offset[1],u.scale,u.scale),i,s,l)),!0):!1}_composeLayers(e,t,n,r,a){let{lastLayerIndex:s,hasBasemapLayers:u,targetTextureSize:h,backgroundCovered:g,foundBlendMode:_,backgroundVTLIndex:y}=a;this._compositor.ensureBuffer(h);let b=!g||_,x=this._surface.baseOpacity,S=!1,T=9987,E=!1,D=0;for(let t=s;t>=0;t--){let a=this._surface.layerViewByIndex(t,1);if(l(a))continue;let s=a.layer,g=f(a),v=k(e,t,g),O=s.opacity,j=!C(e,a),M=!v?.sourceLayerInfo.data&&t===y;if(!v?.sourceLayerInfo.data&&!M||this._canSkipLayer(O,j,_))continue;let N=!o(s)&&!S;S||=N;let P=this._openGroupsAtLayer(t,h,x,u,b,N,r),F=P?4:b&&D===0?this.backgroundIsGrid?3:2:1,L=w[d(a)?a.layer.blendMode:`normal`];for(this._passParameters.baseOpacity=N&&!P&&x<1?x:1,this._passParameters.opacity=O,M||p(v)?E=this._compositor.drawVectorData(this._passParameters,F,h,L,v,n,this.tileSize,E):m(v)?(this._compositor.drawRasterData(this._passParameters,F,h,L,v),A(v)&&(T=9728)):this._dataToTexture(v,c(s))&&(this._passParameters.texture=v.sourceLayerInfo.data.texture,this._passParameters.offset=v.offset,this._passParameters.scale=v.scale,this._compositor.drawImageData(this._passParameters,F,h,L));I.length>0&&I[I.length-1].end===t;){let e=I.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=i,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,h,w[e.blendMode])}D++}let O=e.renderData,j=_||S&&x<1,M=O.ensureTexture(h,j,t,()=>this._buildTexture(h,j,T));this._compositor.copyFBOToTexture(M),this._compositor.unbind(),O.setTextureReference(new v(M,!1,t,R,S?1:x,0,1))}_openGroupsAtLayer(e,t,n,r,i,a,o){let s=!1;return o.forEach(o=>{o.start===e&&(o.output=r?1:i&&a?this.backgroundIsGrid?3:2:1,o.baseOpacity=a?n:1,I.push(o),this._compositor.openGroup(t),s=!0)}),s}_dataToTexture(e,t){if(h(e)){let n=e.sourceLayerInfo,r=!t;n.data=this._buildTexture(n.data,!0,r,e.scale!==1,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return g(e)}_buildTexture(e,t,n=9987,r=!1,i=()=>{}){return e==null?null:typeof e==`number`?this._buildTextureFromSize(e,t,n):this._buildTextureFromImage(e,t,n,r,i)}_buildTextureFromSize(e,t,n){let r=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);r.width=r.height=e;let i=this._buildTileTexture(r);return this._generateTextureMipmap(i),i}_buildTextureFromImage(e,t,n,r,i){let a=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);a.isOpaque=e.isOpaque,a.isOpaque&&(a.pixelFormat=6407);let{bitmap:o}=e;a.width=o.width,a.height=o.height;let s=typeof n==`boolean`&&n,c=this._buildTileTexture(a,s,r,i,o);return this._generateTextureMipmap(c),c}_createTextureDescriptor(e,t){let n=new D;return n.wrapMode=33071,n.samplingMode=t,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,e||(n.pixelFormat=6407),n}_generateTextureMipmap(e){let t=this._rctx,n=t.bindTexture(e.texture,E.TEXTURE_UNIT_FOR_UPDATES);e.generateMipmap(),t.bindTexture(n,E.TEXTURE_UNIT_FOR_UPDATES)}_buildTileTexture(e,t=!1,n=!1,r=()=>{},i){let a=this._cache.pop(x(e,!1))??this._cache.pop(x(e,!0));if(t&&=T(i,e),a)return a.retain(),t?a.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}):a.texture.disableCompression(),a.texture.setData(i),a;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}:void 0;let o=new E(this._rctx,e,i);return new S(o,this._cache)}get test(){}}function k(e,t,i){L.layerIndex=t,L.vtlNeighborInfos.clear();let a=e.layerInfo[1][t];if(n(L.offset,0,0),L.tile=e,L.scale=1,L.sourceLod=e.lij,L.sourceLayerInfo=a,a.data)return i&&e.forEachLoadedNeighbor((n,r)=>{if(n.level!==e.level)return;let i=n.layerInfo[1][t];if(!_(i)||a.data===i.data)return;let o=L.vtlNeighborInfos.pushNew();o.offset=z[r],o.sourceLod=n.lij,o.sourceLayerInfo=i}),L;let o=a.upsampleInfo,s=o?.tile?.layerInfo[1][t];return s&&o.tile?(L.tile=o.tile,r(L.offset,o.offset),L.scale=o.scale,L.sourceLod=o.tile.lij,L.sourceLayerInfo=s,L):i?L:null}function A(e){let t=e.sourceLayerInfo.data;return t.source?t.interpolation===`nearest`:!1}function j(e){let t=e.blendMode!==`normal`;return s(e.parent)&&(t=j(e.parent)||t),t}function M(e,t){s(e.parent)&&M(e.parent,t);let n=e.uid;if(n!=null&&n!==``){let r=F.get(n);r?r.start=t:F.set(n,new N(t,t,e.blendMode,e.opacity,1,1))}}class N{constructor(e,t,n,r,i,a){this.start=e,this.end=t,this.blendMode=n,this.opacity=r,this.output=i,this.baseOpacity=a}}class P{constructor(e,t){this.lij=e,this.targetTextureSize=t,this.numTexturedLayers=0,this.numVisibleLayers=0,this.backgroundCovered=!1,this.hasBasemapLayers=!1,this.foundBlendMode=!1,this.lastLayerIndex=0}}const F=new Map,I=[],L=new b,R=a(0,0,1,1),z=[];z[0]=[0,-1],z[1]=[-1,-1],z[2]=[-1,0],z[3]=[-1,1],z[4]=[0,1],z[5]=[1,1],z[6]=[1,0],z[7]=[1,-1];function B(){L.sourceLayerInfo=null,L.tile=null,L.vtlNeighborInfos.prune()}export{N as GroupInfo,O as TileRenderer,B as cleanupTileRenderer};
@@ -1,10 +1,9 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{glsl as e}from"../../shaderModules/glsl.js";function t(t,n){t.varyings.add(`tbnTangent`,`vec3`),t.varyings.add(`tbnBiTangent`,`vec3`),n.spherical?t.vertex.code.add(e`void forwardVertexTangent(vec3 n) {
3
- tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), n));
4
- tbnBiTangent = normalize(cross(n, tbnTangent));
5
- }`):t.vertex.code.add(e`void forwardVertexTangent(vec3 n) {
6
- tbnTangent = vec3(1.0, 0.0, 0.0);
7
- tbnBiTangent = normalize(cross(n, tbnTangent));
8
- }`),t.fragment.code.add(e`mat3 getTBNMatrix(vec3 n) {
2
+ import{UNIT_X as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{If as t,glsl as n}from"../../shaderModules/glsl.js";function r(r,i){i.spherical?r.varyings.add(`tbnTangent`,`vec3`):(r.vertex.constants.add(`tbnTangent`,`vec3`,e),r.fragment.constants.add(`tbnTangent`,`vec3`,e)),r.varyings.add(`tbnBiTangent`,`vec3`),r.vertex.code.add(n`
3
+ void forwardVertexTangent(vec3 n) {
4
+ ${t(i.spherical,n`tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), n));`)}
5
+ tbnBiTangent = normalize(cross(n, tbnTangent));
6
+ }
7
+ `),r.fragment.code.add(n`mat3 getTBNMatrix(vec3 n) {
9
8
  return mat3(tbnTangent, tbnBiTangent, n);
10
- }`)}export{t as VertexTangent};
9
+ }`)}export{r as VertexTangent};
@@ -1,12 +1,10 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{glsl as e}from"../../shaderModules/glsl.js";function t(t,{spherical:n}){t.code.add(n?`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return normalize(pos + origin); }
3
- vec3 getLocalUp(in vec3 pos) { return normalize(pos); }`:`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return vec3(0.0, 0.0, 1.0); }
4
- vec3 getLocalUp(in vec3 pos) { return vec3(0.0, 0.0, 1.0); }`),n?t.code.add(e`mat3 getTBNMatrix(in vec3 n) {
2
+ import{getLocalUp as e}from"./getLocalUp.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";function n(n,r){n.include(e,r),r.spherical?n.code.add(t`mat3 getTBNMatrix(in vec3 n) {
5
3
  vec3 t = normalize(cross(vec3(0.0, 0.0, 1.0), n));
6
4
  vec3 b = normalize(cross(n, t));
7
5
  return mat3(t, b, n);
8
- }`):t.code.add(e`mat3 getTBNMatrix(in vec3 n) {
6
+ }`):n.code.add(t`mat3 getTBNMatrix(in vec3 n) {
9
7
  vec3 t = vec3(1.0, 0.0, 0.0);
10
8
  vec3 b = normalize(cross(n, t));
11
9
  return mat3(t, b, n);
12
- }`)}export{t as NormalUtils};
10
+ }`)}export{n as NormalUtils};
@@ -0,0 +1,6 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{UNIT_Z as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getLocalUp as t}from"./getLocalUp.glsl.js";import{If as n,glsl as r}from"../../shaderModules/glsl.js";function i(i,a){let{vertex:o,fragment:s,varyings:c}=i,{spherical:l}=a;l?(o.include(t,a),c.add(`upNormal`,`vec3`)):s.constants.add(`upNormal`,`vec3`,e),o.code.add(r`
3
+ void forwardLocalUp(vec3 pos, vec3 origin) {
4
+ ${n(l,r`upNormal = getLocalUp(pos, origin);`)}
5
+ }
6
+ `)}export{i as forwardLocalUp};
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ function e(e,{spherical:t}){e.code.add(t?`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return normalize(pos + origin); }
3
+ vec3 getLocalUp(in vec3 pos) { return normalize(pos); }`:`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return vec3(0.0, 0.0, 1.0); }
4
+ vec3 getLocalUp(in vec3 pos) { return vec3(0.0, 0.0, 1.0); }`)}export{e as getLocalUp};
@@ -9,7 +9,7 @@ import{ReadShadowMapPassParameters as e}from"../shading/readShadow.glsl.js";impo
9
9
  if (opacities.y <= 0.0) {
10
10
  return color * opacities.z * opacities.x;
11
11
  }
12
- vec4 bg = vec4(${_?r`backgroundColor`:r`gridColor(uv)`} * opacities.y, opacities.y);
12
+ vec4 bg = vec4(${_?`backgroundColor`:`gridColor(uv)`} * opacities.y, opacities.y);
13
13
  vec4 layer = color * opacities.z;
14
14
  return (bg * (1.0 - layer.a) + layer) * opacities.x;
15
15
  `,`return color;`)}
@@ -1,17 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{ZEROS as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BackgroundGrid as t}from"./BackgroundGrid.glsl.js";import{BlendModes as n}from"../util/BlendModes.glsl.js";import{Float3PassUniform as r}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{glsl as a,If as o}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as s}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as c}from"../../../../../webgl/NoParameters.js";class l extends c{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=e,this.fboTexture=null}}function u(e,c){let{output:l,blendMode:u,applyBaseOpacity:d,premultipliedAlphaSource:f}=c,p=e.fragment;d&&p.uniforms.add(new i(`baseOpacity`,e=>e.baseOpacity));let m=u!==0,h=!m&&!f&&(l===1&&!d||l===4);p.include(n,c);let g=``;switch(l){case 4:case 0:g=a`vec4(0.0)`;break;case 2:p.uniforms.add(new r(`backgroundColor`,e=>e.backgroundColor)),g=a`vec4(backgroundColor, 1.0)`;break;case 3:p.include(t),g=a`vec4(gridColor(uv), 1.0)`;break;case 1:p.uniforms.add(new s(`fboColor`,e=>e.fboTexture)),g=a`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`}p.code.add(a`
2
+ import{ZEROS as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BackgroundGrid as t}from"./BackgroundGrid.glsl.js";import{BlendModes as n}from"../util/BlendModes.glsl.js";import{Float3PassUniform as r}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as o}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as s}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as c}from"../../../../../webgl/NoParameters.js";class l extends c{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=e,this.fboTexture=null}}function u(e,c){let{output:l,blendMode:u,applyBaseOpacity:d,premultipliedAlphaSource:f}=c,p=e.fragment;d&&p.uniforms.add(new i(`baseOpacity`,e=>e.baseOpacity)),p.include(n,c);let m=``;switch(l){case 4:case 0:m=`vec4(0.0)`;break;case 2:p.uniforms.add(new r(`backgroundColor`,e=>e.backgroundColor)),m=`vec4(backgroundColor, 1.0)`;break;case 3:p.include(t),m=`vec4(gridColor(uv), 1.0)`;break;case 1:p.uniforms.add(new s(`fboColor`,e=>e.fboTexture)),m=`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`}p.code.add(o`
3
3
  vec4 getBackground(vec2 uv) {
4
- return ${o(d,a`baseOpacity *`)} ${g};
5
- }`),m?p.code.add(a`vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
4
+ return ${a(d,`baseOpacity *`)} ${m};
5
+ }`),u===0?!f&&(l===1&&!d||l===4)?p.code.add(o`vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
6
+ return colorLayer * opacity;
7
+ }`):p.code.add(o`vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
8
+ float composeAlpha = colorLayer.a * opacity;
9
+ vec4 bgColor = getBackground(bgUV);
10
+ return bgColor * (1.0 - composeAlpha) + colorLayer * opacity;
11
+ }`):p.code.add(o`vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
6
12
  vec3 cl = colorLayer.a == 0.0 ? colorLayer.rgb : colorLayer.rgb / colorLayer.a;
7
13
  vec4 bgColor = getBackground(bgUV);
8
14
  vec3 cb = bgColor.a == 0.0 ? bgColor.rgb : bgColor.rgb / bgColor.a;
9
15
  return applyBlendMode(clamp(cl, vec3(0.0), vec3(1.0)), colorLayer.a * opacity, cb, bgColor.a);
10
- }`):p.code.add(a`
11
- vec4 blendLayers(vec2 bgUV, vec4 colorLayer, float opacity) {
12
- float composeAlpha = colorLayer.a * opacity;
13
- ${o(h,a`return colorLayer * opacity;`,a`
14
- vec4 bgColor = getBackground(bgUV);
15
- return bgColor * (1.0 - composeAlpha) + colorLayer * opacity;
16
- `)}
17
- }`)}export{u as TileBackground,l as TileBackgroundPassParameters};
16
+ }`)}export{l as TileBackgroundPassParameters,u as blendLayers};
@@ -7,8 +7,8 @@ float mid = 0.5 * (covariance2D.x + covariance2D.z);
7
7
  float radius = length(vec2((covariance2D.x - covariance2D.z) * 0.5, covariance2D.y));
8
8
  return vec2(mid + radius, mid - radius);
9
9
  }
10
- float computeGaussianEllipseThreshold(float gaussianLogAlphaCutoff) {
11
- return max(0.0, -2.0 * gaussianLogAlphaCutoff);
10
+ float computeGaussianEllipseThreshold(float logFalloffCutoff) {
11
+ return max(0.0, -2.0 * logFalloffCutoff);
12
12
  }
13
13
  bool rejectGaussianByMinimumRadius(float maxRadius, float opacity, float minSplatRadius) {
14
14
  return minSplatRadius > 0.0 && maxRadius * opacity < minSplatRadius;
@@ -23,6 +23,12 @@ return any(greaterThan(abs(ndcPosition) - radiusNDC, vec2(1.0)));
23
23
  vec2 computeGaussianUnitQuadCorner(int vertexID) {
24
24
  return vec2((vertexID << 1) & 2, vertexID & 2) - 1.0;
25
25
  }
26
+ vec2 computeGaussianQuadOffset(vec3 covariance2D, float determinant, vec2 coordinates) {
27
+ float inverseRadiusX = inversesqrt(covariance2D.x);
28
+ vec2 choleskyAxisX = covariance2D.xy * inverseRadiusX;
29
+ vec2 choleskyAxisY = vec2(0.0, sqrt(determinant) * inverseRadiusX);
30
+ return coordinates.x * choleskyAxisX + coordinates.y * choleskyAxisY;
31
+ }
26
32
  float evaluateGaussianExponent(vec2 canonicalCoordinates) {
27
33
  return -0.5 * dot(canonicalCoordinates, canonicalCoordinates);
28
34
  }`)}export{t as GaussianSplatEvaluation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as n}from"../../shaderModules/Float2BindUniform.js";import{Float3BindUniform as r}from"../../shaderModules/Float3BindUniform.js";import{Float4BindUniform as i}from"../../shaderModules/Float4BindUniform.js";import{FloatBindUniform as a}from"../../shaderModules/FloatBindUniform.js";import{Matrix4BindUniform as o}from"../../shaderModules/Matrix4BindUniform.js";const s=new o(`view`,({camera:e})=>e.viewMatrix),c=new o(`inverseViewMatrix`,({camera:e})=>e.inverseViewMatrix),l=new o(`proj`,({camera:e})=>e.projectionMatrix),u=new o(`inverseProjectionMatrix`,({camera:e})=>e.inverseProjectionMatrix),d=new r(`cameraPosition`,({camera:e})=>e.eye),f=new o(`viewNormal`,({camera:e})=>e.viewInverseTransposeMatrix),p=new n(`nearFar`,({camera:e})=>e.nearFar),m=new i(`viewport`,({camera:e})=>e.fullViewport),h=new a(`pixelRatio`,e=>e.camera.pixelRatio/e.overlayStretch),g=new a(`screenPixelSizePerDistance`,({camera:e})=>e.screenPixelSizePerDistance),_=new a(`worldToScreenPerDistanceRatio`,({camera:e})=>1/e.screenPixelSizePerDistance),v=new a(`renderPixelSizePerDistance`,({camera:e})=>e.renderPixelSizePerDistance),y=new a(`metersPerRenderUnit`,e=>e.metersPerRenderUnit),b=new n(`inverseScreenSize`,({camera:t})=>e(S,1/t.fullWidth,1/t.fullHeight)),x=new n(`pixelToNDC`,({camera:t})=>e(S,2/t.fullViewport[2],2/t.fullViewport[3])),S=t();export{d as cameraPosition,u as inverseProjectionMatrix,b as inverseScreenSize,c as inverseViewMatrix,y as metersPerRenderUnit,p as nearFar,h as pixelRatio,x as pixelToNDC,l as projMatrix,v as renderPixelSizePerDistance,g as screenPixelSizePerDistance,s as viewMatrix,f as viewNormal,m as viewport,_ as worldToScreenPerDistanceRatio};
2
+ import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as n,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Float2BindUniform as a}from"../../shaderModules/Float2BindUniform.js";import{Float3BindUniform as o}from"../../shaderModules/Float3BindUniform.js";import{Float4BindUniform as s}from"../../shaderModules/Float4BindUniform.js";import{FloatBindUniform as c}from"../../shaderModules/FloatBindUniform.js";import{Matrix4BindUniform as l}from"../../shaderModules/Matrix4BindUniform.js";const u=new l(`view`,({camera:e})=>e.viewMatrix),d=new l(`inverseViewMatrix`,({camera:e})=>e.inverseViewMatrix),f=new l(`proj`,({camera:e})=>e.projectionMatrix),p=new l(`inverseProjectionMatrix`,({camera:e})=>e.inverseProjectionMatrix),m=new o(`cameraPosition`,({camera:e})=>e.eye),h=new l(`viewNormal`,({camera:e})=>e.viewInverseTransposeMatrix),g=new o(`localUpView`,({camera:e})=>{let t=e.viewInverseTransposeMatrix;return n(D,r(D,t[8],t[9],t[10]))}),_=new a(`nearFar`,({camera:e})=>e.nearFar),v=new s(`viewport`,({camera:e})=>e.fullViewport),y=new c(`pixelRatio`,e=>e.camera.pixelRatio/e.overlayStretch),b=new c(`screenPixelSizePerDistance`,({camera:e})=>e.screenPixelSizePerDistance),x=new c(`worldToScreenPerDistanceRatio`,({camera:e})=>1/e.screenPixelSizePerDistance),S=new c(`renderPixelSizePerDistance`,({camera:e})=>e.renderPixelSizePerDistance),C=new c(`metersPerRenderUnit`,e=>e.metersPerRenderUnit),w=new a(`inverseScreenSize`,({camera:t})=>e(E,1/t.fullWidth,1/t.fullHeight)),T=new a(`pixelToNDC`,({camera:t})=>e(E,2/t.fullViewport[2],2/t.fullViewport[3])),E=t(),D=i();export{m as cameraPosition,p as inverseProjectionMatrix,w as inverseScreenSize,d as inverseViewMatrix,g as localUpView,C as metersPerRenderUnit,_ as nearFar,y as pixelRatio,T as pixelToNDC,f as projMatrix,S as renderPixelSizePerDistance,b as screenPixelSizePerDistance,u as viewMatrix,h as viewNormal,v as viewport,x as worldToScreenPerDistanceRatio};