@arcgis/core 4.34.0-next.44 → 4.34.0-next.45

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 (183) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0494e1212dd94d927287.js +1 -0
  3. package/assets/esri/core/workers/chunks/{42c5d957813080143e5a.js → 09268dc856c3d5ce178f.js} +1 -1
  4. package/assets/esri/core/workers/chunks/092cb42b88ecfb9c4a07.js +1 -0
  5. package/assets/esri/core/workers/chunks/0f20c0eec850a39620a1.js +1 -0
  6. package/assets/esri/core/workers/chunks/129144cbdb3fcbb87baf.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b40845b45f8d7cd347a1.js → 17df0f766ee1e323d3fa.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{cf474c055a85bdbfa8d0.js → 19f1bfe815896d4983af.js} +1 -1
  9. package/assets/esri/core/workers/chunks/2370ff6c3006691ac688.js +1 -0
  10. package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +1 -0
  11. package/assets/esri/core/workers/chunks/{bb23371335ac049861e6.js → 28a85997c9003cacdefb.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{9d9a7333a968065b53a1.js → 2942ab268f24cea2e722.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{3a2cbfb03103c402c6c5.js → 2b75212c31145cc07d16.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{5958598da96464128aed.js → 2f65081bfedeab44d6cb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/33f3e3d05429f845c139.js +1 -0
  16. package/assets/esri/core/workers/chunks/379a4f664e77ad1fffe9.js +1 -0
  17. package/assets/esri/core/workers/chunks/45b450c045d5fadf71b6.js +1 -0
  18. package/assets/esri/core/workers/chunks/4c6862ad3af947c704f7.js +1 -0
  19. package/assets/esri/core/workers/chunks/4d544e3e19ce07c2c195.js +1 -0
  20. package/assets/esri/core/workers/chunks/{6759319f3fd2d03c446b.js → 5c556468e2a598ab793a.js} +1 -1
  21. package/assets/esri/core/workers/chunks/64c31c90e4c589ca2f04.js +1 -0
  22. package/assets/esri/core/workers/chunks/709dc98379f4ce18a0b5.js +1 -0
  23. package/assets/esri/core/workers/chunks/73140c5c0beda7ea3703.js +1 -0
  24. package/assets/esri/core/workers/chunks/{ff34fdda7899e784ac73.js → 7c7338af011b8f0d7218.js} +1 -1
  25. package/assets/esri/core/workers/chunks/838998bfda90f099c6e9.js +1 -0
  26. package/assets/esri/core/workers/chunks/84f3e1ce25c36e46fd2a.js +1 -0
  27. package/assets/esri/core/workers/chunks/{c6da9ba188b627ab3b79.js → 8aa77a5e82c033512b45.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{b1c2e5e0a70fb5d27da5.js → 8bab4c59c9b644224ecb.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f4b145feab275b268c2e.js → 8cc700da2ac58849a708.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{28d71e1b866113650c75.js → 8e36693e5213c20158d7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1acc620bfd2983d6853f.js → 8fae35af98c29bef8500.js} +1 -1
  32. package/assets/esri/core/workers/chunks/914eaed113dda727eb47.js +1 -0
  33. package/assets/esri/core/workers/chunks/98175b454e807b1a3c5f.js +1 -0
  34. package/assets/esri/core/workers/chunks/9a20be3b02c9d6349b8d.js +1 -0
  35. package/assets/esri/core/workers/chunks/9d30fed26e0d84ef893b.js +1 -0
  36. package/assets/esri/core/workers/chunks/a1ff4c252012d5026133.js +1 -0
  37. package/assets/esri/core/workers/chunks/{ddeaf688d72b2873c4ac.js → a2a13dd95238bb144479.js} +1 -1
  38. package/assets/esri/core/workers/chunks/a34d98abcf958a632b0f.js +1 -0
  39. package/assets/esri/core/workers/chunks/a3a23a56df4e5ee86bb2.js +1 -0
  40. package/assets/esri/core/workers/chunks/{5ae6e2b3557fe8730072.js → b287624909578d307e07.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{5b91a49202129eedaf00.js → b4304673696fc0774bff.js} +1 -1
  42. package/assets/esri/core/workers/chunks/b45772b72f2b8f4fd53f.js +1 -0
  43. package/assets/esri/core/workers/chunks/c645009f3d2576494bfc.js +1 -0
  44. package/assets/esri/core/workers/chunks/ce569860b170700e9b31.js +1 -0
  45. package/assets/esri/core/workers/chunks/cf5db995ba88912cf6b7.js +1 -0
  46. package/assets/esri/core/workers/chunks/{2aac5d560e4c5defe882.js → cff15600d0ec7b19dffb.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{7e99fc78bd0f40a8ba81.js → d1c97fdcba6eb443cb1c.js} +1 -1
  48. package/assets/esri/core/workers/chunks/d70e1b8b8bee88a7a5b8.js +353 -0
  49. package/assets/esri/core/workers/chunks/da396fdbd6f213042aa7.js +1 -0
  50. package/assets/esri/core/workers/chunks/dd0f1e06b7df953ea223.js +1 -0
  51. package/assets/esri/core/workers/chunks/dd79d3aa6e1a8aee6881.js +1 -0
  52. package/assets/esri/core/workers/chunks/e1272db232194cbe102c.js +1 -0
  53. package/assets/esri/core/workers/chunks/{14b536e0c1de6c7422bc.js → e408ccee12bfe089c913.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{7f2bdb8da5c9ffd7d05e.js → e58336aafe8c95bb6831.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{30b9c131b69297ee186f.js → e59e09766b130a05c617.js} +1 -1
  56. package/assets/esri/core/workers/chunks/e65fc26f4384a328a753.js +1 -0
  57. package/assets/esri/core/workers/chunks/{e3f5afdf133c58b3d161.js → ea262087938335fed19f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{aaab7694eb333ad480f5.js → ec9fd49e0252797f7f6a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{655b8d24ffe5405f8ba1.js → f2a2d3cda4a3dc0a8caf.js} +1 -1
  60. package/assets/esri/core/workers/chunks/f67997250569069ee2ef.js +1 -0
  61. package/assets/esri/core/workers/chunks/fc3a6f2f99629e57dbbd.js +1 -0
  62. package/assets/esri/core/workers/chunks/ff9eef1940eaa3406223.js +1 -0
  63. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  64. package/chunks/bundle.js +1 -1
  65. package/config.js +1 -1
  66. package/core/workers/registry.js +1 -1
  67. package/geometry/operators/json/generalizeOperator.js +5 -0
  68. package/geometry/operators/json/simplifyOperator.js +1 -1
  69. package/interfaces.d.ts +3 -3
  70. package/kernel.js +1 -1
  71. package/layers/ParquetLayer.js +1 -1
  72. package/layers/SubtypeGroupLayer.js +1 -1
  73. package/layers/graphics/data/QueryEngine.js +1 -1
  74. package/layers/graphics/data/QueryEngineResult.js +1 -1
  75. package/layers/graphics/sources/ParquetSource.js +1 -1
  76. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  77. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  78. package/layers/graphics/sources/support/ParquetSourceWorker.js +5 -0
  79. package/layers/mixins/ArcGISImageService.js +1 -1
  80. package/layers/support/fieldUtils.js +1 -1
  81. package/layers/support/parquetUtils.js +1 -1
  82. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  83. package/libs/parquet/parquet.js +1 -1
  84. package/networks/RulesTable.js +1 -1
  85. package/package.json +1 -1
  86. package/smartMapping/statistics/support/statsWorker.js +1 -1
  87. package/support/revision.js +1 -1
  88. package/symbols/cim/CIMEffects.js +1 -1
  89. package/symbols/cim/CIMResourceManager.js +1 -1
  90. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  91. package/symbols/cim/CIMSymbolHelper.js +1 -1
  92. package/symbols/cim/cimAnalyzer.js +1 -1
  93. package/symbols/cim/effects/CIMEffectHelper.js +1 -1
  94. package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
  95. package/symbols/cim/effects/EffectArrow.js +1 -1
  96. package/symbols/cim/effects/EffectBuffer.js +1 -1
  97. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  98. package/symbols/cim/effects/EffectCut.js +1 -1
  99. package/symbols/cim/effects/EffectDashes.js +1 -1
  100. package/symbols/cim/effects/EffectDonut.js +1 -1
  101. package/symbols/cim/effects/EffectEnclosingPolygon.js +1 -1
  102. package/symbols/cim/effects/EffectJog.js +1 -1
  103. package/symbols/cim/effects/EffectMove.js +1 -1
  104. package/symbols/cim/effects/EffectOffset.js +1 -1
  105. package/symbols/cim/effects/EffectRadial.js +1 -1
  106. package/symbols/cim/effects/EffectReverse.js +1 -1
  107. package/symbols/cim/effects/EffectRotate.js +1 -1
  108. package/symbols/cim/effects/EffectScale.js +1 -1
  109. package/symbols/cim/effects/EffectSuppress.js +1 -1
  110. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  111. package/symbols/cim/effects/EffectWave.js +1 -1
  112. package/symbols/cim/fitVectorMarker.js +1 -1
  113. package/symbols/cim/placements/CIMMarkerPlacementHelper.js +1 -1
  114. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  115. package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
  116. package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
  117. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  118. package/symbols/cim/placements/PlacementOnLine.js +1 -1
  119. package/symbols/cim/placements/PlacementOnVertices.js +1 -1
  120. package/symbols/cim/placements/PlacementPolygonCenter.js +1 -1
  121. package/symbols/cim/utils.js +1 -1
  122. package/views/2d/engine/webgl/TextureManager.js +1 -1
  123. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  124. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  125. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  126. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  127. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +1 -1
  128. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  129. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  130. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  131. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  132. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  133. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  134. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  135. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  136. package/views/support/TextureCompressionWorker.js +1 -1
  137. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  138. package/widgets/BatchAttributeForm.js +1 -1
  139. package/widgets/CatalogLayerList.js +1 -1
  140. package/widgets/CoordinateConversion/support/Format.js +1 -1
  141. package/widgets/Editor/UpdateWorkflow.js +1 -1
  142. package/widgets/Editor/workflowUtils.js +1 -1
  143. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  144. package/widgets/Feature/FeatureRelationship.js +1 -1
  145. package/widgets/Feature/FeatureViewModel.js +1 -1
  146. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  147. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  148. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  149. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  150. package/widgets/Print.js +1 -1
  151. package/widgets/Sketch/SketchViewModel.js +1 -1
  152. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  153. package/widgets/support/SnappingControls.js +1 -1
  154. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  155. package/assets/esri/core/workers/chunks/03df4668002eb4cb4f98.js +0 -1
  156. package/assets/esri/core/workers/chunks/087ae1e3e767f0e678e5.js +0 -1
  157. package/assets/esri/core/workers/chunks/0b45566fad2cbb03fea1.js +0 -1
  158. package/assets/esri/core/workers/chunks/0d73afce787ee1e76b21.js +0 -1
  159. package/assets/esri/core/workers/chunks/21dd626a5b5ea6a7e18e.js +0 -1
  160. package/assets/esri/core/workers/chunks/24e76fa530fc0c495fb5.js +0 -1
  161. package/assets/esri/core/workers/chunks/2a26c3fc324d672ebe88.js +0 -1
  162. package/assets/esri/core/workers/chunks/3984ca7e05f30724adaf.js +0 -1
  163. package/assets/esri/core/workers/chunks/439128f23fa091633d2d.js +0 -1
  164. package/assets/esri/core/workers/chunks/489391ed1d443140617d.js +0 -1
  165. package/assets/esri/core/workers/chunks/774844eea928efa811f2.js +0 -1
  166. package/assets/esri/core/workers/chunks/7b82ed4cc475c782256b.js +0 -1
  167. package/assets/esri/core/workers/chunks/7ef29640de297a0cf744.js +0 -1
  168. package/assets/esri/core/workers/chunks/8867368ab9b005460f19.js +0 -353
  169. package/assets/esri/core/workers/chunks/8c3c752408fac3db05cf.js +0 -1
  170. package/assets/esri/core/workers/chunks/8ca95499e00ce8b0af9a.js +0 -1
  171. package/assets/esri/core/workers/chunks/97fc21355efc7b289f3b.js +0 -1
  172. package/assets/esri/core/workers/chunks/9cd9b22354dbdf1b1df0.js +0 -1
  173. package/assets/esri/core/workers/chunks/a89c060ad302381aaf7d.js +0 -1
  174. package/assets/esri/core/workers/chunks/af98c7546be409303213.js +0 -1
  175. package/assets/esri/core/workers/chunks/b01a90ce699058307bc2.js +0 -1
  176. package/assets/esri/core/workers/chunks/c110941e87923ba47193.js +0 -1
  177. package/assets/esri/core/workers/chunks/d93b24e863379116b2aa.js +0 -1
  178. package/assets/esri/core/workers/chunks/da6f46211551a96dce19.js +0 -1
  179. package/assets/esri/core/workers/chunks/dd9be173cddc16a354ed.js +0 -1
  180. package/assets/esri/core/workers/chunks/e6d08230adb90b9a2a17.js +0 -1
  181. package/assets/esri/core/workers/chunks/eb7dd722e4cd7f83b3f5.js +0 -1
  182. package/assets/esri/core/workers/chunks/f1adf8ebc2c1b93857bf.js +0 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/loadGeometryEngine.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import _ from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./Rect.js";import w from"./SDFConverter.js";import S from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as z}from"./urlUtils.js";import{charCodes as C,getCIMMarkerPlacementHash as T,isSVGImage as R}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as P}from"./animations/store/AnimationStore.js";const b="arial-unicode-ms-regular",$=()=>a.getLogger("esri.views.MapView"),j=(e,t,i)=>$().error(new s(e,t,i)),v=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFonts=new Set,this._sdfConverter=new w(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new P,this._spriteMosaic=new S(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return j("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new I(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return j("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(0,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case 1:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return j("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=k.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFonts.has(n),[c,h]=i(a),l=C(c);try{const e=o?b:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){v(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(n);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(b,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${T(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(z(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},A(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally(()=>this._ongoingRasterizations.delete(e)),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},A(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=A(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(B(r)||N(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(R(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},A(e),u,!1)}catch(j){if(!o(j))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${j.message}`);throw j}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function A(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||G(e)),O=e=>null!=e&&e.startsWith("data:image/png"),N=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import r from"../../../../core/Error.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import _ from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./Rect.js";import w from"./SDFConverter.js";import S from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as z}from"./urlUtils.js";import{charCodes as C,getCIMMarkerPlacementHash as T,isSVGImage as R}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as P}from"./animations/store/AnimationStore.js";const b="arial-unicode-ms-regular",$=()=>a.getLogger("esri.views.MapView"),j=(e,t,i)=>$().error(new r(e,t,i)),v=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFonts=new Set,this._sdfConverter=new w(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(s){if(!o(s))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new P,this._spriteMosaic=new S(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return j("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new I(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return j("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size,texture:{texture:r.texture,unit:"sprite"===r.type?f:y}}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const r=this._bindingInfos[t-1],s=r.page,a="Nearest"===r.samplingMode?9728:i?9987:9729;switch(r.mosaicType){case 0:{const t=[this.sprites.getWidth(s),this.sprites.getHeight(s)],i=this._spriteMosaic.getTexture(e,s);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case 1:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,s);return this._glyphMosaic.bind(e,a,s,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return j("mapview-texture-manager",`Cannot handle unknown type ${r.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:r,textString:a}=e,n=s(r),o=this._invalidFonts.has(n),[c,h]=i(a),l=C(c);try{const e=o?b:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){v(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(n);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(b,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${T(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(z(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},A(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[g,g],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},A(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=A(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const s=e.url;if(B(s)||N(s))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let r;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)r=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...i});r=e}if(R(s))if("width"in e&&"height"in e)r.width=h(e.width),r.height=h(e.height);else if("cim"in e){const t=e;r.width=h(t.width??t.scaleX*t.size),r.height=h(t.size)}if(!r.width||!r.height)return null;const n=r.width,o=r.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,r,c);return this._addItemToMosaic(t,l,{type:"static",data:p},A(e),u,!1)}catch(j){if(!o(j))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${j.message}`);throw j}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function A(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||G(e)),O=e=>null!=e&&e.startsWith("data:image/png"),N=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as i}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as s}from"../../../definitions.js";import{AAnimatedMeshWriter as o}from"./AnimatedMeshWriter.js";import{angle as n,sizing as a,animationPointerAndBaseSizeAndReferenceSize as c,uv as l,offset as m,pos as d,bitset as p,id as h,lineLength as u,value1Position2Value2 as f,zoomRange as y}from"./attributes.js";import{createComputedAnimatedMeshParams as x}from"./ComputedAnimatedParams.js";import{getGeometryEngine as P}from"../mesh/loadGeometryEngine.js";import{c256ToRad as M}from"../shaders/constants.js";const g=64,w=64,v=2;class _ extends o{get vertexSpec(){return{createComputedParams:x,optionalAttributes:{zoomRange:y,value1Position2Value2:f,lineLength:u},attributes:{id:h,bitset:p,pos:d,offset:m.marker,uv:l.marker,animationPointerAndBaseSizeAndReferenceSize:c,sizing:a,angle:n}}}_write(e,t){const i=this.evaluatedMeshParams.sprite,{textureBinding:r}=i;e.recordStart(this.instanceId,this.attributeLayout,r);const s=t.getDisplayId();if(this.shift&&"esriGeometryPolyline"===t.geometryType)this._writeParticles(e,t);else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t);else if("esriGeometryPolygon"===t.geometryType){const i=t.readCentroidForDisplay();if(!i)return;const[r,o]=i.coords;this._writeQuad(e,s,r,o)}else if("esriGeometryPoint"===t.geometryType){const i=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,s,i,r)}else{const i=t.readGeometryForDisplay();i&&i.forEachVertex((t,i)=>{this._writeQuad(e,s,t,i)})}e.recordEnd()}_writePlacedMarkers(s,o){const n=t.fromFeatureSetReaderCIM(o)?.clone();if(!n)return;const a=-1,c=r.getPlacement(n,a,this.evaluatedMeshParams.placement,e(1),s.id,P());if(!c)return;const l=o.getDisplayId();let m=c.next(),d=null;for(;null!=m;){const e=m.tx,t=-m.ty;if(Math.abs(e)>i||Math.abs(t)>i){m=c.next();continue}const r=-m.getAngle();s.recordBounds(e,t,g,w),this.shift?d&&this._writeQuad(s,l,d[0],d[1],void 0,r):this._writeQuad(s,l,e,t,void 0,r),d=[e,t],m=c.next()}}_writeParticles(e,t){const i=t.getDisplayId(),r=t.readGeometryForDisplay();if(!r)return;const s=[];r.forEachVertex((e,t)=>{s.push([e,t])});const o=b(s);let n=0;for(let l=1;l<s.length;l++){const e=s[l][0]-s[l-1][0],t=s[l][1]-s[l-1][1],i=Math.sqrt(e*e+t*t);n+=i}const a=t=>{for(const r of o){const{a:s,b:o}=r;this._writeQuad(e,i,s.position[0],s.position[1],[s.distance-t,o.position[0],o.position[1],o.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(s.direction[1],s.direction[0]):0,n,!0)}},{placement:c}=this.evaluatedMeshParams;if(!c||"placementTemplate"in c||"CIMMarkerPlacementOnVertices"===c.type){let e;if(c&&"CIMMarkerPlacementOnVertices"!==c.type)e=c.placementTemplate;else{e=[0];for(const t of o){const{a:i,b:r}=t,s=i.position[0]-r.position[0],o=i.position[1]-r.position[1],n=Math.sqrt(s*s+o*o);e.push(n)}}let t=-1*n;for(;t<(1+v/2)*n;)for(const i of e)t+=i,a(t)}else"CIMMarkerPlacementAtExtremities"===c.type?"JustBegin"===c.extremityPlacement?a(1):"JustEnd"===c.extremityPlacement?(a(n-1),a(-1)):"Both"===c.extremityPlacement&&(a(1),a(n-1)):"CIMMarkerPlacementOnLine"===c.type&&a(n/2)}_writeQuad(e,t,i,r,o,n=0,a=0,c=!1){const l=this.evaluatedMeshParams.sprite,{rect:m}=l,d=m.x+s,p=m.y+s,h=m.x+m.width-s,u=m.y+m.height-s,f=e.vertexCount();c||e.recordBounds(i,r,g,g);const y={texXmin:d,texYmin:p,texXmax:h,texYmax:u,value1Position2Value2:o,angle:n/M,lineLength:a};for(let s=0;s<4;s++)this._writeVertex(e,t,i,r,y);e.indexEnsureSize(6),e.indexWrite(f),e.indexWrite(f+1),e.indexWrite(f+2),e.indexWrite(f+1),e.indexWrite(f+3),e.indexWrite(f+2)}}function b(e){const t=[];let i=0;for(let r=1;r<e.length;r++){const s=e[r-1],o=e[r],n=o[0]-s[0],a=o[1]-s[1],c=Math.sqrt(n*n+a*a),l=n/c,m=a/c;t.push({a:{position:s,distance:i,direction:[l,m]},b:{position:o,distance:i+c,direction:[l,m]}}),i+=c}return t}class C extends _{constructor(){super(...arguments),this.shift=!1}}class j extends _{constructor(){super(...arguments),this.shift=!0}}export{C as AnimatedMarkerMeshWriter,j as AnimatedMarkerShiftMeshWriter};
5
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as i}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as s}from"../../../definitions.js";import{AAnimatedMeshWriter as o}from"./AnimatedMeshWriter.js";import{angle as n,sizing as a,animationPointerAndBaseSizeAndReferenceSize as c,uv as l,offset as m,pos as d,bitset as p,id as h,lineLength as u,value1Position2Value2 as f,zoomRange as y}from"./attributes.js";import{createComputedAnimatedMeshParams as x}from"./ComputedAnimatedParams.js";import{c256ToRad as P}from"../shaders/constants.js";const M=64,g=64,w=2;class v extends o{get vertexSpec(){return{createComputedParams:x,optionalAttributes:{zoomRange:y,value1Position2Value2:f,lineLength:u},attributes:{id:h,bitset:p,pos:d,offset:m.marker,uv:l.marker,animationPointerAndBaseSizeAndReferenceSize:c,sizing:a,angle:n}}}_write(e,t){const i=this.evaluatedMeshParams.sprite,{textureBinding:r}=i;e.recordStart(this.instanceId,this.attributeLayout,r);const s=t.getDisplayId();if(this.shift&&"esriGeometryPolyline"===t.geometryType)this._writeParticles(e,t);else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t);else if("esriGeometryPolygon"===t.geometryType){const i=t.readCentroidForDisplay();if(!i)return;const[r,o]=i.coords;this._writeQuad(e,s,r,o)}else if("esriGeometryPoint"===t.geometryType){const i=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,s,i,r)}else{const i=t.readGeometryForDisplay();i&&i.forEachVertex((t,i)=>{this._writeQuad(e,s,t,i)})}e.recordEnd()}_writePlacedMarkers(s,o){const n=t.fromFeatureSetReaderCIM(o)?.clone();if(!n)return;const a=-1,c=r.getPlacement(n,a,this.evaluatedMeshParams.placement,e(1),s.id);if(!c)return;const l=o.getDisplayId();let m=c.next(),d=null;for(;null!=m;){const e=m.tx,t=-m.ty;if(Math.abs(e)>i||Math.abs(t)>i){m=c.next();continue}const r=-m.getAngle();s.recordBounds(e,t,M,g),this.shift?d&&this._writeQuad(s,l,d[0],d[1],void 0,r):this._writeQuad(s,l,e,t,void 0,r),d=[e,t],m=c.next()}}_writeParticles(e,t){const i=t.getDisplayId(),r=t.readGeometryForDisplay();if(!r)return;const s=[];r.forEachVertex((e,t)=>{s.push([e,t])});const o=_(s);let n=0;for(let l=1;l<s.length;l++){const e=s[l][0]-s[l-1][0],t=s[l][1]-s[l-1][1],i=Math.sqrt(e*e+t*t);n+=i}const a=t=>{for(const r of o){const{a:s,b:o}=r;this._writeQuad(e,i,s.position[0],s.position[1],[s.distance-t,o.position[0],o.position[1],o.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(s.direction[1],s.direction[0]):0,n,!0)}},{placement:c}=this.evaluatedMeshParams;if(!c||"placementTemplate"in c||"CIMMarkerPlacementOnVertices"===c.type){let e;if(c&&"CIMMarkerPlacementOnVertices"!==c.type)e=c.placementTemplate;else{e=[0];for(const t of o){const{a:i,b:r}=t,s=i.position[0]-r.position[0],o=i.position[1]-r.position[1],n=Math.sqrt(s*s+o*o);e.push(n)}}let t=-1*n;for(;t<(1+w/2)*n;)for(const i of e)t+=i,a(t)}else"CIMMarkerPlacementAtExtremities"===c.type?"JustBegin"===c.extremityPlacement?a(1):"JustEnd"===c.extremityPlacement?(a(n-1),a(-1)):"Both"===c.extremityPlacement&&(a(1),a(n-1)):"CIMMarkerPlacementOnLine"===c.type&&a(n/2)}_writeQuad(e,t,i,r,o,n=0,a=0,c=!1){const l=this.evaluatedMeshParams.sprite,{rect:m}=l,d=m.x+s,p=m.y+s,h=m.x+m.width-s,u=m.y+m.height-s,f=e.vertexCount();c||e.recordBounds(i,r,M,M);const y={texXmin:d,texYmin:p,texXmax:h,texYmax:u,value1Position2Value2:o,angle:n/P,lineLength:a};for(let s=0;s<4;s++)this._writeVertex(e,t,i,r,y);e.indexEnsureSize(6),e.indexWrite(f),e.indexWrite(f+1),e.indexWrite(f+2),e.indexWrite(f+1),e.indexWrite(f+3),e.indexWrite(f+2)}}function _(e){const t=[];let i=0;for(let r=1;r<e.length;r++){const s=e[r-1],o=e[r],n=o[0]-s[0],a=o[1]-s[1],c=Math.sqrt(n*n+a*a),l=n/c,m=a/c;t.push({a:{position:s,distance:i,direction:[l,m]},b:{position:o,distance:i+c,direction:[l,m]}}),i+=c}return t}class b extends v{constructor(){super(...arguments),this.shift=!1}}class C extends v{constructor(){super(...arguments),this.shift=!0}}export{b as AnimatedMarkerMeshWriter,C as AnimatedMarkerShiftMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as m}from"../../../definitions.js";import{processColorInput as u,getMinMaxZoom as d,packByteSqrt as p,getBitMask as h}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as f}from"./ComputedMarkerParams.js";import{MarkerConstants as y}from"./markerConstants.js";import{getGeometryEngine as M}from"../mesh/loadGeometryEngine.js";import{MeshWriter as x}from"../mesh/MeshWriter.js";import{DataType as P}from"../../../../../../webgl/enums.js";const g=3.14159265359/180,k=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function v(e){return b(e*k,256)}function S(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*g*-n),l}const I={createComputedParams:e=>f.from(e),optionalAttributes:{zoomRange:{type:P.SHORT,count:2,packPrecisionFactor:m,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:P.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:P.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:P.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=h(y.bitset.isSDF)),1===t&&(a|=h(y.bitset.isMapAligned)),r&&(a|=h(y.bitset.scaleSymbolsProportionally)),o&&(a|=h(y.bitset.overrideOutlineColor)),s&&(a|=h(y.bitset.colorLocked)),a}},offset:{type:P.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=S(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:P.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[p(s,128),p(r,128),p(o,128),0]}},placementAngle:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>v(e)},sdfDecodeCoeff:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends x{constructor(){super(...arguments),this.vertexSpec=I}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),l=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,u=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,p=-this.evaluatedMeshParams.offsetY+u;if(null!=this.evaluatedMeshParams.placement){let o=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(o=n(r,2*e,!1),null===o)return}this._writePlacedMarkers(e,t,o,i,l)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+p,i,l),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+p,i,l),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+p,i,l),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+d,r+p,i,l),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id,M());if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{_ as MarkerMeshWriter,I as MarkerVertexSpec};
5
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as m}from"../../../definitions.js";import{processColorInput as u,getMinMaxZoom as d,packByteSqrt as p,getBitMask as h}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as f}from"./ComputedMarkerParams.js";import{MarkerConstants as y}from"./markerConstants.js";import{MeshWriter as M}from"../mesh/MeshWriter.js";import{DataType as x}from"../../../../../../webgl/enums.js";const P=3.14159265359/180,g=128/Math.PI;function k(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return k(e*g,256)}function v(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*P*-n),l}const S={createComputedParams:e=>f.from(e),optionalAttributes:{zoomRange:{type:x.SHORT,count:2,packPrecisionFactor:m,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:x.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:x.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:x.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=h(y.bitset.isSDF)),1===t&&(a|=h(y.bitset.isMapAligned)),r&&(a|=h(y.bitset.scaleSymbolsProportionally)),o&&(a|=h(y.bitset.overrideOutlineColor)),s&&(a|=h(y.bitset.colorLocked)),a}},offset:{type:x.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=v(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:x.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:x.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[p(s,128),p(r,128),p(o,128),0]}},placementAngle:{type:x.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:x.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class I extends M{constructor(){super(...arguments),this.vertexSpec=S}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),l=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,u=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,p=-this.evaluatedMeshParams.offsetY+u;if(null!=this.evaluatedMeshParams.placement){let o=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(o=n(r,2*e,!1),null===o)return}this._writePlacedMarkers(e,t,o,i,l)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+p,i,l),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+p,i,l),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+p,i,l),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+d,r+p,i,l),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id);if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{I as MarkerMeshWriter,S as MarkerVertexSpec};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{CIMEffectHelper as t}from"../../../../../../../symbols/cim/effects/CIMEffectHelper.js";import{loadGeometryEngine as r,getGeometryEngine as s}from"./loadGeometryEngine.js";import{MeshWriterVertexPack as a}from"./MeshWriterVertexPack.js";function i(e){if(!e)return!1;for(const t of e)switch(t.effect.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectDonut":case"CIMGeometricEffectOffset":case"CIMGeometricEffectTaperedPolygon":case"CIMGeometricEffectEnclosingPolygon":return!0}return!1}class c{constructor(e,t,r,s){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=r,this._viewParams=s,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=a.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){i(this.effectInfos)&&await r()}enqueueRequest(e,t,r){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,r)}write(e,t,r,s,a){this.ensurePacked(t,r,s);const i=this.evaluatedMeshParams.effects;if(!i||0===i.length)return void this._write(e,r,void 0,a);const c=this.getEffectCursor(e,r,i);if(!c)return;let n;for(;n=c.next();)n.invertY(),this._write(e,r,n,a)}ensurePacked(e,t,r){if(!this._evaluator.hasDynamicProperties)return;const s=this._evaluator.evaluateMeshParams(e,t,r);this._vertexPack.pack(s,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,r,s,a){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,r,s,i,a)}getEffectCursor(r,a,i){const c=a.readGeometryForDisplay()?.clone();if(!c)return;const n=e.fromOptimizedCIM(c,a.geometryType),o=s();n.invertY();const f=r.id||"";return t.executeEffects(i,n,f,o,this._preventEffectClipping)}}export{c as MeshWriter};
5
+ import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t}from"../../../../../../../symbols/cim/CIMEffects.js";import{CIMEffectHelper as r}from"../../../../../../../symbols/cim/effects/CIMEffectHelper.js";import{MeshWriterVertexPack as s}from"./MeshWriterVertexPack.js";class a{constructor(e,t,r,s){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=r,this._viewParams=s,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=s.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e)}enqueueRequest(e,t,r){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,r)}write(e,t,r,s,a){this.ensurePacked(t,r,s);const i=this.evaluatedMeshParams.effects;if(!i||0===i.length)return void this._write(e,r,void 0,a);const n=this.getEffectCursor(e,r,i);if(!n)return;let c;for(;c=n.next();)c.invertY(),this._write(e,r,c,a)}ensurePacked(e,t,r){if(!this._evaluator.hasDynamicProperties)return;const s=this._evaluator.evaluateMeshParams(e,t,r);this._vertexPack.pack(s,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,r,s,a){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,r,s,i,a)}getEffectCursor(t,s,a){const i=s.readGeometryForDisplay()?.clone();if(!i)return;const n=e.fromOptimizedCIM(i,s.geometryType);n.invertY();const c=t.id||"";return r.executeEffects(a,n,c,this._preventEffectClipping)}}export{a as MeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as h}from"../../../definitions.js";import{shapeGlyphs as f}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as p,packBitset as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{getGeometryEngine as u}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as y}from"../shaders/constants.js";import{TextMeshTransformProps as S}from"./TextParams.js";import{DataType as _}from"../../../../../../webgl/enums.js";const P=28,b=[4,4],T=[16,4],k={topLeft:T,topRight:T,bottomLeft:T,bottomRight:T},z=[4,2],B=[4,6],R={topLeft:z,topRight:z,bottomLeft:B,bottomRight:B},M={topLeft:z,topRight:B,bottomLeft:z,bottomRight:B},L={topLeft:B,topRight:B,bottomLeft:b,bottomRight:b},w={topLeft:b,topRight:b,bottomLeft:B,bottomRight:B},I={topLeft:B,topRight:b,bottomLeft:B,bottomRight:b},E={topLeft:b,topRight:B,bottomLeft:b,bottomRight:B},G={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||P]},clipAngle:{type:_.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>N(t||0)},referenceSymbol:{type:_.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{const r=t.isLineLabel||!t.referenceBounds,n=i(r?"center":o.horizontalAlignment),a=s(r?"middle":o.verticalAlignment),{offsetX:c,offsetY:l,size:h}=r?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(c),-e(l),Math.round(e(h)),n+1<<2|a+1]}},visibility:{type:_.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:_.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:_.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:_.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>m([[x,t],[y,!!e]])},offset:{type:_.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:_.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>[Math.round(e(t)),Math.round(e(o??t))]},outlineColor:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>p(t)},haloColor:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>p(t)},outlineAndHaloSize:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class A extends g{constructor(){super(...arguments),this.vertexSpec=G,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new S(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,i,e,o,r,0))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,u());if(!l)return;const h=i.getDisplayId();let f=l.next();for(;null!=f;){const e=f.tx,o=-f.ty,r=-f.getAngle();this._writeGlyphs(t,h,e,o,s,r),f=l.next()}}_getShaping(o){const r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const s=e(r.fontSize),n=e(r.offsetX),p=e(r.offsetY),m=t(e(i.lineWidth),c,a),d=l*t(i.lineHeightRatio,.25,4);return f(i.glyphs,{scale:s/h,angle:r.postAngle,xOffset:n,yOffset:p,horizontalAlignment:i.horizontalAlignment,verticalAlignment:o||i.verticalAlignment,maxLineWidth:m,lineHeight:d,decoration:i.decoration,borderLineSizePx:e(i.boxBorderLineSize),hasBackground:!!i.boxBackgroundColor,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a,c,l=!0){const h=this.evaluatedMeshParams,f=this._textMeshTransformProps,m=e(f.fontSize),u=f.haloSize,g=f.outlineSize,x=e(f.offsetX),y=e(f.offsetY),[S,_]=d(h.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const P=s.bounds,b=r+P.x+x,T=i+P.y-y,k=2*(h.minPixelBuffer?h.minPixelBuffer/m:1),z=Math.max(P.width,P.height)*k;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),l&&t.recordBounds(b,T,z,z),this._writeTextBox(t,o,r,i,s.textBox,a,c),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),l&&t.recordBounds(b,T,z,z);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:m,haloSize:u,outlineSize:g,color:p(h.color),isBackground:!1,referenceBounds:a,minZoom:S,maxZoom:_,...c}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:h}=this._textMeshTransformProps,{boxBackgroundColor:f,boxBorderLineColor:m}=a,d={isBackground:!0,fontSize:c,haloSize:l,outlineSize:h,referenceBounds:s,...n};f&&(this._writeQuad(t,e,o,r,{texcoords:k,offsets:i.main,color:p(f),...d}),m||(this._writeQuad(t,e,o,r,{texcoords:L,offsets:i.top,color:p(f),...d}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.bot,color:p(f),...d}),this._writeQuad(t,e,o,r,{texcoords:I,offsets:i.left,color:p(f),...d}),this._writeQuad(t,e,o,r,{texcoords:E,offsets:i.right,color:p(f),...d}))),m&&(this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.top,color:p(m),...d}),this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.bot,color:p(m),...d}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.left,color:p(m),...d}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.right,color:p(m),...d}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const N=t=>Math.round(t*(254/360));export{A as TextMeshWriter,G as TextVertexSpec,P as maxLabelZoom};
5
+ import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as i}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as r,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as h}from"../../../definitions.js";import{shapeGlyphs as f}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as p,packBitset as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{MeshWriter as u}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as g,bitsetTextIsMapAligned as x}from"../shaders/constants.js";import{TextMeshTransformProps as y}from"./TextParams.js";import{DataType as S}from"../../../../../../webgl/enums.js";const _=28,P=[4,4],b=[16,4],T={topLeft:b,topRight:b,bottomLeft:b,bottomRight:b},k=[4,2],z=[4,6],B={topLeft:k,topRight:k,bottomLeft:z,bottomRight:z},R={topLeft:k,topRight:z,bottomLeft:k,bottomRight:z},M={topLeft:z,topRight:z,bottomLeft:P,bottomRight:P},L={topLeft:P,topRight:P,bottomLeft:z,bottomRight:z},w={topLeft:z,topRight:P,bottomLeft:z,bottomRight:P},I={topLeft:P,topRight:z,bottomLeft:P,bottomRight:z},A={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:S.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||_]},clipAngle:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>G(t||0)},referenceSymbol:{type:S.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,n=r(i?"center":o.horizontalAlignment),a=s(i?"middle":o.verticalAlignment),{offsetX:c,offsetY:l,size:h}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(c),-e(l),Math.round(e(h)),n+1<<2|a+1]}},visibility:{type:S.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:S.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:S.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>m([[g,t],[x,!!e]])},offset:{type:S.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},textureUV:{type:S.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},color:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:S.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>[Math.round(e(t)),Math.round(e(o??t))]},outlineColor:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>p(t)},haloColor:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>p(t)},outlineAndHaloSize:{type:S.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class E extends u{constructor(){super(...arguments),this.vertexSpec=A,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new y(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const i=this._getShaping();if(!i)return;const r=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,i,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,r,o.x,o.y,i,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,r,s,n,i,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,r,e,o,i,0))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,r,s,n,i,0)}_writePlacedTextMarkers(t,r,s,n){const a=n??o.fromFeatureSetReaderCIM(r);if(!a)return;const c=-1,l=i.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id);if(!l)return;const h=r.getDisplayId();let f=l.next();for(;null!=f;){const e=f.tx,o=-f.ty,i=-f.getAngle();this._writeGlyphs(t,h,e,o,s,i),f=l.next()}}_getShaping(o){const i=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!r.glyphs?.glyphs.length)return null;const s=e(i.fontSize),n=e(i.offsetX),p=e(i.offsetY),m=t(e(r.lineWidth),c,a),d=l*t(r.lineHeightRatio,.25,4);return f(r.glyphs,{scale:s/h,angle:i.postAngle,xOffset:n,yOffset:p,horizontalAlignment:r.horizontalAlignment,verticalAlignment:o||r.verticalAlignment,maxLineWidth:m,lineHeight:d,decoration:r.decoration,borderLineSizePx:e(r.boxBorderLineSize),hasBackground:!!r.boxBackgroundColor,useCIMAngleBehavior:r.useCIMAngleBehavior})}_writeGlyphs(t,o,i,r,s,n,a,c,l=!0){const h=this.evaluatedMeshParams,f=this._textMeshTransformProps,m=e(f.fontSize),u=f.haloSize,g=f.outlineSize,x=e(f.offsetX),y=e(f.offsetY),[S,_]=d(h.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const P=s.bounds,b=i+P.x+x,T=r+P.y-y,k=2*(h.minPixelBuffer?h.minPixelBuffer/m:1),z=Math.max(P.width,P.height)*k;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),l&&t.recordBounds(b,T,z,z),this._writeTextBox(t,o,i,r,s.textBox,a,c),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),l&&t.recordBounds(b,T,z,z);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,i,r,{texcoords:s,offsets:n,fontSize:m,haloSize:u,outlineSize:g,color:p(h.color),isBackground:!1,referenceBounds:a,minZoom:S,maxZoom:_,...c}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,i,r,s,n){const a=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:h}=this._textMeshTransformProps,{boxBackgroundColor:f,boxBorderLineColor:m}=a,d={isBackground:!0,fontSize:c,haloSize:l,outlineSize:h,referenceBounds:s,...n};f&&(this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.main,color:p(f),...d}),m||(this._writeQuad(t,e,o,i,{texcoords:M,offsets:r.top,color:p(f),...d}),this._writeQuad(t,e,o,i,{texcoords:L,offsets:r.bot,color:p(f),...d}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:r.left,color:p(f),...d}),this._writeQuad(t,e,o,i,{texcoords:I,offsets:r.right,color:p(f),...d}))),m&&(this._writeQuad(t,e,o,i,{texcoords:B,offsets:r.top,color:p(m),...d}),this._writeQuad(t,e,o,i,{texcoords:B,offsets:r.bot,color:p(m),...d}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.left,color:p(m),...d}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.right,color:p(m),...d}))}_writeQuad(t,e,o,i,r){const s=t.vertexCount();this._writeVertex(t,e,o,i,r),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const G=t=>Math.round(t*(254/360));export{E as TextMeshWriter,A as TextVertexSpec,_ as maxLabelZoom};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import t from"../../../../core/Accessor.js";import{watch as e}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{ControlPointsTransformTool as a}from"./ControlPointsTransformTool.js";import{TransformTool as r}from"./TransformTool.js";const n={redo:"r",undo:"z"};let d=class extends t{constructor(o){super(o),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=[],this._sharedRedoStack=[],this._originalOpacity=null,this.activeHandle=0}initialize(){const{view:o,mediaElement:t,preserveAspectRatio:s,snapRotation:i,advancedMode:d}=this;this._originalOpacity=t.opacity,this._transformTool=new r({target:t,view:o,preserveAspectRatio:s,snapRotation:i}),this._controlPointsTransformTool=new a({mediaElement:t,view:o}),this._advancedModeTransformTool=new a({mediaElement:d.mediaElement,view:d.view}),this._transformTool.setSharedUndoStack(this._sharedUndoStack),this._transformTool.setSharedRedoStack(this._sharedRedoStack),this._controlPointsTransformTool.setSharedUndoStack(this._sharedUndoStack),this._controlPointsTransformTool.setSharedRedoStack(this._sharedRedoStack),this._advancedModeTransformTool.setSharedUndoStack(this._sharedUndoStack),this._advancedModeTransformTool.setSharedRedoStack(this._sharedRedoStack);const l=t.georeference,c=d.mediaElement.georeference;d.view.tools.addMany([this._advancedModeTransformTool]),"controlPoints"in c&&"controlPoints"in l&&this.addHandles([d.view.on("key-down",o=>{o.key===n.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===n.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),d.view.on("focus",async o=>{this._controlPointsTransformTool.removeHighlightActiveHandle(),this._advancedModeTransformTool.highlightActiveHandle()}),e(()=>c.controlPoints,o=>{l.controlPoints=o.map(({sourcePoint:o},t)=>({sourcePoint:o,mapPoint:l.controlPoints[t].mapPoint})),this._activeTool?.refresh()}),e(()=>this._controlPointsTransformTool.activeHandle,o=>{this._advancedModeTransformTool.updateActiveHandle(o),this.activeHandle=o}),e(()=>this._advancedModeTransformTool.activeHandle,o=>{this._controlPointsTransformTool.updateActiveHandle(o),this.activeHandle=o})]),this.addHandles([o.on("key-down",o=>{o.key===n.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===n.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),o.on("focus",async o=>{this._advancedModeTransformTool.removeHighlightActiveHandle(),this._controlPointsTransformTool.highlightActiveHandle()})]),o.tools.addMany([this._transformTool,this._controlPointsTransformTool]),o.activeTool=this._transformTool,this._activeTool=this._transformTool,o.focus()}destroy(){this._transformTool?.destroy(),this._controlPointsTransformTool?.destroy(),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=null,this._sharedRedoStack=null}canUndo(){return this._sharedUndoStack.length>0}canRedo(){return this._sharedRedoStack.length>0}undo(){if(this._sharedUndoStack.length>0){const{tool:o,operation:t}=this._sharedUndoStack.pop();o!==this._activeTool&&o.refresh(),t.undo(),o.updateGraphics(),this._sharedRedoStack.push({tool:o,operation:t}),this._activeTool!==o&&this._activeTool?.refresh()}}redo(){if(this._sharedRedoStack.length>0){const{tool:o,operation:t}=this._sharedRedoStack.pop();o!==this._activeTool&&o.refresh(),t.apply(),o.updateGraphics(),this._sharedUndoStack.push({tool:o,operation:t}),this._activeTool!==o&&this._activeTool?.refresh()}}refresh(){this._activeTool.refresh()}reset(){this._activeTool.reset(),this._advancedModeTransformTool.reset()}async enableAdvancedMode(){this.view.activeTool=this._controlPointsTransformTool,this._activeTool=this._controlPointsTransformTool,this._activeTool.refresh(),await this.advancedMode.view.when(),this.advancedMode.view.activeTool=this._advancedModeTransformTool,this._originalOpacity=this._controlPointsTransformTool.mediaElement.opacity,this._controlPointsTransformTool.mediaElement.opacity=.25*this._originalOpacity}disableAdvancedMode(){this.view.activeTool=this._transformTool,this._activeTool=this._transformTool,this._activeTool.refresh(),this.advancedMode.view.activeTool=null,this._controlPointsTransformTool.mediaElement.opacity=this._originalOpacity}};o([s()],d.prototype,"activeHandle",void 0),o([s({constructOnly:!0})],d.prototype,"advancedMode",void 0),o([s()],d.prototype,"preserveAspectRatio",void 0),o([s()],d.prototype,"snapRotation",void 0),o([s({constructOnly:!0,nonNullable:!0})],d.prototype,"mediaElement",void 0),o([s({constructOnly:!0})],d.prototype,"view",void 0),d=o([i("esri.views.2d.interactive.editingTools.MediaTransformToolsWrapper")],d);export{d as MediaTransformToolsWrapper,n as keys};
5
+ import{__decorate as o}from"tslib";import t from"../../../../core/Accessor.js";import{watch as e}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{ControlPointsTransformTool as a}from"./ControlPointsTransformTool.js";import{TransformTool as r}from"./TransformTool.js";const n={redo:"r",undo:"z"};let d=class extends t{constructor(o){super(o),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=[],this._sharedRedoStack=[],this._originalOpacity=null,this.activeHandle=0}initialize(){const{view:o,mediaElement:t,preserveAspectRatio:s,snapRotation:i,advancedMode:d}=this;this._originalOpacity=t.opacity,this._transformTool=new r({target:t,view:o,preserveAspectRatio:s,snapRotation:i}),this._controlPointsTransformTool=new a({mediaElement:t,view:o}),this._advancedModeTransformTool=new a({mediaElement:d.mediaElement,view:d.view}),this._transformTool.setSharedUndoStack(this._sharedUndoStack),this._transformTool.setSharedRedoStack(this._sharedRedoStack),this._controlPointsTransformTool.setSharedUndoStack(this._sharedUndoStack),this._controlPointsTransformTool.setSharedRedoStack(this._sharedRedoStack),this._advancedModeTransformTool.setSharedUndoStack(this._sharedUndoStack),this._advancedModeTransformTool.setSharedRedoStack(this._sharedRedoStack);const l=t.georeference,c=d.mediaElement.georeference;d.view.tools.addMany([this._advancedModeTransformTool]),"controlPoints"in c&&"controlPoints"in l&&this.addHandles([d.view.on("key-down",o=>{o.key===n.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===n.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),d.view.on("focus",()=>{this._controlPointsTransformTool.removeHighlightActiveHandle(),this._advancedModeTransformTool.highlightActiveHandle()}),e(()=>c.controlPoints,o=>{l.controlPoints=o.map(({sourcePoint:o},t)=>({sourcePoint:o,mapPoint:l.controlPoints[t].mapPoint})),this._activeTool?.refresh()}),e(()=>this._controlPointsTransformTool.activeHandle,o=>{this._advancedModeTransformTool.updateActiveHandle(o),this.activeHandle=o}),e(()=>this._advancedModeTransformTool.activeHandle,o=>{this._controlPointsTransformTool.updateActiveHandle(o),this.activeHandle=o})]),this.addHandles([o.on("key-down",o=>{o.key===n.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===n.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),o.on("focus",()=>{this._advancedModeTransformTool.removeHighlightActiveHandle(),this._controlPointsTransformTool.highlightActiveHandle()})]),o.tools.addMany([this._transformTool,this._controlPointsTransformTool]),o.activeTool=this._transformTool,this._activeTool=this._transformTool,o.focus()}destroy(){this._transformTool?.destroy(),this._controlPointsTransformTool?.destroy(),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=null,this._sharedRedoStack=null}canUndo(){return this._sharedUndoStack.length>0}canRedo(){return this._sharedRedoStack.length>0}undo(){if(this._sharedUndoStack.length>0){const{tool:o,operation:t}=this._sharedUndoStack.pop();o!==this._activeTool&&o.refresh(),t.undo(),o.updateGraphics(),this._sharedRedoStack.push({tool:o,operation:t}),this._activeTool!==o&&this._activeTool?.refresh()}}redo(){if(this._sharedRedoStack.length>0){const{tool:o,operation:t}=this._sharedRedoStack.pop();o!==this._activeTool&&o.refresh(),t.apply(),o.updateGraphics(),this._sharedUndoStack.push({tool:o,operation:t}),this._activeTool!==o&&this._activeTool?.refresh()}}refresh(){this._activeTool.refresh()}reset(){this._activeTool.reset(),this._advancedModeTransformTool.reset()}async enableAdvancedMode(){this.view.activeTool=this._controlPointsTransformTool,this._activeTool=this._controlPointsTransformTool,this._activeTool.refresh(),await this.advancedMode.view.when(),this.advancedMode.view.activeTool=this._advancedModeTransformTool,this._originalOpacity=this._controlPointsTransformTool.mediaElement.opacity,this._controlPointsTransformTool.mediaElement.opacity=.25*this._originalOpacity}disableAdvancedMode(){this.view.activeTool=this._transformTool,this._activeTool=this._transformTool,this._activeTool.refresh(),this.advancedMode.view.activeTool=null,this._controlPointsTransformTool.mediaElement.opacity=this._originalOpacity}};o([s()],d.prototype,"activeHandle",void 0),o([s({constructOnly:!0})],d.prototype,"advancedMode",void 0),o([s()],d.prototype,"preserveAspectRatio",void 0),o([s()],d.prototype,"snapRotation",void 0),o([s({constructOnly:!0,nonNullable:!0})],d.prototype,"mediaElement",void 0),o([s({constructOnly:!0})],d.prototype,"view",void 0),d=o([i("esri.views.2d.interactive.editingTools.MediaTransformToolsWrapper")],d);export{d as MediaTransformToolsWrapper,n as keys};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{AProcessorStrategy as t,ASendState as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as a}from"../support/arcadeUtils.js";import{FeatureSetReaderJSON as n}from"../support/FeatureSetReaderJSON.js";class d extends e{}class i extends t{constructor(t,e,s,r){super(t,e,r),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(t){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=t,null!=this._evalOptions&&(this._evalOptions=a(this._evalOptions.$view.scale,t))}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(t){return new d(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),o=[];for(const a of this._source.chunks()){const t=a.reader.getCursor();for(;t.next();){const e=t.getObjectId(),a=t.getDisplayId(),n=r.get(e);if(null!=n){const t=s(a,n,e);o.push(t),r.delete(e)}}}return o}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const o=t.getObjectId(),a=t.getDisplayId();e.has(a)&&!s.has(o)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:a}),s.add(o))}}return{features:r,aggregates:[],tracks:[]}}async*applyOverrideUpdate(t){const e=[];for(const s of t.modified){const t=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=t,e.push(t)}const r=n.fromOptimizedFeatures(t.modified,this._source.metadata).getCursor();for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,this._evalOptions,this._sqlOptions);const a=[];for(const s of t.removed){const t=this._attributeStore.getDisplayIdForObjectId(s);null!=t&&a.push(t)}has("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:t,modifiedDisplayIds:e,removedDisplayIds:a});const d=o.fromFeatures(t.modified,this._source.metadata);this.handledChunks.add(d.chunkId),this.handledChunksForAttributeData.add(d.chunkId),this.handledChunksForIdCreation.add(d.chunkId);for(const o of this._sendStates.values())o.handledChunks.add(d.chunkId),yield new s(o.subscription,null,e,!1,d.queryInfo);for(const o of this._sendStates.values()){const t=d.getTileReader(o.subscription.tile);yield new s(o.subscription,t,a,!1,d.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}afterUpdateChunks(){for(const t of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(t);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(t):this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions,this._sqlOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const o of this._source.chunks()){const{chunkId:a}=o;if(s.has(a)||!this.handledChunksForIdCreation.has(a)||!this.handledChunksForAttributeData.has(a))continue;s.add(a);const n=o.getTileReader(e.tile);n&&(yield new r(t.subscription,n,!1,o.end,o.queryInfo))}}}export{d as DefaultSendState,i as FeatureUpdateStrategy};
5
+ import has from"../../../../../core/has.js";import{AProcessorStrategy as t,ASendState as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as a}from"../support/arcadeUtils.js";import{FeatureSetReaderJSON as n}from"../support/FeatureSetReaderJSON.js";class d extends e{}class i extends t{constructor(t,e,s,r){super(t,e,r),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(t){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=t,null!=this._evalOptions&&(this._evalOptions=a(this._evalOptions.$view.scale,t))}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(t){return new d(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),o=[];for(const a of this._source.chunks()){const t=a.reader.getCursor();for(;t.next();){const e=t.getObjectId(),a=t.getDisplayId(),n=r.get(e);if(null!=n){const t=s(a,n,e);o.push(t),r.delete(e)}}}return o}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const o=t.getObjectId(),a=t.getDisplayId();e.has(a)&&!s.has(o)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:a}),s.add(o))}}return{features:r,aggregates:[],tracks:[]}}async*applyOverrideUpdate(t){const e=[];for(const s of t.modified){const t=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=t,e.push(t)}const r=n.fromOptimizedFeatures(t.modified,this._source.metadata).getCursor();for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,this._evalOptions,this._sqlOptions);const a=[];for(const s of t.removed){const t=this._attributeStore.getDisplayIdForObjectId(s);null!=t&&a.push(t)}has("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:t,modifiedDisplayIds:e,removedDisplayIds:a});const d=o.fromFeatures(t.modified,this._source.metadata);this.handledChunks.add(d.chunkId),this.handledChunksForAttributeData.add(d.chunkId),this.handledChunksForIdCreation.add(d.chunkId);for(const o of this._sendStates.values())o.handledChunks.add(d.chunkId),yield new s(o.subscription,null,e,!1,d.queryInfo);for(const o of this._sendStates.values()){const t=d.getTileReader(o.subscription.tile);yield new s(o.subscription,t,a,!1,d.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}afterUpdateChunks(){for(const t of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(t);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(t):this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}_updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions,this._sqlOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const o of this._source.chunks()){const{chunkId:a}=o;if(s.has(a)||!this.handledChunksForIdCreation.has(a)||!this.handledChunksForAttributeData.has(a))continue;s.add(a);const n=o.getTileReader(e.tile);n&&(yield new r(t.subscription,n,!1,o.end,o.queryInfo))}}}export{d as DefaultSendState,i as FeatureUpdateStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromNestedArray as b}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as T}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as R}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as L}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as A}from"../support/FeatureSetReaderJSON.js";let C;const G=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),P=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return I+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new g}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new _(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=q(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=N(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,P))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new g;m(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);E(a,(t,e)=>u(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new g;m(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class M extends x{constructor(t){super(t),this.done=!1}}class U extends j{static async create(t,e,s,a,o,n){const l=new R({spatialReference:e}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then(([t,e,s])=>{C={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new U(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map(t=>t.chunkId));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new M(t)}async*applyOverrideUpdate(t){G().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,attributes:{},...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,T(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=A.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=A.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=L.from(i,s[r]);return a.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a}).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function q(t,e,s){if(e.length<2)return b(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=p({paths:[e],spatialReference:s});if(null!=r)return b(t,r.paths,!1,!1)}return b(t,[e],!1,!1)}const r=C.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=C.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=C.toGeometry(e,i);if(null!=s&&"paths"in s)return b(t,s.paths,!1,!1)}}return b(t,[e],!1,!1)}function E(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function N(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{U as TrackStrategy};
5
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromNestedArray as _}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as T}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as R}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as L}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as A}from"../support/FeatureSetReaderJSON.js";let C;const G=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),P=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return I+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new g}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new b(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=q(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=N(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,P))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new g;m(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);E(a,(t,e)=>u(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new b(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new g;m(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new b(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new b(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class M extends x{constructor(t){super(t),this.done=!1}}class U extends j{static async create(t,e,s,a,o,n){const l=new R({spatialReference:e}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then(([t,e,s])=>{C={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new U(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map(t=>t.chunkId));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new M(t)}async*applyOverrideUpdate(t){G().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,T(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=A.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=A.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=L.from(i,s[r]);return a.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a}).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function q(t,e,s){if(e.length<2)return _(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=p({paths:[e],spatialReference:s});if(null!=r)return _(t,r.paths,!1,!1)}return _(t,[e],!1,!1)}const r=C.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=C.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=C.toGeometry(e,i);if(null!=s&&"paths"in s)return _(t,s.paths,!1,!1)}}return _(t,[e],!1,!1)}function E(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function N(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{U as TrackStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../../core/Evented.js";import r from"../../../../../core/Logger.js";import{watch as i,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../../geometry/Point.js";import{tryProjectWithZConversion as l}from"../../../../../geometry/projectionUtils.js";import{empty as h,expandPointInPlace as m}from"../../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as c}from"../../support/projectionUtils.js";import{createCoordinateHelper as u}from"../../../../interactive/coordinateHelper.js";import{EditGeometry as d,Part as p}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as y}from"../../../../interactive/editGeometry/EditGeometryOperations.js";let g=class extends t{constructor(e={}){super(e),this._version=0,this._internalGeometryChange=!1,this._extent=h()}set areaMeasurement(e){this._set("areaMeasurement",e),null!=e&&null!=this.view&&this._initialize(e,this.view)}set view(e){this._set("view",e),null!=e&&null!=this.areaMeasurement&&this._initialize(this.areaMeasurement,e)}get constructed(){return null!=this.areaMeasurement&&null!=this.view}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||0===this._editGeometry.parts.length}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.parts.length>0&&this._editGeometry.parts[0].vertices.length>0){const e=h(this._extent);return this.forEachVertex(t=>{m(e,t.pos)}),e}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(e,t){this.removeAllHandles(),this.addHandles(i(()=>e.geometry,()=>{this._updateEditGeometryFromModelGeometry(e,t)},o)),this._makeDirty(!0)}_makeDirty(e=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),e&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(e,t){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let i=e.geometry;if(null!=i){const o=l(i,t.spatialReference);null==o&&c(e,i.spatialReference,r.getLogger(this)),i=o}this._editGeometryOperations=null!=i?y.fromGeometry(i,t.state.viewingMode):new y(new d("polygon",u(!0,!1,t.spatialReference)),t.state.viewingMode),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",t=>{this._makeDirty(null!=t.addedVertices||null!=t.removedVertices),this._internalGeometryChange=!0,e.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const e=[];return this.forEachVertex(t=>{e.push(t)}),e}get numVertices(){return this.constructed&&this._editGeometry.parts.length>0?this._editGeometry.parts[0].vertices.length:0}get polygonIsClosed(){return this._editGeometry.parts.length>0&&this._editGeometry.parts[0].isClosed()}get firstPoint(){if(this.constructed&&this._editGeometry.parts.length>0){const e=this._editGeometry.parts[0].getFirstVertex();if(null!=e)return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}return null}get lastPoint(){if(this.constructed&&this._editGeometry.parts.length>0){const e=this._editGeometry.parts[0].getLastVertex();if(null!=e)return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}return null}getVertex(e){if(!this.constructed||0===this._editGeometry.parts.length||0===this._editGeometry.parts[0].vertices.length)return null;const t=this._editGeometry.parts[0].vertices[0];let r=t;do{if(r.index===e)return r;r=r.rightSegment.rightVertex}while(r!==t&&null!=r);return null}getVertexPositionAsPoint(e){return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}getVertexPositionAsPointFromIndex(e){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(e).pos)}forEachVertex(e){if(this.constructed&&this._editGeometry.parts.length>0)for(const t of this._editGeometry.parts[0].iterateVertices())e(t,t.index)}forEachVertexPosition(e){const t=this._editGeometry.coordinateHelper;this.forEachVertex((r,i)=>{t.vectorToPoint(r.pos,_),e(_,i)})}clear(){null!=this.areaMeasurement&&(this.areaMeasurement.geometry=null)}add(e){if(!this.constructed)return null;if(0===this._editGeometry.parts.length){const e=this.view;this._editGeometry.parts.push(new p(e.spatialReference,e.state.viewingMode))}const t=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(e));return this.emit("change"),t}close(){if(!this.constructed||0===this._editGeometry.parts.length)return null;const e=this._editGeometryOperations.closePart(this._editGeometry.parts[0]);return this.emit("change"),e}ensureContains(e,t=""){let r=!1;if(this._editGeometry.parts.forEach(t=>{for(const i of t.iterateVertices())i===e&&(r=!0)}),!r)throw new Error(`vertex doesn't exist ${t}`);return r}setVertexPosition(e,t){if(!this.constructed)return null;const r=this._editGeometryOperations.setVertexPosition(e,this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),r}equals(e){if(this.numVertices!==e.numVertices)return!1;let t=!0;return this.forEachVertexPosition((r,i)=>{const o=e.getVertexPositionAsPointFromIndex(i);r.equals(o)||(t=!1)}),!!t}};e([s({value:null})],g.prototype,"areaMeasurement",null),e([s({value:null})],g.prototype,"view",null),e([s()],g.prototype,"isEmptyPolygon",null),e([s()],g.prototype,"isValidPolygon",null),e([s()],g.prototype,"extent",null),e([s()],g.prototype,"spatialReference",null),e([s()],g.prototype,"numVertices",null),e([s()],g.prototype,"polygonIsClosed",null),g=e([n("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementPathHelper")],g);const _=new a;export{g as AreaMeasurement3DPathHelper};
5
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../../core/Evented.js";import r from"../../../../../core/Logger.js";import{watch as i,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../../geometry/Point.js";import{tryProjectWithZConversion as l}from"../../../../../geometry/projectionUtils.js";import{empty as h,expandPointInPlace as c}from"../../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as m}from"../../support/projectionUtils.js";import{createCoordinateHelper as u}from"../../../../interactive/coordinateHelper.js";import{EditGeometry as p,Part as d}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as y}from"../../../../interactive/editGeometry/EditGeometryOperations.js";let g=class extends t{constructor(e={}){super(e),this._version=0,this._internalGeometryChange=!1,this._extent=h()}set areaMeasurement(e){this._set("areaMeasurement",e),null!=e&&null!=this.view&&this._initialize(e,this.view)}set view(e){this._set("view",e),null!=e&&null!=this.areaMeasurement&&this._initialize(this.areaMeasurement,e)}get constructed(){return null!=this.areaMeasurement&&null!=this.view}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||0===this._editGeometry.parts.length}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.parts[0]?.vertices.length){const e=h(this._extent);return this.forEachVertex(t=>{c(e,t.pos)}),e}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(e,t){this.removeAllHandles(),this.addHandles(i(()=>e.geometry,()=>{this._updateEditGeometryFromModelGeometry(e,t)},o)),this._makeDirty(!0)}_makeDirty(e=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),e&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(e,t){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let i=e.geometry;if(null!=i){const o=l(i,t.spatialReference);null==o&&m(e,i.spatialReference,r.getLogger(this)),i=o}this._editGeometryOperations=null!=i?y.fromGeometry(i,t.state.viewingMode):new y(new p("polygon",u(!0,!1,t.spatialReference)),t.state.viewingMode),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",t=>{this._makeDirty(null!=t.addedVertices||null!=t.removedVertices),this._internalGeometryChange=!0,e.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const e=[];return this.forEachVertex(t=>{e.push(t)}),e}get numVertices(){return this.constructed?this._editGeometry.parts[0]?.vertices.length??0:0}get polygonIsClosed(){return this._editGeometry.parts[0]?.isClosed()??!1}get firstPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getFirstVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}get lastPoint(){if(this.constructed){const{coordinateHelper:e,parts:t}=this._editGeometry,r=t[0]?.getLastVertex();if(null!=r)return e.vectorToPoint(r.pos)}return null}getVertex(e){if(!this.constructed||!this._editGeometry.parts[0]?.vertices.length)return null;const t=this._editGeometry.parts[0].vertices[0];let r=t;do{if(r.index===e)return r;r=r.rightSegment.rightVertex}while(r!==t&&null!=r);return null}getVertexPositionAsPoint(e){return this._editGeometry.coordinateHelper.vectorToPoint(e.pos)}getVertexPositionAsPointFromIndex(e){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(e).pos)}forEachVertex(e){if(this.constructed&&this._editGeometry.parts.length>0)for(const t of this._editGeometry.parts[0].iterateVertices())e(t,t.index)}forEachVertexPosition(e){const t=this._editGeometry.coordinateHelper;this.forEachVertex((r,i)=>{t.vectorToPoint(r.pos,f),e(f,i)})}clear(){null!=this.areaMeasurement&&(this.areaMeasurement.geometry=null)}add(e){if(!this.constructed)return null;if(0===this._editGeometry.parts.length){const e=this.view;this._editGeometry.parts.push(new d(e.spatialReference,e.state.viewingMode))}const t=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(e));return this.emit("change"),t}close(){if(!this.constructed||0===this._editGeometry.parts.length)return null;const e=this._editGeometryOperations.closePart(this._editGeometry.parts[0]);return this.emit("change"),e}ensureContains(e,t=""){let r=!1;if(this._editGeometry.parts.forEach(t=>{for(const i of t.iterateVertices())i===e&&(r=!0)}),!r)throw new Error(`vertex doesn't exist ${t}`);return r}setVertexPosition(e,t){if(!this.constructed)return null;const r=this._editGeometryOperations.setVertexPosition(e,this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),r}equals(e){if(this.numVertices!==e.numVertices)return!1;let t=!0;return this.forEachVertexPosition((r,i)=>{const o=e.getVertexPositionAsPointFromIndex(i);r.equals(o)||(t=!1)}),!!t}};e([s({value:null})],g.prototype,"areaMeasurement",null),e([s({value:null})],g.prototype,"view",null),e([s()],g.prototype,"isEmptyPolygon",null),e([s()],g.prototype,"isValidPolygon",null),e([s()],g.prototype,"extent",null),e([s()],g.prototype,"spatialReference",null),e([s()],g.prototype,"numVertices",null),e([s()],g.prototype,"polygonIsClosed",null),g=e([n("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementPathHelper")],g);const f=new a;export{g as AreaMeasurement3DPathHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../../../intl.js";import t from"../../../../core/Accessor.js";import{unitRGBAFromColor as i,multiplyOpacityToUnitRGBA as s,getContrast as n,multiplyOpacity as o}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{nextHighestPowerOfTen as l,deg2rad as r}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c,formatImperialVerticalLength as h,formatImperialLength as u,formatMetricVerticalLength as d,formatMetricLength as m}from"../../../../core/quantityFormatUtils.js";import{toUnit as g}from"../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as _,initial as v}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as b,createRenderScreenPointArray as L}from"../../../../core/screenUtils.js";import{adaptiveImperialLengthUnit as w,convertUnit as y}from"../../../../core/unitUtils.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{dot as E}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as V,f as z}from"../../../../chunks/vec32.js";import{create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as P}from"../../interactive/support/viewUtils.js";import{LabelVisualElement as j,mirrorPosition as M}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as C}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as O}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as x}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as D,EuclideanSegment as G}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";import{geodesicDistanceThreshold as k}from"../../../support/geodesicMeasurementUtils.js";import{onLocaleChange as T}from"../../../../intl/locale.js";import{fetchMessageBundle as U}from"../../../../intl/messages.js";let R=class extends t{get _parameters(){const e=this.view.effectiveTheme,{accentColor:t,textColor:l}=e,r=i(t),a=s(t,.75),c=i(n(t)),h=n(l,160);return{accentColor:r,contrastColor:c,translucentAccentColor:a,triangleLineWidth:3,geodesicProjectionLineWidth:2,guideLineWidth:2,guideStippleLengthPixels:3,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12,textColor:l,textBackgroundColor:o(h,.6),textCalloutColor:o(h,.5)}}get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return 0;const i=this.analysisView.result;if(null==i)return 1;if("geodesic"===this.actualVisualizedMeasurement)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?3:1;const{verticalDistance:s,horizontalDistance:n}=i,o=g(s,"meters").value,l=g(n,"meters").value;return Math.min(o/l,l/o)<this.triangleCollapseRatioThreshold?1:2}get actualVisualizedMeasurement(){const{measurementMode:e,result:t}=this.analysisView;switch(e){case 0:return null!=t&&g(t.horizontalDistance,"meters").value>k?"geodesic":"euclidean";case 1:return"euclidean";case 2:return"geodesic"}}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){return"geodesic"===this.actualVisualizedMeasurement?{direct:null,horizontal:this._segmentLabel,vertical:this._verticalLabel}:{direct:this._segmentLabel,horizontal:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=A(),this._endPosition=A(),this._cornerPosition=A(),this._startPositionAtSeaLevel=A(),this._endPositionAtSeaLevel=A(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=0,this.triangleCollapseRatioThreshold=.03}initialize(){const e={attached:!0,view:this.view,isDecoration:!0},{guideLineWidth:t,guideStippleLengthPixels:i,triangleLineWidth:s,geodesicProjectionLineWidth:n,directLabelFontSize:o,verticalLabelFontSize:l,horizontalLabelFontSize:r}=this._parameters;this._segmentVisualElement=new O({...e,geometry:null,renderOccluded:4}),this._triangleVisualElement=new C({...e,width:s,renderOccluded:4}),this._rightAngleQuad=new x({...e,renderOccluded:4});const a={...e,polygonOffset:!0,renderOccluded:4};this._projectedGeodesicLine=new C({...a,width:n,stipplePattern:H(i)}),this._geodesicStartHint=new C({...a,width:t,stipplePattern:H(i)}),this._geodesicEndHint=new C({...a,width:t,stipplePattern:H(i)}),this._segmentLabel=new j({...e,fontSize:o}),this._verticalLabel=new j({...e,fontSize:l}),this._horizontalLabel=new j({...e,fontSize:r}),this.addHandles([p(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},e=>this._updateGeometryAndViewMode(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateVisualElementVisibility(e),_),p(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),e=>this._updateLabelText(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateLabelVisibility(e),_),p(()=>this._measurementArrowStripeLength,e=>this._updateSegmentStripeLength(e),_),T(async()=>this._updateMessageBundle()),p(()=>this._parameters,({textBackgroundColor:e,textCalloutColor:t,textColor:i,translucentAccentColor:s,accentColor:n,contrastColor:o})=>{const{_segmentLabel:l,_verticalLabel:r,_horizontalLabel:a,_triangleVisualElement:c,_rightAngleQuad:h,_projectedGeodesicLine:u,_geodesicStartHint:d,_geodesicEndHint:m,_segmentVisualElement:g}=this;l.backgroundColor=e,l.calloutColor=t,l.textColor=i,r.backgroundColor=e,r.calloutColor=t,r.textColor=i,a.backgroundColor=e,a.calloutColor=t,a.textColor=i,c.color=s,h.color=s,u.color=s,d.color=s,m.color=s,g.color=n,g.contrastColor=o},v)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=a(this._segmentVisualElement),this._triangleVisualElement=a(this._triangleVisualElement),this._rightAngleQuad=a(this._rightAngleQuad),this._projectedGeodesicLine=a(this._projectedGeodesicLine),this._geodesicStartHint=a(this._geodesicStartHint),this._geodesicEndHint=a(this._geodesicEndHint),this._segmentLabel=a(this._segmentLabel),this._verticalLabel=a(this._verticalLabel),this._horizontalLabel=a(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case 0:break;case 1:this._segmentVisualElement.visible=!0;break;case 2:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case 3:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:o,visualizedMeasurement:l,stripeLength:r}){const a=e.renderCoordsHelper;if(null==a||null==s||null==n||s.equals(n))return;let c=this._startPosition,h=this._endPosition;a.toRenderCoords(s,c),a.toRenderCoords(n,h);const u=1===o?1:-1,d=u*(a.getAltitude(h)-a.getAltitude(c));d<0&&(c=this._endPosition,h=this._startPosition);const m="geodesic"===l?new D(this._startPosition,this._endPosition,a.spatialReference):new G(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(r),i){case 1:this._updateSegment(m,o);break;case 2:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:o,startPosition:c,endPosition:h,deltaSign:u,altitudeDelta:d});break;case 3:this._updateSegmentAndProjection({view:e,orientation:o,startPosition:c,endPosition:h})}}_updateSegment(e,t){this._segmentLabel.anchor=1===t?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:o,deltaSign:l,altitudeDelta:r}){const a=this._cornerPosition;e.worldUpAtPosition(n,a),V(a,a,l*Math.abs(r)),z(a,a,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[a[0],a[1],a[2]],[o[0],o[1],o[2]]]],this._rightAngleQuad.geometry={previous:n,center:a,next:o};const c=new G(n,a),h=new G(a,o),u=F(n,o,a,s,t);this._segmentLabel.anchor=u.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=u.vertical,this._horizontalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._horizontalLabel.anchor=u.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new D(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new G(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new G(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=1===t?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.directDistance:e.horizontalDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case 1:case 3:i.visible=!0;break;case 2:i.visible=!0,s.visible=!0,n.visible=!0}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n}=t,o=this.analysisView.unit,l=e=>({directDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(o){case"metric":return l({directDistance:i&&m(e,i),horizontalDistance:s&&m(e,s),verticalDistance:n&&d(e,n)});case"imperial":return l({directDistance:i&&u(e,i),horizontalDistance:s&&u(e,s),verticalDistance:n&&h(e,n)});default:return l({directDistance:i&&c(e,i,o),horizontalDistance:s&&c(e,s,o),verticalDistance:n&&c(e,n,o)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return 0===e?this.view.state.camera.aboveGround?1:2:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&g(s,"meters");break;case"imperial":i=s&&g(s,w(s.value,s.unit));break;default:i=s&&g(s,t)}if(null==i)return null;return l(i.value/30)*y(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,U("esri/core/t9n/Units").then(e=>{this.messages=e}).finally(()=>{this.loadingMessages=!1})}get testData(){}};function F(e,t,i,s,n){const o=q,l=W;n.projectToRenderScreen(i,o),n.projectToRenderScreen(t,l);const r={segment:"bottom",horizontal:"top",vertical:o[0]<l[0]?"left":"right"};{const s=B,o=I;if(P(e,i,n,s),P(e,t,n,o),E(s,o)>=Q){const e=Math.sign(s[1])===Math.sign(o[1]);r.segment=e?M(r.vertical):r.vertical}else{const e=J;P(i,t,n,e),E(e,o)>=Q&&(r.segment=Math.sign(e[0])===Math.sign(o[0])?M(r.horizontal):r.horizontal)}}if(2===s){const e=e=>"top"===e?"bottom":"top";r.segment=e(r.segment),r.horizontal=e(r.horizontal),r.vertical=e(r.vertical)}return r}e([S()],R.prototype,"_parameters",null),e([S()],R.prototype,"_triangleOrientationOverride",void 0),e([S()],R.prototype,"messages",void 0),e([S()],R.prototype,"view",void 0),e([S()],R.prototype,"analysis",void 0),e([S()],R.prototype,"analysisView",void 0),e([S()],R.prototype,"loadingMessages",void 0),e([S()],R.prototype,"visible",null),e([S()],R.prototype,"viewMode",null),e([S()],R.prototype,"actualVisualizedMeasurement",null),e([S()],R.prototype,"visualElementOrientation",void 0),e([S()],R.prototype,"triangleCollapseRatioThreshold",void 0),e([S()],R.prototype,"allowVisualElementsOrientationChange",null),e([S()],R.prototype,"labels",null),e([S()],R.prototype,"_labelsText",null),e([S()],R.prototype,"_actualVisualElementsOrientation",null),e([S()],R.prototype,"_measurementArrowStripeLength",null),R=e([f("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],R);const Q=Math.cos(r(12)),q=b(),W=b(),B=L(),I=L(),J=L();export{R as DirectLineMeasurementVisualization};
5
+ import{__decorate as e}from"tslib";import"../../../../intl.js";import t from"../../../../core/Accessor.js";import{unitRGBAFromColor as i,multiplyOpacityToUnitRGBA as s,getContrast as n,multiplyOpacity as o}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{nextHighestPowerOfTen as l,deg2rad as r}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c,formatImperialVerticalLength as h,formatImperialLength as u,formatMetricVerticalLength as d,formatMetricLength as m}from"../../../../core/quantityFormatUtils.js";import{toUnit as g}from"../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as _,initial as v}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as b,createRenderScreenPointArray as L}from"../../../../core/screenUtils.js";import{adaptiveImperialLengthUnit as w,convertUnit as y}from"../../../../core/unitUtils.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{dot as E}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as V,f as z}from"../../../../chunks/vec32.js";import{create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as P}from"../../interactive/support/viewUtils.js";import{LabelVisualElement as j,mirrorPosition as M}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as C}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as O}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as x}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as D,EuclideanSegment as G}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";import{geodesicDistanceThreshold as k}from"../../../support/geodesicMeasurementUtils.js";import{onLocaleChange as T}from"../../../../intl/locale.js";import{fetchMessageBundle as U}from"../../../../intl/messages.js";let R=class extends t{get _parameters(){const e=this.view.effectiveTheme,{accentColor:t,textColor:l}=e,r=i(t),a=s(t,.75),c=i(n(t)),h=n(l,160);return{accentColor:r,contrastColor:c,translucentAccentColor:a,triangleLineWidth:3,geodesicProjectionLineWidth:2,guideLineWidth:2,guideStippleLengthPixels:3,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12,textColor:l,textBackgroundColor:o(h,.6),textCalloutColor:o(h,.5)}}get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return 0;const i=this.analysisView.result;if(null==i)return 1;if("geodesic"===this.actualVisualizedMeasurement)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?3:1;const{verticalDistance:s,horizontalDistance:n}=i,o=g(s,"meters").value,l=g(n,"meters").value;return Math.min(o/l,l/o)<this.triangleCollapseRatioThreshold?1:2}get actualVisualizedMeasurement(){const{measurementMode:e,result:t}=this.analysisView;switch(e){case 0:return null!=t&&g(t.horizontalDistance,"meters").value>k?"geodesic":"euclidean";case 1:return"euclidean";case 2:return"geodesic"}}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){return"geodesic"===this.actualVisualizedMeasurement?{direct:null,horizontal:this._segmentLabel,vertical:this._verticalLabel}:{direct:this._segmentLabel,horizontal:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=A(),this._endPosition=A(),this._cornerPosition=A(),this._startPositionAtSeaLevel=A(),this._endPositionAtSeaLevel=A(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=0,this.triangleCollapseRatioThreshold=.03}initialize(){const e={attached:!0,view:this.view,isDecoration:!0},{guideLineWidth:t,guideStippleLengthPixels:i,triangleLineWidth:s,geodesicProjectionLineWidth:n,directLabelFontSize:o,verticalLabelFontSize:l,horizontalLabelFontSize:r}=this._parameters;this._segmentVisualElement=new O({...e,geometry:null,renderOccluded:4}),this._triangleVisualElement=new C({...e,width:s,renderOccluded:4}),this._rightAngleQuad=new x({...e,renderOccluded:4});const a={...e,polygonOffset:!0,renderOccluded:4};this._projectedGeodesicLine=new C({...a,width:n,stipplePattern:H(i)}),this._geodesicStartHint=new C({...a,width:t,stipplePattern:H(i)}),this._geodesicEndHint=new C({...a,width:t,stipplePattern:H(i)}),this._segmentLabel=new j({...e,fontSize:o}),this._verticalLabel=new j({...e,fontSize:l}),this._horizontalLabel=new j({...e,fontSize:r}),this.addHandles([p(()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},e=>this._updateGeometryAndViewMode(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateVisualElementVisibility(e),_),p(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),e=>this._updateLabelText(e),_),p(()=>({visible:this.visible,viewMode:this.viewMode}),e=>this._updateLabelVisibility(e),_),p(()=>this._measurementArrowStripeLength,e=>this._updateSegmentStripeLength(e),_),T(()=>this._updateMessageBundle()),p(()=>this._parameters,({textBackgroundColor:e,textCalloutColor:t,textColor:i,translucentAccentColor:s,accentColor:n,contrastColor:o})=>{const{_segmentLabel:l,_verticalLabel:r,_horizontalLabel:a,_triangleVisualElement:c,_rightAngleQuad:h,_projectedGeodesicLine:u,_geodesicStartHint:d,_geodesicEndHint:m,_segmentVisualElement:g}=this;l.backgroundColor=e,l.calloutColor=t,l.textColor=i,r.backgroundColor=e,r.calloutColor=t,r.textColor=i,a.backgroundColor=e,a.calloutColor=t,a.textColor=i,c.color=s,h.color=s,u.color=s,d.color=s,m.color=s,g.color=n,g.contrastColor=o},v)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=a(this._segmentVisualElement),this._triangleVisualElement=a(this._triangleVisualElement),this._rightAngleQuad=a(this._rightAngleQuad),this._projectedGeodesicLine=a(this._projectedGeodesicLine),this._geodesicStartHint=a(this._geodesicStartHint),this._geodesicEndHint=a(this._geodesicEndHint),this._segmentLabel=a(this._segmentLabel),this._verticalLabel=a(this._verticalLabel),this._horizontalLabel=a(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case 0:break;case 1:this._segmentVisualElement.visible=!0;break;case 2:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case 3:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:o,visualizedMeasurement:l,stripeLength:r}){const a=e.renderCoordsHelper;if(null==a||null==s||null==n||s.equals(n))return;let c=this._startPosition,h=this._endPosition;a.toRenderCoords(s,c),a.toRenderCoords(n,h);const u=1===o?1:-1,d=u*(a.getAltitude(h)-a.getAltitude(c));d<0&&(c=this._endPosition,h=this._startPosition);const m="geodesic"===l?new D(this._startPosition,this._endPosition,a.spatialReference):new G(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(r),i){case 1:this._updateSegment(m,o);break;case 2:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:o,startPosition:c,endPosition:h,deltaSign:u,altitudeDelta:d});break;case 3:this._updateSegmentAndProjection({view:e,orientation:o,startPosition:c,endPosition:h})}}_updateSegment(e,t){this._segmentLabel.anchor=1===t?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:o,deltaSign:l,altitudeDelta:r}){const a=this._cornerPosition;e.worldUpAtPosition(n,a),V(a,a,l*Math.abs(r)),z(a,a,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[a[0],a[1],a[2]],[o[0],o[1],o[2]]]],this._rightAngleQuad.geometry={previous:n,center:a,next:o};const c=new G(n,a),h=new G(a,o),u=F(n,o,a,s,t);this._segmentLabel.anchor=u.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=u.vertical,this._horizontalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._horizontalLabel.anchor=u.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new D(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new G(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new G(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=1===t?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.directDistance:e.horizontalDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case 1:case 3:i.visible=!0;break;case 2:i.visible=!0,s.visible=!0,n.visible=!0}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n}=t,o=this.analysisView.unit,l=e=>({directDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(o){case"metric":return l({directDistance:i&&m(e,i),horizontalDistance:s&&m(e,s),verticalDistance:n&&d(e,n)});case"imperial":return l({directDistance:i&&u(e,i),horizontalDistance:s&&u(e,s),verticalDistance:n&&h(e,n)});default:return l({directDistance:i&&c(e,i,o),horizontalDistance:s&&c(e,s,o),verticalDistance:n&&c(e,n,o)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return 0===e?this.view.state.camera.aboveGround?1:2:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&g(s,"meters");break;case"imperial":i=s&&g(s,w(s.value,s.unit));break;default:i=s&&g(s,t)}if(null==i)return null;return l(i.value/30)*y(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,U("esri/core/t9n/Units").then(e=>{this.messages=e}).finally(()=>{this.loadingMessages=!1})}get testData(){}};function F(e,t,i,s,n){const o=q,l=W;n.projectToRenderScreen(i,o),n.projectToRenderScreen(t,l);const r={segment:"bottom",horizontal:"top",vertical:o[0]<l[0]?"left":"right"};{const s=B,o=I;if(P(e,i,n,s),P(e,t,n,o),E(s,o)>=Q){const e=Math.sign(s[1])===Math.sign(o[1]);r.segment=e?M(r.vertical):r.vertical}else{const e=J;P(i,t,n,e),E(e,o)>=Q&&(r.segment=Math.sign(e[0])===Math.sign(o[0])?M(r.horizontal):r.horizontal)}}if(2===s){const e=e=>"top"===e?"bottom":"top";r.segment=e(r.segment),r.horizontal=e(r.horizontal),r.vertical=e(r.vertical)}return r}e([S()],R.prototype,"_parameters",null),e([S()],R.prototype,"_triangleOrientationOverride",void 0),e([S()],R.prototype,"messages",void 0),e([S()],R.prototype,"view",void 0),e([S()],R.prototype,"analysis",void 0),e([S()],R.prototype,"analysisView",void 0),e([S()],R.prototype,"loadingMessages",void 0),e([S()],R.prototype,"visible",null),e([S()],R.prototype,"viewMode",null),e([S()],R.prototype,"actualVisualizedMeasurement",null),e([S()],R.prototype,"visualElementOrientation",void 0),e([S()],R.prototype,"triangleCollapseRatioThreshold",void 0),e([S()],R.prototype,"allowVisualElementsOrientationChange",null),e([S()],R.prototype,"labels",null),e([S()],R.prototype,"_labelsText",null),e([S()],R.prototype,"_actualVisualElementsOrientation",null),e([S()],R.prototype,"_measurementArrowStripeLength",null),R=e([f("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],R);const Q=Math.cos(r(12)),q=b(),W=b(),B=L(),I=L(),J=L();export{R as DirectLineMeasurementVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getObjectId as u}from"../../../layers/graphics/dehydratedFeatures.js";import{FeatureLikeLayerView3D as n}from"./FeatureLikeLayerView3D.js";import{LayerView3D as p}from"./LayerView3D.js";import{FeatureGraphics3DGraphicsPipeline as l}from"./graphics/FeatureGraphics3DGraphicsPipeline.js";import{updatingProgress as m}from"../support/updatingProperties.js";import{FeatureLayerView as c}from"../../layers/FeatureLayerView.js";import d from"../../layers/LayerView.js";import{RefreshableLayerView as h}from"../../layers/RefreshableLayerView.js";let y=class extends(h(n(c(p(d))))){constructor(e){super(e)}initialize(){this.addHandles(i(()=>this._updatingRequiredPromise,e=>this._updatingHandles.addPromise(e),s))}destroy(){this._updatingHandles.removeAll(),this._fetcherContext=t(this._fetcherContext)}get maximumNumberOfFeatures(){return this.graphicsPipeline.maximumNumberOfFeatures}set maximumNumberOfFeatures(e){this.graphicsPipeline.maximumNumberOfFeatures=e}get maximumNumberOfFeaturesExceeded(){return null!=this.graphicsPipeline&&!this.suspended&&this.graphicsPipeline.maximumNumberOfFeaturesExceeded}get updatingProgressValue(){return this.graphicsPipeline?.updatingProgressValue??0}get updatePolicy(){return this.graphicsPipeline?.updatePolicy??0}get hasZ(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in e&&null!=e.returnZ?e.returnZ:r.supportsZ)}get hasM(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsM)&&("returnM"in e&&null!=e.returnM&&e.returnM)}setVisibility(e,r){this.graphicsPipeline?.setVisibility(e,r)}createQuery(){return super.createQuery()}queryFeatures(e,r){const t=()=>super.queryFeatures(e,r);return"mesh"===this.layer.geometryType?this._queryFeaturesMesh(this._ensureQuery(e),t):t()}async createGraphicsPipeline(){if(has("feature-pipeline-3d-test")){const{Feature3DPipeline:e}=await import("./graphics/pipeline/Feature3DPipeline.js");return new e({layerView:this})}return new l({layerView:this})}async doRefresh(e){return await this.graphicsPipeline.doRefresh(e)}_popupFeatureHasRequiredFields(e,r){if(!super._popupFeatureHasRequiredFields(e,r))return!1;const t=u(e,this.layer.objectIdField);if(null==t)return!0;const i=this.graphicsPipeline.getMissingAttributesForFeature(t);if(null==i)return!0;for(const s of r)if(i.has(s))return!1;return!0}get usedMemory(){return this.graphicsPipeline?.usedMemory??0}get unloadedMemory(){return this.graphicsPipeline?.unloadedMemory??0}get ignoresMemoryFactor(){return this.graphicsPipeline?.ignoresMemoryFactor??!1}async _queryFeaturesMesh(e,r){await this._validateQueryFeaturesMesh(e);const t=await r(),i=this.graphicsPipeline;if(e?.outStatistics||null==i)return t;const s=this.layer.objectIdField,a=[];for(const o of t.features)if(o.geometry){const e=i.getHydratedGeometry(o.attributes[s]);e&&(o.geometry=e,a.push(o))}else a.push(o);return t.features=a,t}async _validateQueryFeaturesMesh(e){if(!e)return;const t=e=>{throw new r("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${e}'`)},i=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const r of i)null!=e[r]&&t(r);"returnM"in e&&e.returnM&&t("returnM"),"returnCentroid"in e&&e.returnCentroid&&t("returnCentroid"),null==e.outSpatialReference||e.outSpatialReference.equals(this.view.spatialReference)||t("outSpatialReference")}get test(){}};e([a()],y.prototype,"layer",void 0),e([a()],y.prototype,"graphicsPipeline",void 0),e([a()],y.prototype,"maximumNumberOfFeatures",null),e([a()],y.prototype,"maximumNumberOfFeaturesExceeded",null),e([a(m)],y.prototype,"updatingProgress",void 0),e([a({readOnly:!0})],y.prototype,"updatingProgressValue",null),e([a({readOnly:!0})],y.prototype,"updatePolicy",null),e([a({readOnly:!0})],y.prototype,"hasZ",null),e([a({readOnly:!0})],y.prototype,"hasM",null),y=e([o("esri.views.3d.layers.FeatureLayerViewBase3D")],y);export{y as default};
5
+ import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getObjectId as u}from"../../../layers/graphics/dehydratedFeatures.js";import{FeatureLikeLayerView3D as n}from"./FeatureLikeLayerView3D.js";import{LayerView3D as p}from"./LayerView3D.js";import{FeatureGraphics3DGraphicsPipeline as l}from"./graphics/FeatureGraphics3DGraphicsPipeline.js";import{updatingProgress as m}from"../support/updatingProperties.js";import{FeatureLayerView as c}from"../../layers/FeatureLayerView.js";import d from"../../layers/LayerView.js";import{RefreshableLayerView as h}from"../../layers/RefreshableLayerView.js";let y=class extends(h(n(c(p(d))))){constructor(e){super(e)}initialize(){this.addHandles(i(()=>this._updatingRequiredPromise,e=>this._updatingHandles.addPromise(e),s))}destroy(){this._updatingHandles.removeAll(),this._fetcherContext=t(this._fetcherContext)}get maximumNumberOfFeatures(){return this.graphicsPipeline.maximumNumberOfFeatures}set maximumNumberOfFeatures(e){this.graphicsPipeline.maximumNumberOfFeatures=e}get maximumNumberOfFeaturesExceeded(){return null!=this.graphicsPipeline&&!this.suspended&&this.graphicsPipeline.maximumNumberOfFeaturesExceeded}get updatingProgressValue(){return this.graphicsPipeline?.updatingProgressValue??0}get updatePolicy(){return this.graphicsPipeline?.updatePolicy??0}get hasZ(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in e&&null!=e.returnZ?e.returnZ:r.supportsZ)}get hasM(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsM)&&("returnM"in e&&null!=e.returnM&&e.returnM)}setVisibility(e,r){this.graphicsPipeline?.setVisibility(e,r)}createQuery(){return super.createQuery()}queryFeatures(e,r){const t=()=>super.queryFeatures(e,r);return"mesh"===this.layer.geometryType?this._queryFeaturesMesh(this._ensureQuery(e),t):t()}async createGraphicsPipeline(){if(has("feature-pipeline-3d-test")){const{Feature3DPipeline:e}=await import("./graphics/pipeline/Feature3DPipeline.js");return new e({layerView:this})}return new l({layerView:this})}async doRefresh(e){return await this.graphicsPipeline.doRefresh(e)}_popupFeatureHasRequiredFields(e,r){if(!super._popupFeatureHasRequiredFields(e,r))return!1;const t=u(e,this.layer.objectIdField);if(null==t)return!0;const i=this.graphicsPipeline.getMissingAttributesForFeature(t);if(null==i)return!0;for(const s of r)if(i.has(s))return!1;return!0}get usedMemory(){return this.graphicsPipeline?.usedMemory??0}get unloadedMemory(){return this.graphicsPipeline?.unloadedMemory??0}get ignoresMemoryFactor(){return this.graphicsPipeline?.ignoresMemoryFactor??!1}async _queryFeaturesMesh(e,r){this._validateQueryFeaturesMesh(e);const t=await r(),i=this.graphicsPipeline;if(e?.outStatistics||null==i)return t;const s=this.layer.objectIdField,a=[];for(const o of t.features)if(o.geometry){const e=i.getHydratedGeometry(o.attributes[s]);e&&(o.geometry=e,a.push(o))}else a.push(o);return t.features=a,t}_validateQueryFeaturesMesh(e){if(!e)return;const t=e=>{throw new r("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${e}'`)},i=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const r of i)null!=e[r]&&t(r);"returnM"in e&&e.returnM&&t("returnM"),"returnCentroid"in e&&e.returnCentroid&&t("returnCentroid"),null==e.outSpatialReference||e.outSpatialReference.equals(this.view.spatialReference)||t("outSpatialReference")}get test(){}};e([a()],y.prototype,"layer",void 0),e([a()],y.prototype,"graphicsPipeline",void 0),e([a()],y.prototype,"maximumNumberOfFeatures",null),e([a()],y.prototype,"maximumNumberOfFeaturesExceeded",null),e([a(m)],y.prototype,"updatingProgress",void 0),e([a({readOnly:!0})],y.prototype,"updatingProgressValue",null),e([a({readOnly:!0})],y.prototype,"updatePolicy",null),e([a({readOnly:!0})],y.prototype,"hasZ",null),e([a({readOnly:!0})],y.prototype,"hasM",null),y=e([o("esri.views.3d.layers.FeatureLayerViewBase3D")],y);export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{B as l}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as n}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as u}from"./BloomBlurTechniqueConfiguration.js";import{B as c}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as h}from"./BloomCompositionTechnique.js";import{blurRadiusPresets as p,lodFactorsPresets as b,normalizePreset as _}from"./BloomPresets.glsl.js";import{ColorAttachment1 as d,DepthStencilAttachment as g}from"../../../../webgl/enums.js";let f=class extends m{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionParameters=new c,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r(()=>this._updateFogParameters(),()=>{},o),r(()=>this.view.qualitySettings.bloom,e=>{e?(this._enable(),this.precompile()):this._disable()},o)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=p[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(p.cloudy,p[e.type],r)}this._compositionParameters.lodFactors=b[e.type].far,this._compositionParameters.lodFactorsFront=b[e.type].near,this.requestRender(1)}precompile(){this.techniques.precompile(n,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=1,this.techniques.precompile(n,this._blurVerticalConfiguration),this.techniques.precompile(h)}render(e){const t=e.find(({name:e})=>e===a.TRANSPARENT_ENVIRONMENT),r=t.getAttachment(d)?.attachment;if(!r)return t;const o=this.techniques.get(n,this._blurHorizontalConfiguration),s=this.techniques.get(n,this._blurVerticalConfiguration),i=this.techniques.get(h);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(1),t;const m=t.getTexture(),l=this.fboCache,{fullWidth:u,fullHeight:c}=this.bindParameters.camera,p=this.renderingContext;let b=r,_=u/2,f=c/2;const P=5,T=this._blurParameters.blurRadius;for(let a=0;a<P;a++){const e=l.acquire(_,f,"bloomHorizontal",8);this._blurParameters.color=b,this._prepareFBO(e,_,f),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=l.acquire(_,f,"bloomVertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,f),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,_=Math.ceil(_/2),f=Math.ceil(f/2),b=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=T,this._compositionParameters.color=m,this._compositionParameters.emission=r,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=l.acquire(m.descriptor.width,m.descriptor.height,this.produces);return this._prepareFBO(R,u,c),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach(e=>e.release()),R.attachDepth(t.getAttachment(g)),R.attachColor(t.getAttachment(d),d),R}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(16384)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=_(e)}}}};e([s()],f.prototype,"consumes",void 0),f=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],f);export{f as BloomRenderNode};
5
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{B as l}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as n}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as c}from"./BloomBlurTechniqueConfiguration.js";import{B as u}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as h}from"./BloomCompositionTechnique.js";import{blurRadiusPresets as p,lodFactorsPresets as b,normalizePreset as _}from"./BloomPresets.glsl.js";import{ColorAttachment1 as d,DepthStencilAttachment as g}from"../../../../webgl/enums.js";let f=class extends m{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new c,this._blurVerticalConfiguration=new c,this._compositionParameters=new u,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r(()=>this._updateFogParameters(),()=>{},o),r(()=>this.view.qualitySettings.bloom,e=>{e?(this._enable(),this.precompile()):this._disable()},o)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=p[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(p.cloudy,p[e.type],r)}this._compositionParameters.lodFactors=b[e.type].far,this._compositionParameters.lodFactorsFront=b[e.type].near,this.requestRender(1)}precompile(){this.techniques.precompile(n,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=1,this.techniques.precompile(n,this._blurVerticalConfiguration),this.techniques.precompile(h)}render(e){const t=e.find(({name:e})=>e===a.TRANSPARENT_ENVIRONMENT),r=t.getAttachment(d)?.attachment;if(!r)return t;const o=this.techniques.get(n,this._blurHorizontalConfiguration),s=this.techniques.get(n,this._blurVerticalConfiguration),i=this.techniques.get(h);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(1),t;const m=t.getTexture(),l=this.fboCache,{fullWidth:c,fullHeight:u}=this.bindParameters.camera,p=this.renderingContext;let b=r,_=Math.ceil(c/2),f=Math.ceil(u/2);const P=5,T=this._blurParameters.blurRadius;for(let a=0;a<P;a++){const e=l.acquire(_,f,"bloomHorizontal",8);this._blurParameters.color=b,this._prepareFBO(e,_,f),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=l.acquire(_,f,"bloomVertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,f),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,_=Math.ceil(_/2),f=Math.ceil(f/2),b=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=T,this._compositionParameters.color=m,this._compositionParameters.emission=r,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const R=l.acquire(m.descriptor.width,m.descriptor.height,this.produces);return this._prepareFBO(R,c,u),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach(e=>e.release()),R.attachDepth(t.getAttachment(g)),R.attachColor(t.getAttachment(d),d),R}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(16384)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=_(e)}}}};e([s()],f.prototype,"consumes",void 0),f=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],f);export{f as BloomRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{g as n}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as i,isVoxelIntersectorResult as a,isTiles3DIntersectorResult as l,isI3sIntersectorResult as o}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as u,isTerrainIntersectorResult as c}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,e){return g(r)||s(r)?w(r.target?.object,e):c(r)?e.map?.ground:i(r)||o(r)||u(r)||a(r)?w(r.target,e):null}function d(r,e){const t=m(r,e);return"graphic"===t?.type?t.graphic:null}function m(r,e,t={}){if(null==r)return null;if(g(r)||s(r))return h(r.target?.object,e,t);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return u(r)||p(r)?h(r.target,e,t):o(r)?y(r.target,e,t):null}function h(r,e,t){if(null==r?.graphicUid)return null;const n=w(r,e);if(null==n)return null;if(n===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid,t);const i=e.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,t):null}function y(r,e,t){const n=w(r,e);if(null==n)return null;const i=e.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const a=t.defer;return V(i.getGraphicFromIntersectorTarget(r,{defer:a?async r=>a(async()=>V(await r())):void 0}))}function j(r,e){const t=w(r,e);if(null==t)return null;const n=e.allLayerViews.find(r=>r.layer===t);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function V(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function w(r,e){return null==r?.layerViewUid?null:null!=e.graphicsView&&r.layerViewUid===e.graphicsView.uid?e.graphics:e.allLayerViews.find(e=>e.uid===r.layerViewUid)?.layer}function b(e,i){if(g(e)||s(e))return n(e.target.object.boundingVolumeWorldSpace.bounds);if(p(e)){r(U,e.transformation);const t=Math.max(U[0],U[1],U[2]);return e.target.baseBoundingSphere.radius*t}if(o(e)){const r=j(e.target,i);return r?.5*t(r):null}return null}function I(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!o(r))}const U=e();export{b as getIntersectedFeatureBSRadius,I as hasLod,d as toGraphic,m as toHit,f as toOwner};
5
+ import{getScale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{g as n}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as i,isVoxelIntersectorResult as l,isTiles3DIntersectorResult as a,isI3sIntersectorResult as o}from"../../layers/i3s/Intersector.js";import{isOverlayIntersectorResult as u,isTerrainIntersectorResult as c}from"../../terrain/Intersector.js";import{isHUDIntersectorResult as s}from"./HUDIntersectorResult.js";import{isObjectIntersectorResult as g}from"./ObjectIntersectorResult.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,e){return g(r)||s(r)?w(r.target?.object,e):c(r)?e.map?.ground:i(r)||o(r)||u(r)||l(r)?w(r.target,e):null}function d(r,e){const t=m(r,e);return"graphic"===t?.type?t.graphic:null}function m(r,e,t={}){if(null==r)return null;if(g(r)||s(r))return h(r.target?.object,e,t);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(l(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return u(r)||p(r)?h(r.target,e,t):o(r)?y(r.target,e,t):null}function h(r,e,t){if(null==r?.graphicUid)return null;const n=w(r,e);if(null==n)return null;if(n===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid,t);const i=e.allLayerViews.find(r=>r.layer===n);return!i||i.suspended||null==r.graphicUid?null:"getHit"in i?i.getHit(r.graphicUid,t):null}function y(r,e,t){const n=w(r,e);if(null==n)return null;const i=e.allLayerViews.find(r=>r.layer===n);if(!i||i.suspended||!("getGraphicFromIntersectorTarget"in i))return null;const l=t.defer;return V(i.getGraphicFromIntersectorTarget(r,{defer:l?r=>l(async()=>V(await r())):void 0}))}function j(r,e){const t=w(r,e);if(null==t)return null;const n=e.allLayerViews.find(r=>r.layer===t);return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function V(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function w(r,e){return null==r?.layerViewUid?null:null!=e.graphicsView&&r.layerViewUid===e.graphicsView.uid?e.graphics:e.allLayerViews.find(e=>e.uid===r.layerViewUid)?.layer}function b(e,i){if(g(e)||s(e))return n(e.target.object.boundingVolumeWorldSpace.bounds);if(p(e)){r(U,e.transformation);const t=Math.max(U[0],U[1],U[2]);return e.target.baseBoundingSphere.radius*t}if(o(e)){const r=j(e.target,i);return r?.5*t(r):null}return null}function I(r){return!g(r)&&!s(r)&&(p(r)?r.target.numLodLevels>1:!!o(r))}const U=e();export{b as getIntersectedFeatureBSRadius,I as hasLod,d as toGraphic,m as toHit,f as toOwner};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as o,makeHandle as e}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as i,valueInUnit as l}from"../../../core/quantityUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as s}from"../../../core/unitUtils.js";import{g as u,G as c,u as p}from"../../../chunks/vec32.js";import{clone as f,ONES as m,create as d,UNIT_Z as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as y,load as v}from"../../../geometry/coordinateFormatter.js";import j from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as x}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as h}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as U}from"../keybindings.js";import S from"../Tooltip.js";import{parseLatitudeLongitude as w,parseXY as A}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as M,getDegreesGeographic as k}from"../../support/angularMeasurementUtils.js";function R(t){const o=new S(t());return o.addHandles(a(()=>t(),({view:t,options:e,info:n})=>{o.view=t,void 0!==e&&(o.options=e),void 0!==n&&(o.info=n)})),o}function V(t,o){const e=x(o.vertexSpace),{scale:n,orientation:l}=t,{transform:a}=o,s=T(a);e&&null!=s?(l.actual=r(s,"degrees","arithmetic"),l.visible=!0):(l.actual=null,l.visible=!1),e?(n.actual=i(G(a)),n.visible=!0):(n.actual=null,n.visible=!1)}function z(t,o,e){if(!o||!x(o.vertexSpace))return;const n=o.transform??=new j;D(t,n,e),P(t,n,e)}function D(t,o,e){const n=M(t.orientation.actual),r=q(o.rotationAxis);if(null==n||null==r)return;const i=o.rotationAngle,l=n*r,a=(n-i)*r;i!==l&&(e?.onRotateStart(0),o.rotationAngle=l,e?.onRotate(a),e?.onRotateStop(a))}function P(t,o,e){const n=t.scale.actual?.value,r=G(o);if(null==n||n===r)return;const{scale:i}=o;let l;if(0===r)l=f(m);else{const t=n/r;l=u(d(),i,t)}e?.onScaleStart(i[0],i[1],i[2]),o.scale=l,e?.onScale(l[0],l[1],l[2]),e?.onScaleStop(l[0],l[1],l[2])}function F(t,o){const{x:e,y:r,z:i}=o,{x:l,y:a,z:s}=E(t,o.spatialReference);return{dx:null==l||n(l,e)?0:l-e,dy:null==a||n(a,r)?0:a-r,dz:null==s||null==i||n(s,i)?0:s-i}}function E(t,o){let e,n;t.geographic?(e=k(t.longitude.actual),n=k(t.latitude.actual),b(o)&&(null!=e&&null!=n?[e,n]=h(e,n,I):null!=e?e=h(e,0,I)[0]:null!=n&&(n=h(0,n,I)[1]))):(e=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,i=s(o);return{x:e,y:n,z:null!=i&&null!=r?l(r,i):void 0}}const I=[0,0];function T(t){if(!t)return 0;const o=q(t.rotationAxis);return null!=o?o*t.rotationAngle:null}function q(t){return c(t,g)?1:c(t,B)?-1:null}const B=p(d(),g);function G(t){return t?Math.max(...t.scale):1}function H(t,o){return!("key-down"!==t.type||t.key!==U.enterInputMode||!o||!O(o.info))&&(o.enterInputMode(),t.preventDefault(),t.stopPropagation(),!0)}function O(t){const o=t?.sketchOptions;if(!o)return!1;const{inputEnabled:e,visibleElements:n}=o.tooltips;return e&&!0===t.editableFields.some(({name:t})=>"x"===t||"y"===t?n.coordinates:n[t])}function C(n,r){let i=null;return o([n.on("paste",async o=>{i?.abort(),i=t(async()=>{y()||await v(),J(o,n.info,r)})}),t(()=>v()),e(()=>i?.abort())])}function J(t,o,e){if(!o||!("geographic"in o))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=o=>{t.stopPropagation(),t.preventDefault(),e?.onBeforePaste(),o(),e?.onAfterPaste()};if(o.geographic){const t=w(n);t&&r(()=>{o.longitude.applyValue(t.longitude),o.latitude.applyValue(t.latitude)})}else{const t=A(n);t&&r(()=>{o.x.applyValue(t.x),o.y.applyValue(t.y)})}}export{C as connectPasteEvent,H as enterInputModeIfAvailable,F as getXYZDeltasFromTooltipInfo,R as makeTooltip,J as pasteLocation,z as updateMeshTransformFromTooltipInfo,V as updateTooltipInfoFromMeshTransform};
5
+ import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as o,makeHandle as e}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as i,valueInUnit as l}from"../../../core/quantityUtils.js";import{watch as a}from"../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as s}from"../../../core/unitUtils.js";import{g as u,G as c,u as p}from"../../../chunks/vec32.js";import{clone as f,ONES as m,create as d,UNIT_Z as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as y,load as v}from"../../../geometry/coordinateFormatter.js";import j from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as x}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as h}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as U}from"../keybindings.js";import S from"../Tooltip.js";import{parseLatitudeLongitude as w,parseXY as A}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as M,getDegreesGeographic as k}from"../../support/angularMeasurementUtils.js";function R(t){const o=new S(t());return o.addHandles(a(()=>t(),({view:t,options:e,info:n})=>{o.view=t,void 0!==e&&(o.options=e),void 0!==n&&(o.info=n)})),o}function V(t,o){const e=x(o.vertexSpace),{scale:n,orientation:l}=t,{transform:a}=o,s=T(a);e&&null!=s?(l.actual=r(s,"degrees","arithmetic"),l.visible=!0):(l.actual=null,l.visible=!1),e?(n.actual=i(G(a)),n.visible=!0):(n.actual=null,n.visible=!1)}function z(t,o,e){if(!o||!x(o.vertexSpace))return;const n=o.transform??=new j;D(t,n,e),P(t,n,e)}function D(t,o,e){const n=M(t.orientation.actual),r=q(o.rotationAxis);if(null==n||null==r)return;const i=o.rotationAngle,l=n*r,a=(n-i)*r;i!==l&&(e?.onRotateStart(0),o.rotationAngle=l,e?.onRotate(a),e?.onRotateStop(a))}function P(t,o,e){const n=t.scale.actual?.value,r=G(o);if(null==n||n===r)return;const{scale:i}=o;let l;if(0===r)l=f(m);else{const t=n/r;l=u(d(),i,t)}e?.onScaleStart(i[0],i[1],i[2]),o.scale=l,e?.onScale(l[0],l[1],l[2]),e?.onScaleStop(l[0],l[1],l[2])}function F(t,o){const{x:e,y:r,z:i}=o,{x:l,y:a,z:s}=E(t,o.spatialReference);return{dx:null==l||n(l,e)?0:l-e,dy:null==a||n(a,r)?0:a-r,dz:null==s||null==i||n(s,i)?0:s-i}}function E(t,o){let e,n;t.geographic?(e=k(t.longitude.actual),n=k(t.latitude.actual),b(o)&&(null!=e&&null!=n?[e,n]=h(e,n,I):null!=e?e=h(e,0,I)[0]:null!=n&&(n=h(0,n,I)[1]))):(e=t.x.actual?.value,n=t.y.actual?.value);const r=t.elevation.actual,i=s(o);return{x:e,y:n,z:null!=i&&null!=r?l(r,i):void 0}}const I=[0,0];function T(t){if(!t)return 0;const o=q(t.rotationAxis);return null!=o?o*t.rotationAngle:null}function q(t){return c(t,g)?1:c(t,B)?-1:null}const B=p(d(),g);function G(t){return t?Math.max(...t.scale):1}function H(t,o){return!("key-down"!==t.type||t.key!==U.enterInputMode||!o||!O(o.info))&&(o.enterInputMode(),t.preventDefault(),t.stopPropagation(),!0)}function O(t){const o=t?.sketchOptions;if(!o)return!1;const{inputEnabled:e,visibleElements:n}=o.tooltips;return e&&!0===t.editableFields.some(({name:t})=>"x"===t||"y"===t?n.coordinates:n[t])}function C(n,r){let i=null;return o([n.on("paste",o=>{i?.abort(),i=t(async()=>{y()||await v(),J(o,n.info,r)})}),t(()=>v()),e(()=>i?.abort())])}function J(t,o,e){if(!o||!("geographic"in o))return;const n=t.clipboardData?.getData("text");if(!n)return;const r=o=>{t.stopPropagation(),t.preventDefault(),e?.onBeforePaste(),o(),e?.onAfterPaste()};if(o.geographic){const t=w(n);t&&r(()=>{o.longitude.applyValue(t.longitude),o.latitude.applyValue(t.latitude)})}else{const t=A(n);t&&r(()=>{o.x.applyValue(t.x),o.y.applyValue(t.y)})}}export{C as connectPasteEvent,H as enterInputModeIfAvailable,F as getXYZDeltasFromTooltipInfo,R as makeTooltip,J as pasteLocation,z as updateMeshTransformFromTooltipInfo,V as updateTooltipInfoFromMeshTransform};