@arcgis/core 6.0.0-next.5 → 6.0.0-next.7

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 (215) hide show
  1. package/analysis/AreaMeasurementAnalysis.d.ts +11 -1
  2. package/analysis/DirectLineMeasurementAnalysis.d.ts +11 -1
  3. package/analysis/DistanceMeasurementAnalysis.d.ts +8 -0
  4. package/arcade/functions/knowledgegraph.js +1 -1
  5. package/arcade/geometry/unitConversion.js +1 -1
  6. package/arcgisGlobal.d.ts +5 -5
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1ede8666d804c553803e.js → 0b6941781e35ce0f7274.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0ccab50877b24f862d6e.js +1 -0
  11. package/assets/esri/core/workers/chunks/{a0d459bdb91ee892d4b6.js → 116293b1ee788a89ce1e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{8959a825f5e1ce6f38ac.js → 1c65ab9ed611c322ce27.js} +1 -1
  13. package/assets/esri/core/workers/chunks/257910cca66dc5df465e.js +1 -0
  14. package/assets/esri/core/workers/chunks/27da9ece2afaeec39f59.js +1 -0
  15. package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +1 -0
  17. package/assets/esri/core/workers/chunks/2e096537a3a5555a4a93.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b612de42ee86c0d95247.js → 3d9d7d3a40b51eb7ee3d.js} +1 -1
  19. package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
  20. package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
  21. package/assets/esri/core/workers/chunks/4d3f97a48046021713a6.js +1 -0
  22. package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +1 -0
  23. package/assets/esri/core/workers/chunks/518e8883b6ed613bf451.js +1 -0
  24. package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
  26. package/assets/esri/core/workers/chunks/557671c897ca5563be6c.js +1 -0
  27. package/assets/esri/core/workers/chunks/56a24061589f4a968818.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
  29. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
  30. package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → 67e4b5651fd7ff7d8cf0.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
  32. package/assets/esri/core/workers/chunks/{e521bb9ee2030245c3ce.js → 6f358116f79021ff9687.js} +1 -1
  33. package/assets/esri/core/workers/chunks/7038ead1fa1674416ab3.js +1 -0
  34. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
  35. package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 7165d6f6a5078768bebb.js} +1 -1
  36. package/assets/esri/core/workers/chunks/76196c414e48834f7b92.js +1 -0
  37. package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
  38. package/assets/esri/core/workers/chunks/801e9e66edb4961461eb.js +1 -0
  39. package/assets/esri/core/workers/chunks/{5078b66ba31b770b689f.js → 85908e6e9c50749cee60.js} +1 -1
  40. package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +1 -0
  41. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
  42. package/assets/esri/core/workers/chunks/aba42885c5d6b2b5fe7f.js +1 -0
  43. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
  44. package/assets/esri/core/workers/chunks/ae40eac1eadd1a537bf4.js +1 -0
  45. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +1 -0
  46. package/assets/esri/core/workers/chunks/bfd85e8d54062a590f0e.js +1 -0
  47. package/assets/esri/core/workers/chunks/{ff3a53c3f00335552317.js → c29c474c4b1049352d3e.js} +1 -1
  48. package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +1 -0
  49. package/assets/esri/core/workers/chunks/d90a3bfd45b5ed4092e0.js +1 -0
  50. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
  51. package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
  52. package/assets/esri/core/workers/chunks/f43a50d4bd9636e68ae5.js +1118 -0
  53. package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
  54. package/assets/esri/core/workers/chunks/{fccbb902fe08448f91de.js → fd0a5c243f3426f2a0b5.js} +1 -1
  55. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
  56. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
  57. package/assets/esri/themes/base/widgets/_Features.scss +1 -1
  58. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
  59. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
  60. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  61. package/assets/esri/themes/dark/main.css +1 -1
  62. package/assets/esri/themes/light/main.css +1 -1
  63. package/assets/esri/themes/light/view.css +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  65. package/{basemaps/BasemapCollection.d.ts → basemapGallery/BasemapGalleryModel.d.ts} +8 -8
  66. package/{basemaps/BasemapCollection.js → basemapGallery/BasemapGalleryModel.js} +1 -1
  67. package/{basemaps → basemapGallery}/BasemapsSource.d.ts +1 -1
  68. package/{basemaps → basemapGallery}/BasemapsSource.js +1 -1
  69. package/{basemaps → basemapGallery}/LocalBasemapsSource.d.ts +2 -2
  70. package/{basemaps → basemapGallery}/LocalBasemapsSource.js +1 -1
  71. package/{basemaps → basemapGallery}/PortalBasemapsSource.d.ts +2 -2
  72. package/{basemaps → basemapGallery}/PortalBasemapsSource.js +1 -1
  73. package/{basemaps → basemapGallery}/support/BasemapItem.d.ts +2 -2
  74. package/{basemaps → basemapGallery}/support/BasemapItem.js +1 -1
  75. package/{basemaps → basemapGallery}/types.d.ts +2 -2
  76. package/chunks/GlobalIllumination.glsl.js +4 -2
  77. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  78. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  79. package/config.js +1 -1
  80. package/core/colorUtils.js +1 -1
  81. package/core/has.js +1 -1
  82. package/core/units.js +1 -1
  83. package/core/workers/workerFactory.js +1 -1
  84. package/geometry/projectionUtils.js +1 -1
  85. package/geometry/support/wkt.js +2 -0
  86. package/kernel.js +1 -1
  87. package/layers/graphics/data/FeatureStore.js +1 -1
  88. package/layers/graphics/data/QueryEngineResult.js +1 -1
  89. package/layers/graphics/data/geometryUtils.js +1 -1
  90. package/layers/graphics/data/projectionSupport.js +1 -1
  91. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  92. package/layers/graphics/transferFeatures.js +1 -1
  93. package/layers/knowledgeGraph/layerUtils.js +1 -1
  94. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  95. package/layers/raster/datasets/TIFFRaster.js +1 -1
  96. package/package.json +2 -2
  97. package/symbols/cim/cimAnalyzer.js +1 -1
  98. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +4 -4
  99. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +4 -4
  100. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  101. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  102. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
  103. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  104. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  105. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  106. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  107. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  108. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  109. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -0
  110. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +2 -1
  111. package/views/3d/layers/support/FeatureMemory.js +1 -1
  112. package/views/3d/layers/support/FeatureTile.js +1 -1
  113. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  114. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  115. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  116. package/views/3d/support/PBFDecoder.js +1 -1
  117. package/views/3d/support/elevationUpdateUtils.js +1 -1
  118. package/views/3d/terrain/TerrainRenderer.js +1 -1
  119. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +16 -11
  120. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  121. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  122. package/views/SceneView.d.ts +4 -10
  123. package/views/View.d.ts +4 -12
  124. package/views/draw/Draw.d.ts +1 -1
  125. package/views/draw/support/InteractiveHandle.js +1 -1
  126. package/views/interactive/options/SnappingOptions.d.ts +29 -12
  127. package/views/interactive/options/TooltipOptions.d.ts +9 -1
  128. package/views/interactive/options/ValueOptions.d.ts +9 -2
  129. package/views/interactive/options/ViewOptions.d.ts +82 -6
  130. package/views/interactive/support/Units.d.ts +1 -0
  131. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  132. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  133. package/views/support/projectionUtils.js +1 -1
  134. package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +2 -2
  135. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  136. package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -3
  137. package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -2
  138. package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -2
  139. package/widgets/BasemapGallery/types.d.ts +3 -3
  140. package/widgets/BasemapLayerList.js +1 -1
  141. package/widgets/BatchAttributeForm.js +1 -1
  142. package/widgets/DirectionalPad.js +1 -1
  143. package/widgets/Editor/EditorViewModel.d.ts +13 -8
  144. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  145. package/widgets/Editor.d.ts +9 -9
  146. package/widgets/Expand.js +1 -1
  147. package/widgets/FeatureForm.js +1 -1
  148. package/widgets/FeatureTable/FieldColumn.js +1 -1
  149. package/widgets/FeatureTable.js +1 -1
  150. package/widgets/Features/FeaturesDrillIn.js +1 -1
  151. package/widgets/Features.js +1 -1
  152. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  153. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  154. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  155. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  156. package/widgets/PanoramicVideoViewer.js +1 -1
  157. package/widgets/Print.js +1 -1
  158. package/widgets/ScaleRangeSlider.js +1 -1
  159. package/widgets/Search/SearchResultRenderer.js +1 -1
  160. package/widgets/Sketch/SketchViewModel.d.ts +14 -9
  161. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  162. package/widgets/Sketch.d.ts +10 -10
  163. package/widgets/Track/TrackViewModel.d.ts +1 -1
  164. package/widgets/UtilityNetworkAssociations.js +1 -1
  165. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  166. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  167. package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
  168. package/widgets/UtilityNetworkTrace.js +1 -1
  169. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  170. package/widgets/ValuePicker.js +1 -1
  171. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  172. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  173. package/widgets/support/GridControls.js +1 -1
  174. package/widgets/support/PluginSettingsControls.js +1 -1
  175. package/widgets/support/SelectionToolbar.js +1 -1
  176. package/widgets/support/SnappingControls.js +1 -1
  177. package/widgets/support/componentsUtils.js +1 -1
  178. package/arcade/geometry/wkt.js +0 -2
  179. package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
  180. package/assets/esri/core/workers/chunks/05d865b2736f452ad2aa.js +0 -1
  181. package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
  182. package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +0 -1
  183. package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
  184. package/assets/esri/core/workers/chunks/260dcb79dfd0f981949f.js +0 -1
  185. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  186. package/assets/esri/core/workers/chunks/303676d1b10676c9cab4.js +0 -1
  187. package/assets/esri/core/workers/chunks/33956f12505e72e60293.js +0 -1
  188. package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
  189. package/assets/esri/core/workers/chunks/512628db534605a2a93e.js +0 -1742
  190. package/assets/esri/core/workers/chunks/57970d43cdcc5cf57a30.js +0 -1
  191. package/assets/esri/core/workers/chunks/5e184fd47e76eb976fa9.js +0 -1
  192. package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
  193. package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +0 -1
  194. package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
  195. package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +0 -1
  196. package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
  197. package/assets/esri/core/workers/chunks/71103472c45928bd730c.js +0 -1
  198. package/assets/esri/core/workers/chunks/73a87fb270818aa75fc5.js +0 -1
  199. package/assets/esri/core/workers/chunks/776565dd9741ba2ba151.js +0 -1
  200. package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
  201. package/assets/esri/core/workers/chunks/8e7a33cc1f83063043f2.js +0 -1
  202. package/assets/esri/core/workers/chunks/a23272a7a47a95f6ddea.js +0 -1
  203. package/assets/esri/core/workers/chunks/aa5b42e44d2959fdacd3.js +0 -1
  204. package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
  205. package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
  206. package/assets/esri/core/workers/chunks/cbdebdfa5f2cded29d0d.js +0 -1
  207. package/assets/esri/core/workers/chunks/d56780290e0218d3e9de.js +0 -1
  208. package/assets/esri/core/workers/chunks/d89fe41c71c9621c41ae.js +0 -1
  209. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  210. package/assets/esri/core/workers/chunks/e22d45aeef293a5ffb78.js +0 -1
  211. package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
  212. package/assets/esri/core/workers/chunks/edf3be87a997f4f05b96.js +0 -1
  213. package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
  214. package/assets/esri/core/workers/chunks/f0c0c02730fe0d948fc1.js +0 -1
  215. /package/{basemaps → basemapGallery}/support/basemapCompatibilityUtils.js +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as t}from"../../../../../layers/graphics/data/FeatureIdInfo.js";import n from"../../../../../layers/support/FieldsIndex.js";import{parseField as r,parseTransform as i}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const a=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.offsets={attributes:[],geometry:[]},this.centroid=[],this.byReferenceVertexCounts=new Map}get usedMemory(){let t=0;return t+=e(this.idFieldIndices),t+=e(this.offsets.attributes),t+=e(this.offsets.geometry),t+=e(this.centroid),this.displayIds&&(t+=e(this.displayIds)),this.groupIds&&(t+=e(this.groupIds)),t}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}function s(e,s,c){let l=e.asUnsafe(),u=l.pos(),d=new o,f=0,p=0,m=null,h=[];for(;l.next();)switch(l.tag()){case 12:m=l.processMessage(i);break;case 9:d.exceededTransferLimit=l.getBool();break;case 10:d.hasZ=l.getBool();break;case 11:d.hasM=l.getBool();break;case 13:{let e=l.processMessage(r);e.index=f++,h.push(e);break}case 15:{let e=l.getPackedEnd(),t=d.offsets.geometry,n=d.centroid;t.push(0);let{stride:r}=d;for(n.push(a),n.push(a);l.pos()<e&&l.next();)switch(l.tag()){case 1:{d.offsets.attributes.push(l.pos());let e=l.getLength();l.skipLen(e);break}case 2:if(s){let e=l.getPackedEnd();for(;l.pos()<e&&l.next();)switch(l.tag()){case 3:{let e=l.getPackedEnd(),t=p*r;for(;l.pos()<e;)d.centroid[t++]=l.getSInt64();break}default:l.skip()}}else{d.offsets.geometry[p]=l.pos();let e=l.getLength();d.vertexCount+=e,l.skipLen(e)}break;case 4:{let e=l.getLength(),t=l.pos()+e;for(;l.pos()<t&&l.next();)switch(l.tag()){case 3:{let e=l.getPackedEnd(),t=p*r;for(;l.pos()<e;)d.centroid[t++]=l.getSInt64();break}default:l.skip()}break}case 12:{let e=l.getUInt64();d.byReferenceVertexCounts.set(p,e);break}default:l.skip()}p++,d.hasFeatures=!0;break}default:l.skip()}d.fields=new n(h),d.featureCount=p,d.fieldCount=f;let g=t(c);return d.idFieldIndices=Array.from(g,e=>d.fields.get(e)?.index),d.transform=m,d.displayIds=new Uint32Array(d.featureCount),d.groupIds=new Uint16Array(d.featureCount),l.move(u),d}export{o as FeatureSetHeader,s as parseHeader};
