@arcgis/core 5.2.0-next.28 → 5.2.0-next.29

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 (206) hide show
  1. package/WebMap.js +1 -1
  2. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +40 -2
  3. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0197e459fdb04dfb28ef.js +1 -0
  6. package/assets/esri/core/workers/chunks/{f7344d855f1092383abe.js → 15aa9b85976069acf4f3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/17b98787a0698f584882.js +1 -0
  8. package/assets/esri/core/workers/chunks/1b9c68e8431bb4608209.js +1 -0
  9. package/assets/esri/core/workers/chunks/1bbf5f5da5842b93f638.js +1 -0
  10. package/assets/esri/core/workers/chunks/1bd7b7f4ee7ea6cb7ef9.js +1 -0
  11. package/assets/esri/core/workers/chunks/1e386475937e02b3f523.js +1 -0
  12. package/assets/esri/core/workers/chunks/{24704e70d1ce01ca4081.js → 20ffeb09bb30400de110.js} +1 -1
  13. package/assets/esri/core/workers/chunks/21122f3f3e19a7fd7d33.js +1 -0
  14. package/assets/esri/core/workers/chunks/{25fd4d5d3af887536b3b.js → 2628136bf9f47d238a24.js} +1 -1
  15. package/assets/esri/core/workers/chunks/2b044c8fab2055a8818d.js +1 -0
  16. package/assets/esri/core/workers/chunks/2b2b042a6d6949b06127.js +1 -0
  17. package/assets/esri/core/workers/chunks/2c15c227d057292d4fa8.js +1 -0
  18. package/assets/esri/core/workers/chunks/2f02880a7f081eb210cd.js +1 -0
  19. package/assets/esri/core/workers/chunks/2fc3e43b64300014dddc.js +1 -0
  20. package/assets/esri/core/workers/chunks/{5363c622a0571134cadd.js → 32740b075d7a890d7888.js} +1 -1
  21. package/assets/esri/core/workers/chunks/38b69fba9ae4ccbae6b7.js +1 -0
  22. package/assets/esri/core/workers/chunks/3c342e662c13a05f4caf.js +1 -0
  23. package/assets/esri/core/workers/chunks/{8b452383ba972b638a0c.js → 3d1e5bfd88771d4a0bf6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/43847d66726fd0bcbbb7.js +1 -0
  25. package/assets/esri/core/workers/chunks/4545cf12ad0824ce6b41.js +1 -0
  26. package/assets/esri/core/workers/chunks/45e4b9069263adeae394.js +1 -0
  27. package/assets/esri/core/workers/chunks/47290f27375c76bcc9c7.js +1 -0
  28. package/assets/esri/core/workers/chunks/{8aba35305368234c94f8.js → 5115059b012ef84407cf.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5cccb8b06014ccef30f8.js +1 -0
  30. package/assets/esri/core/workers/chunks/{7f1babbb7ead78201ab3.js → 689673173ca1c0e098fe.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6991ba1b204668e7d4da.js +1 -0
  32. package/assets/esri/core/workers/chunks/{ccffaba50674adba7a0f.js → 6b56971783bf4c31a563.js} +1 -1
  33. package/assets/esri/core/workers/chunks/70c94bcfa20453134037.js +1 -0
  34. package/assets/esri/core/workers/chunks/759686b896f51f0fe6a9.js +1 -0
  35. package/assets/esri/core/workers/chunks/7656900713e55036c3c1.js +1 -0
  36. package/assets/esri/core/workers/chunks/774615303c1cc9a77e20.js +1 -0
  37. package/assets/esri/core/workers/chunks/{6183a26837dc087663ad.js → 7ff37a4f315f7621462b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8ad5e80e911419c1685a.js +1 -0
  39. package/assets/esri/core/workers/chunks/{87011d2fe14c54e296af.js → 9fe71d49c888fd871312.js} +1 -1
  40. package/assets/esri/core/workers/chunks/a14e5607c5c091c77e3d.js +1 -0
  41. package/assets/esri/core/workers/chunks/{7c344c339743295d11d7.js → a2be8784f2cfdbb42681.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a6379a8df8c08b729b9c.js +1 -0
  43. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +1 -0
  44. package/assets/esri/core/workers/chunks/{11d1af758e2140095b10.js → aec82b94787821153d2b.js} +1 -1
  45. package/assets/esri/core/workers/chunks/b624796ff4a9d4c406bf.js +1 -0
  46. package/assets/esri/core/workers/chunks/bb1fad01d9f070e7d795.js +1 -0
  47. package/assets/esri/core/workers/chunks/{654a6dc13ff5be88c8b9.js → bcb2092c87d8d21c6458.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{3e94ed4d57ee7d870cba.js → c6f5688074ae89c37add.js} +1 -1
  49. package/assets/esri/core/workers/chunks/caf150028aeac91b8d80.js +1 -0
  50. package/assets/esri/core/workers/chunks/{a3ca0649edb646da0918.js → cb30e8a66d6dcfebd439.js} +1 -1
  51. package/assets/esri/core/workers/chunks/d7c0ab622caf495dbcef.js +1 -0
  52. package/assets/esri/core/workers/chunks/{fd629872b5c07853f695.js → e4015870412edd69453c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/e774303efefee31952d0.js +1 -0
  54. package/assets/esri/core/workers/chunks/e98a8f80023c6023e72c.js +1 -0
  55. package/assets/esri/core/workers/chunks/f10a339b16d84b650012.js +2 -0
  56. package/assets/esri/core/workers/chunks/fe42fa2144691b9186fd.js +1 -0
  57. package/chunks/GlowComposition.glsl.js +5 -5
  58. package/config.js +1 -1
  59. package/core/AsyncUpdate.js +1 -1
  60. package/core/date.js +1 -1
  61. package/core/workers/workerFactory.js +1 -1
  62. package/form/elements/AttachmentElement.d.ts +4 -1
  63. package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -0
  64. package/form/elements/inputs/attachments/AudioInput.d.ts +1 -0
  65. package/form/elements/inputs/attachments/DocumentInput.d.ts +3 -0
  66. package/form/elements/inputs/attachments/ImageInput.d.ts +1 -0
  67. package/form/elements/inputs/attachments/VideoInput.d.ts +1 -0
  68. package/kernel.js +1 -1
  69. package/layers/AnnotationFeatureLayer.d.ts +0 -2
  70. package/layers/AnnotationFeatureLayer.js +1 -1
  71. package/layers/DimensionFeatureLayer.d.ts +0 -2
  72. package/layers/DimensionFeatureLayer.js +1 -1
  73. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  74. package/layers/support/featureLayerUtils.js +1 -1
  75. package/layers/support/parquetUtils.js +1 -1
  76. package/linkChart/guards.js +2 -0
  77. package/linkChart/utils.js +1 -1
  78. package/networks/CircuitManager.d.ts +44 -0
  79. package/networks/support/CircuitExportJobInfo.d.ts +1 -1
  80. package/networks/support/CircuitVerifyJobInfo.d.ts +1 -1
  81. package/networks/support/jsonTypes.d.ts +2 -0
  82. package/package.json +3 -3
  83. package/rest/featureService/types.d.ts +4 -7
  84. package/rest/networks/circuits/support/CircuitVerifyResult.d.ts +1 -1
  85. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +1 -1
  86. package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +17 -3
  87. package/rest/networks/unitIdentifiers/support/UnitQueryResult.d.ts +1 -1
  88. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  89. package/support/revision.js +1 -1
  90. package/symbols/cim/CIMOperators.js +1 -1
  91. package/symbols/cim/utils.js +1 -1
  92. package/symbols/support/cimSymbolUtils.js +1 -1
  93. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  94. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  95. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  96. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  97. package/views/2d/engine/webgl/util/DictionaryMatcher.js +1 -1
  98. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  99. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  100. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  101. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  102. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  103. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  104. package/views/2d/layers/LayerView2D.js +1 -1
  105. package/views/2d/layers/features/Processor.js +1 -1
  106. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  107. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  108. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  109. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  110. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  111. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  112. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  113. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  114. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  115. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  116. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  117. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  118. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  119. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  120. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  121. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  122. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  123. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  124. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  125. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +2 -0
  126. package/views/2d/layers/support/annodime/PrivateDimensionEffect.js +1 -1
  127. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +2 -0
  128. package/views/2d/layers/support/annodime/TileObjectId.js +2 -0
  129. package/views/2d/layers/support/annodime/annotationGraphic.js +1 -1
  130. package/views/2d/layers/support/annodime/debugUtils.js +2 -0
  131. package/views/2d/layers/support/annodime/dimensionStyleDefaults.js +2 -0
  132. package/views/2d/layers/support/annodime/dimensionSymbols.js +1 -1
  133. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  134. package/views/2d/layers/support/annodime/utils.js +1 -1
  135. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  136. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  137. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  138. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  139. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  140. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  141. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  142. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  143. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  144. package/views/draw/DrawTool.js +1 -1
  145. package/views/interactive/sketch/SketchLabelOptions.d.ts +0 -6
  146. package/views/layers/AnnotationFeatureLayerView.d.ts +0 -7
  147. package/views/layers/DimensionFeatureLayerView.d.ts +0 -7
  148. package/views/support/LayerViewManager.js +1 -1
  149. package/webdoc/support/webdocSaveUtils.js +1 -1
  150. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  151. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  152. package/widgets/Editor/EditorViewModel.d.ts +0 -12
  153. package/widgets/Editor.d.ts +0 -12
  154. package/widgets/Feature/FeatureViewModel.js +1 -1
  155. package/widgets/Feature.js +1 -1
  156. package/widgets/Features/FeaturesViewModel.js +1 -1
  157. package/widgets/Features.js +1 -1
  158. package/widgets/LayerList/LayerListViewModel.js +1 -1
  159. package/widgets/Popup/PopupViewModel.d.ts +0 -1
  160. package/widgets/Popup/PopupViewModel.js +1 -1
  161. package/widgets/Popup.js +1 -1
  162. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  163. package/widgets/Sketch/SketchViewModel.d.ts +0 -12
  164. package/widgets/Sketch.d.ts +0 -12
  165. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  166. package/assets/esri/core/workers/chunks/1893a4b344aa9b57aa8d.js +0 -1
  167. package/assets/esri/core/workers/chunks/1a7c0a1dc6ecc93ea03a.js +0 -1
  168. package/assets/esri/core/workers/chunks/29a7321fd069253c2521.js +0 -1
  169. package/assets/esri/core/workers/chunks/3b7060d264888bf298b1.js +0 -1
  170. package/assets/esri/core/workers/chunks/409bc7d69b95f7a1634c.js +0 -1
  171. package/assets/esri/core/workers/chunks/4fc32e60e63a9c8429b9.js +0 -1
  172. package/assets/esri/core/workers/chunks/548842f8ba9224b15ee4.js +0 -1
  173. package/assets/esri/core/workers/chunks/5728d8440aca205e4f53.js +0 -1
  174. package/assets/esri/core/workers/chunks/668d84dc512b3085a960.js +0 -1
  175. package/assets/esri/core/workers/chunks/67f44cab103d4411dcc5.js +0 -1
  176. package/assets/esri/core/workers/chunks/6db5ee9c589265b23b60.js +0 -1
  177. package/assets/esri/core/workers/chunks/78f68f7534716956f5bc.js +0 -1
  178. package/assets/esri/core/workers/chunks/7c34eb94e2c74602aeab.js +0 -1
  179. package/assets/esri/core/workers/chunks/7fcf4f3b9131c7516524.js +0 -1
  180. package/assets/esri/core/workers/chunks/86e61841df12dbe20a19.js +0 -1
  181. package/assets/esri/core/workers/chunks/8dbf9b1d8bb6817b19c1.js +0 -1
  182. package/assets/esri/core/workers/chunks/937e347d130d469518ce.js +0 -1
  183. package/assets/esri/core/workers/chunks/a195f569eada3a8736be.js +0 -1
  184. package/assets/esri/core/workers/chunks/a2357aae79bfbb91f125.js +0 -1
  185. package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +0 -1
  186. package/assets/esri/core/workers/chunks/b10f36658aa77bc3a6cf.js +0 -1
  187. package/assets/esri/core/workers/chunks/b87aca8ad281870ae970.js +0 -1
  188. package/assets/esri/core/workers/chunks/c46500cc95a84e2a5f7a.js +0 -1
  189. package/assets/esri/core/workers/chunks/cc46261e01a985df5aab.js +0 -1
  190. package/assets/esri/core/workers/chunks/ceb5bd9f2afaa2ea0808.js +0 -1
  191. package/assets/esri/core/workers/chunks/d07261f3fb67b9a99369.js +0 -1
  192. package/assets/esri/core/workers/chunks/d25c37f169577a33db46.js +0 -1
  193. package/assets/esri/core/workers/chunks/d61294dcc3ba41060d44.js +0 -1
  194. package/assets/esri/core/workers/chunks/d8ae5b61b5ae71f4796c.js +0 -1
  195. package/assets/esri/core/workers/chunks/db279d5d9c7deec554bb.js +0 -1
  196. package/assets/esri/core/workers/chunks/e1340232962cf576d37e.js +0 -1
  197. package/assets/esri/core/workers/chunks/e38d1ba15babc238b151.js +0 -1
  198. package/assets/esri/core/workers/chunks/f5125925f83c979edde7.js +0 -2
  199. package/assets/esri/core/workers/chunks/f68b84df093f2894210b.js +0 -1
  200. package/assets/esri/core/workers/chunks/f74b6952c888d92e479e.js +0 -1
  201. package/assets/esri/core/workers/chunks/fe20683f442294eb111b.js +0 -1
  202. package/views/2d/layers/features/layerAdapters/featureLayerAdapterUtils.js +0 -2
  203. package/views/2d/layers/features/support/FeatureSetReaderAnnotationJSON.js +0 -2
  204. package/views/2d/layers/features/support/FeatureSetReaderDimensionJSON.js +0 -2
  205. package/views/2d/layers/support/annodime/annotationUtils.js +0 -2
  206. /package/assets/esri/core/workers/chunks/{f5125925f83c979edde7.js.LICENSE.txt → f10a339b16d84b650012.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as t}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as n}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as d,quantizeY as u}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as c}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as h}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as l,generalizeOptimizedGeometry as m,quantizeOptimizedGeometry as y,unquantizeOptimizedGeometryInPlace as f}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as _,unknown as b}from"../../../../../time/constants.js";import{FeatureSetCache as x}from"./FeatureSetCache.js";const D=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],T=D[0],F=D[1],I=D[2],S=D[3],A=has("featurelayer-simplify-payload-size-factors")??[1,2,4],j=A[0],B=A[1],C=A[2],G=has("featurelayer-simplify-mobile-factor")??2,M=has("esri-mobile"),v=4294967295;function O(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class w{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=M?G:1;t>4e6?r=C*s:t>1e6?r=B*s:t>5e5?r=j*s:t>1e5&&(r=s);let i=0;return e>4e3?i=S*r:e>2e3?i=I*r:e>100?i=F:e>15&&(i=T),i}getBounds(e){O(this._boundsBuffer,4*this.getIndex()+4,0);const t=this.getBoundsXMin();if(t===v||!isFinite(t))return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(t?.isPoint&&0===t.coords[0]&&0===t.coords[1])return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(v),!1;let r=1/0,s=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,r,s,i,a),!0}const r=this.getBoundsXMin(),s=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,r,s,i,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new p(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return l(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&"esriGeometryPolyline"===this.metadata.geometryType&&(t=m(t,this.metadata.geometryType,e.scale[0])),t&&(t=y(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=d(e,t.coords[0]),s=u(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();const t=this.getInTransform();t&&f(e,t);const r=c(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&1!==r){const{stride:t,coords:s}=e;for(let e=2;e<s.length;e+=t)s[e]*=r}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),this._transformToWorldSpace(e)}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);null==t&&(t=new x(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=t(this._boundsBuffer);for(const t of this._caches.values())e+=t.usedMemory;return e}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);if("esriGeometryPoint"===this.geometryType||!t)return t;const r=this.getInTransform();if(!t||!r)return t;const s=r.scale[2]??1,i=r.translate[2]??0,o=r.scale[3]??1,a=r.translate[3]??0,{hasZ:n,hasM:d,stride:u,size:c,coords:h}=t,l=n&&(1!==s||0!==i),m=d&&(1!==o||0!==a);if(l||m){const e=2,t=n?3:2;for(let r=0,n=u*c;r<n;r+=u)l&&(h[r+e]=s*h[r+e]+i),m&&(h[r+t]=o*h[r+t]+a)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){const e=this.readGeometryWorldSpace(),t=l(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??_):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===b}field(t){let i=this.fields.get(t);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const o of this._joined)if(o.setIndex(this.getIndex()),i=o.fields.get(t),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(o._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(o._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(o._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,o._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&null==this.geometry()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.toJSON()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;const t=this.getCursor();for(;t.next();){e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}const e=this.getObjectId();return this._deleted.has(e)||!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(null==this.getInTransform())return h(e);const t=i.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=n(t);return r?isNaN(r[0])||isNaN(r[1])?h(e):(r[1]*=-1,new g([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return l(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new g([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new g([2],[e-1,t+1,1,-1])}}export{w as FeatureSetReader};
2
+ import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as t}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as n}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as d,quantizeY as u}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as c}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as h}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as l,generalizeOptimizedGeometry as m,quantizeOptimizedGeometry as y,unquantizeOptimizedGeometryInPlace as f}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as _,unknown as b}from"../../../../../time/constants.js";import{FeatureSetCache as x}from"./FeatureSetCache.js";const D=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],T=D[0],F=D[1],I=D[2],S=D[3],A=has("featurelayer-simplify-payload-size-factors")??[1,2,4],j=A[0],B=A[1],C=A[2],G=has("featurelayer-simplify-mobile-factor")??2,M=has("esri-mobile"),v=4294967295;function O(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class w{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=M?G:1;t>4e6?r=C*s:t>1e6?r=B*s:t>5e5?r=j*s:t>1e5&&(r=s);let i=0;return e>4e3?i=S*r:e>2e3?i=I*r:e>100?i=F:e>15&&(i=T),i}getBounds(e){O(this._boundsBuffer,4*this.getIndex()+4,0);const t=this.getBoundsXMin();if(t===v||!isFinite(t))return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(t?.isPoint&&0===t.coords[0]&&0===t.coords[1])return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(v),!1;let r=1/0,s=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,r,s,i,a),!0}const r=this.getBoundsXMin(),s=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,r,s,i,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new p(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return l(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&"esriGeometryPolyline"===this.metadata.geometryType&&(t=m(t,this.metadata.geometryType,e.scale[0])),t&&(t=y(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=d(e,t.coords[0]),s=u(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();const t=this.getInTransform();t&&f(e,t);const r=c(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&1!==r){const{stride:t,coords:s}=e;for(let e=2;e<s.length;e+=t)s[e]*=r}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),this._transformToWorldSpace(e)}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);null==t&&(t=new x(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=t(this._boundsBuffer);for(const t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);if("esriGeometryPoint"===this.geometryType||!t)return t;const r=this.getInTransform();if(!t||!r)return t;const s=r.scale[2]??1,i=r.translate[2]??0,o=r.scale[3]??1,a=r.translate[3]??0,{hasZ:n,hasM:d,stride:u,size:c,coords:h}=t,l=n&&(1!==s||0!==i),m=d&&(1!==o||0!==a);if(l||m){const e=2,t=n?3:2;for(let r=0,n=u*c;r<n;r+=u)l&&(h[r+e]=s*h[r+e]+i),m&&(h[r+t]=o*h[r+t]+a)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){const e=this.readGeometryWorldSpace(),t=l(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??_):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===b}field(t){let i=this.fields.get(t);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const o of this._joined)if(o.setIndex(this.getIndex()),i=o.fields.get(t),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(o._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(o._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(o._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,o._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&null==this.geometry()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.toJSON()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;const t=this.getCursor();for(;t.next();){e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}const e=this.getObjectId();return this._deleted.has(e)||!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(null==this.getInTransform())return h(e);const t=i.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=n(t);return r?isNaN(r[0])||isNaN(r[1])?h(e):(r[1]*=-1,new g([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return l(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new g([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new g([2],[e-1,t+1,1,-1])}}export{w as FeatureSetReader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as r,quantizeX as t,quantizeY as s}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as i}from"./FeatureSetReader.js";class d extends i{static from(e,r){if(e instanceof this){const t=new Set(r),s=e._indices.filter(e=>t.has(e));return new d(e._reader,s)}return new d(e.copy(),r)}constructor(e,r){super(e.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=e,this._indices=r}setTransformForDisplay(e){const t=this._reader.getInTransform();if(null==t)return void(this._displayTransform=r(e));const s=r(t),a=r(e),[i,d]=s.scale,[n,o]=s.translate,[h,u]=a.scale,[_,l]=a.translate,y=i/h,c=d/u,p=(n-_)/h,m=(o-l)/u;this._displayTransform={originPosition:"lowerLeft",scale:[1/y,1/c,1,1],translate:[-p/y,-m/c,0,0]}}getInTransform(){return this._reader.getInTransform()}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const e=new d(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e._displayTransform=this._displayTransform,e._processorAttributes=this._processorAttributes,e}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(e){this._reader.contextTimeZone=e}get usedMemory(){return e+this._reader.usedMemory}setProcessorAttributes(e){this._processorAttributes=Object.assign(this._processorAttributes??{},e)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?t(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?s(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){const e=this._reader.readCentroidForDisplay()?.clone();if(e){const[r,a]=e.coords;this._displayTransform&&(e.coords[0]=t(this._displayTransform,r),e.coords[1]=s(this._displayTransform,a))}return e}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(e,r=!1){const t=this._reader.readAttribute(e,r);return null==t&&this._processorAttributes?this._processorAttributes[e]:t}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(e){return this._reader.joinAttributes(e)}getBounds(e){return this._reader.getBounds(e)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return a(e,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(e,r){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this._reader.field(e)}hasField(e){return this._reader.hasField(e)}setField(e,r){return this._reader.setField(e,r)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}}export{d as FeatureSetReaderIndirect};
2
+ import{baseObjectMemory as r}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as e,quantizeX as t,quantizeY as s}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as i}from"./FeatureSetReader.js";class d extends i{static from(r,e){if(r instanceof this){const t=new Set(e),s=r._indices.filter(r=>t.has(r));return new d(r._reader,s)}return new d(r.copy(),e)}constructor(r,e){super(r.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=r,this._indices=e}setTransformForDisplay(r){const t=this._reader.getInTransform();if(null==t)return void(this._displayTransform=e(r));const s=e(t),a=e(r),[i,d]=s.scale,[n,o]=s.translate,[h,u]=a.scale,[_,l]=a.translate,y=i/h,c=d/u,p=(n-_)/h,m=(o-l)/u;this._displayTransform={originPosition:"lowerLeft",scale:[1/y,1/c,1,1],translate:[-p/y,-m/c,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const r=new d(this._reader.copy(),this._indices);return r._currentIndex=this._currentIndex,r._displayTransform=this._displayTransform,r._processorAttributes=this._processorAttributes,r}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(r){this._reader.contextTimeZone=r}get usedMemory(){return r+this._reader.usedMemory}setProcessorAttributes(r){this._processorAttributes=Object.assign(this._processorAttributes??{},r)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?t(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?s(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){const r=this._reader.readCentroidForDisplay()?.clone();if(r){const[e,a]=r.coords;this._displayTransform&&(r.coords[0]=t(this._displayTransform,e),r.coords[1]=s(this._displayTransform,a))}return r}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(r,e=!1){const t=this._reader.readAttribute(r,e);return null==t&&this._processorAttributes?this._processorAttributes[r]:t}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(r){return this._reader.joinAttributes(r)}getBounds(r){return this._reader.getBounds(r)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(r){return this._reader.setDisplayId(r)}setIndex(r){return this._reader.setIndex(r)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){const r=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(r&&{x:r.coords[0],y:r.coords[1]})??null}}readLegacyGeometryForDisplay(){const r=this.readGeometryForDisplay();return a(r,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(r,e){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(r){return this._reader.field(r)}hasField(r){return this._reader.hasField(r)}setField(r,e){return this._reader.setField(r,e)}keys(){return this._reader.keys()}castToText(r=!1){return this._reader.castToText(r)}}export{d as FeatureSetReaderIndirect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"../../../../../core/Error.js";import{deg2rad as t,rad2deg as n}from"../../../../../core/mathUtils.js";import{dist as e,set as s,equals as o,subtract as r,len as h,scale as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m,create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as a}from"../../../../../geometry/support/jsonTypeUtils.js";import d from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as u}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as g,fromCIMVerticalAlignment as c,fromCIMFontDecoration as x}from"../../../../../symbols/cim/utils.js";import P from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as b,magicLabelLineHeight as f}from"../../../engine/webgl/definitions.js";import p from"../../../engine/webgl/Rect.js";import{shapeGlyphs as y}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{queryPointOnLine as D,angleFromXAxis as S,intersectRaysByPointsAndAngles as L}from"../../features/support/FeatureSetReaderDimensionJSON.js";import{roundPtToWholePixel as M,getLineWidth as E}from"../../graphics/graphicsUtils.js";import{DimensionRealFieldName as T}from"./dimensionUtils.js";import{getAttributeValue as w}from"./utils.js";class k{static async create(i,t,n,e){const s=e(i.textSymbol),o=new k(i,s);return await o.initialize(t,n),o}constructor(i,t){if(this._dimensionStyle=i,this._mosaicItems=t,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!")}async initialize(t,n){if(!this._dimensionStyle)return;const{attributes:e}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:e,expressionParserName:s}=this._dimensionStyle;if(e&&s){if(s&&"arcade"!==s.toLocaleLowerCase())throw new i("dimension-layer",`Unsupported expression parser (${s}) for dimension text.`);this._compiledExpression=await u(e,n),this._fieldsIndex=N(t)}}const s=Number(w(T.extAngle,e));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(w("__SYSTEM_LENGTH__",e));const{geometry:o}=t;if(o&&!a(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;e.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,t){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,t),this._evaluateDefaultPlacement(t),this._updateExtensionLines(t),this._updateTextPoint(t),this._offsetTextPoint(t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:t}=this._dimensionStyle;let n=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===t||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(n=!0);if((B(this._beginMarkerRect,this._textRect)||B(this._endMarkerRect,this._textRect))&&(n=!1),!n){const n=i*(this._textRect.width/2);"MoveBegin"===t?this._textPoint=D(this._beginDimensionPoint,this._endDimensionPoint,-n):"MoveEnd"===t&&(this._textPoint=D(this._endDimensionPoint,this._beginDimensionPoint,-n))}}}_offsetTextPoint(i){if(this._hasTextPoint)return;const t=this._textPoint;if(!t)return;const n=.5*this._textSize*i,e=-n*this._dimensionDirection[1],s=n*this._dimensionDirection[0];t[0]+=e,t[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:t,extensionLineOffset:n}=this._dimensionStyle;let s=this._dimensionLinePoint,o=this._endDimensionPoint;null==t||isNaN(t)||0===t||(s=D(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=D(this._endDimensionPoint,this._endBaselinePoint,-t*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=n&&!isNaN(n)&&0!==n){const i=e(s,this._beginBaselinePoint),t=e(o,this._endBaselinePoint);r=D(s,this._beginBaselinePoint,i-n),h=D(o,this._endBaselinePoint,t-n)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(e,d){if(!e||!a(e)||e.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const u=e.rings[0],g=m(u[0][0],u[0][1]),c=m(u[1][0],u[1][1]),x=m(u[2][0],u[2][1]);this._beginBaselinePoint=s(_(),g[0],g[1]),this._endBaselinePoint=s(_(),c[0],c[1]),this._dimensionLinePoint=x;let P=this._extAngleRad;if(o(g,x))this._beginDimensionPoint=s(_(),g[0],g[1]),this._endDimensionPoint=s(_(),c[0],c[1]),this._displayExtLines=!1;else{const e=S([c[0]-g[0],c[1]-g[1]]),o=n(P);o>=-1&&o<=1?P+=t(1):o>=179&&o<=181&&(P-=t(1));const r=L(x,e,c,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=s(_(),x[0],x[1]),this._endDimensionPoint=s(_(),r[0],r[1])}this._dimensionDirection=r(_(),this._endDimensionPoint,this._beginDimensionPoint),this._dimensionLength=h(this._dimensionDirection),this._dimensionDirection=l(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=D(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:t,endMarkerSymbol:n}=this._dimensionStyle,e=this._measureMarkerSymbolSize(t,this._beginDimensionPoint,this._dimensionAngleRad,i),s=this._measureMarkerSymbolSize(n,this._endDimensionPoint,this._dimensionAngleRad+Math.PI,i),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((e?.width??0)/2),h=i*((s?.width??0)/2);if(e&&this._beginDimensionPoint&&(e.x+=this._beginDimensionPoint[0],e.y+=this._beginDimensionPoint[1]),s&&this._endDimensionPoint&&(s.x+=this._endDimensionPoint[0],s.y+=this._endDimensionPoint[1]),this._beginMarkerRect=e,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(e,s,o,i),this._doMarkersFit){const i=D(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=D(this._beginDimensionPoint,this._endDimensionPoint,-4*r),t=D(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[t,this._endDimensionPoint]]}}_checkMarkerFit(i,t,n,e){if(!i||!t)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;if("Tolerance"===s)r*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?B(i,t)&&(h=!1):(B(i,t)&&(h=!1),h&&n&&(B(n,i)||B(n,t))&&(h=!1))}return h}_measureDimensionText(i,t,n){if(null==this._textString||null==t||null==this._mosaicItems)return null;const e=[];for(const g of i)g.codePointAt(0),e.push(this._mosaicItems.glyphs[g.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=g(s.horizontalAlignment),r=c(s.verticalAlignment),h=x(s),l=M(s.height||10);this._textSize=l;const m=!0,_=s.angle||0,a=l/b,d=E(s.lineWidth),u=f*Math.max(.25,Math.min(l||1,4)),P={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},D=y(P,{scale:a,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:u,useCIMAngleBehavior:m,maxLineWidth:d,hasBackground:!1}),S=t;if(!S)return null;const L=n,T=[D.bounds.blX,D.bounds.trY],w=[D.bounds.trX,D.bounds.trY],k=[D.bounds.blX,D.bounds.blY],N=[D.bounds.trX,D.bounds.blY];return T[0]-=D.bounds.x,T[1]-=D.bounds.y,w[0]-=D.bounds.x,w[1]-=D.bounds.y,k[0]-=D.bounds.x,k[1]-=D.bounds.y,N[0]-=D.bounds.x,N[1]-=D.bounds.y,T[0]*=L,T[1]*=L,w[0]*=L,w[1]*=L,k[0]*=L,k[1]*=L,N[0]*=L,N[1]*=L,T[0]+=S[0],T[1]+=S[1],w[0]+=S[0],w[1]+=S[1],k[0]+=S[0],k[1]+=S[1],N[0]+=S[0],N[1]+=S[1],new p(w[0],w[1],1.1*Math.abs(T[0]-w[0]),1.1*Math.abs(N[1]-w[1]))}_measureMarkerSymbolSize(i,t,n,e){return i?new p(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let n=null;const e=1===Number(w(T.useCustomLength,t));n=Number(w(e?T.customLength:T.dimLength,t)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),t.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,t){const{convertUnits:n,displayUnits:e,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&t)return P(this._compiledExpression,t,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function N(i){const{attributes:t}=i,n=Object.keys(T).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new d(n)}function R(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function B(i,t){const n=R(i),e=R(t),s=n.left<=e.right&&e.left<=n.right,o=n.bottom<=e.top&&e.bottom<=n.top;return s&&o}export{k as default};
2
+ import i from"../../../../../core/Error.js";import{deg2rad as t,rad2deg as n}from"../../../../../core/mathUtils.js";import{dist as e,set as s,equals as o,subtract as r,len as h,scale as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m,create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as a}from"../../../../../geometry/support/jsonTypeUtils.js";import d from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as u}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as g,fromCIMVerticalAlignment as c,fromCIMFontDecoration as x}from"../../../../../symbols/cim/utils.js";import P from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as b,magicLabelLineHeight as f}from"../../../engine/webgl/definitions.js";import p from"../../../engine/webgl/Rect.js";import{shapeGlyphs as y}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as D,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as L}from"./dimensionStyleDefaults.js";import{DimensionRealFieldName as M,queryPointOnLine as w,angleFromXAxis as E,intersectRaysByPointsAndAngles as T}from"./dimensionUtils.js";import{getAttributeValue as k}from"./utils.js";class N{static async create(i,t,n,e){const s=e(i.textSymbol),o=new N(i,s);return await o.initialize(t,n),o}constructor(i,t){if(this._dimensionStyle=i,this._mosaicItems=t,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");L(i)}async initialize(t,n){if(!this._dimensionStyle)return;const{attributes:e}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:e,expressionParserName:s}=this._dimensionStyle;if(e&&s){if(s&&"arcade"!==s.toLocaleLowerCase())throw new i("dimension-layer",`Unsupported expression parser (${s}) for dimension text.`);this._compiledExpression=await u(e,n),this._fieldsIndex=R(t)}}const s=Number(k(M.extAngle,e));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(k("__SYSTEM_LENGTH__",e));const{geometry:o}=t;if(o&&!a(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;e.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,t){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,t),this._evaluateDefaultPlacement(t),this._updateExtensionLines(t),this._updateTextPoint(t),this._offsetTextPoint(t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:t}=this._dimensionStyle;let n=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===t||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(n=!0);if((v(this._beginMarkerRect,this._textRect)||v(this._endMarkerRect,this._textRect))&&(n=!1),!n){const n=this._textRect.width/2,e=this._beginMarkerRect.width/2*i,s=this._endMarkerRect.width/2*i;"MoveBegin"===t?this._textPoint=w(this._beginDimensionPoint,this._endDimensionPoint,-(n+e)):"MoveEnd"===t&&(this._textPoint=w(this._endDimensionPoint,this._beginDimensionPoint,-(n+s)))}}}_offsetTextPoint(i){if(this._hasTextPoint)return;const t=this._textPoint;if(!t)return;const n=.5*this._textSize*i,e=-n*this._dimensionDirection[1],s=n*this._dimensionDirection[0];t[0]+=e,t[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:t,extensionLineOffset:n}=this._dimensionStyle;let s=this._dimensionLinePoint,o=this._endDimensionPoint;null==t||isNaN(t)||0===t||(s=w(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=w(this._endDimensionPoint,this._endBaselinePoint,-t*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=n&&!isNaN(n)&&0!==n){const i=e(s,this._beginBaselinePoint),t=e(o,this._endBaselinePoint);r=w(s,this._beginBaselinePoint,i-n),h=w(o,this._endBaselinePoint,t-n)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(e,d){if(!e||!a(e)||e.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const u=e.rings[0],g=m(u[0][0],u[0][1]),c=m(u[1][0],u[1][1]),x=m(u[2][0],u[2][1]);this._beginBaselinePoint=s(_(),g[0],g[1]),this._endBaselinePoint=s(_(),c[0],c[1]),this._dimensionLinePoint=x;let P=this._extAngleRad;if(o(g,x))this._beginDimensionPoint=s(_(),g[0],g[1]),this._endDimensionPoint=s(_(),c[0],c[1]),this._displayExtLines=!1;else{const e=E([c[0]-g[0],c[1]-g[1]]),o=n(P);o>=-1&&o<=1?P+=t(1):o>=179&&o<=181&&(P-=t(1));const r=T(x,e,c,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=s(_(),x[0],x[1]),this._endDimensionPoint=s(_(),r[0],r[1])}this._dimensionDirection=r(_(),this._endDimensionPoint,this._beginDimensionPoint),this._dimensionLength=h(this._dimensionDirection),this._dimensionDirection=l(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:t,endMarkerSymbol:n}=this._dimensionStyle,e=this._measureMarkerSymbolSize(t,this._beginDimensionPoint,this._dimensionAngleRad,i),s=this._measureMarkerSymbolSize(n,this._endDimensionPoint,this._dimensionAngleRad+Math.PI,i),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const r=i*((e?.width??0)/2),h=i*((s?.width??0)/2);if(e&&this._beginDimensionPoint&&(e.x+=this._beginDimensionPoint[0],e.y+=this._beginDimensionPoint[1]),s&&this._endDimensionPoint&&(s.x+=this._endDimensionPoint[0],s.y+=this._endDimensionPoint[1]),this._beginMarkerRect=e,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(e,s,o,i),this._doMarkersFit){const i=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=w(this._beginDimensionPoint,this._endDimensionPoint,-4*r),t=w(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*h);this._dimensionPolyline=[[i,this._beginDimensionPoint],[t,this._endDimensionPoint]]}}_checkMarkerFit(i,t,n,e){if(!i||!t)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;if("Tolerance"===s)r*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?v(i,t)&&(h=!1):(v(i,t)&&(h=!1),h&&n&&(v(n,i)||v(n,t))&&(h=!1))}return h}_measureDimensionText(i,t,n){if(null==this._textString||null==t||null==this._mosaicItems)return null;const e=[];for(const g of i)g.codePointAt(0),e.push(this._mosaicItems.glyphs[g.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=g(s.horizontalAlignment),r=c(s.verticalAlignment),h=x(s),l=D(s.height||10);this._textSize=l;const m=!0,_=s.angle||0,a=l/b,d=S(s.lineWidth),u=f*Math.max(.25,Math.min(l||1,4)),P={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},L=y(P,{scale:a,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:u,useCIMAngleBehavior:m,maxLineWidth:d,hasBackground:!1}),M=t;if(!M)return null;const w=n,E=[L.bounds.blX,L.bounds.trY],T=[L.bounds.trX,L.bounds.trY],k=[L.bounds.blX,L.bounds.blY],N=[L.bounds.trX,L.bounds.blY];return E[0]-=L.bounds.x,E[1]-=L.bounds.y,T[0]-=L.bounds.x,T[1]-=L.bounds.y,k[0]-=L.bounds.x,k[1]-=L.bounds.y,N[0]-=L.bounds.x,N[1]-=L.bounds.y,E[0]*=w,E[1]*=w,T[0]*=w,T[1]*=w,k[0]*=w,k[1]*=w,N[0]*=w,N[1]*=w,E[0]+=M[0],E[1]+=M[1],T[0]+=M[0],T[1]+=M[1],k[0]+=M[0],k[1]+=M[1],N[0]+=M[0],N[1]+=M[1],new p(T[0],T[1],1.1*Math.abs(E[0]-T[0]),1.1*Math.abs(N[1]-T[1]))}_measureMarkerSymbolSize(i,t,n,e){return i?new p(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let n=null;const e=1===Number(k(M.useCustomLength,t));n=Number(k(e?M.customLength:M.dimLength,t)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),t.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,t){const{convertUnits:n,displayUnits:e,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&t)return P(this._compiledExpression,t,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function R(i){const{attributes:t}=i,n=Object.keys(M).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new d(n)}function B(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function v(i,t){const n=B(i),e=B(t),s=n.left<=e.right&&e.left<=n.right,o=n.bottom<=e.top&&e.bottom<=n.top;return s&&o}export{N as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../../../core/Logger.js";import{rad2deg as t}from"../../../../../core/mathUtils.js";import r from"../../../../../geometry/Point.js";import{normalizeTransform as o,quantizeY as n,quantizeX as i}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import m from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as s}from"../../../../../layers/graphics/data/projectionSupport.js";import{DimensionRealFieldName as p}from"./dimensionUtils.js";import{getAttributeValue as y,parseElement as u,reprojectAndQuantize as l}from"./utils.js";import{featureFields as g}from"./virtualFields.js";function f(t){const r=t.readAttribute("element");if(!r)return null;const n=t.getInTransform()??t.getDisplayTransform();if(!n)throw new Error("Quantization transform is required to read annotation features.");const i=t.geometryType;if(!i)return null;const a=t.metadata.outSpatialReference,m=t.metadata.attributeSpatialReference??t.metadata.spatialReference??a,s=o(n),p=t.getObjectId(),y=u(r,p),f=y.geometry||y.graphic?.geometry;if(!f)return e.getLogger("esri.layers.AnnotationFeatureLayer").warn("No geometry found on annotation graphic.",{element:y,objectId:p}),null;const c=l(f,m,a,s);if(!c)return null;const d={},h={annotationGeometryType:b(y),annotationGraphic:y,attributes:d,geometryOverride:{geometry:c,geometryType:i}};for(const e of g)e.addToFeature(h,y);return h}function c(e){const a=e.getInTransform()??e.getDisplayTransform();if(!a)throw new Error("Quantization transform is required to read dimension features.");const u=e.geometryType;if(!u)return null;const l={...e.readAttributes()},g=e.metadata.outSpatialReference,f=e.metadata.attributeSpatialReference??e.metadata.spatialReference??g,c=o(a),d={x:Number(y(p.beginX,l)),y:Number(y(p.beginY,l)),spatialReference:f},b={x:Number(y(p.endX,l)),y:Number(y(p.endY,l)),spatialReference:f},h={x:Number(y(p.dimX,l)),y:Number(y(p.dimY,l)),spatialReference:f};if(isNaN(d.x)||isNaN(d.y)||isNaN(b.x)||isNaN(b.y))return console.error(`Feature with ${p.objectId}=${y(p.objectId,l)} is missing valid begin, end, or dimension points and will be skipped.`),null;(isNaN(h.x)||isNaN(h.y))&&(h.x=d.x,h.y=d.y);const N=s(new r(d),f,g),w=s(new r(b),f,g),x=[N,w,s(new r(h),f,g)],j=Math.sqrt((w.x-N.x)*(w.x-N.x)+(w.y-N.y)*(w.y-N.y)),T=w.x-N.x,E=w.y-N.y;let I=Math.PI/2;0!==T?I=Math.atan2(E,T):E<0&&(I=-Math.PI/2);const R=y(p.textX,l),_=y(p.textY,l);if(null!=R&&null!=_){const e=new r({x:Number(R),y:Number(_),spatialReference:f}),t=s(e,f,g);x.push(t)}const S=x.map(e=>({x:i(c,e.x),y:n(c,e.y)})).flatMap(e=>[e.x,e.y]);return l.__SYSTEM_LENGTH__=j,l.__DIMENSION_ANGLE__=360-t(I),{attributes:l,geometryOverride:{geometry:new m([S.length],S),geometryType:u}}}function d(e,t){const{geometry:r,geometryType:o}=t.geometryOverride,n=a(r,o,!1,!1);return n?{attributes:{...e.readAttributes(),...t.attributes},centroid:null,geometry:n}:null}function b(e){if(e.geometry){if("custom-two-point"===e.geometry.type)return"line";if("custom-multipoint"===e.geometry.type)return"multipoint";if("geometry-bag"===e.geometry.type){if("custom-multipoint"===e.geometry.geometries[0].type)return"multipoint";throw new Error("Unable to determine geometry type from annotation graphic")}if("custom-point"===e.geometry.type)return"point";if("polyline"===e.geometry.type)return"line";if("point"===e.geometry.type)return"point";throw new Error("Unable to determine geometry type from annotation graphic")}if(e.graphic){if("polyline"===e.graphic.geometry.type)return"line";if("point"===e.graphic.geometry.type)return"point";if("multipoint"===e.graphic.geometry.type)return"multipoint";throw new Error("Unable to determine geometry type from annotation graphic")}throw new Error("Unable to determine geometry type from annotation graphic")}export{f as createAnnotationMatcherFeatureInfo,c as createDimensionMatcherFeatureInfo,b as getAnnotationGeometryType,d as mixFeature};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{GeometryCursor as e}from"../../../../../geometry/GeometryCursor.js";class t{static{this.instance=null}static local(){return null===t.instance&&(t.instance=new t),t.instance}execute(e,t,i){return new n(e,t,i)}}class n{constructor(e,t,n){this._cursor=e,this._effect=t,this._context=n}next(){const t=this._cursor.next();if(t&&t.totalSize>0){const n=t.asJSON(),i=f[this._effect.part](n,{...this._effect,target:this._context.target,scaleFactor:this._context.scaleFactor,matcher:this._context.matcher,tileKey:this._context.tileKey,geomUnitsPerPoint:this._context.geomUnitsPerPoint});return e.fromJSONCIM(i)}return null}}function i(e,t){const n=t.matcher,i=t.target.getObjectId(),s=`${t.tileKey}_${i}`,r=n.getAnalyzedGraphic(s);return r.evaluateWithGeometry(e,t.geomUnitsPerPoint*t.scaleFactor),r}function s(e,t){const n=i(e,t);if(!n||!n.textPoint)return e;return{x:n.textPoint[0],y:n.textPoint[1],spatialReference:e.spatialReference}}function r(e,t){const n=i(e,t);if(!n||!n.dimensionLine)return e;const s=n.dimensionLine[0],r=s[1][0],o=s[1][1],c=s[0][0],a=s[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function o(e,t){const n=i(e,t);if(!n||!n.dimensionLine)return e;const s=n.dimensionLine[1],r=s[1][0],o=s[1][1],c=s[0][0],a=s[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function c(e,t){const n=i(e,t);if(!n||!n.extensionLines)return e;const s=n.extensionLines[0],r=s[0][0],o=s[0][1],c=s[1][0],a=s[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function a(e,t){const n=i(e,t);if(!n||!n.extensionLines)return e;const s=n.extensionLines[1],r=s[0][0],o=s[0][1],c=s[1][0],a=s[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}const f={textPoint:s,beginDimensionLine:r,endDimensionLine:o,beginExtensionLine:c,endExtensionLine:a},u="beginMarker",l="endMarker",x="textPoint",h="beginDimensionLine",m="endDimensionLine",p="beginExtensionLine",L="endExtensionLine";export{t as PrivateDimensionEffect,h as beginDimensionLineName,p as beginExtensionLineName,u as beginMarkerName,m as endDimensionLineName,L as endExtensionLineName,l as endMarkerName,i as getDimensionInfo,x as textPointName};
2
+ import{GeometryCursor as e}from"../../../../../geometry/GeometryCursor.js";import{createTileObjectId as t}from"./TileObjectId.js";class n{static{this.instance=null}static local(){return null===n.instance&&(n.instance=new n),n.instance}execute(e,t,n){return new i(e,t,n)}}class i{constructor(e,t,n){this._cursor=e,this._effect=t,this._context=n}next(){const t=this._cursor.next();if(t&&t.totalSize>0){const n=t.asJSON(),i=u[this._effect.part](n,{...this._effect,target:this._context.target,scaleFactor:this._context.scaleFactor,matcher:this._context.matcher,tileKey:this._context.tileKey,geomUnitsPerPoint:this._context.geomUnitsPerPoint});return i?e.fromJSONCIM(i):null}return null}}function s(e,n){const i=n.matcher,s=n.target.getObjectId(),r=t(n.tileKey,s),o=i.getAnalyzedGraphic(r);return o?(o.evaluateWithGeometry(e,n.geomUnitsPerPoint*n.scaleFactor),o):null}function r(e,t){const n=s(e,t);if(!n||!n.textPoint)return e;return{x:n.textPoint[0],y:n.textPoint[1],spatialReference:e.spatialReference}}function o(e,t){const n=s(e,t);if(!n||!n.dimensionLine)return e;const i=n.dimensionLine[0],r=i[1][0],o=i[1][1],c=i[0][0],a=i[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function c(e,t){const n=s(e,t);if(!n||!n.dimensionLine)return e;const i=n.dimensionLine[1],r=i[1][0],o=i[1][1],c=i[0][0],a=i[0][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function a(e,t){const n=s(e,t);if(!n||!n.extensionLines)return e;const i=n.extensionLines[0],r=i[0][0],o=i[0][1],c=i[1][0],a=i[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}function l(e,t){const n=s(e,t);if(!n||!n.extensionLines)return e;const i=n.extensionLines[1],r=i[0][0],o=i[0][1],c=i[1][0],a=i[1][1];return{spatialReference:e.spatialReference,paths:[[[r,o],[c,a]]]}}const u={textPoint:r,beginDimensionLine:o,endDimensionLine:c,beginExtensionLine:a,endExtensionLine:l},f="beginMarker",x="endMarker",m="textPoint",h="beginDimensionLine",p="endDimensionLine",L="beginExtensionLine",g="endExtensionLine";export{n as PrivateDimensionEffect,h as beginDimensionLineName,L as beginExtensionLineName,f as beginMarkerName,p as endDimensionLineName,g as endExtensionLineName,x as endMarkerName,s as getDimensionInfo,m as textPointName};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{GeometryCursor as t}from"../../../../../geometry/GeometryCursor.js";import{createTileObjectId as e}from"./TileObjectId.js";class r{static{this.instance=null}static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(t,e,r){return new n(t,r)}}class n{constructor(t,e){this._cursor=t,this._context=e}next(){const r=this._cursor.next();if(!r||0===r.totalSize)return null;const{matcher:n,target:c,tileKey:o}=this._context,s=n&&c&&null!=o?n.getMatcherGeometryOverride(e(o,c.getObjectId())):null;if(!s)return r;const i=t.fromOptimizedCIM(s.geometry.clone(),s.geometryType);return i.invertY(),i}}export{r as PrivateMatcherGeometryOverrideEffect};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function n(n,r){return`${n}_${r}`}export{n as createTileObjectId};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../core/pbf.js";import{fromJSON as t}from"../../../../../geometry/support/jsonUtils.js";import{base64ToArrayBuffer as a}from"../../../../../support/base64Utils.js";function r(t){const r={leader:[],anchorPoint:[],fontVariations:[]},n=a(t.toString()),i=new e(new Uint8Array(n),new DataView(n));for(;i.next();)switch(i.tag()){case 1:r.version=o(i);break;case 2:r.bloated=i.getBool();break;case 3:r.graphic=s(o(i));break;case 4:r.geometryStorageType=i.getEnum();break;case 5:r.geometry=c(o(i),r.geometryStorageType);break;case 6:r.text=o(i);break;case 7:r.bloated?i.skip():r.symbolID=i.getUInt32();break;case 8:r.textAngle=i.getDouble();break;case 9:r.xOffset=i.getDouble();break;case 10:r.yOffset=i.getDouble();break;case 11:r.horizontalAlignment=i.getEnum();break;case 12:r.verticalAlignment=i.getEnum();break;case 13:r.flipAngle=i.getDouble();break;case 14:i.skip(),r.leader=[];break;case 15:i.skip(),r.anchorPoint=[];break;case 16:r.size=i.getDouble();break;case 17:r.color=o(i);break;case 18:r.characterSpacing=i.getDouble();break;case 19:r.characterWidth=i.getDouble();break;case 20:r.wordSpacing=i.getDouble();break;case 21:r.leading=i.getDouble();break;case 22:r.fontFamilyName=o(i);break;case 23:r.fontStyleName=o(i);break;case 24:r.underline=i.getBool();break;case 25:r.callout=o(i);break;case 26:i.skip(),r.fontVariations=[];break;default:i.skip()}return r}function o(e){return n(e.getString()||"")}function n(e){return e.replaceAll(/\p{Cc}/gu,"")}function s(e){return e?JSON.parse(e):null}function i(e){if(e?.ga){const t=e?.ga?.map(e=>i(e)).filter(e=>e);return{type:"geometry-bag",geometries:t}}const a=e?.g?.points;if(a)return{type:"custom-multipoint",points:a};const r=t(e);return r&&("point"===r.type||"polyline"===r.type)?r:void 0}function c(e,t){if(!e||null==t)return;if(1===t){const t=e.split(",").map(e=>parseFloat(e));return{type:"custom-point",x:t[0],y:t[1]}}if(2===t){const t=e.split(";").map(e=>e.split(",").map(e=>parseFloat(e)));return{type:"custom-two-point",from:[t[0][0],t[0][1]],to:[t[1][0],t[1][1]]}}if(3===t){return{type:"custom-multipoint",points:e.split(";").map(e=>e.split(",").map(e=>parseFloat(e)))}}return i(JSON.parse(e))}export{c as parseAnnotationGeometry,i as parseAnnotationGeometryJson,r as parseAnnotationGraphic,s as parseAnnotationInnerGraphic};
2
+ import e from"../../../../../core/Logger.js";import t from"../../../../../core/pbf.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{base64ToArrayBuffer as r}from"../../../../../support/base64Utils.js";function o(a,o){const s={leader:[],anchorPoint:[],fontVariations:[]},c=r(a.toString()),l=new t(new Uint8Array(c),new DataView(c));for(;l.next();)switch(l.tag()){case 1:s.version=n(l);break;case 2:s.bloated=l.getBool();break;case 3:s.graphic=i(n(l));break;case 4:s.geometryStorageType=l.getEnum();break;case 5:s.geometry=p(n(l),s.geometryStorageType);break;case 6:s.text=n(l);break;case 7:s.bloated?l.skip():s.symbolID=l.getUInt32();break;case 8:s.textAngle=l.getDouble();break;case 9:s.xOffset=l.getDouble();break;case 10:s.yOffset=l.getDouble();break;case 11:s.horizontalAlignment=l.getEnum();break;case 12:s.verticalAlignment=l.getEnum();break;case 13:s.flipAngle=l.getDouble();break;case 14:l.skip(),s.leader=[];break;case 15:l.skip(),s.anchorPoint=[];break;case 16:s.size=l.getDouble();break;case 17:s.color=n(l);break;case 18:s.characterSpacing=l.getDouble();break;case 19:s.characterWidth=l.getDouble();break;case 20:s.wordSpacing=l.getDouble();break;case 21:s.leading=l.getDouble();break;case 22:s.fontFamilyName=n(l);break;case 23:s.fontStyleName=n(l);break;case 24:s.underline=l.getBool();break;case 25:s.callout=n(l);break;case 26:l.skip(),s.fontVariations=[];break;default:l.skip()}const g=s.graphic?.type;return"CIMTextGraphic"===g&&e.getLogger("esri.layers.AnnotationFeatureLayer").warn(`Unsupported annotation with "${g}" graphic.`,{element:s,objectId:o}),s}function n(e){return s(e.getString()||"")}function s(e){return e.replaceAll(/\p{Cc}/gu,"")}function i(e){return e?JSON.parse(e):null}function c(e){if(e?.ga){const t=e?.ga?.map(e=>c(e)).filter(e=>e);return{type:"geometry-bag",geometries:t}}const t=e?.g?.points;if(t)return{type:"custom-multipoint",points:t};const r=a(e);return r&&("point"===r.type||"polyline"===r.type)?r:void 0}function p(e,t){if(!e||null==t)return;if(1===t){const t=e.split(",").map(e=>parseFloat(e));return{type:"custom-point",x:t[0],y:t[1]}}if(2===t){const t=e.split(";").map(e=>e.split(",").map(e=>parseFloat(e)));return{type:"custom-two-point",from:[t[0][0],t[0][1]],to:[t[1][0],t[1][1]]}}if(3===t){return{type:"custom-multipoint",points:e.split(";").map(e=>e.split(",").map(e=>parseFloat(e)))}}return c(JSON.parse(e))}export{p as parseAnnotationGeometry,c as parseAnnotationGeometryJson,o as parseAnnotationGraphic,i as parseAnnotationInnerGraphic};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ const e={type:"CIMSolidStroke",enable:!0,color:[255,0,0,255],width:1.5};async function o(e,o,n){const r=t(n);if(!r)return[];const s=await o.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:r});return e.createMeshWriters(s?.meshes||[])}function t(e){return"esriGeometryPolygon"!==e?(e&&console.error(`Annotation/dimension debug overlay expects polygon footprint geometry, but received ${e}.`),null):{type:"CIMSymbolReference",symbol:n()}}function n(){return{type:"CIMPolygonSymbol",symbolLayers:[{...e}]}}export{o as createDebugWriters};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function n(n){return null==n.align&&(n.align=!1),null==n.baselineHeight&&(n.baselineHeight=0),null==n.convertUnits&&(n.convertUnits=!1),null==n.displayPrecision&&(n.displayPrecision=0),null==n.drawLineOnFit&&(n.drawLineOnFit=!1),null==n.extendLineOnFit&&(n.extendLineOnFit=!1),null==n.extensionLineOffset&&(n.extensionLineOffset=0),null==n.extensionLineOvershot&&(n.extensionLineOvershot=0),null==n.iD&&(n.iD=0),null==n.markerFitTolerance&&(n.markerFitTolerance=0),n}export{n as initializeDimensionStyleDefaults};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clone as e}from"../../../../../core/lang.js";import{textPointName as i,beginMarkerName as r,endMarkerName as n,beginDimensionLineName as t,endDimensionLineName as o,beginExtensionLineName as m,endExtensionLineName as s}from"./PrivateDimensionEffect.js";import{fixCIMUnsupported as a}from"./unsupported.js";function p(i){i=L(i);const r=e(i.symbolLayers||[]);for(const e of r)"CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||(e.markerPlacement={type:"CIMMarkerPlacementAtRatioPositions",angleToLine:!0,keepUpright:!1,positionArray:[0]});return r}function f(e){const i=[{type:"PrivateDimensionEffect",part:t,primitiveName:t+"Effect"}];let n=e.dimensionLineSymbol.symbolLayers||[];n=n.map(e=>({...e,primitiveName:t+"Layer",effects:[...i]})),"Begin"!==e.dimensionLineOption&&"Both"!==e.dimensionLineOption&&n.forEach(e=>{});let o=p(e.beginMarkerSymbol);o=o.map(e=>({...e,primitiveName:r+"Layer",effects:[...i]})),"Begin"!==e.markerOption&&"Both"!==e.markerOption&&n.forEach(e=>{});return{...e.dimensionLineSymbol,symbolLayers:[...n,...o]}}function y(e){const i=[{type:"PrivateDimensionEffect",part:o,primitiveName:o+"Effect"}];let r=e.dimensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:o+"Layer",effects:[...i]})),"End"!==e.dimensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});let t=p(e.endMarkerSymbol);t=t.map(e=>({...e,primitiveName:n+"Layer",effects:[...i]})),"End"!==e.markerOption&&"Both"!==e.markerOption&&r.forEach(e=>{});return{...e.dimensionLineSymbol,symbolLayers:[...r,...t]}}function u(e){const i=[{type:"PrivateDimensionEffect",part:m,primitiveName:m+"Effect",overshot:e.extensionLineOvershot||1}];let r=e.extensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:m+"Layer",effects:[...i]})),"Begin"!==e.extensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});return{...e.extensionLineSymbol,symbolLayers:r}}function l(e){const i=[{type:"PrivateDimensionEffect",part:s,primitiveName:s+"Effect",overshot:e.extensionLineOvershot||1}];let r=e.extensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:s+"Layer",effects:[...i]})),"End"!==e.extensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});return{...e.extensionLineSymbol,symbolLayers:r}}function L(e){const i=(e.symbolLayers||[]).map(e=>{if("CIMVectorMarker"===e.type){const i=e.frame.xmax-e.frame.xmin;return{...e,frame:{xmin:e.frame.xmin,ymin:e.frame.ymin,xmax:e.frame.xmax+i,ymax:e.frame.ymax}}}return e});return{...e,symbolLayers:i}}function c(e){if("None"===e.textOption)return null;const r=[{type:"PrivateDimensionEffect",part:i,primitiveName:i+"Effect"}];return{type:"CIMPointSymbol",angleAlignment:"Map",symbolLayers:[{type:"CIMVectorMarker",primitiveName:i+"Layer",enable:!0,size:20,frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},primitiveName:i+"Graphic",symbol:e.textSymbol}],effects:r}]}}function E(e){const a="$feature.__DIMENSION_ANGLE__",p="0",f=v(),y=[],u=[i+"Graphic",i+"Effect",t+"Effect",o+"Effect",m+"Effect",s+"Effect"];for(const i of u)y.push({type:"CIMPrimitiveOverride",primitiveName:i,propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",expression:f,returnType:"Default"}});return[...y,{type:"CIMPrimitiveOverride",primitiveName:i+"Layer",propertyName:"Rotation",valueExpressionInfo:{type:"CIMExpressionInfo",expression:a+"-"+p,returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:r+"Layer",propertyName:"Size",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.MARKERDISPLAY == 2 || $feature.MARKERDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:n+"Layer",propertyName:"Size",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.MARKERDISPLAY == 1 || $feature.MARKERDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:t+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.DIMDISPLAY == 2 || $feature.DIMDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:o+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.DIMDISPLAY == 1 || $feature.DIMDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:m+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.EXTDISPLAY == 2 || $feature.EXTDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:s+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.EXTDISPLAY == 1 || $feature.EXTDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}}]}function v(e){return"$feature.__COMPUTED_TEXT_STRING__"}function x(e){e=a(e);return{beginDimensionLineSymbol:I.getBeginDimensionLine(e),endDimensionLineSymbol:I.getEndDimensionLine(e),beginExtensionLineSymbol:I.getBeginExtensionLine(e),endExtensionLineSymbol:I.getEndExtensionLine(e),textSymbol:I.getText(e),primitiveOverrides:I.getPrimitiveOverrides(e)}}const I={getBeginDimensionLine:f,getEndDimensionLine:y,getBeginExtensionLine:u,getEndExtensionLine:l,getText:c,getPrimitiveOverrides:E,processDimensionStyle:x};export{I as dimensionSymbols,x as processDimensionStyle};
2
+ import{clone as e}from"../../../../../core/lang.js";import{initializeDimensionStyleDefaults as i}from"./dimensionStyleDefaults.js";import{textPointName as r,beginMarkerName as t,endMarkerName as n,beginDimensionLineName as o,endDimensionLineName as m,beginExtensionLineName as a,endExtensionLineName as s}from"./PrivateDimensionEffect.js";import{fixCIMUnsupported as p}from"./unsupported.js";function f(e){return e}function y(i){i=v(i);const r=e(i.symbolLayers||[]);for(const e of r)"CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||(e.markerPlacement={type:"CIMMarkerPlacementAtRatioPositions",angleToLine:!0,keepUpright:!1,positionArray:[0]});return r}function u(){return f({type:"PrivateMatcherGeometryOverrideEffect"})}function l(e){const i=[u(),f({type:"PrivateDimensionEffect",part:o,primitiveName:o+"Effect"})];let r=e.dimensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:o+"Layer",effects:[...i]})),"Begin"!==e.dimensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});let n=y(e.beginMarkerSymbol);n=n.map(e=>({...e,primitiveName:t+"Layer",effects:[...i]})),"Begin"!==e.markerOption&&"Both"!==e.markerOption&&r.forEach(e=>{});return{...e.dimensionLineSymbol,symbolLayers:[...r,...n]}}function L(e){const i=[u(),f({type:"PrivateDimensionEffect",part:m,primitiveName:m+"Effect"})];let r=e.dimensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:m+"Layer",effects:[...i]})),"End"!==e.dimensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});let t=y(e.endMarkerSymbol);t=t.map(e=>({...e,primitiveName:n+"Layer",effects:[...i]})),"End"!==e.markerOption&&"Both"!==e.markerOption&&r.forEach(e=>{});return{...e.dimensionLineSymbol,symbolLayers:[...r,...t]}}function c(e){const i=[u(),f({type:"PrivateDimensionEffect",part:a,primitiveName:a+"Effect"})];let r=e.extensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:a+"Layer",effects:[...i]})),"Begin"!==e.extensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});return{...e.extensionLineSymbol,symbolLayers:r}}function E(e){const i=[u(),f({type:"PrivateDimensionEffect",part:s,primitiveName:s+"Effect"})];let r=e.extensionLineSymbol.symbolLayers||[];r=r.map(e=>({...e,primitiveName:s+"Layer",effects:[...i]})),"End"!==e.extensionLineOption&&"Both"!==e.dimensionLineOption&&r.forEach(e=>{});return{...e.extensionLineSymbol,symbolLayers:r}}function v(e){const i=(e.symbolLayers||[]).map(e=>{if("CIMVectorMarker"===e.type){const i=e.frame.xmax-e.frame.xmin;return{...e,frame:{xmin:e.frame.xmin,ymin:e.frame.ymin,xmax:e.frame.xmax+i,ymax:e.frame.ymax}}}return e});return{...e,symbolLayers:i}}function x(e){if("None"===e.textOption)return null;const i=[u(),f({type:"PrivateDimensionEffect",part:r,primitiveName:r+"Effect"})];return{type:"CIMPointSymbol",angleAlignment:"Map",symbolLayers:[{type:"CIMVectorMarker",primitiveName:r+"Layer",enable:!0,size:20,frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},primitiveName:r+"Graphic",symbol:e.textSymbol}],effects:i}]}}function I(e){const i="$feature.__DIMENSION_ANGLE__",p="0",f=M(),y=[],u=[r+"Graphic",r+"Effect",o+"Effect",m+"Effect",a+"Effect",s+"Effect"];for(const r of u)y.push({type:"CIMPrimitiveOverride",primitiveName:r,propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",expression:f,returnType:"Default"}});return[...y,{type:"CIMPrimitiveOverride",primitiveName:r+"Layer",propertyName:"Rotation",valueExpressionInfo:{type:"CIMExpressionInfo",expression:i+"-"+p,returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:t+"Layer",propertyName:"Size",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.MARKERDISPLAY == 2 || $feature.MARKERDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:n+"Layer",propertyName:"Size",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.MARKERDISPLAY == 1 || $feature.MARKERDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:o+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.DIMDISPLAY == 2 || $feature.DIMDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:m+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.DIMDISPLAY == 1 || $feature.DIMDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:a+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.EXTDISPLAY == 2 || $feature.EXTDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:s+"Layer",propertyName:"Width",valueExpressionInfo:{type:"CIMExpressionInfo",expression:"if ($feature.EXTDISPLAY == 1 || $feature.EXTDISPLAY == 3) { return 0; } else { return null; }",returnType:"Default"}}]}function M(e){return"$feature.__COMPUTED_TEXT_STRING__"}function D(e){i(e),e=p(e);return{beginDimensionLineSymbol:d.getBeginDimensionLine(e),endDimensionLineSymbol:d.getEndDimensionLine(e),beginExtensionLineSymbol:d.getBeginExtensionLine(e),endExtensionLineSymbol:d.getEndExtensionLine(e),textSymbol:d.getText(e),primitiveOverrides:d.getPrimitiveOverrides(e)}}const d={getBeginDimensionLine:l,getEndDimensionLine:L,getBeginExtensionLine:c,getEndExtensionLine:E,getText:x,getPrimitiveOverrides:I,processDimensionStyle:D};export{d as dimensionSymbols,D as processDimensionStyle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getFontFamily as t}from"../../../../../core/fontUtils.js";import{fromCIMFontDecoration as e,fromCIMFontStyle as n}from"../../../../../symbols/cim/utils.js";function i(e){const{style:i}=n(e.fontStyleName);return`${t(e.fontFamilyName)}_${i}`}function o(i){const o=e(i),{style:m,weight:E}=n(i.fontStyleName);return{family:t(i.fontFamilyName),decoration:o,style:m,weight:E}}var m;!function(t){t.objectId="OBJECTID",t.shape="SHAPE",t.dimLength="DIMLENGTH",t.beginX="BEGINX",t.beginY="BEGINY",t.endX="ENDX",t.endY="ENDY",t.textX="TEXTX",t.textY="TEXTY",t.styleId="STYLEID",t.dimX="DIMX",t.dimY="DIMY",t.customLength="CUSTOMLENGTH",t.useCustomLength="USECUSTOMLENGTH",t.dimDisplay="DIMDISPLAY",t.extDisplay="EXTDISPLAY",t.markerDisplay="MARKERDISPLAY",t.extAngle="EXTANGLE",t.dimType="DIMTYPE",t.textAngle="TEXTANGLE"}(m||(m={}));export{m as DimensionRealFieldName,o as getFontForCIMTextSymbol,i as getFontNameForCIMTextSymbol};
2
+ import{getFontFamily as t}from"../../../../../core/fontUtils.js";import{fromCIMFontDecoration as n,fromCIMFontStyle as e}from"../../../../../symbols/cim/utils.js";function r(n){const{style:r}=e(n.fontStyleName);return`${t(n.fontFamilyName)}_${r}`}function i(r){const i=n(r),{style:o,weight:s}=e(r.fontStyleName);return{family:t(r.fontFamilyName),decoration:i,style:o,weight:s}}var o;function s(t,n,e){const r=n[0]-t[0],i=n[1]-t[1],o=Math.sqrt(r*r+i*i);if(0===o)return[t[0],t[1]];return[t[0]+r/o*e,t[1]+i/o*e]}!function(t){t.objectId="OBJECTID",t.shape="SHAPE",t.dimLength="DIMLENGTH",t.beginX="BEGINX",t.beginY="BEGINY",t.endX="ENDX",t.endY="ENDY",t.textX="TEXTX",t.textY="TEXTY",t.styleId="STYLEID",t.dimX="DIMX",t.dimY="DIMY",t.customLength="CUSTOMLENGTH",t.useCustomLength="USECUSTOMLENGTH",t.dimDisplay="DIMDISPLAY",t.extDisplay="EXTDISPLAY",t.markerDisplay="MARKERDISPLAY",t.extAngle="EXTANGLE",t.dimType="DIMTYPE",t.textAngle="TEXTANGLE"}(o||(o={}));const a=1e-9;function u(t,n){return t[0]*n[1]-t[1]*n[0]}function f(t,n,e,r){const i=[Math.cos(n),Math.sin(n)],o=[Math.cos(r),Math.sin(r)],s=[e[0]-t[0],e[1]-t[1]],f=u(i,o);if(Math.abs(f)<=a)return null;const l=u(s,o)/f,c=u(s,i)/f;if(l<0||c<0)return null;return[t[0]+i[0]*l,t[1]+i[1]*l]}function l(t){const n=t[0],e=t[1];if(0===n&&0===e)return 0;if(0===n&&e>0)return Math.PI/2;if(0===n&&e<0)return 3*Math.PI/2;if(n<0&&0===e)return Math.PI;if(n>0&&0===e)return 0;let r=Math.atan2(e,n);return r<0&&(r+=2*Math.PI),r}export{o as DimensionRealFieldName,l as angleFromXAxis,i as getFontForCIMTextSymbol,r as getFontNameForCIMTextSymbol,f as intersectRaysByPointsAndAngles,s as queryPointOnLine};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../geometry/Point.js";import t from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as n}from"../../../../../layers/graphics/data/projectionSupport.js";import{parseAnnotationGraphic as r}from"./annotationGraphic.js";function o({scale:e,translate:t},n){return(n-t[0])/e[0]}function i({scale:e,translate:t},n){return(n-t[1])/e[1]}function s(r,p,c,f){if("custom-point"===r.type||"point"===r.type){const{x:s,y:u}=r,a=n(new e({x:s,y:u,spatialReference:p}),p,c);return new t([1],[o(f,a.x),i(f,a.y)])}if("custom-two-point"===r.type){const[s,u]=r.from,a=n(new e({x:s,y:u,spatialReference:p}),p,c),[y,l]=r.to,m=n(new e({x:y,y:l,spatialReference:p}),p,c);return new t([2],[o(f,a.x),i(f,a.y),o(f,m.x),i(f,m.y)])}if("custom-multipoint"===r.type){const s=r.points.map(([t,r])=>n(new e({x:t,y:r,spatialReference:p}),p,c)),u=s.map(({x:e,y:t})=>[o(f,e),i(f,t)]).flat();return new t([s.length],u)}if("geometry-bag"===r.type){let e=[],n=[],o=!0;for(const t of r.geometries){o||(e.push(2),n.push(0,0,1,1)),o=!1;const r=s(t,p,c,f);r&&(e=[...e,...r.lengths],n=[...n,...r.coords])}if(0===e.length||0===n.length)return;return new t(e,n)}if("polyline"===r.type){const[s,u]=r.paths[0][0],a=n(new e({x:s,y:u,spatialReference:p}),p,c),[y,l]=r.paths[0][1],m=n(new e({x:y,y:l,spatialReference:p}),p,c);return new t([2],[o(f,a.x),i(f,a.y),o(f,m.x),i(f,m.y)])}throw new Error("Unsupported geometry type!")}function p(e){return r(e)}function c(e,...t){const n={};for(const r of t)n[r]=e[r];return n}function f(e,t){const n=e.indexOf(t);if(-1===n)return null;return e[n+1]}function u(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"ReferenceScale");return parseInt(n,10)}function a(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"SymbolCollection");if(!n)return[];return JSON.parse(n)}function y(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"StyleCollection");if(!n)return[];return JSON.parse(n)}function l(e,t){const n=e.toLowerCase();for(const r in t){if(n===r.toLowerCase())return r}return e}function m(e,t){return t[l(e,t)]}function x(e,t,n){n[l(e,n)]=t}export{m as getAttributeValue,u as getReferenceScale,y as getStyleCollection,a as getSymbolCollection,p as parseElement,c as pick,o as quantizeXf,i as quantizeYf,s as reprojectAndQuantize,x as setAttributeValue};
2
+ import e from"../../../../../geometry/Point.js";import t from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as n}from"../../../../../layers/graphics/data/projectionSupport.js";import{parseAnnotationGraphic as r}from"./annotationGraphic.js";function o({scale:e,translate:t},n){return(n-t[0])/e[0]}function i({scale:e,translate:t},n){return(n-t[1])/e[1]}function s(r,p,c,f){if("custom-point"===r.type||"point"===r.type){const{x:s,y:u}=r,a=n(new e({x:s,y:u,spatialReference:p}),p,c);return new t([1],[o(f,a.x),i(f,a.y)])}if("custom-two-point"===r.type){const[s,u]=r.from,a=n(new e({x:s,y:u,spatialReference:p}),p,c),[y,l]=r.to,m=n(new e({x:y,y:l,spatialReference:p}),p,c);return new t([2],[o(f,a.x),i(f,a.y),o(f,m.x),i(f,m.y)])}if("custom-multipoint"===r.type){const s=r.points.map(([t,r])=>n(new e({x:t,y:r,spatialReference:p}),p,c)),u=s.map(({x:e,y:t})=>[o(f,e),i(f,t)]).flat();return new t([s.length],u)}if("geometry-bag"===r.type){let e=[],n=[],o=!0;for(const t of r.geometries){o||(e.push(2),n.push(0,0,1,1)),o=!1;const r=s(t,p,c,f);r&&(e=[...e,...r.lengths],n=[...n,...r.coords])}if(0===e.length||0===n.length)return;return new t(e,n)}if("polyline"===r.type){const[s,u]=r.paths[0][0],a=n(new e({x:s,y:u,spatialReference:p}),p,c),[y,l]=r.paths[0][1],m=n(new e({x:y,y:l,spatialReference:p}),p,c);return new t([2],[o(f,a.x),i(f,a.y),o(f,m.x),i(f,m.y)])}throw new Error("Unsupported geometry type!")}function p(e,t){return r(e,t)}function c(e,...t){const n={};for(const r of t)n[r]=e[r];return n}function f(e,t){const n=e.indexOf(t);if(-1===n)return null;return e[n+1]}function u(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"ReferenceScale");return parseInt(n,10)}function a(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"SymbolCollection");if(!n)return[];return JSON.parse(n)}function y(e){const{propertySetItems:t}=e.extensionProperties,n=f(t,"StyleCollection");if(!n)return[];return JSON.parse(n)}function l(e,t){const n=e.toLowerCase();for(const r in t){if(n===r.toLowerCase())return r}return e}function m(e,t){return t[l(e,t)]}function x(e,t,n){n[l(e,n)]=t}export{m as getAttributeValue,u as getReferenceScale,y as getStyleCollection,a as getSymbolCollection,p as parseElement,c as pick,o as quantizeXf,i as quantizeYf,s as reprojectAndQuantize,x as setAttributeValue};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as s,throwIfAborted as o,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as n,sync as r}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../../../core/units.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createDrawTool as p,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as m}from"./toolLifecycleUtils.js";import{creationVerticalOffset as u}from"./ViewshedConfiguration.js";import w from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as g}from"./viewshedToolUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as y}from"../../../input/InputManager.js";import{sketchKeys as O}from"../../../interactive/keybindings.js";import b from"../../../interactive/sketch/SketchOptions.js";const S="multiple",f=Symbol("hiddenManipulatorHandle");let C=class extends i{constructor(e){super(e),this.placementMode=S,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._sketchOptions=new b({tooltips:{enabled:!1}}),this._scenePoint=d()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),y.DEFAULT),n(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},r)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._sketchOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(s()),o(t);const{resolve:i,reject:n,promise:r}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new w({abortHandle:l,reject:n,resolve:i}),this.place(e),r}place(e){this.callbacks.setSelectedViewshed(null),this.placementMode=e,this._startObserverPlacement()}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(O.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):O.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,i,s){const o=new t({observer:e,feature:s});this.analysis.viewsheds.add(o),this.stagedViewshed=o,this.creationState="placing-target",this._updateStagedViewshed(i),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),"multiple"!==this.placementMode||(this.creationState="placing-observer")}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:i,snappingManager:s}=p({analysisViewData:this.analysisViewData,view:this.view,sketchOptions:this._sketchOptions,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=i;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,i)=>this._onObserverMapPointComplete(t,s,e,i),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(o){this._destroyDrawTool(e),this._rejectPlaceOperation(o instanceof Error?o:new Error(String(o)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,i,s){const o=V(i),a=this._toScenePoint(o),n=_({intersector:e,snappingManager:t,screenPoint:s,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(o,a,n)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)}_onObserverMapPointPreview(e){const t=V(e),i=this._toScenePoint(t);this._renderer?.updatePlacementLocation(i)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_onManipulatorCountChange(e){e.removeHandles(f);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,f)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&m(this.view,e)}_toScenePoint(e){return this.view.renderCoordsHelper.toRenderCoords(e,this._scenePoint),this._scenePoint}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const i=this.callbacks.findViewshedComputedData(t);if(!i)return;const{heading:s,tilt:o,farDistance:a}=g(this.view,i,e);t.farDistance=a,t.tilt=o,t.heading=s}get test(){}};function V(e){const t=e.clone(),i=l(t.spatialReference);return t.z=(t.z??0)+u/i,t}e([c({constructOnly:!0})],C.prototype,"analysis",void 0),e([c({constructOnly:!0})],C.prototype,"analysisViewData",void 0),e([c({constructOnly:!0})],C.prototype,"view",void 0),e([c({constructOnly:!0})],C.prototype,"callbacks",void 0),e([c()],C.prototype,"placementMode",void 0),e([c()],C.prototype,"stagedViewshed",void 0),e([c()],C.prototype,"_placeOperation",void 0),e([c()],C.prototype,"_drawTool",void 0),e([c()],C.prototype,"_renderer",void 0),e([c()],C.prototype,"_sketchOptions",void 0),e([c()],C.prototype,"updating",null),e([c()],C.prototype,"active",null),e([c({value:null})],C.prototype,"creationState",null),C=e([h("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],C);export{C as ViewshedPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import i from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as s,throwIfAborted as o,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as r,sync as n}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../../../core/units.js";import{property as c,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createDrawTool as p,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as m}from"./toolLifecycleUtils.js";import{creationVerticalOffset as u}from"./ViewshedConfiguration.js";import v from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as w}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as g}from"./viewshedToolUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as O}from"../../../input/InputManager.js";import{sketchKeys as S}from"../../../interactive/keybindings.js";import y from"../../../interactive/sketch/SketchOptions.js";const b="multiple",f=Symbol("hiddenManipulatorHandle");let C=class extends i{constructor(e){super(e),this.placementMode=b,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._sketchOptions=new y({tooltips:{enabled:!1}}),this._observerScenePoint=d(),this._targetScenePoint=d()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),O.DEFAULT),r(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},n)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._sketchOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(s()),o(t);const{resolve:i,reject:r,promise:n}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new v({abortHandle:l,reject:r,resolve:i}),this.place(e),n}place(e){this.callbacks.setSelectedViewshed(null),this.placementMode=e,this._startObserverPlacement()}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(S.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):S.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,i,s){const o=new t({observer:e,feature:s});this.analysis.viewsheds.add(o),this.stagedViewshed=o,this.creationState="placing-target",this._updateStagedViewshed(i),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t)}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:i,snappingManager:s}=p({analysisViewData:this.analysisViewData,view:this.view,sketchOptions:this._sketchOptions,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=i;try{this.view.addAndActivateTool(e),e.begin([w({mode:this.placementMode,onObserverComplete:(e,i)=>this._onObserverMapPointComplete(t,s,e,i),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(o){this._destroyDrawTool(e),this._rejectPlaceOperation(o instanceof Error?o:new Error(String(o)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,i,s){const o=V(i),a=this._toScenePoint(i,this._targetScenePoint),r=_({intersector:e,snappingManager:t,screenPoint:s,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(o,a,r)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t),"multiple"===this.placementMode&&(this.creationState="placing-observer",this._onObserverMapPointPreview(e))}_onObserverMapPointPreview(e){const t=V(e),i=this._toScenePoint(t,this._observerScenePoint);this._renderer?.updatePlacementLocation(i)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_onManipulatorCountChange(e){e.removeHandles(f);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,f)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&m(this.view,e)}_toScenePoint(e,t){return this.view.renderCoordsHelper.toRenderCoords(e,t),t}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const i=this.callbacks.findViewshedComputedData(t);if(!i)return;const{heading:s,tilt:o,farDistance:a}=g(this.view,i,e);t.farDistance=a,t.tilt=o,t.heading=s}get test(){}};function V(e){const t=e.clone(),i=l(t.spatialReference);return t.z=(t.z??0)+u/i,t}e([c({constructOnly:!0})],C.prototype,"analysis",void 0),e([c({constructOnly:!0})],C.prototype,"analysisViewData",void 0),e([c({constructOnly:!0})],C.prototype,"view",void 0),e([c({constructOnly:!0})],C.prototype,"callbacks",void 0),e([c()],C.prototype,"placementMode",void 0),e([c()],C.prototype,"stagedViewshed",void 0),e([c()],C.prototype,"_placeOperation",void 0),e([c()],C.prototype,"_drawTool",void 0),e([c()],C.prototype,"_renderer",void 0),e([c()],C.prototype,"_sketchOptions",void 0),e([c()],C.prototype,"updating",null),e([c()],C.prototype,"active",null),e([c({value:null})],C.prototype,"creationState",null),C=e([h("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],C);export{C as ViewshedPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{watch as e,sync as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as n}from"../../../draw/plugins/PluginBase.js";var a;const p=Symbol("viewshed-placement-point-plugin-marker");let r=class extends n{static{a=p}constructor(t){super(t),this[a]=!0,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol("viewshed-placement-point-vertex")}start(t){super.start(t);const{positionOfLastUserInput:e,session:i}=t,o=this._getInitialMapPoint(e);!o||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||(i.appendOrReplacePoint(this._vertexId,o),this.outputMapPosition=o.clone()),this._ensureInteractiveHandle(t,o)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(t,o){this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?o:void 0}),this.addHandles(e(()=>this._interactiveHandle?.outputMapPosition,t=>{this.outputMapPosition=t?.clone(),this.screenPosition=this._interactiveHandle?.screenPosition,t&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,t)},i),this._ownHandlesKey))}_getInitialMapPoint(t){return"grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??t:this.inputMapPosition??t}};function l(t){return{uniqueId:Symbol(`viewshed-${t}-plugin`),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new r({step:t})}}t([o({constructOnly:!0})],r.prototype,"step",void 0),t([o()],r.prototype,"defaultCaptureMode",void 0),t([o()],r.prototype,"inputMapPosition",void 0),t([o()],r.prototype,"outputMapPosition",void 0),t([o()],r.prototype,"screenPosition",void 0),t([o()],r.prototype,"hasCommittedPoint",void 0),t([o()],r.prototype,"_interactiveHandle",void 0),r=t([s("esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin")],r);export{r as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
2
+ import{__decorate as t}from"tslib";import{watch as e,sync as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as n}from"../../../draw/plugins/PluginBase.js";var a;const p=Symbol("viewshed-placement-point-plugin-marker");let r=class extends n{static{a=p}constructor(t){super(t),this[a]=!0,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol("viewshed-placement-point-vertex")}start(t){super.start(t);const{positionOfLastUserInput:e,session:i}=t,o=this._getInitialMapPoint(e);!o||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||(i.appendOrReplacePoint(this._vertexId,o),this.outputMapPosition=o.clone()),this._ensureInteractiveHandle(t,o)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(t,o){this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?o:void 0}),this.addHandles(e(()=>{const t=this._interactiveHandle;return{outputMapPosition:t?.outputMapPosition,screenPosition:t?.screenPosition}},({outputMapPosition:t,screenPosition:e})=>{this.outputMapPosition=t?.clone(),this.screenPosition=e,t&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,t)},i),this._ownHandlesKey))}_getInitialMapPoint(t){return"grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??t:this.inputMapPosition??t}};function u(t){return{uniqueId:Symbol(`viewshed-${t}-plugin`),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new r({step:t})}}t([o({constructOnly:!0})],r.prototype,"step",void 0),t([o()],r.prototype,"defaultCaptureMode",void 0),t([o()],r.prototype,"inputMapPosition",void 0),t([o()],r.prototype,"outputMapPosition",void 0),t([o()],r.prototype,"screenPosition",void 0),t([o()],r.prototype,"hasCommittedPoint",void 0),t([o()],r.prototype,"_interactiveHandle",void 0),r=t([s("esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin")],r);export{r as ViewshedPlacementPointPlugin,u as createViewshedPlacementPointPluginConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import s from"../../../core/Logger.js";import t from"../../../core/PooledArray.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as i}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as n}from"../../../geometry/projection/projectVectorToVector.js";class r{constructor(s,t,e,o,i,n){this.layout=s,this.interleavedVertexData=t,this.indices=e,this.hasColors=o,this.hasModifications=i,this.positionData=n}}class h{constructor(s,t,e,o,i,n,r){this.componentOffsets=s,this.featureIds=t,this.anchorIds=e,this.anchors=o,this.transformedGeometry=i,this.globalTrafo=n,this.obb=r}}class a extends o{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0}),this._schemasByContext=new Map,this._modificationsByContext=new Map}_onClientConnected(s){for(const[t,e]of this._schemasByContext)s.invoke("setLegacySchema",{context:t,jsonSchema:e});for(const t of this._modificationsByContext.values())s.invoke("setModifications",t)}setModifications(s,t,e){const o={context:s,modifications:t,isGeodetic:e};return this._modificationsByContext.set(s,o),this.broadcast(o,"setModifications")}setLegacySchema(s,t){const e=JSON.stringify(t);return this._schemasByContext.set(s,e),this.broadcast({context:s,jsonSchema:e},"setLegacySchema")}destroyContext(s){return this._schemasByContext.delete(s),this._modificationsByContext.delete(s),this.broadcast(s,"destroyContext")}async destroyContextAndSelf(s){await this.destroyContext(s),this.destroy()}project(s,t){return this.invokeMethod("project",s,t)}transformNormals(s,t){return this.invokeMethod("transformNormals",s,t)}}const c=new t({deallocator:null}),p=e();function u(t,e,o){c.clear();let r=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of e){const t="clip"===m.type?2:"mask"===m.type?1:0,e=m.geometry;let f=s=>s;if(e.spatialReference){if(!i(e.spatialReference,o)){s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:e});continue}f=s=>(n(s,e.spatialReference,p,o),p)}l=l||1===t;const g=e.rings.length,d=e.rings.some(s=>s.length<3);if(0===g||d)s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:e});else{c.push(t),c.push(g);for(const s of e.rings){c.push(s.length);for(const t of s){const s=f(t);c.push(s[0]),c.push(s[1]),c.push(s[2]??0),r=Math.min(r,s[0]),h=Math.min(h,s[1]),a=Math.max(a,s[0]),u=Math.max(u,s[1])}}}}if(null!=t)if(l){const s=1e-4;c.push(2),c.push(2),c.push(4),c.push(r-s),c.push(h-s),c.push(0),c.push(a+s),c.push(h-s),c.push(0),c.push(a+s),c.push(u+s),c.push(0),c.push(r-s),c.push(u+s),c.push(0),c.push(4),c.push(t[0]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[3]),c.push(0),c.push(t[0]),c.push(t[3]),c.push(0)}else c.push(1),c.push(1),c.push(4),c.push(t[0]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[1]),c.push(0),c.push(t[2]),c.push(t[3]),c.push(0),c.push(t[0]),c.push(t[3]),c.push(0);c.push(3);const f=new Float64Array(c.length);for(let s=0;s<c.length;++s)f[s]=c.at(s);return f}function l(s,t){let e=0;for(const o of t){const t=o.geometry,i=t.rings.length,n=t.rings.some(s=>s.length<3);if(0!==i&&!n){e+=1,e+=1;for(let o=0;o<t.rings.length;++o){const i=t.rings[o];e+=1;for(let n=0;n<i.length;++n){const i=[s[e+0],s[e+1],s[e+2]];e+=3,t.setPoint(o,n,i)}}}}}export{a as SceneLayerWorkerHandle,h as TransformedData,r as TransformedGeometry,l as fromWasmModification,u as toWasmModification};
2
+ import t from"../../../core/Logger.js";import s from"../../../core/PooledArray.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as i}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as n}from"../../../geometry/projection/projectVectorToVector.js";class r{constructor(t,s,e,o,i,n){this.layout=t,this.interleavedVertexData=s,this.indices=e,this.hasColors=o,this.hasModifications=i,this.positionData=n}}class h{constructor(t,s,e,o,i,n,r){this.componentOffsets=t,this.featureIds=s,this.anchorIds=e,this.anchors=o,this.transformedGeometry=i,this.globalTrafo=n,this.obb=r}}class a extends o{constructor(t){super("SceneLayerWorker","process",{process:t=>[t.geometryBuffer],project:t=>[t.positions.buffer],transformNormals:t=>[t.normals.buffer]},t,{hasInitialize:!0}),this._schemasByContext=new Map,this._modificationsByContext=new Map}_onClientConnected(t){for(const[s,e]of this._schemasByContext)t.invoke("setLegacySchema",{context:s,jsonSchema:e}).catch(()=>{});for(const s of this._modificationsByContext.values())t.invoke("setModifications",s).catch(()=>{})}setModifications(t,s,e){const o={context:t,modifications:s,isGeodetic:e};return this._modificationsByContext.set(t,o),this.broadcast(o,"setModifications")}setLegacySchema(t,s){const e=JSON.stringify(s);return this._schemasByContext.set(t,e),this.broadcast({context:t,jsonSchema:e},"setLegacySchema")}destroyContext(t){return this._schemasByContext.delete(t),this._modificationsByContext.delete(t),this.broadcast(t,"destroyContext")}async destroyContextAndSelf(t){await this.destroyContext(t),this.destroy()}project(t,s){return this.invokeMethod("project",t,s)}transformNormals(t,s){return this.invokeMethod("transformNormals",t,s)}}const c=new s({deallocator:null}),p=e();function u(s,e,o){c.clear();let r=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of e){const s="clip"===m.type?2:"mask"===m.type?1:0,e=m.geometry;let f=t=>t;if(e.spatialReference){if(!i(e.spatialReference,o)){t.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:e});continue}f=t=>(n(t,e.spatialReference,p,o),p)}l=l||1===s;const g=e.rings.length,d=e.rings.some(t=>t.length<3);if(0===g||d)t.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:e});else{c.push(s),c.push(g);for(const t of e.rings){c.push(t.length);for(const s of t){const t=f(s);c.push(t[0]),c.push(t[1]),c.push(t[2]??0),r=Math.min(r,t[0]),h=Math.min(h,t[1]),a=Math.max(a,t[0]),u=Math.max(u,t[1])}}}}if(null!=s)if(l){const t=1e-4;c.push(2),c.push(2),c.push(4),c.push(r-t),c.push(h-t),c.push(0),c.push(a+t),c.push(h-t),c.push(0),c.push(a+t),c.push(u+t),c.push(0),c.push(r-t),c.push(u+t),c.push(0),c.push(4),c.push(s[0]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[3]),c.push(0),c.push(s[0]),c.push(s[3]),c.push(0)}else c.push(1),c.push(1),c.push(4),c.push(s[0]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[1]),c.push(0),c.push(s[2]),c.push(s[3]),c.push(0),c.push(s[0]),c.push(s[3]),c.push(0);c.push(3);const f=new Float64Array(c.length);for(let t=0;t<c.length;++t)f[t]=c.at(t);return f}function l(t,s){let e=0;for(const o of s){const s=o.geometry,i=s.rings.length,n=s.rings.some(t=>t.length<3);if(0!==i&&!n){e+=1,e+=1;for(let o=0;o<s.rings.length;++o){const i=s.rings[o];e+=1;for(let n=0;n<i.length;++n){const i=[t[e+0],t[e+1],t[e+2]];e+=3,s.setPoint(o,n,i)}}}}}export{a as SceneLayerWorkerHandle,h as TransformedData,r as TransformedGeometry,l as fromWasmModification,u as toWasmModification};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateNumberMemory as u,estimateStringMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,sync as f}from"../../../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as O}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let w=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=G,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new F(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(y(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},f)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new I(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!(v(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,L(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${O(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=j(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(C(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:x,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([_({constructOnly:!0})],w.prototype,"view",void 0),e([_({constructOnly:!0})],w.prototype,"layer",void 0),e([_({readOnly:!0})],w.prototype,"is3DOFL",null),e([_()],w.prototype,"_interactiveEditingSessions",void 0),e([_({readOnly:!0})],w.prototype,"sortedGeometryChangedObjectIds",null),e([_({readOnly:!0})],w.prototype,"geometryOverrides",void 0),e([_()],w.prototype,"_clientGeometryCache",void 0),e([_()],w.prototype,"_associatedLayer",null),e([_({constructOnly:!0})],w.prototype,"memoryController",void 0),e([_()],w.prototype,"_attributeChangedObjectIds",void 0),e([_()],w.prototype,"_geometryChangedObjectIds",void 0),e([_()],w.prototype,"hasGeometryChanges",null),e([_()],w.prototype,"_pendingFetchChangedObjectIds",void 0),e([_()],w.prototype,"_pendingFetchAbortController",void 0),e([_()],w.prototype,"_applyGeometryOverridesTask",void 0),e([_()],w.prototype,"updating",null),e([_()],w.prototype,"isEmpty",null),w=e([b("esri.views.3d.layers.i3s.I3SOverrides")],w);class I{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class F{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?m(e):u}}const x=1e4,G=5e4;function L(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{w as I3SOverrides};
2
+ import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateNumberMemory as u,estimateStringMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,sync as f}from"../../../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as O}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let w=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=G,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new F(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(y(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise.catch(()=>{}))},f)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}).catch(()=>{})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new I(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!(v(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,L(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${O(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=j(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(C(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:x,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([_({constructOnly:!0})],w.prototype,"view",void 0),e([_({constructOnly:!0})],w.prototype,"layer",void 0),e([_({readOnly:!0})],w.prototype,"is3DOFL",null),e([_()],w.prototype,"_interactiveEditingSessions",void 0),e([_({readOnly:!0})],w.prototype,"sortedGeometryChangedObjectIds",null),e([_({readOnly:!0})],w.prototype,"geometryOverrides",void 0),e([_()],w.prototype,"_clientGeometryCache",void 0),e([_()],w.prototype,"_associatedLayer",null),e([_({constructOnly:!0})],w.prototype,"memoryController",void 0),e([_()],w.prototype,"_attributeChangedObjectIds",void 0),e([_()],w.prototype,"_geometryChangedObjectIds",void 0),e([_()],w.prototype,"hasGeometryChanges",null),e([_()],w.prototype,"_pendingFetchChangedObjectIds",void 0),e([_()],w.prototype,"_pendingFetchAbortController",void 0),e([_()],w.prototype,"_applyGeometryOverridesTask",void 0),e([_()],w.prototype,"updating",null),e([_()],w.prototype,"isEmpty",null),w=e([b("esri.views.3d.layers.i3s.I3SOverrides")],w);class I{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class F{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?m(e):u}}const x=1e4,G=5e4;function L(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{w as I3SOverrides};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import c from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as h}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as p}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as C,DefaultMaterialDrawParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as T}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends c{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new C,this._fillVolumeParameters=new C,this._compositeParameters=new h,this._drawParameters=new _;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new g(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new g(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}render(e){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0);const t=this.techniques.getCompiled(b,this._cutVolumeConfiguration),i=this.techniques.getCompiled(b,this._fillVolumeConfiguration),s=this.techniques.getCompiled(p),o=this.techniques.getCompiled(d),r=this.input;if(!this._vaoCut||!this._vaoFill)return r;const a=this._vaoCut.vertexCount("geometry"),u=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,c=n.camera,m=c.fullViewport[2],h=c.fullViewport[3],f=this.renderingContext,C=this.fboCache,_=e.find(({name:e})=>e===l.GROUND_DEPTH),g=C.acquire(m,h,"cutfill color mask",2);g.attachDepth(_.getAttachment(V)),f.bindFramebuffer(g.fbo),f.setClearColor(0,0,0,1),f.clear(17408),f.setViewport(0,0,m,h),f.bindTechnique(s,n,T,this._maskParameters),f.setFaceCullingEnabled(!1),f.setStencilTestEnabled(!0),f.setStencilOpSeparate(1028,7680,34055,7680),f.setStencilOpSeparate(1029,7680,34056,7680),f.setDepthWriteEnabled(!1),f.bindVAO(this._vaoCut),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.setDepthTestEnabled(!1),f.setStencilWriteMask(0),f.setStencilFunction(517,0,255),f.setColorMask(!0,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.bindVAO(this._vaoFill),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!0,!1,!1),f.drawArrays(v.TRIANGLES,0,u);const w=C.acquire(m,h,"cutfill color cut volume",5);w.acquireDepth(14),f.blitFramebuffer(r.fbo,w.fbo,256),f.bindFramebuffer(w.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),f.bindVAO(this._vaoCut),f.drawArrays(v.TRIANGLES,0,a);const F=C.acquire(m,h,"cutfill color fill volume",5);F.acquireDepth(14),f.blitFramebuffer(r.fbo,F.fbo,256),f.bindFramebuffer(F.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),f.bindVAO(this._vaoFill),f.drawArrays(v.TRIANGLES,0,u);const P=this.fboCache.acquire(m,h,this.produces);return f.bindFramebuffer(P.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutVolume=w.getTexture(),this._compositeParameters.fillVolume=F.getTexture(),this._compositeParameters.cutFillMask=g.getTexture(),this._compositeParameters.sceneDepth=r.getTexture(V),this._compositeParameters.referenceDepth=_.getTexture(V),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),f.bindTechnique(o,n,this._compositeParameters),f.screen.draw(),g.release(),w.release(),F.release(),P.moveAttachments(r),P}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=P.createBuffer(r),{position:n,normal:c}=l;let h=0;for(let u=0;u<s.length;u++){const e=3*s[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}for(let u=0;u<o.length;u++){const e=3*o[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}const d=new w(a,u(P),l.buffer);return new m(a,d)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualizationRenderNode")],F);const P=n().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillVisualizationRenderNode,q as VolumeGeometry};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import c from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as h}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as p}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as C,DefaultMaterialDrawParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as T}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends c{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new C,this._fillVolumeParameters=new C,this._compositeParameters=new h,this._drawParameters=new _;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new g(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new g(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}render(e){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0);const t=this.techniques.getCompiled(b,this._cutVolumeConfiguration),i=this.techniques.getCompiled(b,this._fillVolumeConfiguration),s=this.techniques.getCompiled(p),o=this.techniques.getCompiled(d),r=this.input;if(!this._vaoCut||!this._vaoFill)return r;const a=this._vaoCut.vertexCount("geometry"),u=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,c=n.camera,m=c.fullViewport[2],h=c.fullViewport[3],f=this.renderingContext,C=this.fboCache,_=e.find(({name:e})=>e===l.GROUND_DEPTH),g=C.acquire(m,h,"cutfill color mask",2);g.attachDepth(_.getAttachment(V)),f.bindFramebuffer(g.fbo),f.setClearColor(0,0,0,1),f.clear(17408),f.setViewport(0,0,m,h),f.bindTechnique(s,n,T,this._maskParameters),f.setFaceCullingEnabled(!1),f.setStencilTestEnabled(!0),f.setStencilOpSeparate(1028,7680,34055,7680),f.setStencilOpSeparate(1029,7680,34056,7680),f.setDepthWriteEnabled(!1),f.bindVAO(this._vaoCut),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.setDepthTestEnabled(!1),f.setStencilWriteMask(0),f.setStencilFunction(517,0,255),f.setColorMask(!0,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.bindVAO(this._vaoFill),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!0,!1,!1),f.drawArrays(v.TRIANGLES,0,u);const w=C.acquire(m,h,"cutfill color cut volume",5).acquireDepth(14);f.blitFramebuffer(r.fbo,w.fbo,256),f.bindFramebuffer(w.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),f.bindVAO(this._vaoCut),f.drawArrays(v.TRIANGLES,0,a),w.detachDepth();const F=C.acquire(m,h,"cutfill color fill volume",5).acquireDepth(14);f.blitFramebuffer(r.fbo,F.fbo,256),f.bindFramebuffer(F.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),f.bindVAO(this._vaoFill),f.drawArrays(v.TRIANGLES,0,u),F.detachDepth();const P=this.fboCache.acquire(m,h,this.produces);return f.bindFramebuffer(P.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutVolume=w.getTexture(),this._compositeParameters.fillVolume=F.getTexture(),this._compositeParameters.cutFillMask=g.getTexture(),this._compositeParameters.sceneDepth=r.getTexture(V),this._compositeParameters.referenceDepth=_.getTexture(V),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),f.bindTechnique(o,n,this._compositeParameters),f.screen.draw(),g.release(),w.release(),F.release(),P.moveAttachments(r),P}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=P.createBuffer(r),{position:n,normal:c}=l;let h=0;for(let u=0;u<s.length;u++){const e=3*s[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}for(let u=0;u<o.length;u++){const e=3*o[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}const d=new w(a,u(P),l.buffer);return new m(a,d)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualizationRenderNode")],F);const P=n().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillVisualizationRenderNode,q as VolumeGeometry};