@arcgis/core 5.2.0-next.20 → 5.2.0-next.21

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 (149) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/057d288d795b853295f1.js +2 -0
  3. package/assets/esri/core/workers/chunks/{595bc41ff36c77324d01.js → 19493c9c7e1d2ac0f80f.js} +8 -8
  4. package/assets/esri/core/workers/chunks/2ef80e003b4f0393ac2e.js +1 -0
  5. package/assets/esri/core/workers/chunks/{4fdd38d7362bf09a994b.js → 33866e6e6de1bab64599.js} +1 -1
  6. package/assets/esri/core/workers/chunks/360fd810d70d21c092d9.js +1 -0
  7. package/assets/esri/core/workers/chunks/{4517630bf869205bab87.js → 38a76bc4ef5c10ab0488.js} +1 -1
  8. package/assets/esri/core/workers/chunks/5468a65698931603656d.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c9e5d3f496cefb8e3934.js → 5aa375b0c6a205134703.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{db26cf2c2735183294b8.js → 6649acaceab00ad30e7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/7175f0c6a6e56b685d20.js +680 -0
  12. package/assets/esri/core/workers/chunks/{501fa9b029df2e7b73c3.js → 754f7ed62afc4e0a1972.js} +2 -2
  13. package/assets/esri/core/workers/chunks/{6ac09f4e85c664a17365.js → 8331e04ebe0a54b04ab6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{72edd08a2ff08970ba38.js → 87011d2fe14c54e296af.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{5216dd0544e901039c84.js → 8c64c6b8d7376a9d1c91.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{8ce4fe00328173224ed2.js → 909e67dee8c30e391d69.js} +1 -1
  17. package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +1 -0
  18. package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +1 -0
  19. package/assets/esri/core/workers/chunks/{4104a0585969f8cd524c.js → a40ede4d3375184f21fe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/a533d066cac26124c5ce.js +1 -0
  21. package/assets/esri/core/workers/chunks/a536904fe6f3b16fdbdc.js +1 -0
  22. package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +1 -0
  23. package/assets/esri/core/workers/chunks/{dd0c1cf921369e2bc48b.js → a90619adff41658f8057.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{6e8b9c03240ec372b587.js → c30ca771dd3f7198142b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{e8d65900eefff1152207.js → c593539c2cce7a2b9d44.js} +1 -1
  26. package/assets/esri/core/workers/chunks/da47fdffb5969694a2ae.js +1 -0
  27. package/assets/esri/core/workers/chunks/{764c8ba14ab74b66b391.js → e5fcd8e7a4a660ef6ad6.js} +1 -1
  28. package/assets/esri/core/workers/chunks/f0519b06987471456b69.js +1 -0
  29. package/assets/esri/core/workers/chunks/{5f63077ec5ba3560491b.js → f1ff33584680d8718400.js} +1 -1
  30. package/assets/esri/core/workers/chunks/f47319d36f1527277923.js +1 -0
  31. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  32. package/assets/esri/themes/dark/main.css +1 -1
  33. package/assets/esri/themes/light/main.css +1 -1
  34. package/assets/esri/themes/light/view.css +1 -1
  35. package/chunks/Pattern.glsl.js +17 -17
  36. package/chunks/RibbonLine.glsl.js +45 -43
  37. package/chunks/bundle2.js +1 -1
  38. package/config.js +1 -1
  39. package/geometry/support/geometryUtils.js +1 -1
  40. package/geometry/support/intersects.js +1 -1
  41. package/geometry/support/intersectsBase.js +1 -1
  42. package/kernel.js +1 -1
  43. package/layers/AnnotationFeatureLayer.d.ts +43 -0
  44. package/layers/AnnotationFeatureLayer.js +1 -1
  45. package/layers/DimensionFeatureLayer.d.ts +39 -0
  46. package/layers/DimensionFeatureLayer.js +1 -1
  47. package/layers/DimensionLayer.d.ts +1 -0
  48. package/layers/FeatureLayer.js +1 -1
  49. package/layers/IntegratedMesh3DTilesLayer.d.ts +9 -1
  50. package/layers/ParquetLayer.d.ts +6 -10
  51. package/layers/graphics/data/attributeSupport.js +1 -1
  52. package/layers/graphics/data/queryValidationUtils.js +1 -1
  53. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  54. package/layers/mixins/ArcGISImageService.js +1 -1
  55. package/layers/raster/datasets/WCSRaster.js +1 -1
  56. package/layers/support/AnnotationFeatureSublayer.d.ts +5 -3
  57. package/layers/support/SymbolLayerDrawing.js +1 -1
  58. package/package.json +2 -2
  59. package/support/revision.js +1 -1
  60. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  61. package/views/2d/engine/transitions/FadeTransition.js +1 -1
  62. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  63. package/views/2d/engine/webgl/TileCpuState.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  70. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  71. package/views/2d/layers/LayerView2D.js +1 -1
  72. package/views/2d/layers/MediaLayerView2D.js +1 -1
  73. package/views/2d/layers/features/FeatureContainer.js +1 -1
  74. package/views/2d/layers/features/RenderState.js +1 -1
  75. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  76. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  77. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  78. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  79. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  80. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  81. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  82. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  83. package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +2 -0
  85. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  86. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  87. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  88. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  89. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  90. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  91. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  92. package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
  93. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  94. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  95. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +11 -11
  96. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +6 -9
  97. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +46 -46
  98. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +46 -18
  99. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +22 -22
  100. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  101. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  102. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  103. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  104. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  105. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  106. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  107. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  108. package/views/3d/webgl-engine/lib/PathVertexInfo.js +1 -1
  109. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  110. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +1 -1
  111. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  112. package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
  113. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  114. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  115. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  116. package/views/3d/webgl-engine/shaders/PatternTextureBuffer.glsl.js +1 -1
  117. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  118. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  119. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +2 -0
  120. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +10 -10
  121. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  122. package/views/webgl/ShaderBuilder.js +1 -1
  123. package/widgets/BatchAttributeForm.js +1 -1
  124. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  125. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  126. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  127. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  128. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  129. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  130. package/widgets/OrientedImageryViewer/constants.js +1 -1
  131. package/widgets/OrientedImageryViewer/support/panConstraint.js +2 -0
  132. package/widgets/OrientedImageryViewer.js +1 -1
  133. package/widgets/Print/CustomTemplate.d.ts +7 -0
  134. package/widgets/Search/LayerSearchSource.d.ts +3 -0
  135. package/assets/esri/core/workers/chunks/0a259137932211b80f0e.js +0 -1
  136. package/assets/esri/core/workers/chunks/35a508a9311689d8df52.js +0 -1
  137. package/assets/esri/core/workers/chunks/74922daaedb479ec6f03.js +0 -1
  138. package/assets/esri/core/workers/chunks/912a8743a02f467b63b0.js +0 -2
  139. package/assets/esri/core/workers/chunks/9def4619d102f1d41578.js +0 -1
  140. package/assets/esri/core/workers/chunks/a0876a52a3c2ad849370.js +0 -1
  141. package/assets/esri/core/workers/chunks/a3c5b754a6fa0f4250bf.js +0 -1
  142. package/assets/esri/core/workers/chunks/a98905bf6050ad3b8721.js +0 -633
  143. package/assets/esri/core/workers/chunks/bf67e0f6064fb9d94ac8.js +0 -1
  144. package/assets/esri/core/workers/chunks/cd892f429d5ffe8de99e.js +0 -1
  145. package/assets/esri/core/workers/chunks/d34d41a350facfa9b7c0.js +0 -1
  146. package/assets/esri/core/workers/chunks/d5a0e3a73df827dc7b06.js +0 -1
  147. package/assets/esri/core/workers/chunks/e5471373f89fd7cb9844.js +0 -1
  148. /package/assets/esri/core/workers/chunks/{912a8743a02f467b63b0.js.LICENSE.txt → 057d288d795b853295f1.js.LICENSE.txt} +0 -0
  149. /package/assets/esri/core/workers/chunks/{501fa9b029df2e7b73c3.js.LICENSE.txt → 754f7ed62afc4e0a1972.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as l}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as o}from"./FeatureTilePresentStrategy.js";import{RenderState as d}from"./RenderState.js";import{renderHighlight as h}from"../support/util.js";import{createHittestQuery as u}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e){this.level=e,this.id=performance.now(),this.messages=[],this.resolver=Promise.withResolvers()}}class _{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this.referenceScale=null,this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new o,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&l.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(v(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._handleNextLevelUpdate(),this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),e.mesh.factory.referenceScale&&(this.referenceScale=e.mesh.factory.referenceScale),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new _(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}beginLevelMeshUpdate(e){if(null!=this._pendingLevelUpdate)throw new Error("InternalError: Pending level mesh update in progress");return this._pendingLevelUpdate=new p(e),has("esri-2d-update-debug")&&console.debug(`FeatureContainer.beginLevelMeshUpdate(level=${e}, id=${this._pendingLevelUpdate.id})`),this._pendingLevelUpdate.id}applyLevelMeshUpdate(e){if(null==this._pendingLevelUpdate)throw new Error("InternalError: No level mesh update to apply");if(this._pendingLevelUpdate.id!==e)throw new Error("InternalError: Unexpected id");if(this._nextLevelUpdate)throw new Error("InternalError: Already applying pending level mesh update in progress");if(has("esri-2d-update-debug")){const{id:e,level:t}=this._pendingLevelUpdate;console.debug(`FeatureContainer.applyLevelMeshUpdate(level=${t}, id=${e})`)}return this._nextLevelUpdate=this._pendingLevelUpdate,this._pendingLevelUpdate=null,this._nextLevelUpdate.resolver.promise}_handleNextLevelUpdate(){if(this._nextLevelUpdate){if(has("esri-2d-update-debug")){const{id:e,level:t}=this._nextLevelUpdate;console.debug(`FeatureContainer._handleLevelMeshUpdate(level=${t}, id=${e})`)}const e=this._renderStateNext.value??this._renderState.value;for(const t of this._nextLevelUpdate.messages)e?.clearLevelCpuState(this._nextLevelUpdate.level),this._applyMessage(t);this._nextLevelUpdate.resolver.resolve(),this._nextLevelUpdate=null}}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new d(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){if(t(s),!this._pendingLevelUpdate)return this._applyMessage(e);this._pendingLevelUpdate.messages.push(e)}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=u(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve({trueHitIds:[],candidateHitIds:[]});let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=l.heatmap.getStencilReference(t)}createRenderParams(e){const t=super.createRenderParams(e);return t.referenceScale=this.referenceScale,t}_applyMessage(e){const t=e.inner;if(!this._subscriptions.has(t.id))return;const s=this._subscriptions.get(t.id);if(s.version!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}const r=this._renderStateNext.value??this._renderState.value;if(!r)throw new Error("InternalError: No renderState defined");r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.enqueueUpdate(e),this.requestRender()}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&h(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:l,smallSymbolDistance:o}=e.passOptions,d=Math.max(l,o),h=e.passOptions.hittestType;for(const u of this.children)u.visible&&("rect"===h?u.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(u,e,0):u.containsScreenPoint(e.state,e.passOptions.position,2*d)&&this._renderTile(u,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function v(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{AFeatureContainer as s}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as l}from"./FeatureTilePresentStrategy.js";import{RenderState as d}from"./RenderState.js";import{renderHighlight as h}from"../support/util.js";import{createHittestQuery as u}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e){this.level=e,this.id=performance.now(),this.messages=[]}}class f{constructor(e,t){this.id=e,this.version=t}}class _ extends s{constructor(e){super(e.view.featuresTilingScheme),this.referenceScale=null,this._updatingChildren=r(!1),this._hitTestsRequests=[],this._renderState=r(null),this._renderStateNext=r(null),this._store=new a,this._subscriptions=new Map,this._presentation=new l,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,r=!!this._renderStateNext.value,s=this.attributeView.updating;return e||t||r||s}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(v(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,r){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:r}),this.requestRender(),e.mesh.factory.referenceScale&&(this.referenceScale=e.mesh.factory.referenceScale),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:r}of e.subscribe){if(!this._subscriptions.has(t)){const e=new f(t,r);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=r}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),r=t&n,s=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(r&&s)}getDisplayStatistics(e,t){const r=this._statisticsByLevel.get(e);return r?r.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let r=this._statisticsByLevel.get(e);r||(r=new Map,this._statisticsByLevel.set(e,r));for(const s of t)r.set(s.fieldName,{minValue:s.minValue,maxValue:s.maxValue})}beginLevelMeshUpdate(e){if(null!=this._pendingLevelUpdate)throw new Error("InternalError: Pending level mesh update in progress");return this._pendingLevelUpdate=new p(e),has("esri-2d-update-debug")&&console.debug(`FeatureContainer.beginLevelMeshUpdate(level=${e}, id=${this._pendingLevelUpdate.id})`),this._pendingLevelUpdate.id}applyLevelMeshUpdate(e){if(null==this._pendingLevelUpdate)throw new Error("InternalError: No level mesh update to apply");if(this._pendingLevelUpdate.id!==e)throw new Error("InternalError: Unexpected id");if(has("esri-2d-update-debug")){const{id:e,level:t}=this._pendingLevelUpdate;console.debug(`FeatureContainer.applyLevelMeshUpdate(level=${t}, id=${e})`)}const{level:t,messages:r}=this._pendingLevelUpdate,s=this._renderStateNext.value??this._renderState.value;if(!s)throw new Error("InternalError: No renderState defined");s.enqueueLevelReplace(t,r),this._pendingLevelUpdate=null,this.requestRender()}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new d(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,r){if(t(r),!this._pendingLevelUpdate)return this._applyMessage(e);this._pendingLevelUpdate.messages.push(e)}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=u(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve({trueHitIds:[],candidateHitIds:[]});let r=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const s=Promise.withResolvers();return r?r.resolvers.push(s):(r={query:t,resolvers:[s]},this._hitTestsRequests.push(r)),this.requestRender(),s.promise}getSortKeys(e){const t=new Set(e),r=new Map;for(const s of this.children)if(s.getSortKeys(t).forEach((e,t)=>r.set(t,e)),r.size===t.size)break;return r}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:r}=this._layerView.layer.effectiveScaleRange,s=e.state.scale;s<=(t||1/0)&&s>=r&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}createRenderParams(e){const t=super.createRenderParams(e);return t.referenceScale=this.referenceScale,t}_applyMessage(e){const t=e.inner;if(!this._subscriptions.has(t.id))return;const r=this._subscriptions.get(t.id);if(r.version!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${r.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}const s=this._renderStateNext.value??this._renderState.value;if(!s)throw new Error("InternalError: No renderState defined");s.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${s.version}, message: ${t.version}]`),s.enqueueUpdate(e),this.requestRender()}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:r}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),r&&(this.restartAllAnimations(),this.swapRenderState());const s="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(s),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,r=new Set;for(const s of e?.tiles()??[])s.decluttering&&t.add(s.id),s.presenting&&r.add(s.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const s of this._renderState.value.tiles())t.has(s.id)&&(s.decluttering=!0),r.has(s.id)&&(s.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&h(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,r=e.painter.effects.hittest,s=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;r.bind(e),e.passOptions=r.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:l}=e.passOptions,d=Math.max(o,l),h=e.passOptions.hittestType;for(const u of this.children)u.visible&&("rect"===h?u.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(u,e,0):u.containsScreenPoint(e.state,e.passOptions.position,2*d)&&this._renderTile(u,e,0));r.draw(e),r.unbind(),t.bindFramebuffer(s),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const r=this._getHeatmapInstance(e);null!=r?this._renderHeatmapFeatures(e,t,r):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const r of this.children)r.visible&&this._renderTile(r,e,t)}_renderHeatmapFeatures(e,t,r){for(const s of this.children)s.visible&&this._renderTile(s,e,t,19);r.techniqueRef.renderResolvePass(e,r)}_renderTile(e,t,r,s){t.selection=r,e.getDisplayList()?.render(t,s)}}function v(e){return 19===e.techniqueRef.type}export{_ as FeatureContainer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{signal as s}from"../../../../core/signal.js";import{create as r}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import n from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as o}from"../../engine/webgl/FeatureTile.js";const d=1e3;class a{constructor(t,i,r,n,o){this.getStage=t,this.getSubscriptionVersion=i,this.version=r,this._container=n,this._tileInfoView=o,this._pendingUpdates=new e(d),this._locked=!1,this._tiles=new Map,this._updating=s(!1)}destroy(){for(const e of this.tiles())this._fader?.unregisterFeatureTile(e),e.destroy();this._pendingUpdates.clear(),this._tiles.clear(),this._container=null}get _fader(){return this.getStage()?.labelManager.symbolFader}tiles(){return Array.from(this._tiles.values())}size(){return this._tiles.size}get usedMemory(){let e=0;for(const t of this._tiles.values())e+=t.usedMemory;for(const t of this._pendingUpdates.entries)t&&(e+=u(t.inner));return e}get requiresRefresh(){for(const e of this._tiles.values())if(e.requiresRefresh)return!0;return!1}get updating(){return this._updating.value}clearLevelCpuState(e){for(const t of this._tiles.values())t.key.level===e&&t.clearCpuState()}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1}enqueueUpdate(e){this._pendingUpdates.enqueue(e),this._notify()}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||t.inner.attributeEpoch>e)break;this._updateTile(t),this._pendingUpdates.dequeue()}this._notify()}flush(e){for(;this._pendingUpdates.size;){const t=this._pendingUpdates.dequeue();null!=t&&(t.inner.attributeEpoch>e&&console.warn("Tried to flush RenderState, but patch more recent than current",{patchEpoch:t.inner.attributeEpoch,currentEpoch:e}),this._updateTile(t))}this._notify()}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader?.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}_notify(){this._updating.mutate(e=>0!==this._pendingUpdates.size)}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const r=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;r.update({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const r of s){const e=this._tiles.get(r.tileId);e&&e.update({type:"update",modify:r,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void r.update({type:"append",debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...o]=t.append;r.update({type:"append",append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const d of o){const e=this._tiles.get(d.tileId);e&&e.update({type:"update",modify:d,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const s=new n(e),d=this._tileInfoView.getTileBounds(r(),s),a=d[0],u=d[3],l=this._tileInfoView.getTileResolution(s.level),p=this._container.instanceStore.find(20)?.instanceId,c=new o(s,l,a,u,this._fader,p);if(this._fader?.registerFeatureTile(c),c.stage=this.getStage(),!c.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return c}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let r=-1;r<=1;r++){if(0===s&&0===r)continue;const n=e.key.getNormalizedNeighbor(r,s,i).id,o=this._tiles.get(n);if(null!=o){const i=1<<t;e.copyPixelBufferedEntitesFrom(o,i,r,s)}t--}}}function u(e){switch(e.type){case"update":return e.modify.reduce((e,t)=>e+l(t),0);case"append":return e.append?e.append.reduce((e,t)=>e+l(t),0):0}}function l(e){return e.entities.byteLength+e.data.reduce((e,t)=>e+p(t),0)}function p(e){return e.indices.byteLength+e.vertices.byteLength+(e.metrics?.byteLength??0)}export{a as RenderState};
2
+ import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{signal as s}from"../../../../core/signal.js";import{create as r}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import n from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as o}from"../../engine/webgl/FeatureTile.js";const a=1e3;class d{constructor(t,i,r,n){this.getStage=t,this.getSubscriptionVersion=i,this.version=r,this._tileInfoView=n,this._pendingUpdates=new e(a),this._locked=!1,this._tiles=new Map,this._updating=s(!1)}destroy(){for(const e of this.tiles())this._fader?.unregisterFeatureTile(e),e.destroy();this._pendingUpdates.clear(),this._tiles.clear()}get _fader(){return this.getStage()?.labelManager.symbolFader}tiles(){return Array.from(this._tiles.values())}size(){return this._tiles.size}get usedMemory(){let e=0;for(const t of this._tiles.values())e+=t.usedMemory;for(const t of this._pendingUpdates.entries)t&&(e+=l(t)?t.messages.reduce((e,t)=>e+u(t.inner),0):u(t.inner));return e}get requiresRefresh(){for(const e of this._tiles.values())if(e.requiresRefresh)return!0;return!1}get updating(){return this._updating.value}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1}enqueueUpdate(e){this._pendingUpdates.enqueue(e),this._notify()}enqueueLevelReplace(e,t){this._pendingUpdates.enqueue({type:"level-replace",level:e,messages:t}),this._notify()}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||p(t)>e)break;this._applyUpdate(t),this._pendingUpdates.dequeue()}this._notify()}flush(e){for(;this._pendingUpdates.size;){const t=this._pendingUpdates.dequeue();if(null!=t){const i=p(t);i>e&&console.warn("Tried to flush RenderState, but patch more recent than current",{patchEpoch:i,currentEpoch:e}),this._applyUpdate(t)}}this._notify()}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader?.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}_clearLevelCpuState(e){for(const t of this._tiles.values())t.key.level===e&&t.clearCpuState()}_notify(){this._updating.mutate(e=>0!==this._pendingUpdates.size)}_applyUpdate(e){if(l(e)){this._clearLevelCpuState(e.level);for(const t of e.messages)this._updateTile(t)}else this._updateTile(e)}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const r=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;r.update({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const r of s){const e=this._tiles.get(r.tileId);e&&e.update({type:"update",modify:r,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void r.update({type:"append",debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...o]=t.append;r.update({type:"append",append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const a of o){const e=this._tiles.get(a.tileId);e&&e.update({type:"update",modify:a,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const s=new n(e),a=this._tileInfoView.getTileBounds(r(),s),d=a[0],u=a[3],l=this._tileInfoView.getTileResolution(s.level),p=new o(s,l,d,u,this._fader);if(this._fader?.registerFeatureTile(p),p.stage=this.getStage(),!p.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return p}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let r=-1;r<=1;r++){if(0===s&&0===r)continue;const n=e.key.getNormalizedNeighbor(r,s,i).id,o=this._tiles.get(n);if(null!=o){const i=1<<t;e.copyPixelBufferedEntitesFrom(o,i,r,s)}t--}}}function u(e){switch(e.type){case"update":return e.modify.reduce((e,t)=>e+c(t),0);case"append":return e.append?e.append.reduce((e,t)=>e+c(t),0):0}}function l(e){return"type"in e&&"level-replace"===e.type}function p(e){if(!l(e))return e.inner.attributeEpoch;let t=-1/0;for(const i of e.messages)t=Math.max(t,i.inner.attributeEpoch);return t}function c(e){return e.entities.byteLength+e.data.reduce((e,t)=>e+f(t),0)}function f(e){return e.indices.byteLength+e.vertices.byteLength+(e.metrics?.byteLength??0)}export{d as RenderState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)return;[a,h]=r.coords}const d=o(a,h,i,n);d&&this._tree.insert(e,d[0],d[1],i)}}put(e,r){throw new Error("Not supported.")}putBounded(t,o,i,a){const{arcadeContextInfo:h,scale:d,geohashLevel:l,spatialReference:c,fields:p}=this.options.inner,u=n(d,h),f=s(i,a,l,c);null!=f&&this._tree.forEachInBounds(f,s=>{let i=null;for(const n of s.indices){this._reader.setIndex(n);const a=this._reader.getObjectId();o.has(a)||(i??=e(t,s.id,()=>r.create(p,s.xNode,s.yNode,s.depth)),i.insert(this._reader,l,c,u),o.add(a))}})}}export{a as GeohashSpatialIndex};
2
+ import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)continue;[a,h]=r.coords}const d=o(a,h,i,n);d&&this._tree.insert(e,d[0],d[1],i)}}put(e,r){throw new Error("Not supported.")}putBounded(t,o,i,a){const{arcadeContextInfo:h,scale:d,geohashLevel:l,spatialReference:c,fields:p}=this.options.inner,u=n(d,h),f=s(i,a,l,c);null!=f&&this._tree.forEachInBounds(f,s=>{let i=null;for(const n of s.indices){this._reader.setIndex(n);const a=this._reader.getObjectId();o.has(a)||(i??=e(t,s.id,()=>r.create(p,s.xNode,s.yNode,s.depth)),i.insert(this._reader,l,c,u),o.add(a))}})}}export{a as GeohashSpatialIndex};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)return;[n,o]=t.coords}const l=n*this._pixelsPerMapUnit,a=o*this._pixelsPerMapUnit,c=Math.floor(l/s),d=Math.floor(a/s);this._getCellOrCreate(c,d).push(t.getIndex())}}get usedMemory(){return 0}forEachInCell(e,t){const r=this._cells.get(e);if(r)for(const i of r._indices)this._reader.setIndex(i),t(this._reader)}put(t,r){const{arcadeContextInfo:i,scale:n,fields:l}=this.options.inner,a=o(n,i);this._cells.forEach(i=>{let n=null;for(const o of i._indices){this._reader.setIndex(o);const c=this._reader.getObjectId();r.has(c)||(n??=e(t,i.id,()=>s.create(i.gridX,i.gridY,l,this.worldUnitsPerCell)),n.insert(this._reader,a),r.add(c))}})}putBounded(t,r,i,n){const{arcadeContextInfo:l,scale:a,cellSize:c,fields:d}=this.options.inner,h=o(a,l),p=[i.xmin,i.ymin,i.xmax,i.ymax],[f,_,u,x]=p,m=Math.floor(f*this._pixelsPerMapUnit/c),g=Math.floor(_*this._pixelsPerMapUnit/c),M=Math.ceil(u*this._pixelsPerMapUnit/c),C=Math.ceil(x*this._pixelsPerMapUnit/c);for(let o=g;o<=C;o++)for(let i=m;i<=M;i++){const n=s.createId(i,o),l=this._cells.get(n);if(!l)continue;let a=null;for(const c of l._indices){this._reader.setIndex(c);const n=this._reader.getObjectId();r.has(n)||(a??=e(t,l.id,()=>s.create(i,o,d,this.worldUnitsPerCell)),a.insert(this._reader,h),r.add(n))}}}_getCellOrCreate(e,t){const r=n.createId(e,t);let i=this._cells.get(r);return i||(i=new n(e,t),this._cells.set(r,i)),i}}export{c as GridSpatialIndex,a as pixelsPerMapUnit};
2
+ import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)continue;[n,o]=t.coords}const l=n*this._pixelsPerMapUnit,a=o*this._pixelsPerMapUnit,c=Math.floor(l/s),d=Math.floor(a/s);this._getCellOrCreate(c,d).push(t.getIndex())}}get usedMemory(){return 0}forEachInCell(e,t){const r=this._cells.get(e);if(r)for(const i of r._indices)this._reader.setIndex(i),t(this._reader)}put(t,r){const{arcadeContextInfo:i,scale:n,fields:l}=this.options.inner,a=o(n,i);this._cells.forEach(i=>{let n=null;for(const o of i._indices){this._reader.setIndex(o);const c=this._reader.getObjectId();r.has(c)||(n??=e(t,i.id,()=>s.create(i.gridX,i.gridY,l,this.worldUnitsPerCell)),n.insert(this._reader,a),r.add(c))}})}putBounded(t,r,i,n){const{arcadeContextInfo:l,scale:a,cellSize:c,fields:d}=this.options.inner,h=o(a,l),p=[i.xmin,i.ymin,i.xmax,i.ymax],[f,_,u,x]=p,m=Math.floor(f*this._pixelsPerMapUnit/c),g=Math.floor(_*this._pixelsPerMapUnit/c),M=Math.ceil(u*this._pixelsPerMapUnit/c),C=Math.ceil(x*this._pixelsPerMapUnit/c);for(let o=g;o<=C;o++)for(let i=m;i<=M;i++){const n=s.createId(i,o),l=this._cells.get(n);if(!l)continue;let a=null;for(const c of l._indices){this._reader.setIndex(c);const n=this._reader.getObjectId();r.has(n)||(a??=e(t,l.id,()=>s.create(i,o,d,this.worldUnitsPerCell)),a.insert(this._reader,h),r.add(n))}}}_getCellOrCreate(e,t){const r=n.createId(e,t);let i=this._cells.get(r);return i||(i=new n(e,t),this._cells.set(r,i)),i}}export{c as GridSpatialIndex,a as pixelsPerMapUnit};
@@ -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{sqlNotIn as t,sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createFeatureIdInfo as i}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{ExceedsLimitCache as c}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as p,createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{getSortKey as m}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as y}from"../schema/processor/StorageSchema.js";import{getAnnotationMatcherSchema as d}from"../../support/annodime/annotationSchema.js";import{annotationRealFields as h,annotationVirtualFields as f}from"../../support/annodime/fields.js";import{getReferenceScale as g}from"../../support/annodime/utils.js";class S{constructor(e){this.layer=e,this._cache=new c}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,i=!s&&a,o=p("isSourceHosted"in r&&r.isSourceHosted,i,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let n=[];return n=e.availableFields.concat(...h),u(r,o,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:n,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:a}=await this._fetchAnnotationDataElementRequest(e,{type:"annotation-data-element-request"}),{objectIdField:i}=this.layer,o=m(null,null,i);return{storage:y(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:a}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e,s){e=o(this.layer,e,s);const i=this.layer.sublayers.filter(e=>!e.visible).map(e=>e.subtypeCode);if(!i.length)return e;e??=new a;const n=t(this.layer.subtypeField,i.toArray());return e.where=r(e.where,n),e}getUpdateHashProperties(e){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>n(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields,()=>this.layer.sublayers.map(({visible:e})=>({visible:e}))]}getRenderer(){return null}setGraphicOrigin(e){const t=this.layer.findSublayerForFeature(e);e.layer=e.sourceLayer=this.layer,e.origin=t?.graphicOrigin}_createServiceInfo(t){const r=this.layer,a=r.fieldsIndex.toJSON();a.fields.push(...f);const{capabilities:o,editingInfo:n,globalIdField:c,datesInUnknownTimezone:p,dateFieldsTimeZone:u,subtypeField:m}=r,y=l(r),d=r.timeInfo?.toJSON(),h=r.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,b=s(g.path),F=t.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:b,orderByFields:S,outSpatialReference:F,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:u,subtypeField:m,globalIdField:c,fieldsIndex:a,geometryType:y,featureIdInfo:i(r),timeInfo:d,spatialReference:h,outSpatialReference:F,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:r.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:!1,supportsQuantization:!1,maxRecordCount:o.query.maxRecordCount,tileMaxRecordCount:o.query.tileMaxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:o.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:o.query.supportsDegeneratedQuantizedGeometry,lastEditDate:n?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:o.query.supportsReturnExceededLimitGeometries}}}async _fetchAnnotationDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,a=await s.fetchDataElement(),i=g(a);return{type:"annotation-data-element-response",dataElement:a,meshes:await d(a,r),referenceScale:i}}}export{S as AnnotationLayerAdapter};
2
+ import{clone as e}from"../../../../../core/lang.js";import{sqlNotIn as t,sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createFeatureIdInfo as i}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{ExceedsLimitCache as p}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as u,createFeatureSourceSchema as c}from"../schema/SourceSchema.js";import{getSortKey as m}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as y}from"../schema/processor/StorageSchema.js";import{getAnnotationMatcherSchema as d}from"../../support/annodime/annotationSchema.js";import{annotationRealFields as h,annotationVirtualFields as f}from"../../support/annodime/fields.js";import{getReferenceScale as g}from"../../support/annodime/utils.js";class S{constructor(e){this.layer=e,this._cache=new p}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,i=!s&&a,o=u("isSourceHosted"in r&&r.isSourceHosted,i,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let n=[];return n=e.availableFields.concat(...h),c(r,o,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:n,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:a}=await this._fetchAnnotationDataElementRequest(e,{type:"annotation-data-element-request"}),{objectIdField:i}=this.layer,o=m(null,null,i);return{storage:y(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:a}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e,s){e=o(this.layer,e,s);const i=this.layer.sublayers.filter(e=>!e.visible).map(e=>e.subtypeCode);if(!i.length)return e;e??=new a;const n=t(this.layer.subtypeField,i.toArray());return e.where=r(e.where,n),e}getUpdateHashProperties(e){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>n(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields,()=>this.layer.sublayers.map(({visible:e})=>({visible:e}))]}getRenderer(){return null}setGraphicOrigin(e){const t=this.layer.findSublayerForFeature(e);e.layer=e.sourceLayer=this.layer,e.origin=t?.graphicOrigin}_createServiceInfo(t){const r=this.layer,a=r.fieldsIndex.toJSON();a.fields.push(...f);const{capabilities:o,editingInfo:n,globalIdField:p,datesInUnknownTimezone:u,dateFieldsTimeZone:c,subtypeField:m}=r,y=l(r),d=r.timeInfo?.toJSON(),h=r.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,b=s(g.path),F=t.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:b,orderByFields:S,outSpatialReference:F,metadata:{timeReferenceUnknownClient:u,dateFieldsTimeZone:c,subtypeField:m,globalIdField:p,fieldsIndex:a,geometryType:y,featureIdInfo:i(r),timeInfo:d,spatialReference:h,outSpatialReference:F,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:r.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:o.query.supportsFormatPBF,supportsQuantization:!1,maxRecordCount:o.query.maxRecordCount,tileMaxRecordCount:o.query.tileMaxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:o.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:o.query.supportsDegeneratedQuantizedGeometry,lastEditDate:n?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:o.query.supportsReturnExceededLimitGeometries}}}async _fetchAnnotationDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,a=await s.fetchDataElement(),i=g(a);return{type:"annotation-data-element-response",dataElement:a,meshes:await d(a,r),referenceScale:i}}}export{S as AnnotationLayerAdapter};
@@ -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{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as r}from"./featureServiceUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{ExceedsLimitCache as i}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as a,createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{getSortKey as n}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as l}from"../schema/processor/StorageSchema.js";import{getDimensionMatcherSchema as c}from"../../support/annodime/dimensionSchema.js";import{dimensionRealFields as p,dimensionVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as m}from"../../support/annodime/utils.js";class d{constructor(e){this.layer=e,this._cache=new i}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,i=this.layer.refreshInterval>0,n=!s&&i,l=a("isSourceHosted"in r&&r.isSourceHosted,n,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let c=[];return c=e.availableFields.concat(...p),o(r,l,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:c,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchDimensionDataElementRequest(e,{type:"dimension-data-element-request"}),{objectIdField:a}=this.layer,o=n(null,null,a);return{storage:l(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields]}getRenderer(){return null}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}_createServiceInfo(i){const a=this.layer,o=a.fieldsIndex.toJSON();o.fields.push(...u);const{capabilities:n,editingInfo:l,globalIdField:c,datesInUnknownTimezone:p,dateFieldsTimeZone:m,subtypeField:d}=a,y=s(a),h=a.timeInfo?.toJSON(),f=a.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,R=t(g.path),x=i.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:R,orderByFields:S,outSpatialReference:x,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:m,subtypeField:d,globalIdField:c,fieldsIndex:o,geometryType:y,featureIdInfo:r(a),timeInfo:h,spatialReference:f,outSpatialReference:x,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:a.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:!1,supportsQuantization:!1,maxRecordCount:n.query.maxRecordCount,tileMaxRecordCount:n.query.tileMaxRecordCount,supportsCompactGeometry:n.query.supportsCompactGeometry,supportsDefaultSpatialReference:n.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:n.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:n.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:n.query.supportsDegeneratedQuantizedGeometry,lastEditDate:l?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:n.query.supportsReturnExceededLimitGeometries}}}async _fetchDimensionDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,i=await s.fetchDataElement(),a=m(i);return{type:"dimension-data-element-response",dataElement:i,meshes:await c(i,r),referenceScale:a}}}export{d as DimensionLayerAdapter};
2
+ import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as r}from"./featureServiceUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{ExceedsLimitCache as i}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as a,createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{getSortKey as n}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as l}from"../schema/processor/StorageSchema.js";import{getDimensionMatcherSchema as c}from"../../support/annodime/dimensionSchema.js";import{dimensionRealFields as p,dimensionVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as m}from"../../support/annodime/utils.js";class d{constructor(e){this.layer=e,this._cache=new i}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,i=this.layer.refreshInterval>0,n=!s&&i,l=a("isSourceHosted"in r&&r.isSourceHosted,n,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let c=[];return c=e.availableFields.concat(...p),o(r,l,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:c,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchDimensionDataElementRequest(e,{type:"dimension-data-element-request"}),{objectIdField:a}=this.layer,o=n(null,null,a);return{storage:l(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields]}getRenderer(){return null}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}_createServiceInfo(i){const a=this.layer,o=a.fieldsIndex.toJSON();o.fields.push(...u);const{capabilities:n,editingInfo:l,globalIdField:c,datesInUnknownTimezone:p,dateFieldsTimeZone:m,subtypeField:d}=a,y=s(a),h=a.timeInfo?.toJSON(),f=a.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,R=t(g.path),F=i.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:R,orderByFields:S,outSpatialReference:F,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:m,subtypeField:d,globalIdField:c,fieldsIndex:o,geometryType:y,featureIdInfo:r(a),timeInfo:h,spatialReference:f,outSpatialReference:F,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:a.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:n.query.supportsFormatPBF,supportsQuantization:!1,maxRecordCount:n.query.maxRecordCount,tileMaxRecordCount:n.query.tileMaxRecordCount,supportsCompactGeometry:n.query.supportsCompactGeometry,supportsDefaultSpatialReference:n.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:n.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:n.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:n.query.supportsDegeneratedQuantizedGeometry,lastEditDate:l?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:n.query.supportsReturnExceededLimitGeometries}}}async _fetchDimensionDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,i=await s.fetchDataElement(),a=m(i);return{type:"dimension-data-element-response",dataElement:i,meshes:await c(i,r),referenceScale:a}}}export{d as DimensionLayerAdapter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i,createTrackStorageSchema as n}from"./StorageSchema.js";import{createVisualVariableUniforms as a}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,n=a(i);return{symbology:await s(e,i),labels:await t(e,r,n)}}async function o(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return f(n,e,r,t,s);case"cluster":return b(n,e,r,t,s)}if(t.trackInfo?.enabled)return y(t.trackInfo,e,r,t,s);t.symbolLayerDrawing?.enabled&&(e.symbolLayerDrawing=t.symbolLayerDrawing);const a=p(t.orderBy,t.renderer,t.objectIdField),o=i(t.renderer,r.filters),c=await l(e,t),u=d(c.symbology);return{storage:o,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:u,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:c},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map(e=>({...e.toJSON(),type:u(e,r)}))}function u(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find(e=>e.name===s);return e?e.type:"esriFieldTypeString"}}}async function f(r,n,l,o,u){const f=c(r,o.fields),b=r.renderer,y=await s(n,b),p=i(b,[null,null]),m=a(b),g=await t(n,{geometryType:"polygon",labelingInfoSource:o.labelingInfoSource+"-binning",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=d(y),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:p,mesh:{properties:{sortKey:null,timeZone:l.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:l.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:l.filters[0]},factory:{labels:g,symbology:y}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function b(r,n,l,o,u){const f=c(r,o.fields),b={type:"cluster",feature:await s(n,r.effectiveFeatureRenderer),cluster:await s(n,r.effectiveClusterRenderer)},y=a(r.effectiveFeatureRenderer),p={type:"cluster",feature:await t(n,o,y),cluster:await t(n,{geometryType:"point",labelingInfoSource:o.labelingInfoSource+"-clusters",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)},m=i(r.effectiveFeatureRenderer,[null,null]),g=d(b);return{storage:m,mesh:{properties:{sortKey:null,timeZone:l.timeZone,displayRefreshVersion:u,returnMeshObjectId:g,currentUser:l.currentUser},strategy:{type:"cluster",fields:f,featureFilter:l.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:p,symbology:b}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function y(e,r,i,l,o){const u=c(e,l.fields),f={type:"track",previousObservation:await s(r,e.previousObservations.renderer),latestObservation:await s(r,e.latestObservations.renderer),trackLine:await s(r,e.trackLines.renderer)},b={type:"track",previousObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-prev",labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},a(e.previousObservations.renderer)),latestObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-latest",labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},a(e.latestObservations.renderer)),trackLine:await t(r,{geometryType:"polyline",labelingInfoSource:l.labelingInfoSource+"-track-line",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},a(e.trackLines.renderer))},y=n(e,[null,null]),p=d(f);return{storage:y,mesh:{properties:{sortKey:null,timeZone:i.timeZone,returnMeshObjectId:p,displayRefreshVersion:o,currentUser:i.currentUser},strategy:{type:"track",featureFilter:i.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:b,symbology:f}},expressionProperties:{timeExtent:i.timeExtent?.toJSON()}}}function p(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function m(e){return 2===e.techniqueType}function d(e){if("simple"===e.type&&e.meshes.some(m))return!0;if("interval"===e.type){if(e.intervals.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}if("map"===e.type){if(e.map.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}return!1}export{o as createSimpleProcessorSchema,c as getAggregateFields,p as getSortKey};
2
+ import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i,createTrackStorageSchema as n}from"./StorageSchema.js";import{createVisualVariableUniforms as a}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,n=a(i);return{symbology:await s(e,i),labels:await t(e,r,n)}}async function o(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return f(n,e,r,t,s);case"cluster":return b(n,e,r,t,s)}if(t.trackInfo?.enabled)return y(t.trackInfo,e,r,t,s);e.symbolLayerDrawing=t.symbolLayerDrawing?.enabled?t.symbolLayerDrawing:null;const a=p(t.orderBy,t.renderer,t.objectIdField),o=i(t.renderer,r.filters),c=await l(e,t),u=d(c.symbology);return{storage:o,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:u,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:c},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map(e=>({...e.toJSON(),type:u(e,r)}))}function u(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find(e=>e.name===s);return e?e.type:"esriFieldTypeString"}}}async function f(r,n,l,o,u){const f=c(r,o.fields),b=r.renderer,y=await s(n,b),p=i(b,[null,null]),m=a(b),g=await t(n,{geometryType:"polygon",labelingInfoSource:o.labelingInfoSource+"-binning",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=d(y),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:p,mesh:{properties:{sortKey:null,timeZone:l.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:l.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:l.filters[0]},factory:{labels:g,symbology:y}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function b(r,n,l,o,u){const f=c(r,o.fields),b={type:"cluster",feature:await s(n,r.effectiveFeatureRenderer),cluster:await s(n,r.effectiveClusterRenderer)},y=a(r.effectiveFeatureRenderer),p={type:"cluster",feature:await t(n,o,y),cluster:await t(n,{geometryType:"point",labelingInfoSource:o.labelingInfoSource+"-clusters",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)},m=i(r.effectiveFeatureRenderer,[null,null]),g=d(b);return{storage:m,mesh:{properties:{sortKey:null,timeZone:l.timeZone,displayRefreshVersion:u,returnMeshObjectId:g,currentUser:l.currentUser},strategy:{type:"cluster",fields:f,featureFilter:l.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:p,symbology:b}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function y(e,r,i,l,o){const u=c(e,l.fields),f={type:"track",previousObservation:await s(r,e.previousObservations.renderer),latestObservation:await s(r,e.latestObservations.renderer),trackLine:await s(r,e.trackLines.renderer)},b={type:"track",previousObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-prev",labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},a(e.previousObservations.renderer)),latestObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-latest",labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},a(e.latestObservations.renderer)),trackLine:await t(r,{geometryType:"polyline",labelingInfoSource:l.labelingInfoSource+"-track-line",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},a(e.trackLines.renderer))},y=n(e,[null,null]),p=d(f);return{storage:y,mesh:{properties:{sortKey:null,timeZone:i.timeZone,returnMeshObjectId:p,displayRefreshVersion:o,currentUser:i.currentUser},strategy:{type:"track",featureFilter:i.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:b,symbology:f}},expressionProperties:{timeExtent:i.timeExtent?.toJSON()}}}function p(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function m(e){return 2===e.techniqueType}function d(e){if("simple"===e.type&&e.meshes.some(m))return!0;if("interval"===e.type){if(e.intervals.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}if("map"===e.type){if(e.map.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}return!1}export{o as createSimpleProcessorSchema,c as getAggregateFields,p as getSortKey};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../../../request.js";import t from"../../../../../../../core/Error.js";import has from"../../../../../../../core/has.js";import a from"../../../../../../../core/workers/Connection.js";import{toQuantizationTransform as r}from"../../../../../../../geometry/support/quantizationUtils.js";import{equals as s}from"../../../../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatureSet as i,quantizeOptimizedFeatureSet as o}from"../../../../../../../layers/graphics/featureConversionUtils.js";import{checkProjectionSupport as n}from"../../../../../../../layers/graphics/data/projectionSupport.js";import{queryOptimizedFeatureSet as u}from"../../../../../../../layers/ogc/ogcFeatureUtils.js";import{executeQueryPBFBuffer as c,getQueryParameters as m,executeQuery as l}from"../../../../../../../rest/query/operations/query.js";import{FeatureSetReaderAnnotationJSON as p}from"../../../support/FeatureSetReaderAnnotationJSON.js";import{FeatureSetReaderDimensionJSON as d}from"../../../support/FeatureSetReaderDimensionJSON.js";import{FeatureSetReaderJSON as f}from"../../../support/FeatureSetReaderJSON.js";import{FeatureSetReaderPBF as h}from"../../../support/FeatureSetReaderPBF.js";import{annotationVirtualFields as y,dimensionVirtualFields as _}from"../../../../support/annodime/fields.js";class w{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}function q(e,t,a){switch(e.type){case"memory":return new z(e,t,a);case"ogc":return new v(e,t);case"feature-service":return e.queryMetadata.supportsFormatPBF&&has("featurelayer-pbf")?new F(e,t):"annotation-feature"===t.layerType?new P(e,t):"dimension-feature"===t.layerType?new R(e,t):new j(e,t)}}async function S(e){const t=new a;return await t.open(e,{}),t}class z extends w{constructor(e,t,a){super(e,t),this._ports=[],this._loaded=this._load(a)}destroy(){this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}async _load(e){this._ports=await e.layerView.openMemoryPorts(),this._client=await S(this._ports)}async executeQuery(e,t){await this._loaded;const a=await this._client.invoke("queryFeatures",e.toJSON(),t);let r=this._metadata;return s(e.outSpatialReference,a.spatialReference)&&(r=r.weakCloneWithResolvedSpatialReference()),f.fromFeatureSet(a,r)}}class F extends w{async executeQuery(a,r){const s=await c(this.service.source,a,r),i=!a.quantizationParameters;try{return h.fromBuffer(s,this._metadata,i)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class j extends w{async executeQuery(e,t){const{source:a,queryMetadata:s}=this.service,n=null;if(null!=e.quantizationParameters&&!s.supportsQuantization){const s=e.clone(),u=r(s.quantizationParameters);s.quantizationParameters=null;const c=await l(a,s,n,t),m=i(c,this._metadata.featureIdInfo);return o(u,m),f.fromOptimizedFeatureSet(m,this._metadata)}const u=await l(a,e,n,t);return"esriGeometryPoint"===this._metadata.geometryType&&(u.features=u.features?.filter(e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0})),f.fromFeatureSet(u,this._metadata)}}class P extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(...y),o(n,c),p.fromOptimizedFeatureSet(c,this._metadata)}}class R extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(..._),o(n,c),d.fromOptimizedFeatureSet(c,this._metadata)}}class v extends w{async executeQuery(e,t){if(e.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const a=e.clone(),s=r(a.quantizationParameters);a.quantizationParameters=null;const i=await u(this.service.source,e,t);return o(s,i),f.fromOptimizedFeatureSet(i,this._metadata)}const a=await u(this.service.source,e,t);return f.fromOptimizedFeatureSet(a,this._metadata)}}export{w as SourceAdapter,q as createQueryAdapter};
2
+ import e from"../../../../../../../request.js";import t from"../../../../../../../core/Error.js";import has from"../../../../../../../core/has.js";import a from"../../../../../../../core/workers/Connection.js";import{toQuantizationTransform as r}from"../../../../../../../geometry/support/quantizationUtils.js";import{equals as s}from"../../../../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatureSet as i,quantizeOptimizedFeatureSet as o}from"../../../../../../../layers/graphics/featureConversionUtils.js";import{checkProjectionSupport as n}from"../../../../../../../layers/graphics/data/projectionSupport.js";import{queryOptimizedFeatureSet as u}from"../../../../../../../layers/ogc/ogcFeatureUtils.js";import{executeQueryPBFBuffer as c,getQueryParameters as m,executeQuery as l}from"../../../../../../../rest/query/operations/query.js";import{FeatureSetReaderAnnotationJSON as p}from"../../../support/FeatureSetReaderAnnotationJSON.js";import{FeatureSetReaderDimensionJSON as d}from"../../../support/FeatureSetReaderDimensionJSON.js";import{FeatureSetReaderJSON as f}from"../../../support/FeatureSetReaderJSON.js";import{FeatureSetReaderPBF as h}from"../../../support/FeatureSetReaderPBF.js";import{annotationVirtualFields as y,dimensionVirtualFields as _}from"../../../../support/annodime/fields.js";class w{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}function q(e,t,a){switch(e.type){case"memory":return new z(e,t,a);case"ogc":return new O(e,t);case"feature-service":return e.queryMetadata.supportsFormatPBF&&has("featurelayer-pbf")?"annotation-feature"===t.layerType?new P(e,t):"dimension-feature"===t.layerType?new j(e,t):new F(e,t):"annotation-feature"===t.layerType?new x(e,t):"dimension-feature"===t.layerType?new R(e,t):new v(e,t)}}async function S(e){const t=new a;return await t.open(e,{}),t}class z extends w{constructor(e,t,a){super(e,t),this._ports=[],this._loaded=this._load(a)}destroy(){this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}async _load(e){this._ports=await e.layerView.openMemoryPorts(),this._client=await S(this._ports)}async executeQuery(e,t){await this._loaded;const a=await this._client.invoke("queryFeatures",e.toJSON(),t);let r=this._metadata;return s(e.outSpatialReference,a.spatialReference)&&(r=r.weakCloneWithResolvedSpatialReference()),f.fromFeatureSet(a,r)}}class F extends w{async executeQuery(a,r){const s=await c(this.service.source,a,r),i=!a.quantizationParameters;try{return h.fromBuffer(s,this._metadata,i)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class v extends w{async executeQuery(e,t){const{source:a,queryMetadata:s}=this.service,n=null;if(null!=e.quantizationParameters&&!s.supportsQuantization){const s=e.clone(),u=r(s.quantizationParameters);s.quantizationParameters=null;const c=await l(a,s,n,t),m=i(c,this._metadata.featureIdInfo);return o(u,m),f.fromOptimizedFeatureSet(m,this._metadata)}const u=await l(a,e,n,t);return"esriGeometryPoint"===this._metadata.geometryType&&(u.features=u.features?.filter(e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0})),f.fromFeatureSet(u,this._metadata)}}class x extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(...y),o(n,c),p.fromOptimizedFeatureSet(c,this._metadata)}}class P extends w{async executeQuery(a,r){const[s]=await Promise.all([c(this.service.source,a,r),n(this._metadata.spatialReference,this._metadata.outSpatialReference)]),i=!a.quantizationParameters;try{const e=h.fromBuffer(s,this._metadata,i),t=[];for(;e.next();){const a=e.readOptimizedFeatureWorldSpace();a&&t.push(a)}const a=e.getInTransform();return p.fromOptimizedFeatures(t,this._metadata,a)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class R extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(..._),o(n,c),d.fromOptimizedFeatureSet(c,this._metadata)}}class j extends w{async executeQuery(a,r){const[s]=await Promise.all([c(this.service.source,a,r),n(this._metadata.spatialReference,this._metadata.outSpatialReference)]),i=!a.quantizationParameters;try{const e=h.fromBuffer(s,this._metadata,i),t=[];for(;e.next();){const a=e.readOptimizedFeatureWorldSpace();a&&t.push(a)}const a=e.getInTransform();return d.fromOptimizedFeatures(t,this._metadata,a)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class O extends w{async executeQuery(e,t){if(e.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const a=e.clone(),s=r(a.quantizationParameters);a.quantizationParameters=null;const i=await u(this.service.source,e,t);return o(s,i),f.fromOptimizedFeatureSet(i,this._metadata)}const a=await u(this.service.source,e,t);return f.fromOptimizedFeatureSet(a,this._metadata)}}export{w as SourceAdapter,q as createQueryAdapter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as s}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{FeatureSetReader as r}from"./FeatureSetReader.js";const n=new TextDecoder;class o extends r{constructor(i,s,r,n,o,d=new Uint32Array(r.size()),a,h){if(super(i),this._indexMap=s,this._inner=r,this._fileId=n,this._transform=o,this._displayIds=d,this._points=a,this._rowIds=h,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}i.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,i,s){const r=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,r,n,i,s);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return s(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new o(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),s=this._inner.readLengthsUnsafe(this._index);return t&&s?new i(s,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(e,t){const i=this.fields.get(e);if(!i)return;const s=this._indexMap[i.name];if(null==s)return this.getObjectId();const r=this._inner.readAttribute(this._index,s);if(null==r)return r;if("esriFieldTypeString"===i.type||"esriFieldTypeDateOnly"===i.type||"esriFieldTypeTimeOnly"===i.type||"esriFieldTypeTimestampOffset"===i.type){const e=this._inner.readAttribute(this._index,s);return n.decode(e)}const o=this.fields.isDateField(i.name);return t?null==r?r:o?new Date(r):r:r}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const i=this._readAttribute(t.name,!1);void 0!==i&&(e[t.name]=i)}return e.__OBJECTID=this.getObjectId(),e}}export{o as FeatureSetReaderParquet};
2
+ import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as r}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{FeatureSetReader as n}from"./FeatureSetReader.js";const o=new TextDecoder;class d extends n{constructor(i,s,r,n,o,d=new Uint32Array(r.size()),h,a){if(super(i),this._indexMap=s,this._inner=r,this._fileId=n,this._transform=o,this._displayIds=d,this._points=h,this._rowIds=a,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}i.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,i,s){const r=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,r,n,i,s);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return r(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}getBounds(e){const t=this._inner.boundsXMin(this._index);return!!Number.isFinite(t)&&(i(e,t,this._inner.boundsYMin(this._index),this._inner.boundsXMax(this._index),this._inner.boundsYMax(this._index)),!0)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new d(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),i=this._inner.readLengthsUnsafe(this._index);return t&&i?new s(i,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(e,t){const i=this.fields.get(e);if(!i)return;const s=this._indexMap[i.name];if(null==s)return this.getObjectId();const r=this._inner.readAttribute(this._index,s);if(null==r)return r;if("esriFieldTypeString"===i.type||"esriFieldTypeDateOnly"===i.type||"esriFieldTypeTimeOnly"===i.type||"esriFieldTypeTimestampOffset"===i.type){const e=this._inner.readAttribute(this._index,s);return o.decode(e)}const n=this.fields.isDateField(i.name);return t?null==r?r:n?new Date(r):r:r}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const i=this._readAttribute(t.name,!1);void 0!==i&&(e[t.name]=i)}return e.__OBJECTID=this.getObjectId(),e}}export{d as FeatureSetReaderParquet};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"../../../../../core/Error.js";import{rad2deg as t}from"../../../../../core/mathUtils.js";import{dist as e,set as n,equals as s,subtract as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as l}from"../../../../../geometry/support/jsonTypeUtils.js";import m from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as _}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as a,fromCIMVerticalAlignment as d,fromCIMFontDecoration as u}from"../../../../../symbols/cim/utils.js";import g from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as P,magicLabelLineHeight as c}from"../../../engine/webgl/definitions.js";import b from"../../../engine/webgl/Rect.js";import{shapeGlyphs as x}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{queryPointOnLine as p,angleFromXAxis as f,intersectRaysByPointsAndAngles as y}from"../../features/support/FeatureSetReaderDimensionJSON.js";import{roundPtToWholePixel as D,getLineWidth as M}from"../../graphics/graphicsUtils.js";import{DimensionRealFieldName as S}from"./dimensionUtils.js";import{getAttributeValue as k}from"./utils.js";class L{static async create(i,t,e,n){const s=n(i.textSymbol),o=new L(i,s);return await o.initialize(t,e),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._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._beginMarkerPoint=null,this._endMarkerPoint=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,e){if(!this._dimensionStyle)return;const{attributes:n}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:i,expressionParserName:n}=this._dimensionStyle;i&&"arcade"===n.toLocaleLowerCase()&&(this._compiledExpression=await _(i,e),this._fieldsIndex=w(t))}const s=Number(k(S.extAngle,n));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(k("__SYSTEM_LENGTH__",n));const{geometry:o}=t;if(o&&!l(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;n.__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(i,t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i,t){if(this._hasTextPoint)return;const{textFit:e}=this._dimensionStyle;let n=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===e||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(n=!0);if((T(this._beginMarkerRect,this._textRect)||T(this._endMarkerRect,this._textRect))&&(n=!1),!n){const i=t*(this._textRect.width/2);"MoveBegin"===e?this._textPoint=p(this._beginMarkerPoint,this._endMarkerPoint,-i):"MoveEnd"===e&&(this._textPoint=p(this._endMarkerPoint,this._beginMarkerPoint,-i))}}if(n){if(!this._dimensionStyle.textSymbol)return;const i=t*(this._textRect.width/2),e=this._dimensionPolyline[0],n=this._dimensionPolyline[1],s=p(e[0],e[1],i),o=p(n[0],n[1],i);this._dimensionPolyline=[[s,e[1]],[o,n[1]]]}}_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=p(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=p(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=p(s,this._beginBaselinePoint,i-n),h=p(o,this._endBaselinePoint,t-n)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(o,m){if(!o||!l(o)||o.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const _=o.rings[0],a=r(_[0][0],_[0][1]),d=r(_[1][0],_[1][1]),u=r(_[2][0],_[2][1]);this._beginBaselinePoint=n(h(),a[0],a[1]),this._endBaselinePoint=n(h(),d[0],d[1]),this._dimensionLinePoint=u;let g=this._extAngleRad;if(s(a,u))this._beginDimensionPoint=n(h(),a[0],a[1]),this._endDimensionPoint=n(h(),d[0],d[1]),this._displayExtLines=!1;else{const e=f([d[0]-a[0],d[1]-a[1]]),s=t(g);s>=-1&&s<=1?g+=t(1):s>=179&&s<=181&&(g-=t(1));const o=y(u,e,d,e+g);if(!o)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=n(h(),u[0],u[1]),this._endDimensionPoint=n(h(),o[0],o[1])}this._dimensionLength=e(this._beginDimensionPoint,this._endDimensionPoint),this._hasTextPoint||(this._textPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:t,endMarkerSymbol:e}=this._dimensionStyle,n=this._measureMarkerSymbolSize(t,this._beginDimensionPoint,this._dimensionAngleRad,i),s=this._measureMarkerSymbolSize(e,this._endDimensionPoint,this._dimensionAngleRad+Math.PI,i),r=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=r;const h=i*((n?.width??0)/2),l=i*((s?.width??0)/2);this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,h),this._endMarkerPoint=p(this._endDimensionPoint,this._beginDimensionPoint,l);const m=[0,0];if(n&&this._beginMarkerPoint){const i=o(m,this._beginMarkerPoint,this._beginDimensionPoint);n.x+=i[0],n.y+=i[1]}if(s&&this._endMarkerPoint){const i=o(m,this._endMarkerPoint,this._endDimensionPoint);s.x+=i[0],s.y+=i[1]}if(this._beginMarkerRect=n,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(n,s,r,i),this._doMarkersFit){const i=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,-4*h),this._endMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*l),this._dimensionPolyline=[[this._beginMarkerPoint,this._beginDimensionPoint],[this._endMarkerPoint,this._endDimensionPoint]]}_checkMarkerFit(i,t,e,n){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*n>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?T(i,t)&&(h=!1):(T(i,t)&&(h=!1),h&&e&&(T(e,i)||T(e,t))&&(h=!1))}return h||(this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,-i.width/2),this._endMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+t.width/2)),h}_measureDimensionText(i,t,e){if(null==this._textString||null==t||null==this._mosaicItems)return null;const n=[];for(const a of i)a.codePointAt(0),n.push(this._mosaicItems.glyphs[a.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=a(s.horizontalAlignment),r=d(s.verticalAlignment),h=u(s),l=D(s.height||10),m=!0,_=s.angle||0,g=l/P,p=M(s.lineWidth),f=c*Math.max(.25,Math.min(l||1,4)),y={...this._mosaicItems,glyphs:n.filter(i=>null!=i)},S=x(y,{scale:g,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:f,useCIMAngleBehavior:m,maxLineWidth:p,hasBackground:!1}),k=t;if(!k)return null;const L=e,w=[S.bounds.blX,S.bounds.trY],E=[S.bounds.trX,S.bounds.trY],T=[S.bounds.blX,S.bounds.blY],R=[S.bounds.trX,S.bounds.blY];return w[0]-=S.bounds.x,w[1]-=S.bounds.y,E[0]-=S.bounds.x,E[1]-=S.bounds.y,T[0]-=S.bounds.x,T[1]-=S.bounds.y,R[0]-=S.bounds.x,R[1]-=S.bounds.y,w[0]*=L,w[1]*=L,E[0]*=L,E[1]*=L,T[0]*=L,T[1]*=L,R[0]*=L,R[1]*=L,w[0]+=k[0],w[1]+=k[1],E[0]+=k[0],E[1]+=k[1],T[0]+=k[0],T[1]+=k[1],R[0]+=k[0],R[1]+=k[1],new b(E[0],E[1],1.1*Math.abs(w[0]-E[0]),1.1*Math.abs(R[1]-E[1]))}_measureMarkerSymbolSize(i,t,e,n){return i?new b(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let e=this._systemLength;1===Number(k(S.useCustomLength,t))&&(e=Number(k(S.customLength,t)));let n=this._getDimensionString(e,i);return"number"==typeof n&&(n=n.toString()),t.__COMPUTED_TEXT_STRING__=n,n||""}_getDimensionString(i,t){const{convertUnits:e,displayUnits:n,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&t)return g(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 w(i){const{attributes:t}=i,e=Object.keys(S).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new m(e)}function E(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function T(i,t){const e=E(i),n=E(t),s=e.left<=n.right&&n.left<=e.right,o=e.bottom<=n.top&&n.bottom<=e.top;return s&&o}export{L 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}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as h,create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as m}from"../../../../../geometry/support/jsonTypeUtils.js";import _ from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as a}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as d,fromCIMVerticalAlignment as u,fromCIMFontDecoration as g}from"../../../../../symbols/cim/utils.js";import P from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as c,magicLabelLineHeight as b}from"../../../engine/webgl/definitions.js";import x from"../../../engine/webgl/Rect.js";import{shapeGlyphs as p}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{queryPointOnLine as f,angleFromXAxis as y,intersectRaysByPointsAndAngles as D}from"../../features/support/FeatureSetReaderDimensionJSON.js";import{roundPtToWholePixel as M,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{DimensionRealFieldName as k}from"./dimensionUtils.js";import{getAttributeValue as L}from"./utils.js";class w{static async create(i,t,n,e){const s=e(i.textSymbol),o=new w(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._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._beginMarkerPoint=null,this._endMarkerPoint=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 a(e,n),this._fieldsIndex=E(t)}}const s=Number(L(k.extAngle,e));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(L("__SYSTEM_LENGTH__",e));const{geometry:o}=t;if(o&&!m(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(i,t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i,t){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;let e=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===n||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(e=!0);if((N(this._beginMarkerRect,this._textRect)||N(this._endMarkerRect,this._textRect))&&(e=!1),!e){const i=t*(this._textRect.width/2);"MoveBegin"===n?this._textPoint=f(this._beginMarkerPoint,this._endMarkerPoint,-i):"MoveEnd"===n&&(this._textPoint=f(this._endMarkerPoint,this._beginMarkerPoint,-i))}}if(e){if(!this._dimensionStyle.textSymbol)return;const i=t*(this._textRect.width/2),n=this._dimensionPolyline[0],e=this._dimensionPolyline[1],s=f(n[0],n[1],i),o=f(e[0],e[1],i);this._dimensionPolyline=[[s,n[1]],[o,e[1]]]}}_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=f(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=f(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=f(s,this._beginBaselinePoint,i-n),h=f(o,this._endBaselinePoint,t-n)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(r,_){if(!r||!m(r)||r.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const a=r.rings[0],d=h(a[0][0],a[0][1]),u=h(a[1][0],a[1][1]),g=h(a[2][0],a[2][1]);this._beginBaselinePoint=s(l(),d[0],d[1]),this._endBaselinePoint=s(l(),u[0],u[1]),this._dimensionLinePoint=g;let P=this._extAngleRad;if(o(d,g))this._beginDimensionPoint=s(l(),d[0],d[1]),this._endDimensionPoint=s(l(),u[0],u[1]),this._displayExtLines=!1;else{const e=y([u[0]-d[0],u[1]-d[1]]),o=n(P);o>=-1&&o<=1?P+=t(1):o>=179&&o<=181&&(P-=t(1));const r=D(g,e,u,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=s(l(),g[0],g[1]),this._endDimensionPoint=s(l(),r[0],r[1])}this._dimensionLength=e(this._beginDimensionPoint,this._endDimensionPoint),this._hasTextPoint||(this._textPoint=f(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 h=i*((e?.width??0)/2),l=i*((s?.width??0)/2);this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,h),this._endMarkerPoint=f(this._endDimensionPoint,this._beginDimensionPoint,l);const m=[0,0];if(e&&this._beginMarkerPoint){const i=r(m,this._beginMarkerPoint,this._beginDimensionPoint);e.x+=i[0],e.y+=i[1]}if(s&&this._endMarkerPoint){const i=r(m,this._endMarkerPoint,this._endDimensionPoint);s.x+=i[0],s.y+=i[1]}if(this._beginMarkerRect=e,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(e,s,o,i),this._doMarkersFit){const i=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,-4*h),this._endMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*l),this._dimensionPolyline=[[this._beginMarkerPoint,this._beginDimensionPoint],[this._endMarkerPoint,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?N(i,t)&&(h=!1):(N(i,t)&&(h=!1),h&&n&&(N(n,i)||N(n,t))&&(h=!1))}return h||(this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,-i.width/2),this._endMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+t.width/2)),h}_measureDimensionText(i,t,n){if(null==this._textString||null==t||null==this._mosaicItems)return null;const e=[];for(const d of i)d.codePointAt(0),e.push(this._mosaicItems.glyphs[d.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=d(s.horizontalAlignment),r=u(s.verticalAlignment),h=g(s),l=M(s.height||10),m=!0,_=s.angle||0,a=l/c,P=S(s.lineWidth),f=b*Math.max(.25,Math.min(l||1,4)),y={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},D=p(y,{scale:a,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:f,useCIMAngleBehavior:m,maxLineWidth:P,hasBackground:!1}),k=t;if(!k)return null;const L=n,w=[D.bounds.blX,D.bounds.trY],E=[D.bounds.trX,D.bounds.trY],T=[D.bounds.blX,D.bounds.blY],N=[D.bounds.trX,D.bounds.blY];return w[0]-=D.bounds.x,w[1]-=D.bounds.y,E[0]-=D.bounds.x,E[1]-=D.bounds.y,T[0]-=D.bounds.x,T[1]-=D.bounds.y,N[0]-=D.bounds.x,N[1]-=D.bounds.y,w[0]*=L,w[1]*=L,E[0]*=L,E[1]*=L,T[0]*=L,T[1]*=L,N[0]*=L,N[1]*=L,w[0]+=k[0],w[1]+=k[1],E[0]+=k[0],E[1]+=k[1],T[0]+=k[0],T[1]+=k[1],N[0]+=k[0],N[1]+=k[1],new x(E[0],E[1],1.1*Math.abs(w[0]-E[0]),1.1*Math.abs(N[1]-E[1]))}_measureMarkerSymbolSize(i,t,n,e){return i?new x(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let n=null;const e=1===Number(L(k.useCustomLength,t));n=Number(L(e?k.customLength:k.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 E(i){const{attributes:t}=i,n=Object.keys(k).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new _(n)}function T(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function N(i,t){const n=T(i),e=T(t),s=n.left<=e.right&&e.left<=n.right,o=n.bottom<=e.top&&e.bottom<=n.top;return s&&o}export{w as default};
@@ -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"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{property as i,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{PointVisualElement as s}from"../../interactive/visualElements/PointVisualElement.js";let r=class extends t{constructor(e){super(e),this.elevationInfo=null,this._active=!1,this._visuals=new Map}destroy(){for(const e of this._visuals.keys())this.removeVisual(e)}activate(){this._active=!0,this._refreshVisuals()}refresh(){this._refreshVisuals()}deactivate(){this._active=!1;for(const{element:e}of this._visuals.values())e.attached=!1}addOrUpdateGraphic(e,t){}addOrUpdateVisual(e,t){if(!has("enable-feature:analysis-drawtool-line-of-sight-placement-visuals"))return;const i=this._visuals.get(e),o=u(t,i?.props);if(!n(o))return void this.removeVisual(e);if(i)return i.props=o,void this._applyVisual(i.element,o);const r=new s({view:this.view,attached:!1,isDecoration:!0,outlineSize:1,pixelSnappingEnabled:!1,primitive:"circle",size:8});this._visuals.set(e,{element:r,props:o}),this._applyVisual(r,o)}removeGraphic(e){}removeVisual(e){const t=this._visuals.get(e);t&&(t.element.destroy(),this._visuals.delete(e))}hitTestVisualDistance(e,t){return null}_refreshVisuals(){for(const{element:e,props:t}of this._visuals.values())this._applyVisual(e,t)}_applyVisual(e,t){const i=l(t.geometry);if(!i)return void(e.attached=!1);e.geometry=i,e.elevationInfo=this.elevationInfo,e.attached=this._active;const{color:o,outlineColor:s,size:r}=c(this.view,t.role,t.state);e.color=o,e.outlineColor=s,e.size=r}};function n(e){return null!=l(e.geometry)&&("cursor"===e.role||"controlPoint"===e.role)}function l(e){if(!e)return null;switch(e.type){case"point":return e;case"multipoint":return a(e);default:return null}}function a(e){return 0===e.points.length?null:e.getPoint(e.points.length-1)}function u(e,t={geometry:null,role:"outputGeometry",state:"idle"}){return{...t,...e}}function c(e,t,i){const o=e.effectiveTheme.accentColor.toUnitRGBA(),s="active"===i?1:"focused"===i?.95:.85,r="controlPoint"===t?7:"active"===i?10:8;return{color:[o[0],o[1],o[2],s],outlineColor:[0,0,0,.45],size:r}}e([i({constructOnly:!0})],r.prototype,"view",void 0),e([i()],r.prototype,"elevationInfo",void 0),e([i()],r.prototype,"_active",void 0),r=e([o("esri.views.3d.analysis.LineOfSight.LineOfSightDrawToolRenderer")],r);export{r as LineOfSightDrawToolRenderer};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l,fromPoints as c}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as u}from"./LineOfSightInteractionVisuals.js";import{PointVisualElement as h}from"../../interactive/visualElements/PointVisualElement.js";let p=class extends t{constructor(e){super(e),this.elevationInfo=null,this.analysisVisible=!0,this._active=!1,this._rendererVisuals=new Map,this._observerRenderLocation=a(),this._targetRenderLocation=a(),this._laserLineSegment=l(),this._interactionVisuals=null}initialize(){this._interactionVisuals=new u({view:this.view}),this.addHandles(s(()=>({active:this._active,analysisVisible:this.analysisVisible,cursorTargetPosition:this.analysisViewData.cursorTarget?.position,observerPosition:this.analysis.observer?.position}),()=>this._refreshInteractionVisuals(),r))}destroy(){for(const e of this._rendererVisuals.keys())this.removeVisual(e);this._interactionVisuals=i(this._interactionVisuals)}activate(){this._active=!0,this._refreshVisuals(),this._refreshInteractionVisuals()}refresh(){this._refreshVisuals(),this._refreshInteractionVisuals()}deactivate(){this._active=!1;for(const{element:e}of this._rendererVisuals.values())e.attached=!1;this._interactionVisuals?.hide()}addOrUpdateGraphic(e,t){}addOrUpdateVisual(e,t){if(!has("enable-feature:analysis-drawtool-line-of-sight-placement-visuals"))return;const i=this._rendererVisuals.get(e),s=m(t,i?.props);if(!d(s))return void this.removeVisual(e);if(i)return i.props=s,void this._applyVisual(i.element,s);const r=new h({view:this.view,attached:!1,isDecoration:!0,outlineSize:1,pixelSnappingEnabled:!1,primitive:"circle",size:8});this._rendererVisuals.set(e,{element:r,props:s}),this._applyVisual(r,s)}removeGraphic(e){}removeVisual(e){const t=this._rendererVisuals.get(e);t&&(t.element.destroy(),this._rendererVisuals.delete(e))}hitTestVisualDistance(e,t){return null}_refreshVisuals(){for(const{element:e,props:t}of this._rendererVisuals.values())this._applyVisual(e,t)}_refreshInteractionVisuals(){const{_observerRenderLocation:e,_targetRenderLocation:t,_laserLineSegment:i}=this,s=this.analysis.observer?.position,r=this.analysisViewData.cursorTarget?.position;this._active&&this.analysisVisible&&null!=s&&null!=r&&this.view.renderCoordsHelper.toRenderCoords(s,e)&&this.view.renderCoordsHelper.toRenderCoords(r,t)?this._interactionVisuals?.update({target:t,lineVerticalPlaneSegment:c(e,t,i),visible:!0}):this._interactionVisuals?.hide()}_applyVisual(e,t){const i=v(t.geometry);if(!i)return void(e.attached=!1);e.geometry=i,e.elevationInfo=this.elevationInfo,e.attached=this._active;const{color:s,outlineColor:r,size:o}=V(this.view,t.role,t.state);e.color=s,e.outlineColor=r,e.size=o}get test(){}};function d(e){return null!=v(e.geometry)&&("cursor"===e.role||"controlPoint"===e.role)}function v(e){if(!e)return null;switch(e.type){case"point":return e;case"multipoint":return f(e);default:return null}}function f(e){return 0===e.points.length?null:e.getPoint(e.points.length-1)}function m(e,t={geometry:null,role:"outputGeometry",state:"idle"}){return{...t,...e}}function V(e,t,i){const s=e.effectiveTheme.accentColor.toUnitRGBA(),r="active"===i?1:"focused"===i?.95:.85,o="controlPoint"===t?7:"active"===i?10:8;return{color:[s[0],s[1],s[2],r],outlineColor:[0,0,0,.45],size:o}}e([o({constructOnly:!0})],p.prototype,"analysis",void 0),e([o({constructOnly:!0})],p.prototype,"analysisViewData",void 0),e([o({constructOnly:!0})],p.prototype,"view",void 0),e([o()],p.prototype,"elevationInfo",void 0),e([o()],p.prototype,"analysisVisible",void 0),e([o()],p.prototype,"_active",void 0),p=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightDrawToolRenderer")],p);export{p as LineOfSightDrawToolRenderer};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as l,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{laserLineConfiguration as o,getLaserLineColors as a}from"./LineOfSightConfiguration.js";import{LaserlineVisualElement as c}from"../../interactive/visualElements/LaserlineVisualElement.js";const m=Symbol("line-of-sight-interaction-visual-elements");let h=class extends i{constructor(e){super(e),this._laserLineVisualElement=null}initialize(){this._createVisuals()}update({target:e,lineVerticalPlaneSegment:i=null,visible:t}){const l=this.laserLineVisualElement;null!=l&&(l.visible=t,l.heightManifoldTarget=t?e:null,l.lineVerticalPlaneSegment=t?i:null)}hide(){this.update({target:null,visible:!1})}get laserLineVisualElement(){return this._laserLineVisualElement}get test(){}_createVisuals(){const{glowWidth:e,innerWidth:i}=o,n=new c({view:this.view,attached:!0,visible:!1,style:{glowWidth:e,innerWidth:i},isDecoration:!0});this._laserLineVisualElement=n,this.addHandles([l(()=>a(this.view.effectiveTheme),({glowColor:e,innerColor:i,globalAlpha:t})=>{const l=n.style;n.style={...l,glowColor:e.toUnitRGB(),innerColor:i.toUnitRGB(),globalAlpha:t}},s),t(()=>{n.destroy(),this._laserLineVisualElement=null})],m)}};e([n({constructOnly:!0})],h.prototype,"view",void 0),h=e([r("esri.views.3d.analysis.LineOfSight.LineOfSightInteractionVisuals")],h);export{h as LineOfSightInteractionVisuals};
@@ -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"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{when as s,syncAndInitial as l,watch as n}from"../../../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromPoints as d}from"../../../../geometry/support/lineSegment.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{getLaserLineColors as p,laserLineConfiguration as v}from"./LineOfSightConfiguration.js";import{createDrawTool as m}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as y}from"./LineOfSightRootPlugin.js";import{Manipulator3D as _}from"../../interactive/Manipulator3D.js";import{LaserlineVisualElement as w}from"../../interactive/visualElements/LaserlineVisualElement.js";const f=Symbol("hiddenManipulatorHandle"),g=h(),T=h(),E=u();let V=class extends t{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(e){super(e),this.visible=!0,this.placementElevationInfo=null,this._drawTool=null,this._laserlineVisualElement=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this._createLaserLine(),this.addHandles([s(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},l),n(()=>p(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),l),n(()=>({active:this.active,cursorTargetPosition:this.analysisViewData.cursorTarget?.position,observerPosition:this.analysis.observer?.position,visible:this.visible}),()=>this._updateLaserLineRenderer(),l)])}destroy(){this._destroyDrawTool(),this._laserlineVisualElement=o(this._laserlineVisualElement)}get activeSnappingManager(){return this.active?this._drawTool?.snappingManager??null:null}get laserLineVisualElement(){return this._laserlineVisualElement}get _snapToSceneEnabled(){const e=this._sourceElevationInfo?.mode;return"relative-to-ground"!==e&&"on-the-ground"!==e&&null}get _defaultElevationInfo(){return this.placementElevationInfo}get _sourceElevationInfo(){return this.placementElevationInfo??c}_createLaserLine(){this._laserlineVisualElement=o(this._laserlineVisualElement);const{glowWidth:e,innerWidth:t}=v;this._laserlineVisualElement=new w({view:this.view,attached:!0,visible:!1,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_updateLaserLineRenderer(){const e=this._laserlineVisualElement,t=this.analysis.observer?.position,i=this.analysisViewData.cursorTarget?.position;null!=e&&this.active&&this.visible&&null!=t&&null!=i&&b(this.view,t,g)&&b(this.view,i,T)?(e.visible=!0,e.heightManifoldTarget=T,e.lineVerticalPlaneSegment=d(g,T,E)):this._hideLaserLine()}_hideLaserLine(){const e=this._laserlineVisualElement;null!=e&&(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_updateLaserLineStyle(e,t,i){const o=this._laserlineVisualElement;if(null==o)return;const s=o.style;o.style={...s,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:i}}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid;const{drawTool:e}=this._createDrawTool();this._drawTool=e,this.view.addAndActivateTool(e),e.begin([y({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultElevationInfo:this._defaultElevationInfo,sourceElevationInfo:this._sourceElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return m({analysisViewData:this.analysisViewData,view:this.view,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,getSourceElevationInfo:()=>this._sourceElevationInfo,getVisible:()=>this.visible,onCancel:e=>{e!==this._drawTool||this._sessionStartedWithValidAnalysis||null!=this.analysis.observer||(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(e)},onComplete:e=>this._destroyDrawTool(e),onManipulatorCountChange:e=>this._hideManipulatorOnAppearance(e)})}_destroyDrawTool(e=this._drawTool){if(null==e)return;const t=e===this._drawTool;this.view.activeTool===e&&(this.view.activeTool=null),this.view.tools.includes(e)&&this.view.tools.remove(e),e.destroy(),t&&(this._drawTool=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(e){e.removeHandles(f),e.addHandles(e.manipulators.toArray().map(e=>e instanceof _?e.disableDisplay():null).filter(i),f)}};function b(e,t,i){return e.renderCoordsHelper.toRenderCoords(t,i)}e([a({constructOnly:!0})],V.prototype,"view",void 0),e([a({constructOnly:!0})],V.prototype,"analysis",void 0),e([a({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],V.prototype,"parent",void 0),e([a()],V.prototype,"visible",void 0),e([a()],V.prototype,"placementElevationInfo",void 0),e([a()],V.prototype,"active",null),e([a()],V.prototype,"canRedo",null),e([a()],V.prototype,"canUndo",null),e([a()],V.prototype,"updating",null),e([a()],V.prototype,"activeTooltipInfo",null),e([a()],V.prototype,"tooltip",null),e([a()],V.prototype,"_drawTool",void 0),V=e([r("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController")],V);export{V as LineOfSightPlacementController};
2
+ import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{isSome as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as i,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as a,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as r}from"../../../../support/elevationInfoUtils.js";import{createDrawTool as l}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const h=Symbol("hiddenManipulatorHandle");let u=class extends o{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(t){super(t),this.visible=!0,this.placementElevationInfo=null,this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([i(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},n)])}destroy(){this._destroyDrawTool()}get activeSnappingManager(){return this.active?this._drawTool?.snappingManager??null:null}get _snapToSceneEnabled(){const t=this._sourceElevationInfo?.mode;return"relative-to-ground"!==t&&"on-the-ground"!==t&&null}get _defaultElevationInfo(){return this.placementElevationInfo}get _sourceElevationInfo(){return this.placementElevationInfo??r}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid;const{drawTool:t,renderer:o}=this._createDrawTool();this._drawTool=t,this._renderer=o,this.view.addAndActivateTool(t),t.begin([d({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultElevationInfo:this._defaultElevationInfo,sourceElevationInfo:this._sourceElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return l({analysis:this.analysis,analysisViewData:this.analysisViewData,view:this.view,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,getSourceElevationInfo:()=>this._sourceElevationInfo,getVisible:()=>this.visible,onCancel:t=>{t!==this._drawTool||this._sessionStartedWithValidAnalysis||null!=this.analysis.observer||(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(t)},onComplete:t=>this._destroyDrawTool(t),onManipulatorCountChange:t=>this._hideManipulatorOnAppearance(t),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(t=this._drawTool){if(null==t)return;const o=t===this._drawTool;this.view.activeTool===t&&(this.view.activeTool=null),this.view.tools.includes(t)&&this.view.tools.remove(t),t.destroy(),o&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(t){t.removeHandles(h),t.addHandles(t.manipulators.toArray().map(t=>t instanceof p?t.disableDisplay():null).filter(e),h)}};t([a({constructOnly:!0})],u.prototype,"view",void 0),t([a({constructOnly:!0})],u.prototype,"analysis",void 0),t([a({constructOnly:!0})],u.prototype,"analysisViewData",void 0),t([a({constructOnly:!0})],u.prototype,"parent",void 0),t([a({constructOnly:!0})],u.prototype,"shouldPreventVertexAdd",void 0),t([a()],u.prototype,"visible",void 0),t([a()],u.prototype,"placementElevationInfo",void 0),t([a()],u.prototype,"active",null),t([a()],u.prototype,"canRedo",null),t([a()],u.prototype,"canUndo",null),t([a()],u.prototype,"updating",null),t([a()],u.prototype,"activeTooltipInfo",null),t([a()],u.prototype,"tooltip",null),t([a()],u.prototype,"_drawTool",void 0),t([a()],u.prototype,"_renderer",void 0),u=t([s("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController")],u);export{u as LineOfSightPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{when as a,watch as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{create as l,fromPoints as h}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as p}from"./LineOfSightAggregateManipulatedObject3D.js";import{getLaserLineColors as u,laserLineConfiguration as c}from"./LineOfSightConfiguration.js";import{ReshapeTool3D as g}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import{LaserlineVisualElement as d}from"../../interactive/visualElements/LaserlineVisualElement.js";import _ from"../../../interactive/sketch/SketchOptions.js";import{acquire as v}from"../../../interactive/snapping/SnappingManagerPool.js";const b=Symbol("line-of-sight-reshape-laser-line-manipulators"),m=Symbol("line-of-sight-reshape-tool-operations"),L=l();let y=class extends t{constructor(e){super(e),this.visible=!0,this._editing=!1,this._grabbedManipulator=null,this._laserlineVisualElement=null,this._snappingManagerResult=v(e.view),this._object=new p({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new g({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,sketchOptions:new _({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._createLaserLine(),this.addHandles([this._snappingManagerResult,this._reshapeTool.events.on("manipulators-changed",()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("reshape",e=>{"reshape-start"===e.type?this._editing=!0:"reshape-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("move",e=>{"move-start"===e.type?this._editing=!0:"move-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),a(()=>!this.active,()=>{this._cleanupAfterDeactivate()}),s(()=>u(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),n),s(()=>({active:this.active,analysisVisible:this.analysisViewData.visible,targetCount:this.analysis.targets.length,visible:this.visible}),()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()},n),s(()=>this._object.operations,e=>{this.removeHandles(m),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],m),this.notifyChange("canUndo"),this.notifyChange("canRedo")},n)])}destroy(){this.stop(),this.removeHandles(b),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._laserlineVisualElement=i(this._laserlineVisualElement)}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._laserlineVisualElement}activate(){this._reshapeTool.visible=this.visible,this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.getObserverManipulator()}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection()}applySelection(e){const t="observer"===e.type?this._object.getObserverManipulator():this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this._editing=!1,this._grabbedManipulator=null,this._hideLaserLine()}suspend(){this.clearSelection(),this.snappingManager?.doneSnapping(),this.stop()}undo(){this._reshapeTool.undo()}_cleanupAfterDeactivate(){this._editing=!1,this._grabbedManipulator=null,this._reshapeTool.snappingManager?.doneSnapping(),this._hideLaserLine()}_createLaserLine(){this._laserlineVisualElement=i(this._laserlineVisualElement);const{glowWidth:e,innerWidth:t}=c;this._laserlineVisualElement=new d({view:this.view,attached:!0,visible:!1,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_updateLaserLineRenderer(){const e=this._laserlineVisualElement,t=this._object.getObserverManipulator(),i=this._getLaserLineManipulator();null!=e&&this.active&&this.visible&&this.analysisViewData.visible&&null!=t&&null!=i?(e.visible=!0,e.heightManifoldTarget=i.renderLocation,e.lineVerticalPlaneSegment=i===t?null:h(t.renderLocation,i.renderLocation,L)):this._hideLaserLine()}_hideLaserLine(){const e=this._laserlineVisualElement;null!=e&&(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_updateLaserLineStyle(e,t,i){const a=this._laserlineVisualElement;if(null==a)return;const s=a.style;a.style={...s,glowColor:e.toUnitRGB(),innerColor:t.toUnitRGB(),globalAlpha:i}}_getLaserLineManipulator(){const e=this._grabbedManipulator;if(this._editing){const e=this._getSelectedManipulator();if(null!=e)return e}if(null!=e?.view)return e;for(const i of this.analysis.targets){const e=this._object.getTargetManipulator(i);if(M(e))return e}const t=this._object.getObserverManipulator();return M(t)?t:null}_getSelectedManipulator(){let e=null;for(const t of this._getLaserLineManipulators())if(t.selected){if(null!=e)return null;e=t}return e}_syncLaserLineManipulatorHandles(){this.removeHandles(b);const e=this._getLaserLineManipulators();null==this._grabbedManipulator||e.includes(this._grabbedManipulator)||(this._grabbedManipulator=null),this.addHandles(e.flatMap(e=>[e.events.on("grab-changed",t=>{"start"===t.action?this._grabbedManipulator=e:this._grabbedManipulator===e&&(this._grabbedManipulator=null),this._updateLaserLineRenderer()}),e.events.on("location-update",()=>this._updateLaserLineRenderer())]),b)}_getLaserLineManipulators(){return[this._object.getObserverManipulator(),...this.analysis.targets.toArray().map(e=>this._object.getTargetManipulator(e))].filter(e=>null!=e)}};function M(e){return null!=e&&e.grabbing}e([r({constructOnly:!0})],y.prototype,"analysisViewData",void 0),e([r({constructOnly:!0})],y.prototype,"analysis",void 0),e([r({constructOnly:!0})],y.prototype,"intersector",void 0),e([r({constructOnly:!0})],y.prototype,"view",void 0),e([r()],y.prototype,"visible",void 0),e([r()],y.prototype,"active",null),e([r()],y.prototype,"canRedo",null),e([r()],y.prototype,"canUndo",null),e([r()],y.prototype,"updating",null),y=e([o("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],y);export{y as LineOfSightReshapeTool3D};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{when as a,watch as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{create as l,fromPoints as h}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as p}from"./LineOfSightAggregateManipulatedObject3D.js";import{LineOfSightInteractionVisuals as u}from"./LineOfSightInteractionVisuals.js";import{ReshapeTool3D as c}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import g from"../../../interactive/sketch/SketchOptions.js";import{acquire as d}from"../../../interactive/snapping/SnappingManagerPool.js";const _=Symbol("line-of-sight-reshape-laser-line-manipulators"),v=Symbol("line-of-sight-reshape-tool-operations"),b=l();let M=class extends t{constructor(e){super(e),this.visible=!0,this._editing=!1,this._grabbedManipulator=null,this._interactionVisuals=null,this._snappingManagerResult=d(e.view),this._object=new p({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new c({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,sketchOptions:new g({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._interactionVisuals=new u({view:this.view}),this.addHandles([this._snappingManagerResult,this._reshapeTool.events.on("manipulators-changed",()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("reshape",e=>{"reshape-start"===e.type?this._editing=!0:"reshape-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("move",e=>{"move-start"===e.type?this._editing=!0:"move-stop"===e.type&&(this._editing=!1,this._grabbedManipulator=null),this._updateLaserLineRenderer()}),this._reshapeTool.events.on("before-vertex-remove",e=>{let t=this.analysis.targets.length;for(const i of e.vertices){if(0===i.componentIndex)return void e.preventDefault();if(t-=1,0===t)return void e.preventDefault()}}),a(()=>!this.active,()=>{this._cleanupAfterDeactivate()}),s(()=>({active:this.active,analysisVisible:this.analysisViewData.visible,targetCount:this.analysis.targets.length,visible:this.visible}),()=>{this._syncLaserLineManipulatorHandles(),this._updateLaserLineRenderer()},n),s(()=>this._object.operations,e=>{this.removeHandles(v),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],v),this.notifyChange("canUndo"),this.notifyChange("canRedo")},n)])}destroy(){this.stop(),this.removeHandles(_),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._interactionVisuals=i(this._interactionVisuals)}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}activate(){this._reshapeTool.visible=this.visible,this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.getObserverManipulator()}hasManipulatorAt(e,t){if(f(this._object.getObserverManipulator(),e,t))return!0;for(const i of this.analysis.targets)if(f(this._object.getTargetManipulator(i),e,t))return!0;return!1}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection()}applySelection(e){const t="observer"===e.type?this._object.getObserverManipulator():this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this._editing=!1,this._grabbedManipulator=null,this._hideLaserLine()}suspend(){this.clearSelection(),this.snappingManager?.doneSnapping(),this.stop()}undo(){this._reshapeTool.undo()}_cleanupAfterDeactivate(){this._editing=!1,this._grabbedManipulator=null,this._reshapeTool.snappingManager?.doneSnapping(),this._hideLaserLine()}_updateLaserLineRenderer(){const e=this._object.getObserverManipulator(),t=this._getLaserLineManipulator();null!=this._interactionVisuals&&this.active&&this.visible&&this.analysisViewData.visible&&null!=e&&null!=t?this._interactionVisuals.update({target:t.renderLocation,lineVerticalPlaneSegment:t===e?null:h(e.renderLocation,t.renderLocation,b),visible:!0}):this._hideLaserLine()}_hideLaserLine(){this._interactionVisuals?.hide()}_getLaserLineManipulator(){const e=this._grabbedManipulator;if(this._editing){const e=this._getSelectedManipulator();if(null!=e)return e}if(null!=e?.view)return e;for(const i of this.analysis.targets){const e=this._object.getTargetManipulator(i);if(y(e))return e}const t=this._object.getObserverManipulator();return y(t)?t:null}_getSelectedManipulator(){let e=null;for(const t of this._getLaserLineManipulators())if(t.selected){if(null!=e)return null;e=t}return e}_syncLaserLineManipulatorHandles(){this.removeHandles(_);const e=this._getLaserLineManipulators();null==this._grabbedManipulator||e.includes(this._grabbedManipulator)||(this._grabbedManipulator=null),this.addHandles(e.flatMap(e=>[e.events.on("grab-changed",t=>{"start"===t.action?this._grabbedManipulator=e:this._grabbedManipulator===e&&(this._grabbedManipulator=null),this._updateLaserLineRenderer()}),e.events.on("location-update",()=>this._updateLaserLineRenderer())]),_)}_getLaserLineManipulators(){return[this._object.getObserverManipulator(),...this.analysis.targets.toArray().map(e=>this._object.getTargetManipulator(e))].filter(e=>null!=e)}};function f(e,t,i){return!0===e?.interactive&&e.consumesClicks&&null!=e.intersectionDistance(t,i)}function y(e){return null!=e&&e.grabbing}e([r({constructOnly:!0})],M.prototype,"analysisViewData",void 0),e([r({constructOnly:!0})],M.prototype,"analysis",void 0),e([r({constructOnly:!0})],M.prototype,"intersector",void 0),e([r({constructOnly:!0})],M.prototype,"view",void 0),e([r()],M.prototype,"visible",void 0),e([r()],M.prototype,"active",null),e([r()],M.prototype,"canRedo",null),e([r()],M.prototype,"canUndo",null),e([r()],M.prototype,"updating",null),M=e([o("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],M);export{M as LineOfSightReshapeTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import"../../../../core/has.js";import{onAbort as e}from"../../../../core/promiseUtils.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as c}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as h}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new c,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),h.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(o,()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.suspend(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo&&(t.stopPropagation(),this.redo())}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active||!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
2
+ import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.suspend(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo&&(t.stopPropagation(),this.redo())}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active||!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as t}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{DrawTool as a}from"../../../draw/DrawTool.js";import s from"../../../interactive/sketch/SketchOptions.js";import{acquire as l}from"../../../interactive/snapping/SnappingManagerPool.js";import{createScreenPointFromEvent as p}from"../../../support/screenUtils.js";function c(c){const{analysisViewData:m,view:f,getVisible:g,getSourceElevationInfo:v,getSnapToSceneEnabled:d,onCancel:u,onComplete:w,onManipulatorCountChange:h}=c,S=v(),b=new t({view:f}),j=new r({view:f}),I=l(f),P=new a({elevationInfo:S,enableVertexVisuals:!1,hasZ:!0,renderer:b,sketchOptions:new s({tooltips:{enabled:!0}}),snappingManager:I.snappingManager,view:f});return b.elevationInfo=S,P.addHandles([I,e(b),e(j),P.on("cancel",()=>u(P)),P.on("complete",()=>w(P)),n(()=>[P.surfaceManager,d()],([e,n])=>{e&&(e.snapToSceneEnabled=n)},o),n(()=>[g(),m.visible,v()],([e,n,o])=>{P.visible=e&&n,P.elevationInfo=o,b.elevationInfo=o,b.refresh()},o),n(()=>P.manipulators.length,()=>h(P),o),P.on(["before-vertex-add","before-vertex-add-at-point"],e=>{const n=e.detail.originalEvent;if("immediate-click"!==n?.type)return;const o=p(n),t=j.getScreenPointIntersection(o);if(null==t?.mapPoint)e.preventDefault();else{const e=P.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=t)}})]),{drawTool:P}}export{c as createDrawTool};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as t}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as i}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as o}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{DrawTool as a}from"../../../draw/DrawTool.js";import s from"../../../interactive/sketch/SketchOptions.js";import{acquire as l}from"../../../interactive/snapping/SnappingManagerPool.js";import{createScreenPointFromEvent as p}from"../../../support/screenUtils.js";function c(c){const{analysis:f,analysisViewData:m,view:d,getVisible:v,getSourceElevationInfo:g,getSnapToSceneEnabled:u,onCancel:w,onComplete:h,onManipulatorCountChange:b,shouldPreventVertexAdd:S}=c,j=g(),y=new i({analysis:f,analysisViewData:m,view:d}),I=new r({view:d}),D=l(d),P=new a({elevationInfo:j,enableVertexVisuals:!1,hasZ:!0,renderer:y,sketchOptions:new s({tooltips:{enabled:!0}}),snappingManager:D.snappingManager,view:d});return y.elevationInfo=j,P.addHandles([D,e(y),e(I),P.on("cancel",()=>w(P)),P.on("complete",()=>h(P)),n(()=>[P.surfaceManager,u()],([e,n])=>{e&&(e.snapToSceneEnabled=n)},t),n(()=>[v(),m.visible,g()],([e,n,t])=>{P.visible=e&&n,y.analysisVisible=P.visible,P.elevationInfo=t,y.elevationInfo=t,y.refresh()},t),n(()=>P.manipulators.length,()=>b(P),t),P.on(["before-vertex-add","before-vertex-add-at-point"],e=>{const n=e.detail.originalEvent;if("immediate-click"!==n?.type)return;const t=p(n);if(S(t,n.pointerType))return void e.preventDefault();const i=I.getScreenPointIntersection(t);if(null==i?.mapPoint)e.preventDefault();else{const e=P.mostDownstreamPlugin;o(e)&&(e.preservedIntersection=i)}})]),{drawTool:P,renderer:y}}export{c as createDrawTool};