2
+ import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as t}from"../../../../../layers/graphics/data/FeatureIdInfo.js";import n from"../../../../../layers/support/FieldsIndex.js";import{parseField as r,parseTransform as i}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const a=has(`featurelayer-snapping-density-sample-interval`),o=has(`featurelayer-snapping-density-max-vertices-per-feature`),s=has(`featurelayer-snapping-density-max-distance`)**2,c=268435455;class l{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.geometryDensity={sampleCount:0,densePairCount:0},this.offsets={attributes:[],geometry:[]},this.centroid=[],this.byReferenceVertexCounts=new Map}get usedMemory(){let t=0;return t+=e(this.idFieldIndices),t+=e(this.offsets.attributes),t+=e(this.offsets.geometry),t+=e(this.centroid),this.displayIds&&(t+=e(this.displayIds)),this.groupIds&&(t+=e(this.groupIds)),t}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}function u(e,o,s,u=!1){let f=e.asUnsafe(),p=f.pos(),m=new l,h=0,g=0,_=[];for(;f.next();)switch(f.tag()){case 12:m.transform=f.processMessage(i);break;case 9:m.exceededTransferLimit=f.getBool();break;case 10:m.hasZ=f.getBool();break;case 11:m.hasM=f.getBool();break;case 13:{let e=f.processMessage(r);e.index=h++,_.push(e);break}case 15:{let t=f.getPackedEnd(),n=m.offsets.geometry,r=m.centroid;n.push(0);let{stride:i}=m;for(r.push(c),r.push(c);f.pos()<t&&f.next();)switch(f.tag()){case 1:{m.offsets.attributes.push(f.pos());let e=f.getLength();f.skipLen(e);break}case 2:if(o){let e=f.getPackedEnd();for(;f.pos()<e&&f.next();)switch(f.tag()){case 3:{let e=f.getPackedEnd(),t=g*i;for(;f.pos()<e;)m.centroid[t++]=f.getSInt64();break}default:f.skip()}}else{m.offsets.geometry[g]=f.pos();let t=f.getLength(),n=f.pos()+t;m.vertexCount+=t,u&&m.transform!=null&&g%a===0&&d(e,n,m),f.move(n)}break;case 4:{let e=f.getLength(),t=f.pos()+e;for(;f.pos()<t&&f.next();)switch(f.tag()){case 3:{let e=f.getPackedEnd(),t=g*i;for(;f.pos()<e;)m.centroid[t++]=f.getSInt64();break}default:f.skip()}break}case 12:{let e=f.getUInt64();m.byReferenceVertexCounts.set(g,e);break}default:f.skip()}g++,m.hasFeatures=!0;break}default:f.skip()}m.fields=new n(_),m.featureCount=g,m.fieldCount=h;let v=t(s);return m.idFieldIndices=Array.from(v,e=>m.fields.get(e)?.index),m.displayIds=new Uint32Array(m.featureCount),m.groupIds=new Uint16Array(m.featureCount),f.move(p),m}function d(e,t,n){let r=e.asUnsafe(),i=0,a=0,c=0;for(;r.pos()<t&&r.next();)switch(r.tag()){case 2:{let e=r.getPackedEnd();i=r.pos()<e?r.getUInt32():0,r.move(e);break}case 3:c=r.getPackedEnd(),a=r.pos(),r.move(c);break;default:r.skip()}if(i<2||!a)return;let{stride:l,geometryDensity:u}=n,d=Math.min(i,o);r.move(a);for(let e=0;e<d&&r.pos()<c;e++){let t=r.getSInt64(),n=r.getSInt64();for(let e=2;e<l;e++)r.getSInt64();e>0&&(u.sampleCount++,t*t+n*n<=s&&u.densePairCount++)}}export{l as FeatureSetHeader,u as parseHeader};
@@ -14,6 +14,9 @@ import type { ViewshedPlacementOptions, ViewshedPlacementResult } from "./Viewsh
14
14
  * or to make existing viewsheds selectable and editable by enabling the [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) property.
15
15
  * To select a viewshed, hover and click on its field-of-view manipulators.
16
16
  *
17
+ * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
18
+ * [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
19
+ *
17
20
  * The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView)
18
21
  * similar to how layer views are retrieved for layers using [SceneView.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenLayerView).
19
22
  *
@@ -28,7 +28,8 @@ import type { VolumeMeasurementPlacementResult } from "./VolumeMeasurement/types
28
28
  * > **Things to consider:**
29
29
  * >
30
30
  * > - When using the "cut-fill" [VolumeMeasurementAnalysis.measureType](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/#measureType) in [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#interactive) mode, hover over the shift manipulator, press `Tab` to activate the tooltip input mode, and enter the elevation of the target surface.
31
- * > - The cut-fill elevation tooltip is enabled by default and remains enabled independently of [ViewOptions.tooltips](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#tooltips). Support for this setting is planned for a future release.
31
+ * > - The cut-fill elevation tooltip remains enabled independently of [ViewOptions.tooltips](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#tooltips). Support for this setting is planned for a future release.
32
+ * > Its display and input units can still inherit [ViewOptions.displayUnits](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#displayUnits) and [ViewOptions.inputUnits](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/#inputUnits).
32
33
  * > - Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key.
33
34
  * > - Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries),
34
35
  * > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../core/has.js";import{estimateAttributesMemory as e}from"../../../../core/memoryEstimations.js";import{signal as t}from"../../../../core/signal.js";import{estimateGeometryMemory as n}from"../../../../layers/graphics/dehydratedFeatures.js";class r{constructor(){this._payloads=new Map,this._usedMemory=t(0),this._duplicatedMemory=t(0),this._referenceCount=t(0)}get usedMemory(){return this._usedMemory.value}get usedMemoryPerFeature(){return this._referenceCount.value>0?this._duplicatedMemory.value/this._referenceCount.value:0}ref(t){this._duplicatedMemory.value+=this._refPayload(t.geometry,n)+this._refPayload(t.attributes,e),this._referenceCount.value++}unref(e){this._duplicatedMemory.value-=this._unrefPayload(e.geometry)+this._unrefPayload(e.attributes),this._referenceCount.value--}_refPayload(e,t){if(e==null)return 0;let n=this._payloads.get(e);if(n)return n.count++,n.size;let r=t(e);return this._payloads.set(e,new i(r)),this._usedMemory.value+=r,r}_unrefPayload(e){if(e==null)return 0;let t=this._payloads.get(e);return--t.count===0&&(this._payloads.delete(e),this._usedMemory.value-=t.size),t.size}get test(){}}class i{constructor(e){this.size=e,this.count=1}}export{r as FeatureMemory};
2
+ import"../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{estimateAttributesMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{estimateGeometryMemory as r}from"../../../../layers/graphics/dehydratedFeatures.js";class i{constructor(e=()=>void 0){this._getGeometryKey=e,this._payloads=new Map,this._geometries=new Map,this._usedMemory=n(0),this._duplicatedMemory=n(0),this._referenceCount=n(0)}findGeometry(e,t){if(e===void 0)return;let n=this._geometries.get(e);if(n){for(let e of n)if(t(e))return e}}get usedMemory(){return this._usedMemory.value}get usedMemoryPerFeature(){return this._referenceCount.value>0?this._duplicatedMemory.value/this._referenceCount.value:0}ref(n,i,a=!0){let o;a&&n.geometry&&!this._payloads.has(n.geometry)&&(o=this._getGeometryKey(n.geometry,i),o!==void 0&&e(this._geometries,o,()=>new Set).add(n.geometry)),this._duplicatedMemory.value+=this._refPayload(n.geometry,r,o)+this._refPayload(n.attributes,t),this._referenceCount.value++}unref(e){let t=e.geometry,n=t&&this._payloads.get(t);if(t&&n?.count===1&&n.geometryKey!==void 0){let e=this._geometries.get(n.geometryKey);e.delete(t),e.size===0&&this._geometries.delete(n.geometryKey)}this._duplicatedMemory.value-=this._unrefPayload(e.geometry)+this._unrefPayload(e.attributes),this._referenceCount.value--}_refPayload(e,t,n){if(e==null)return 0;let r=this._payloads.get(e);if(r)return r.count++,r.size;let i=t(e);return this._payloads.set(e,new a(i,n)),this._usedMemory.value+=i,i}_unrefPayload(e){if(e==null)return 0;let t=this._payloads.get(e);return--t.count===0&&(this._payloads.delete(e),this._usedMemory.value-=t.size),t.size}get test(){}}class a{constructor(e,t){this.size=e,this.geometryKey=t,this.count=1}}export{i as FeatureMemory};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r){this._replaceFeatures(e),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e){for(let t of e??[])this._memory.ref(t);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=2,T=a(),E=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
2
+ import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=2,T=a(),E=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
@@ -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{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{FeatureMemory as O}from"./FeatureMemory.js";import{MultiFeatureReference as k,SingleFeatureReference as A}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as M}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as N,virtualSnapshotTileId as P}from"./FeatureTileDescriptor.js";import{tilesAreRelated as F}from"../../terrain/tileUtils.js";import{ImmediateTask as I,TaskPriority as L}from"../../../support/Scheduler.js";let R=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(z)||!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 O,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(L.FEATURE_TILE_FETCHER,this)??I,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?k:A,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()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(N);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}}_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(C(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?C(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._queryFeatures(i,r),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(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,G(e.availableFields,a.fields),K(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:Z})}_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=ee;for(let n of e){if(z(n)||t<=0)break;if(!B(n)&&(t--,n.sampledDensityEstimate>$)){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=j),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,J),r.intersectionIncludingBorrowed(e,Y),_(J,Y)||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=C(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=H(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 M(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&&F(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(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(C(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(4):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){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),U(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,V(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>D.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,t),d=c||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,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,W(l),K(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=G(l,h),u=K(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!V(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),B(e)){let{highlightIds:e}=this.context;e&&e.length>q&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${q} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,q)}else!z(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(V(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 E({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+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,X),x(X)>r||S(X)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!z(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||q}_resultType(e){if(this.context.capabilities.supportsResultType)return z(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 o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||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=C(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=C(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+Q,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([p({constructOnly:!0})],R.prototype,`features`,void 0),e([p({constructOnly:!0})],R.prototype,`context`,void 0),e([p()],R.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],R.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],R.prototype,`memoryFactor`,null),e([p({value:1})],R.prototype,`lodFactor`,null),e([p()],R.prototype,`useTileCount`,null),e([p({readOnly:!0})],R.prototype,`updating`,null),e([p({readOnly:!0})],R.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],R.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],R.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],R.prototype,`expectedFeatureDiff`,void 0),e([p()],R.prototype,`usedMemory`,null),e([p()],R.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],R.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],R.prototype,`totalVertices`,null),e([p({readOnly:!0})],R.prototype,`totalFeatures`,null),e([p({readOnly:!0})],R.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],R.prototype,`hasFullGeometries`,null),e([p()],R.prototype,`filterExtent`,null),e([p()],R.prototype,`_dirty`,void 0),e([p()],R.prototype,`_suspended`,void 0),e([p()],R.prototype,`_pendingEdits`,void 0),e([p()],R.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],R.prototype,`_paused`,null),e([p()],R.prototype,`snappingComplexityExceeded`,void 0),e([p()],R.prototype,`_isFetching`,void 0),R=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],R);function z(e){return e.id===P}function B(e){return e.id===N}function V(e){return z(e)||B(e)}function H(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 U(e){e.setFeatures([],0,null,void 0)}function W(e){return e==null?new Set:new Set(e.map(e=>e.name))}function G(e,t){if(e==null||t==null)return W(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function K(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 q=2e3,J=g(),Y=g(),X=g(),Z=6e5,Q=200,$=.95,ee=10;export{R 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{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}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 M(E),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?ee:te,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()}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}}_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(C(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?C(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(C(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=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(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=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){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),_(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=C(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??=v(e.descriptor.extent),y(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(C(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(4):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){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;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>j.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>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,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 _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.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`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=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 A({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+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(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 o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||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=C(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=C(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+ne,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([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`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=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=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 t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{initializeProjection as u,project as d}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as f}from"../../../../support/GraphicsCollection.js";import p from"../../../../symbols/SimpleFillSymbol.js";import m from"../../../../symbols/SimpleLineSymbol.js";import h from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as g}from"../../../layers/support/highlightUtils.js";let _=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new f,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new h({size:`2px`,style:`square`,color:n})],[`polyline`,new m({width:`2px`,color:n})],[`polygon`,new p({outline:null,color:n})]])}highlight(e,t){let n=g(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>((e.length===0||!e.at(-1)?.equals(t))&&e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await u(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{let r=t?d(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],_.prototype,`graphics`,void 0),e([c()],_.prototype,`graphicsView`,void 0),e([c()],_.prototype,`view`,void 0),e([c()],_.prototype,`layer`,void 0),e([c()],_.prototype,`updatingHandles`,void 0),e([c()],_.prototype,`suspended`,void 0),e([c()],_.prototype,`updating`,null),_=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],_);export{_ as ImageHighlightHelper3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>((e.length===0||!e.at(-1)?.equals(t))&&e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await d(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{u(t);let r=t?f(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],v.prototype,`graphics`,void 0),e([c()],v.prototype,`graphicsView`,void 0),e([c()],v.prototype,`view`,void 0),e([c()],v.prototype,`layer`,void 0),e([c()],v.prototype,`updatingHandles`,void 0),e([c()],v.prototype,`suspended`,void 0),e([c()],v.prototype,`updating`,null),v=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],v);export{v as ImageHighlightHelper3D};
@@ -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 n from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,createAbortError as a}from"../../../../core/promiseUtils.js";import{difference as o}from"../../../../core/SetUtils.js";import{parseWhereClause as s}from"../../../../core/sql.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fromFeatureSetJSON as u}from"../../../../layers/graphics/dehydratedFeatures.js";import{canConvertSqlRelativeTime as d,sqlRelativeTimeToAbsolute as f}from"../../../../layers/support/relativeTimeQueryUtils.js";import{queueAutoPriority as p}from"../../../../request/queue.js";import{runQuery as m,executeQuery as h,executeQueryForCount as g}from"../../../../rest/query/operations/query.js";import{PBFDecoder as _}from"../../support/PBFDecoder.js";let v=class extends t{constructor(e){super(e)}get implicitFields(){if(!this.layer.outFields?.includes(`*`))return new Set;let e=new Set(this.layerView.requiredFields),t=new Set(this.layerView.availableFields);return o(t,e)}async queryFeaturesDehydrated(e,t){let{layer:n}=this,r=n.capabilities,o=r?.query?.supportsFormatPBF,c=n.parsedUrl,l=d(e.where)?await f(n.fieldsIndex,e.where,r.query.relativeTimeBinWindow):e.where,p=e.where;l!==e.where&&(e=e.clone(),e.where=l);let g;if(o){this._decoder??=new _(this.controller);let r={sourceSpatialReference:n.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S};g=await m(c,e,`pbf`,this._createRequestOptions(t)).then(e=>(i(t),this._decoder==null?Promise.reject(a()):this._decoder.invoke({buffer:e,options:r},t.signal)))}else g=await h(c,e,n.spatialReference,this._createRequestOptions(t)).then(e=>u(e,{maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S}));if(p&&e.where!==p){let e=await this.controller.schedule(()=>s(p,this.layer.fieldsIndex),t.signal);g.features=await this.controller.schedule(()=>g.features.filter(t=>e.testFeatureCompiled(t)),t.signal)}return g}queryFeatureCount(e,t){return g(this.layer.parsedUrl,e,this._createRequestOptions(t))}destroy(){this._decoder=r(this._decoder)}_createRequestOptions(e){return{...p,...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([c({constructOnly:!0})],v.prototype,`layer`,void 0),e([c({constructOnly:!0})],v.prototype,`layerView`,void 0),e([c({constructOnly:!0})],v.prototype,`controller`,void 0),e([c({readOnly:!0})],v.prototype,`implicitFields`,null),v=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D`)],v);let y=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.queryFeatures(e,t)}};e([c({constructOnly:!0})],y.prototype,`layer`,void 0),y=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileOGCServiceQuery3D`)],y);let b=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.source.queryFeaturesJSON(e,t).then(u,n=>{if(n&&n.name===`query-features-json:unsupported`)return this.layer.queryFeatures(e,t);throw n})}queryFeatureCount(e,t){return this.layer.queryFeatureCount(e,t)}};e([c({constructOnly:!0})],b.prototype,`layer`,void 0),b=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D`)],b);function x(e,t){let{layer:r}=e;switch(r.type){case`feature`:switch(r.source.type){case`feature-layer`:return new v({layer:r,layerView:e,controller:t});case`memory`:return new b({layer:r});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:case`ogc-feature`:case`parquet`:break;default:r.source.type}break;case`catalog-footprint`:return new v({layer:r,layerView:e,controller:t});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:return new b({layer:r});case`ogc-feature`:return new y({layer:r})}throw new n(`feature-layer:unsupported`,`Unsupported Feature layer type ${e.layer.type}:${e.layer.source.type}`)}const S=1024;export{x as createFeatureTileQuery3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,createAbortError as a}from"../../../../core/promiseUtils.js";import{difference as o}from"../../../../core/SetUtils.js";import{parseWhereClause as s}from"../../../../core/sql.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fromFeatureSetJSON as u}from"../../../../layers/graphics/dehydratedFeatures.js";import{canConvertSqlRelativeTime as d,sqlRelativeTimeToAbsolute as f}from"../../../../layers/support/relativeTimeQueryUtils.js";import{queueAutoPriority as p}from"../../../../request/queue.js";import{runQuery as m,executeQuery as h,executeQueryForCount as g}from"../../../../rest/query/operations/query.js";import{PBFDecoder as _}from"../../support/PBFDecoder.js";let v=class extends t{constructor(e){super(e)}get implicitFields(){if(!this.layer.outFields?.includes(`*`))return new Set;let e=new Set(this.layerView.requiredFields),t=new Set(this.layerView.availableFields);return o(t,e)}async queryFeaturesDehydrated(e,t){let{layer:n}=this,r=n.capabilities,o=r?.query?.supportsFormatPBF,c=n.parsedUrl,l=d(e.where)?await f(n.fieldsIndex,e.where,r.query.relativeTimeBinWindow):e.where,p=e.where;l!==e.where&&(e=e.clone(),e.where=l);let g;if(o){this._decoder??=new _(this.controller);let r={sourceSpatialReference:n.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S};g=await m(c,e,`pbf`,this._createRequestOptions(t)).then(e=>(i(t),this._decoder==null?Promise.reject(a()):this._decoder.invoke({buffer:e,options:r},t.completeFeatureFromTransfer,t.signal)))}else g=await h(c,e,n.spatialReference,this._createRequestOptions(t)).then(e=>u(e,{maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:S}));if(p&&e.where!==p){let e=await this.controller.schedule(()=>s(p,this.layer.fieldsIndex),t.signal);g.features=await this.controller.schedule(()=>g.features.filter(t=>e.testFeatureCompiled(t)),t.signal)}return g}queryFeatureCount(e,t){return g(this.layer.parsedUrl,e,this._createRequestOptions(t))}destroy(){this._decoder=r(this._decoder)}_createRequestOptions(e){return{...p,...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([c({constructOnly:!0})],v.prototype,`layer`,void 0),e([c({constructOnly:!0})],v.prototype,`layerView`,void 0),e([c({constructOnly:!0})],v.prototype,`controller`,void 0),e([c({readOnly:!0})],v.prototype,`implicitFields`,null),v=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D`)],v);let y=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.queryFeatures(e,t)}};e([c({constructOnly:!0})],y.prototype,`layer`,void 0),y=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileOGCServiceQuery3D`)],y);let b=class extends t{constructor(e){super(e)}queryFeaturesDehydrated(e,t){return this.layer.source.queryFeaturesJSON(e,t).then(u,n=>{if(n&&n.name===`query-features-json:unsupported`)return this.layer.queryFeatures(e,t);throw n})}queryFeatureCount(e,t){return this.layer.queryFeatureCount(e,t)}};e([c({constructOnly:!0})],b.prototype,`layer`,void 0),b=e([l(`esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D`)],b);function x(e,t){let{layer:r}=e;switch(r.type){case`feature`:switch(r.source.type){case`feature-layer`:return new v({layer:r,layerView:e,controller:t});case`memory`:return new b({layer:r});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:case`ogc-feature`:case`parquet`:break;default:r.source.type}break;case`catalog-footprint`:return new v({layer:r,layerView:e,controller:t});case`csv`:case`geojson`:case`oriented-imagery`:case`wfs`:return new b({layer:r});case`ogc-feature`:return new y({layer:r})}throw new n(`feature-layer:unsupported`,`Unsupported Feature layer type ${e.layer.type}:${e.layer.source.type}`)}const S=1024;export{x as createFeatureTileQuery3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{generateUID as t}from"../../../core/uid.js";import{WorkerHandle as n}from"../../../core/workers/WorkerHandle.js";import r from"../../../geometry/SpatialReference.js";import{toDehydratedGeometry as i}from"../../../layers/graphics/transferFeatures.js";import a from"../../../layers/support/Field.js";class o{constructor(e){this._controller=e,this._abortController=new AbortController,this._handle=new s((t,n)=>e.schedule(t,n))}destroy(){this._abortController.abort(),this._handle.destroy()}async invoke(n,o){if(o=AbortSignal.any([o,this._abortController.signal]),e(o),!n.buffer||n.buffer.byteLength===0)return null;n.options.sourceSpatialReference&&n.options.sourceSpatialReference instanceof r&&(n.options={...n.options,sourceSpatialReference:n.options.sourceSpatialReference.toJSON()});let{featureSet:s,coordinates:c,queryGeometry:l,queryCoordinates:u}=await this._handle.invoke(n,o);return await this._controller.scheduleGenerator(function*(e){let n=r.fromJSON(s.spatialReference),o=[];for(let t=0;t<s.fields.length;++t)o.push(a.fromJSON(s.fields[t])),e.madeProgress()&&(e=yield);let d=s.features;for(let r=0;r<d.length;++r){let a=d[r];a.geometry=i(a.geometry,c[r],n),a.uid=t(),a.centroid&&(a.centroid.spatialReference=n),c[r]=null,e.madeProgress()&&(e=yield)}return Object.assign(s,{spatialReference:n,fields:o,queryGeometry:i(l,u,n)})},o)}}class s extends n{constructor(e){super(`PBFDecoderWorker`,`parseFeatureQuery`,{parseFeatureQuery:e=>[e.buffer]},e)}}export{o as PBFDecoder};
2
+ import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{generateUID as t}from"../../../core/uid.js";import{WorkerHandle as n}from"../../../core/workers/WorkerHandle.js";import r from"../../../geometry/SpatialReference.js";import{completeDehydratedGeometryFromTransfer as i,completeDehydratedFeatureFromTransfer as a}from"../../../layers/graphics/transferFeatures.js";import o from"../../../layers/support/Field.js";class s{constructor(e){this._controller=e,this._abortController=new AbortController,this._handle=new c((t,n)=>e.schedule(t,n))}destroy(){this._abortController.abort(),this._handle.destroy()}async invoke(n,s,c){if(c=AbortSignal.any([c,this._abortController.signal]),e(c),!n.buffer||n.buffer.byteLength===0)return null;n.options.sourceSpatialReference&&n.options.sourceSpatialReference instanceof r&&(n.options={...n.options,sourceSpatialReference:n.options.sourceSpatialReference.toJSON()});let{featureSet:l,coordinates:u,queryGeometry:d,queryCoordinates:f}=await this._handle.invoke(n,c);return await this._controller.scheduleGenerator(function*(e){let n=r.fromJSON(l.spatialReference),c=[];for(let t=0;t<l.fields.length;++t)c.push(o.fromJSON(l.fields[t])),e.madeProgress()&&(e=yield);let p=l.features,m=[],h=s??a;for(let r=0;r<p.length;++r){let i=p[r],a=u[r];h(i,a,n),i.uid=t(),i.centroid&&(i.centroid.spatialReference=n),m.push(i),p[r]=null,u[r]=null,e.madeProgress()&&(e=yield)}return i(d,f,n),Object.assign(l,{spatialReference:n,fields:c,features:m,queryGeometry:d})},c)}}class c extends n{constructor(e){super(`PBFDecoderWorker`,`parseFeatureQuery`,{parseFeatureQuery:e=>[e.buffer]},e)}}export{s as PBFDecoder};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import r from"../../../geometry/Extent.js";import{projectOrLoad as i}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as a}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as o,fromExtent as s,empty as c}from"../../../geometry/support/aaBoundingRect.js";function l(c){let l=!1,p=(e,t,n)=>{if(l||u(e,n)||t==null)return;let m=i(t,c.view.spatialReference);if(m.pending!=null){l=!0,m.pending.finally(()=>{l=!1,p(e,t,n)});return}let h=m.geometry;if(h==null)return;let g=h.type===`point`?r.fromPoint(h):h.extent;g!=null&&a(e.extent,e.spatialReference,d,c.view.spatialReference)&&o(d,s(g,f))&&c.onElevationChanges()},m,h=t(()=>({elevationMode:c.elevationInfo?.mode,geometry:c.geometry}),({elevationMode:e,geometry:t})=>{m?.remove(),e!==`absolute-height`&&(m=c.view.elevationProvider.on(`elevation-change`,n=>p(n,t,e)))},n);return e([h,m])}function u({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const d=c(),f=c();export{l as createElevationUpdateHandle};
2
+ import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import{assertNotMesh as r}from"../../../geometry/asserts.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as s,fromExtent as c,empty as l}from"../../../geometry/support/aaBoundingRect.js";function u(l){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;r(t);let h=a(t,l.view.spatialReference);if(h.pending!=null){u=!0,h.pending.finally(()=>{u=!1,m(e,t,n)});return}let g=h.geometry;if(g==null)return;let _=g.type===`point`?i.fromPoint(g):g.extent;_!=null&&o(e.extent,e.spatialReference,f,l.view.spatialReference)&&s(f,c(_,p))&&l.onElevationChanges()},h,g=t(()=>({elevationMode:l.elevationInfo?.mode,geometry:l.geometry}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=l.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},n);return e([g,h])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=l(),p=l();export{u as createElevationUpdateHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(t.viewingMode===1),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),!this.reuseTextureFromParent(e)&&this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),!x.isFiltered&&(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.setNeedsRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(t.viewingMode===1),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),!this.reuseTextureFromParent(e)&&this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),!x.isFiltered&&(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.receiveGlobalIllumination=c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.setNeedsRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};
@@ -1,24 +1,29 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{BooleanBindUniform as e}from"../../shaderModules/BooleanBindUniform.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as n}from"../../shaderModules/Texture2DBindUniform.js";import{blurSizePixels as r}from"../../../effects/globalIllumination/GlobalIllumination.js";function i(i,a){a.receiveGlobalIllumination?(i.uniforms.add(new e(`hasGlobalIlluminationTexture`,e=>e.globalIllumination!=null),new n(`globalIlluminationTexture`,e=>e.globalIllumination?.getTexture())),i.constants.add(`blurSizePixelsInverse`,`float`,1/r),i.code.add(t`vec3 readGlobalIlluminationOcclusionInverse() {
2
+ import{BooleanBindUniform as e}from"../../shaderModules/BooleanBindUniform.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as n}from"../../shaderModules/Texture2DBindUniform.js";function r(r,i){i.receiveGlobalIllumination?(r.uniforms.add(new e(`hasGlobalIlluminationTexture`,e=>e.globalIllumination!=null),new n(`globalIlluminationTexture`,e=>e.globalIllumination?.getTexture())),r.constants.add(`globalIlluminationEmissionNoiseThreshold`,`float`,.01),r.code.add(t`vec3 readGlobalIlluminationOcclusionInverse() {
3
3
  if (!hasGlobalIlluminationTexture) {
4
4
  return vec3(1.0);
5
5
  }
6
- ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
6
+ ivec2 texel = ivec2(gl_FragCoord.xy);
7
7
  return vec3(texelFetch(globalIlluminationTexture, texel, 0).a);
8
8
  }
9
9
  vec3 readGlobalIlluminationOcclusion() {
10
10
  return 1.0 - readGlobalIlluminationOcclusionInverse();
11
11
  }
12
- vec4 readGlobalIlluminationEmissionInverse() {
13
- if (!hasGlobalIlluminationTexture) {
14
- return vec4(1.0);
12
+ vec3 suppressBlackNoise(vec3 color) {
13
+ float peak = max(color.r, max(color.g, color.b));
14
+ if (peak <= globalIlluminationEmissionNoiseThreshold) {
15
+ return vec3(0.0);
15
16
  }
16
- ivec2 texel = ivec2(gl_FragCoord.xy * blurSizePixelsInverse);
17
- return 1.0 - vec4(texelFetch(globalIlluminationTexture, texel, 0).rgb, 0.0);
17
+ float correctedPeak = (peak - globalIlluminationEmissionNoiseThreshold) / (1.0 - globalIlluminationEmissionNoiseThreshold);
18
+ return color * (correctedPeak / peak);
18
19
  }
19
20
  vec4 readGlobalIlluminationEmission() {
20
- return max((1.0 - readGlobalIlluminationEmissionInverse() - 0.01) / 0.99, 0.0);
21
- }`)):i.code.add(t`vec3 readGlobalIlluminationOcclusionInverse() { return vec3(1.0); }
21
+ if (!hasGlobalIlluminationTexture) {
22
+ return vec4(0.0);
23
+ }
24
+ ivec2 texel = ivec2(gl_FragCoord.xy);
25
+ vec3 color = texelFetch(globalIlluminationTexture, texel, 0).rgb;
26
+ return vec4(suppressBlackNoise(color), 0.0);
27
+ }`)):r.code.add(t`vec3 readGlobalIlluminationOcclusionInverse() { return vec3(1.0); }
22
28
  vec3 readGlobalIlluminationOcclusion() { return vec3(0.0); }
23
- vec4 readGlobalIlluminationEmissionInverse() { return vec4(1.0); }
24
- vec4 readGlobalIlluminationEmission() { return vec4(0.0); }`)}export{i as ReadGlobalIllumination};
29
+ vec4 readGlobalIlluminationEmission() { return vec4(0.0); }`)}export{r as ReadGlobalIllumination};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";const b=1;let x=class extends u{constructor(e){super(e),this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){let t=this.bindParameters.frameRendererTarget===1;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._emptyOutput:(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderScreenshot(r,i):this._renderInteractive(r,i))}_renderScreenshot(e,t){let n=this._emptyOutput,r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._emptyOutput;let n=this._mode===1?this._lowQualityResolutionScale:1,r=this.techniques.getCompiled(m,this._configuration),i=this.techniques.getCompiled(p),a=n<1,o=a?this.techniques.getCompiled(_):null;if(!r||!i||a&&!o)return this._requestRender(),this._emptyOutput;let s=this._renderAccumulationFrame(e,t,r,i,o,n);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(s),s}_renderAccumulationFrame(e,t,n,r,i,a=1){let s=this.bindParameters,c=this.renderingContext,{camera:u}=s;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/u.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:d,fullHeight:f}=u,p=Math.max(1,Math.floor(d*a)),m=Math.max(1,Math.floor(f*a)),h=this.fboCache.acquire(p,m,`global illumination input`).acquireColor(y,2);c.bindFramebuffer(h.fbo),c.setViewport(0,0,p,m),c.bindTechnique(n,s,this._passParameters,this._drawParameters),c.screen.draw();let g=Math.max(1,Math.round(p/1)),_=Math.max(1,Math.round(m/1)),v=this.fboCache.acquire(g,_,`global illumination blur horizontal`);c.bindFramebuffer(v.fbo);let b=h.obtainAttachment(y);this._drawParameters.texture=h.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,0,1/m),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),h.release();let x=this.fboCache.acquire(g,_,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);c.bindFramebuffer(x.fbo),c.setViewport(0,0,g,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.texture=v.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,1/g,0),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),v.release(),x.attachColor(b,y),b.release();let S=x;return i&&(S=this.fboCache.acquire(d,f,l.AMBIENT_ILLUMINATION).acquireColor(y,2),c.bindFramebuffer(S.fbo),c.setViewport(0,0,d,f),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParametersUpscale.colorTexture=x.getTexture(),this._drawParametersUpscale.weightTexture=x.getTexture(y),c.bindTechnique(i,s,this._passParameters,this._drawParametersUpscale),c.screen.draw(),x.release()),c.setViewport4fv(u.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,S}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return!!e.lastFrameColor&&(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};x=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],x);export{x as GlobalIllumination,b as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{waitRender as i}from"../../../../../core/scheduling.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as s,ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import{AmbientIllumination as u}from"../AmbientIllumination.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as m}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as h}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as g}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as _}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as v,ColorAttachment1 as y}from"../../../../webgl/enums.js";let b=class extends u{constructor(e){super(e),this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new g,this._configuration=new h,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(n(()=>this._mode,e=>{e===0?this._disable():this._enable()},r))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return this._mode===2}resetAccumulation(){!this._isGlobalIlluminationUpdate&&(this._passParameters.accumulatedFrames>100||!this._configuration.hasEmission)&&this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}get isAccumulating(){return this.enabled&&this._passParameters.accumulatedFrames<this._maxFrames}precompile(){this.techniques.getCompiled(_)}render(e){let t=this.bindParameters.frameRendererTarget===1;if(this._passParameters.accumulatedFrames>=this._maxFrames&&!t)return this._lastOutput?.retain(),this._lastOutput;let n=e.find(({name:e})=>e===`normals`),r=n?.getTexture(),i=n?.getTexture(v);return!r||!i||this._mode===0?this._emptyOutput:(this._configuration.hasEmission=!!this.bindParameters.reprojection.lastFrameEmission,t?this._renderScreenshot(r,i):this._renderInteractive(r,i))}_renderScreenshot(e,t){let n=this._emptyOutput,r=this._passParameters.accumulatedFrames,i=this._passParameters.temporalSampleFrame;this._passParameters.accumulatedFrames=0,this._passParameters.temporalSampleFrame=0;let a=this.techniques.get(m,this._configuration),o=this.techniques.get(p);for(;this._passParameters.accumulatedFrames<this._maxFrames;){this._passParameters.globalIllumination=n.getTexture(),this._passParameters.globalIlluminationWeights=n.getTexture(y);let r=this._renderAccumulationFrame(e,t,a,o);++this._passParameters.accumulatedFrames,n.release(),n=r}return this._passParameters.globalIllumination=null,this._passParameters.globalIlluminationWeights=null,this._passParameters.accumulatedFrames=r,this._passParameters.temporalSampleFrame=i,n}_renderInteractive(e,t){if(!this._canRender)return this._requestRender(),this._emptyOutput;let n=this._mode===1?this._lowQualityResolutionScale:1,r=this.techniques.getCompiled(m,this._configuration),i=this.techniques.getCompiled(p),a=n<1,o=a?this.techniques.getCompiled(_):null;if(!r||!i||a&&!o)return this._requestRender(),this._emptyOutput;let s=this._renderAccumulationFrame(e,t,r,i,o,n);return++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),this._storeOutput(s),s}_renderAccumulationFrame(e,t,n,r,i,a=1){let s=this.bindParameters,c=this.renderingContext,{camera:u}=s;this._passParameters.normalTexture=e,this._passParameters.depthTexture=t,this._passParameters.projScale=1/u.computeScreenPixelSizeAtDistance(1),this._passParameters.resolutionScale=a,this._passParameters.glowBoost=this._glowBoost;let{fullWidth:d,fullHeight:f}=u,p=Math.max(1,Math.floor(d*a)),m=Math.max(1,Math.floor(f*a)),h=this.fboCache.acquire(p,m,`global illumination input`).acquireColor(y,2);c.bindFramebuffer(h.fbo),c.setViewport(0,0,p,m),c.bindTechnique(n,s,this._passParameters,this._drawParameters),c.screen.draw();let g=Math.max(1,Math.round(p)),_=Math.max(1,Math.round(m)),v=this.fboCache.acquire(g,_,`global illumination blur horizontal`);c.bindFramebuffer(v.fbo);let b=h.obtainAttachment(y);this._drawParameters.texture=h.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,0,1/m),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),h.release();let x=this.fboCache.acquire(g,_,i?`global illumination blur vertical`:l.AMBIENT_ILLUMINATION);c.bindFramebuffer(x.fbo),c.setViewport(0,0,g,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.texture=v.getTexture(),this._drawParameters.weightTexture=b.attachment,o(this._drawParameters.blurSize,1/g,0),c.bindTechnique(r,s,this._passParameters,this._drawParameters),c.setViewport(0,0,g,_),c.screen.draw(),v.release(),x.attachColor(b,y),b.release();let S=x;return i&&(S=this.fboCache.acquire(d,f,l.AMBIENT_ILLUMINATION).acquireColor(y,2),c.bindFramebuffer(S.fbo),c.setViewport(0,0,d,f),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParametersUpscale.colorTexture=x.getTexture(),this._drawParametersUpscale.weightTexture=x.getTexture(y),c.bindTechnique(i,s,this._passParameters,this._drawParametersUpscale),c.screen.draw(),x.release()),c.setViewport4fv(u.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,S}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){let e=this.renderingContext,{fullWidth:t,fullHeight:n}=this.bindParameters.camera,r=this.fboCache.acquire(t,n,l.AMBIENT_ILLUMINATION).acquireColor(y,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,n),e.clearBuffer(0,s),e.clearBuffer(1,c),r}get _canRender(){let{reprojection:e,hasEmission:t,globalIllumination:n}=this.bindParameters;return!!e.lastFrameColor&&(!t||!!e.lastFrameEmission)&&!!e.lastFrameDepth&&!!n}get _glowBoost(){let e=this.view.environment.lighting.glow;return e==null?0:2+3*e.intensity}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){let e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){e.produces!==`disabled`&&(e._disable(),await i(),e._enable())}}}};b=e([a(`esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination`)],b);export{b as GlobalIllumination};
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import{glsl as e}from"../../core/shaderModules/glsl.js";function t(t){t.code.add(e`
3
- vec3 quantizeGlobalIlluminationColor(vec3 color) {
4
- vec3 clampedColor = clamp(color, vec3(0.0), vec3(1.0));
3
+ vec4 quantizeGlobalIlluminationColor(vec4 color) {
4
+ vec4 clampedColor = clamp(color, vec4(0.0), vec4(1.0));
5
5
  return floor(clampedColor * ${e.float(255)} + 0.5) * ${e.float(1/255)};
6
6
  }
7
7
  `)}export{t as GlobalIlluminationColorQuantization};
@@ -300,16 +300,13 @@ export interface SceneViewProperties extends ViewProperties, DOMContainerPropert
300
300
  */
301
301
  floors?: ReadonlyArrayOrCollection<string>;
302
302
  /**
303
- * Configures snapping, tooltips, and measurement units for supported components and analyses configured to inherit these options from the view.
304
- *
305
- * Snapping is enabled by default. Tooltips are disabled by default.
303
+ * Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses.
304
+ * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for supported options, exceptions, and opt-in requirements.
306
305
  *
307
306
  * > [!IMPORTANT]
308
307
  * >
309
308
  * > These options are not saved in a [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
310
309
  *
311
- * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for details.
312
- *
313
310
  * @beta
314
311
  * @since 5.2
315
312
  */
@@ -1117,16 +1114,13 @@ export default class SceneView extends SceneViewSuperclass {
1117
1114
  */
1118
1115
  get groundView(): GroundView;
1119
1116
  /**
1120
- * Configures snapping, tooltips, and measurement units for supported components and analyses configured to inherit these options from the view.
1121
- *
1122
- * Snapping is enabled by default. Tooltips are disabled by default.
1117
+ * Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses.
1118
+ * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for supported options, exceptions, and opt-in requirements.
1123
1119
  *
1124
1120
  * > [!IMPORTANT]
1125
1121
  * >
1126
1122
  * > These options are not saved in a [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
1127
1123
  *
1128
- * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for details.
1129
- *
1130
1124
  * @beta
1131
1125
  * @since 5.2
1132
1126
  */
package/views/View.d.ts CHANGED
@@ -162,17 +162,13 @@ export interface ViewProperties<TLayerView extends LayerView = LayerView> extend
162
162
  */
163
163
  navigation?: NavigationProperties;
164
164
  /**
165
- * Configures snapping, tooltips, and measurement units for supported components and analyses configured to inherit these options from the view.
166
- *
167
- * Snapping is disabled by default in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) and enabled by default in a
168
- * [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). Tooltips are disabled by default.
165
+ * Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses.
166
+ * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for supported options, exceptions, and opt-in requirements.
169
167
  *
170
168
  * > [!IMPORTANT]
171
169
  * >
172
170
  * > These options are not saved in a [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/) or [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
173
171
  *
174
- * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for details.
175
- *
176
172
  * @beta
177
173
  * @since 5.2
178
174
  */
@@ -603,17 +599,13 @@ export default abstract class View<TLayerView extends LayerView = LayerView> ext
603
599
  get navigation(): Navigation;
604
600
  set navigation(value: NavigationProperties);
605
601
  /**
606
- * Configures snapping, tooltips, and measurement units for supported components and analyses configured to inherit these options from the view.
607
- *
608
- * Snapping is disabled by default in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) and enabled by default in a
609
- * [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). Tooltips are disabled by default.
602
+ * Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses.
603
+ * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for supported options, exceptions, and opt-in requirements.
610
604
  *
611
605
  * > [!IMPORTANT]
612
606
  * >
613
607
  * > These options are not saved in a [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/) or [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
614
608
  *
615
- * See [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) for details.
616
- *
617
609
  * @beta
618
610
  * @since 5.2
619
611
  */
@@ -87,7 +87,7 @@ export type ToolType = "point" | "polygon" | "polyline" | "multipoint" | "rectan
87
87
  * view.graphics.removeAll();
88
88
  *
89
89
  * let line = createLine(vertices);
90
- * let lineLength = geometryEngine.geodesicLength(line, "miles");
90
+ * let lineLength = geodesicLengthExecute(line, { unit: "miles" });
91
91
  * let graphic = createGraphic(line);
92
92
  * view.graphics.add(graphic);
93
93
  * }