@arcgis/core 4.33.0-next.20250303 → 4.33.0-next.20250305

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 (158) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{b49af2e3a1a38a063ab9.js → 1bd4fe77ba6fb25322e7.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{2f818b9a6b1f2b61410d.js → 1e7a70a1871fea29169e.js} +27 -27
  4. package/assets/esri/core/workers/chunks/{3ebdd0701e77bb28c75d.js → 2079f9d28e4199714f22.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{0fd6a78b38b0e2dae8a5.js → 237a965bd41ba8903e03.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{618016fc1165bcfc2b0d.js → 42b862550c96cc1be956.js} +7 -9
  7. package/assets/esri/core/workers/chunks/4403b3f08907e88d0d91.js +1 -0
  8. package/assets/esri/core/workers/chunks/{4dbd4523281691401272.js → 4539a802cba77a7a7cc7.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{0e2d9cd4e8ee5a62b05c.js → 45eee326f7a649c5a15b.js} +7 -9
  10. package/assets/esri/core/workers/chunks/{99f90d085aa9eb13e4fb.js → 46fb6ba8900286d18b6f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{2a44a6e75b2799246257.js → 4fb4884d2de42792abe3.js} +1 -1
  12. package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +1 -0
  13. package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 6e6422eda398774acbc7.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{c9cb8a6ff01275bec713.js → 77845cd5d824c1004bfa.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{a73a262ddc959a59819f.js → 7d3b2bdc75525d47389c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{cc1aedb2b3aa3854b0de.js → 901c957c049f53318e87.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → 909be86782af3deb448e.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{7d93ff4f18fd21c7b9f2.js → 94f41ef15f6c61562e5e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8540fb31bd0b29ff1906.js → 968956284f44187f0622.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{92b48e3365d1cc933113.js → 96d2a0777f5c418055fb.js} +1 -1
  21. package/assets/esri/core/workers/chunks/988efc508c33ca341e49.js +1 -0
  22. package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → abfc5f9ac16c3e885c5f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{856b03020b2dd047291d.js → ad9b3b83aa96db7b79ea.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → afddb94ff4e1a70022c7.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{c409bb2acd846d3b1395.js → b2f9f0767dadf185120c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → ba917175ca2a6681501e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/c03e6e35082beaec02a6.js +1 -0
  28. package/assets/esri/core/workers/chunks/{759781cad91d31ab7bc4.js → db4c110ab4c26c4b768c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/dcb043986fb065de0366.js +1 -0
  30. package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → de16b771d2c8d816c738.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{3010a22d00f45fce5939.js → e0ac90b4ad8c36fb7d70.js} +1 -1
  32. package/assets/esri/core/workers/chunks/e3e049311bced533c853.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → e56647e61296643c5f84.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1bc22af4cc4effcbcf2b.js → e6a5911ea21bef32834b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f4111bb5e5a4910b684a.js +1 -0
  36. package/assets/esri/core/workers/chunks/{12d798775a96a45aada2.js → f46c4a69ef2f763e905b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{5e80e10b7c7e66dd861e.js → febae745a29a17ca130a.js} +1 -1
  38. package/chunks/Bufferer-CicaNej1.js +1 -1
  39. package/chunks/Clouds.glsl.js +19 -23
  40. package/chunks/DefaultMaterial.glsl.js +22 -22
  41. package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
  42. package/chunks/Envelope.js +1 -1
  43. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  44. package/chunks/ImageMaterial.glsl.js +1 -1
  45. package/chunks/OperatorClip.js +1 -1
  46. package/chunks/OperatorCut.js +1 -1
  47. package/chunks/OperatorGeodesicBuffer.js +1 -1
  48. package/chunks/OperatorGeodeticArea.js +1 -1
  49. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  50. package/chunks/OperatorProximity.js +1 -1
  51. package/chunks/OperatorShapePreservingProject.js +1 -1
  52. package/chunks/ProjectionTransformation.js +1 -1
  53. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  54. package/chunks/disjointOperator.js +1 -1
  55. package/core/Accessor.js +1 -1
  56. package/core/accessorSupport/decorators/subclass.js +1 -1
  57. package/core/accessorSupport/interfaces.js +1 -1
  58. package/core/arrayUtils.js +1 -1
  59. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  60. package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
  61. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +5 -0
  62. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +5 -0
  63. package/geometry/operators/extendOperator.js +1 -1
  64. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  65. package/geometry/operators/gx/operatorBuffer.js +1 -1
  66. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  67. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  68. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  69. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  70. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  71. package/geometry/operators/gx/operatorSimplify.js +1 -1
  72. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  73. package/geometry/operators/gx/operatorUnion.js +1 -1
  74. package/geometry/operators/json/disjointOperator.js +1 -1
  75. package/geometry/operators/reshapeOperator.js +1 -1
  76. package/geometry/operators/support/apiConverter.js +1 -1
  77. package/geometry/operators/support/initNoPeFactory.js +1 -1
  78. package/geometry/operators/support/jsonConverter.js +1 -1
  79. package/interfaces.d.ts +20 -18
  80. package/layers/WMTSLayer.js +1 -1
  81. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  82. package/layers/graphics/dehydratedFeatures.js +1 -1
  83. package/layers/mixins/ArcGISImageService.js +1 -1
  84. package/layers/support/SubtypeSublayer.js +1 -1
  85. package/layers/support/featureLayerUtils.js +1 -1
  86. package/layers/support/wmtsUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/request.js +1 -1
  89. package/rest/support/IdentifyParameters.js +1 -1
  90. package/support/revision.js +1 -1
  91. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  92. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  93. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  94. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  95. package/views/3d/environment/Clouds.glsl.js +1 -1
  96. package/views/3d/environment/CloudsParameters.js +1 -1
  97. package/views/3d/environment/CloudsRenderer.js +1 -1
  98. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  99. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  100. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  101. package/views/3d/layers/I3SMeshView3D.js +1 -1
  102. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  103. package/views/3d/layers/MediaLayerView3D.js +1 -1
  104. package/views/3d/layers/SceneLayerView3D.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  106. package/views/3d/layers/support/FeatureTile.js +1 -1
  107. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  108. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  109. package/views/3d/layers/support/projectExtentUtils.js +1 -1
  110. package/views/3d/support/StreamTextureCollection.js +1 -1
  111. package/views/3d/support/TextureCollection.js +1 -1
  112. package/views/3d/terrain/TerrainRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainSurface.js +1 -1
  114. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +7 -7
  115. package/views/3d/webgl-engine/core/shaderLibrary/util/DoublePrecision.glsl.js +5 -7
  116. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCloudsFromTextureArray.glsl.js +51 -0
  117. package/views/3d/webgl-engine/lib/GLMaterialParameters.js +5 -0
  118. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  119. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  120. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  121. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  122. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  123. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  125. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  126. package/views/View.js +1 -1
  127. package/views/animation/pointToPoint/apex/planning.js +1 -1
  128. package/views/support/LayerLayerViewInfo.js +5 -0
  129. package/views/support/LayerViewManager.js +5 -0
  130. package/views/webgl/FramebufferObject.js +1 -1
  131. package/views/webgl/TextureDescriptor.js +1 -1
  132. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  133. package/widgets/Editor/Edits.js +1 -1
  134. package/widgets/Editor/workflowUtils.js +1 -1
  135. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  136. package/widgets/Feature/FeatureRelationship.js +1 -1
  137. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  138. package/widgets/Feature/support/featureUtils.js +1 -1
  139. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  140. package/widgets/FeatureForm/FieldInput.js +1 -1
  141. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  142. package/widgets/Features/FeaturesDrillIn.js +1 -1
  143. package/widgets/Features/FeaturesViewModel.js +1 -1
  144. package/widgets/Features.js +1 -1
  145. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  146. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  147. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  148. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  149. package/assets/esri/core/workers/chunks/0e6d338b0937724763c7.js +0 -1
  150. package/assets/esri/core/workers/chunks/10118666a5a5b141ece6.js +0 -1
  151. package/assets/esri/core/workers/chunks/64d3e683872791eb6ae9.js +0 -1
  152. package/assets/esri/core/workers/chunks/7d120f8b01fe719eb257.js +0 -1
  153. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +0 -1
  154. package/assets/esri/core/workers/chunks/960b12a6fd5b6933212f.js +0 -1
  155. package/assets/esri/core/workers/chunks/af005704f23088db3ded.js +0 -1
  156. package/editing/sharedTemplates/executor/support/createServiceEdit.js +0 -5
  157. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCubemapFromTextureArray.glsl.js +0 -39
  158. package/views/LayerViewManager.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as i}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import n from"../../geometry/Extent.js";import l from"../../geometry/SpatialReference.js";import{fromJSON as m}from"../../geometry/support/jsonUtils.js";import{geometryTypes as y}from"../../geometry/support/typeUtils.js";import a from"../../layers/support/Sublayer.js";import u from"../../time/TimeExtent.js";var d;let c=d=class extends o{static from(t){return i(d,t)}constructor(t){super(t),this.dpi=96,this.floors=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=null,this.height=400,this.historicMoment=null,this.layerIds=null,this.layerOption="top",this.mapExtent=null,this.maxAllowableOffset=null,this.returnFieldName=!0,this.returnGeometry=!1,this.returnM=!1,this.returnUnformattedValues=!0,this.returnZ=!1,this.spatialReference=null,this.sublayers=null,this.timeExtent=null,this.tolerance=null,this.width=400}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}};t([r({type:Number,json:{write:!0}})],c.prototype,"dpi",void 0),t([r()],c.prototype,"floors",void 0),t([r({type:String,json:{write:!0}})],c.prototype,"gdbVersion",void 0),t([r({types:y,json:{read:m,write:!0}})],c.prototype,"geometry",void 0),t([r({type:Number,json:{write:!0}})],c.prototype,"geometryPrecision",void 0),t([r({type:Number,json:{write:!0}})],c.prototype,"height",void 0),t([r({type:Date})],c.prototype,"historicMoment",void 0),t([p("historicMoment")],c.prototype,"writeHistoricMoment",null),t([r({type:[Number],json:{write:!0}})],c.prototype,"layerIds",void 0),t([r({type:["top","visible","all","popup"],json:{write:!0}})],c.prototype,"layerOption",void 0),t([r({type:n,json:{write:!0}})],c.prototype,"mapExtent",void 0),t([r({type:Number,json:{write:!0}})],c.prototype,"maxAllowableOffset",void 0),t([r({type:Boolean,json:{write:!0}})],c.prototype,"returnFieldName",void 0),t([r({type:Boolean,json:{write:!0}})],c.prototype,"returnGeometry",void 0),t([r({type:Boolean,json:{write:!0}})],c.prototype,"returnM",void 0),t([r({type:Boolean,json:{write:!0}})],c.prototype,"returnUnformattedValues",void 0),t([r({type:Boolean,json:{write:!0}})],c.prototype,"returnZ",void 0),t([r({type:l,json:{write:!0}})],c.prototype,"spatialReference",void 0),t([r({type:e.ofType(a)})],c.prototype,"sublayers",void 0),t([r({type:u,json:{write:!0}})],c.prototype,"timeExtent",void 0),t([r({type:Number,json:{write:!0}})],c.prototype,"tolerance",void 0),t([r({type:Number,json:{write:!0}})],c.prototype,"width",void 0),c=d=t([s("esri.rest.support.IdentifyParameters")],c);const j=c;export{j as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as i}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import n from"../../geometry/Extent.js";import l from"../../geometry/SpatialReference.js";import{fromJSON as m}from"../../geometry/support/jsonUtils.js";import{geometryTypes as y}from"../../geometry/support/typeUtils.js";import a from"../../time/TimeExtent.js";var u;let d=u=class extends o{static from(t){return i(u,t)}constructor(t){super(t),this.dpi=96,this.floors=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=null,this.height=400,this.historicMoment=null,this.layerIds=null,this.layerOption="top",this.mapExtent=null,this.maxAllowableOffset=null,this.returnFieldName=!0,this.returnGeometry=!1,this.returnM=!1,this.returnUnformattedValues=!0,this.returnZ=!1,this.spatialReference=null,this.sublayers=null,this.timeExtent=null,this.tolerance=null,this.width=400}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}};t([r({type:Number,json:{write:!0}})],d.prototype,"dpi",void 0),t([r()],d.prototype,"floors",void 0),t([r({type:String,json:{write:!0}})],d.prototype,"gdbVersion",void 0),t([r({types:y,json:{read:m,write:!0}})],d.prototype,"geometry",void 0),t([r({type:Number,json:{write:!0}})],d.prototype,"geometryPrecision",void 0),t([r({type:Number,json:{write:!0}})],d.prototype,"height",void 0),t([r({type:Date})],d.prototype,"historicMoment",void 0),t([p("historicMoment")],d.prototype,"writeHistoricMoment",null),t([r({type:[Number],json:{write:!0}})],d.prototype,"layerIds",void 0),t([r({type:["top","visible","all","popup"],json:{write:!0}})],d.prototype,"layerOption",void 0),t([r({type:n,json:{write:!0}})],d.prototype,"mapExtent",void 0),t([r({type:Number,json:{write:!0}})],d.prototype,"maxAllowableOffset",void 0),t([r({type:Boolean,json:{write:!0}})],d.prototype,"returnFieldName",void 0),t([r({type:Boolean,json:{write:!0}})],d.prototype,"returnGeometry",void 0),t([r({type:Boolean,json:{write:!0}})],d.prototype,"returnM",void 0),t([r({type:Boolean,json:{write:!0}})],d.prototype,"returnUnformattedValues",void 0),t([r({type:Boolean,json:{write:!0}})],d.prototype,"returnZ",void 0),t([r({type:l,json:{write:!0}})],d.prototype,"spatialReference",void 0),t([r({type:e})],d.prototype,"sublayers",void 0),t([r({type:a,json:{write:!0}})],d.prototype,"timeExtent",void 0),t([r({type:Number,json:{write:!0}})],d.prototype,"tolerance",void 0),t([r({type:Number,json:{write:!0}})],d.prototype,"width",void 0),d=u=t([s("esri.rest.support.IdentifyParameters")],d);const c=d;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const e="20250303",c="cc2ffb23d14e5e1e8e44cf58267b6016445206f9";export{e as buildDate,c as commitHash};
5
+ const c="20250305",e="e6e3cc5e89ca1e1dd3a034696c93a488a8453f74";export{c as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{clock as t}from"../../../../core/clock.js";import{destroyHandle as i,makeHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r,when as a}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import u from"../../../../geometry/Point.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{DidPointerMoveRecentlyFlag as p}from"./lengthDimensionManipulatorUtils.js";import{LengthDimensionSubTool as h}from"./LengthDimensionSubTool.js";import{pointerMoveTimeoutMs as d}from"./settings.js";import{AnalysisToolBase as v}from"../../../interactive/AnalysisToolBase.js";import{sketchKeys as _}from"../../../interactive/keybindings.js";import{newToolIntersector as y}from"../../../interactive/ToolIntersector.js";import{createScreenPointArrayFromEvent as T}from"../../../support/screenUtils.js";var g;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(g||(g={}));let S=class extends v{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=d,this._prevPointerMoveTimeout=null}initialize(){this._intersector=y(this.view.state.viewingMode),this._lengthDimensionSubTool=new h({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([i(this._lengthDimensionSubTool),o((()=>this._clearPointerMoveTimeout())),n((()=>this.state),(e=>{e===g.Created&&this.finishToolCreation()}),r),a((()=>this.firstGrabbedManipulator),(e=>{this.selectedDimension=e.metadata}),r),n((()=>this.selectedDimension),(()=>this._resetPointerMoveTimeout()),r)])}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?null!=this._activeSubTool?g.Creating:g.Created:g.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(_.cancel===e.key){if(null!=this._activeSubTool&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else _.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){null!=this._activeSubTool&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(null==this._activeSubTool)return;const t=this._intersectScreen(e);null!=t&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),null==this._activeSubTool)return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);null!=t&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){null!=this._activeSubTool&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=T(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=m.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,new u({spatialReference:this.view.spatialReference})):null}_removeSelected(){null!=this.selectedDimension&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach((e=>e.manipulator.state|=p)),this._prevPointerMoveTimeout=t.setTimeout((()=>{this.manipulators.forEach((e=>e.manipulator.state&=~p))}),this._pointerMoveTimerMs)}get testInfo(){}};e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l({constructOnly:!0})],S.prototype,"analysis",void 0),e([l({readOnly:!0})],S.prototype,"state",null),e([l({readOnly:!0})],S.prototype,"updating",null),e([l({readOnly:!0})],S.prototype,"cursor",null),e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l()],S.prototype,"selectedDimension",null),e([l()],S.prototype,"automaticManipulatorSelection",void 0),e([l()],S.prototype,"_activeSubTool",void 0),e([l()],S.prototype,"_lengthDimensionSubTool",void 0),S=e([c("esri.views.3d.analysis.Dimension.DimensionTool")],S);export{S as DimensionTool};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{clock as t}from"../../../../core/clock.js";import{destroyHandle as i,makeHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r,when as a}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import u from"../../../../geometry/Point.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{DidPointerMoveRecentlyFlag as p}from"./lengthDimensionManipulatorUtils.js";import{LengthDimensionSubTool as h}from"./LengthDimensionSubTool.js";import{pointerMoveTimeoutMs as d}from"./settings.js";import{AnalysisToolBase as v}from"../../../interactive/AnalysisToolBase.js";import{sketchKeys as _}from"../../../interactive/keybindings.js";import{newToolIntersector as y}from"../../../interactive/ToolIntersector.js";import{createScreenPointArrayFromEvent as T}from"../../../support/screenUtils.js";var g;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(g||(g={}));let S=class extends v{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=d,this._prevPointerMoveTimeout=null}initialize(){this._intersector=y(this.view.state.viewingMode),this._lengthDimensionSubTool=new h({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([i(this._lengthDimensionSubTool),o((()=>this._clearPointerMoveTimeout())),n((()=>this.state),(e=>{e===g.Created&&this.finishToolCreation()}),r),a((()=>this.firstGrabbedManipulator),(e=>{this.selectedDimension=e.metadata}),r),n((()=>this.selectedDimension),(()=>this._resetPointerMoveTimeout()),r)])}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?null!=this._activeSubTool?g.Creating:g.Created:g.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(_.cancel===e.key){if(null!=this._activeSubTool&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else _.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){null!=this._activeSubTool&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(null==this._activeSubTool)return;const t=this._intersectScreen(e);null!=t&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),null==this._activeSubTool)return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);null!=t&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){null!=this._activeSubTool&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=T(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=m.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,new u({spatialReference:this.view.spatialReference})):null}_removeSelected(){null!=this.selectedDimension&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach((e=>e.manipulator.state|=p)),this._prevPointerMoveTimeout=t.setTimeout((()=>{this.manipulators.forEach((e=>e.manipulator.state&=~p))}),this._pointerMoveTimerMs)}get test(){}};e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l({constructOnly:!0})],S.prototype,"analysis",void 0),e([l({readOnly:!0})],S.prototype,"state",null),e([l({readOnly:!0})],S.prototype,"updating",null),e([l({readOnly:!0})],S.prototype,"cursor",null),e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l()],S.prototype,"selectedDimension",null),e([l()],S.prototype,"automaticManipulatorSelection",void 0),e([l()],S.prototype,"_activeSubTool",void 0),e([l()],S.prototype,"_lengthDimensionSubTool",void 0),S=e([c("esri.views.3d.analysis.Dimension.DimensionTool")],S);export{S as DimensionTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as r}from"../../../../core/lang.js";import{mapCollection as p}from"../../../../core/mapCollectionUtils.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{memoize as u}from"../../../../core/memoize.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{watch as c,initial as m,sync as h,syncAndInitial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import C from"../../../../geometry/Point.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as w,LengthDimensionConstraint as b,applyConstraint as P,computeConstraint as O,constraintDependencies as D}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as j,LengthDimensionPointManipulator as H,pointManipulatorHandles as T,createOffsetManipulator as G,offsetManipulatorHandles as x,LineOfSightOrientationManipulator as z,headingManipulatorHandles as U,rotationManipulatorHandles as I,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as R,updateOffsetManipulatorTransform as A,updateHeadingManipulatorTransform as k,updateRotationManipulatorTransform as E,updateMeasureTypeManipulatorTransform as L,unfocusedOffsetWidth as F,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computeGeometryFromDimension as J,computationToGeometryDependencies as K}from"./lengthDimensionUtils.js";import{disabledPointColor as Q,pointRadius as W,getTransparentAccentColor as X,getContrastColor as Y,initialOffsetPx as Z}from"./settings.js";import{getRotateHeadingTexture as $}from"../images/Factory.js";import{SnappingVisualizer3D as tt}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as et}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as it}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as at}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as nt}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as st}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as ot}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as rt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as pt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as lt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as ut}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as dt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as ct}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as mt}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as ht}from"../../../interactive/snapping/snappingUtils.js";let gt=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._orientationManipulatorTexture=null,this._updatingHandles=new y,this._getSnappingContext=u((t=>new ut({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new lt(new pt("point",rt(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new tt})));const{view:i}=t;this._snappingManagerResult=ct(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:st(2)}),this._constraintSnappingIndicator=new et({view:i,attached:!0,width:1,renderOccluded:at.OccludeAndTransparent,stipplePattern:st(5),isDecoration:!0});const a=e.toUnitRGBA(Q);this._stagedStartIndicator=new it({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*W,outlineSize:0,renderOccluded:at.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new mt({view:t});const i=!t._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorMaterial=new nt({writeDepth:!1,renderOccluded:at.Opaque,isDecoration:!0}),this.addHandles(c((()=>({accentColor:X(t.effectiveTheme),contrastColor:Y(t.effectiveTheme)})),(({accentColor:a,contrastColor:n})=>{const s=this._orientationManipulatorTexture,o=$(t.textures,{accentColor:a,contrastColor:n,preMultiplyAlpha:i});this._orientationManipulatorMaterial.setParameters({textureId:o.texture.id}),this._orientationManipulatorTexture=o,s?.release();const r=e.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r}),m));const a=p((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(a)),this.addHandles([c((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=S(t,new C);this._applyPointUpdate(e,{endPoint:i})}),h),c((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),g),c((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),m),c((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),c((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=v();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),ht(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(d(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);w(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._snappingOperation=l(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture?.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...g,equals:r}),c((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case b.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case b.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case b.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),h)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[c((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),c((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==b.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(d(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:S(n,new C),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=S(a,new C);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new j({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([c((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...g,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new H(i,{metadata:a}),s=T(n,{isStart:e.isStart,createSnappingPipelineStep:t=>dt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=G(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=x(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=U(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=R(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=B(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);N(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;A(l,g,f),u.available&&k(u,t,f),d.available&&E(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&L(e,t,i,f)}))}_updateManipulatorStyle(t){const e=F(t),i=q(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=K(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=J(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});P(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,ft);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(ft);t.dimension.offset=Z*a*i.unitInMeters}_computeConstraint(t){return O(D(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new ot({width:1,renderOccluded:at.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){}};t([_({constructOnly:!0})],gt.prototype,"analysis",void 0),t([_({constructOnly:!0})],gt.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],gt.prototype,"manipulators",void 0),t([_({constructOnly:!0})],gt.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],gt.prototype,"view",void 0),t([_({readOnly:!0})],gt.prototype,"updating",null),t([_()],gt.prototype,"firstGrabbedManipulator",null),t([_()],gt.prototype,"hasGrabbedManipulators",null),t([_()],gt.prototype,"snappingOptions",null),t([_()],gt.prototype,"_stagedDimension",void 0),t([_()],gt.prototype,"_activeComputation",null),t([_()],gt.prototype,"_stagedComputation",null),gt=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],gt);const ft=v();export{gt as LengthDimensionSubTool};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as r}from"../../../../core/lang.js";import{mapCollection as p}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as l,destroyMaybe as u}from"../../../../core/maybe.js";import{memoize as d}from"../../../../core/memoize.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{watch as m,initial as h,sync as g,syncAndInitial as f,when as _}from"../../../../core/reactiveUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import S from"../../../../geometry/Point.js";import{clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as b,LengthDimensionConstraint as P,applyConstraint as O,computeConstraint as D,constraintDependencies as H}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as j,LengthDimensionPointManipulator as T,pointManipulatorHandles as x,createOffsetManipulator as G,offsetManipulatorHandles as z,LineOfSightOrientationManipulator as U,headingManipulatorHandles as V,rotationManipulatorHandles as I,createMeasureTypeManipulator as A,measureTypeManipulatorHandles as R,updateOffsetManipulatorTransform as k,updateHeadingManipulatorTransform as E,updateRotationManipulatorTransform as L,updateMeasureTypeManipulatorTransform as F,unfocusedOffsetWidth as q,focusedOffsetWidth as B}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as N,arePointsVerticallyAligned as J,computeGeometryFromDimension as K,computationToGeometryDependencies as Q}from"./lengthDimensionUtils.js";import{disabledPointColor as W,pointRadius as X,getTransparentAccentColor as Y,getContrastColor as Z,initialOffsetPx as $}from"./settings.js";import{getRotateHeadingTexture as tt}from"../images/Factory.js";import{SnappingVisualizer3D as et}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as it}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as at}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as nt}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as st}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as ot}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as rt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as pt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as lt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ut}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as dt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ct}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as mt}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as ht}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as gt}from"../../../interactive/snapping/snappingUtils.js";let ft=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new C,this._getSnappingContext=d((t=>new dt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new ut(new lt("point",pt(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new et})));const{view:i}=t;this._snappingManagerResult=mt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:ot(2)}),this._constraintSnappingIndicator=new it({view:i,attached:!0,width:1,renderOccluded:nt.OccludeAndTransparent,stipplePattern:ot(5),isDecoration:!0});const a=e.toUnitRGBA(W);this._stagedStartIndicator=new at({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*X,outlineSize:0,renderOccluded:nt.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ht({view:t});const i=Y(t.effectiveTheme),a=Z(t.effectiveTheme),n=!t._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=tt(t.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial=new st({texture:this._textureHandle.texture,writeDepth:!1,renderOccluded:nt.Opaque,isDecoration:!0});const s=p((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles([m((()=>({accentColor:Y(t.effectiveTheme),contrastColor:Z(t.effectiveTheme)})),(({accentColor:i,contrastColor:a})=>{const s=this._textureHandle;this._textureHandle=tt(t.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial.setParameters({texture:this._textureHandle.texture}),s?.release();const o=e.toUnitRGBA(i);this._unfocusedOffsetManipulatorMaterial.setParameters({color:o}),this._focusedOffsetManipulatorMaterial.setParameters({color:o}),this._thinOffsetManipulatorMaterial.setParameters({color:o}),this._constraintSnappingIndicator.color=o}),h),o(s),m((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=w(t,new S);this._applyPointUpdate(e,{endPoint:i})}),g),m((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),f),m((()=>this.analysis.style.lineSize),(t=>this._updateManipulatorStyle(t)),h),m((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),m((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),gt(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(c(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);b(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._textureHandle=l(this._textureHandle),this._snappingOperation=u(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorMaterial.dispose()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[_((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...f,equals:r}),m((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case P.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case P.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case P.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),g)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[m((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),m((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==P.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(c(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:w(n,new S),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=w(a,new S);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new j({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([m((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...f,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new T(i,{metadata:a}),s=x(n,{isStart:e.isStart,createSnappingPipelineStep:t=>ct({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=G(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=z(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new U(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=V(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new U(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=A(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=R(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=N(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);J(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;k(l,g,f),u.available&&E(u,t,f),d.available&&L(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&F(e,t,i,f)}))}_updateManipulatorStyle(t){const e=q(t),i=B(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=Q(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=K(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});O(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,_t);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(_t);t.dimension.offset=$*a*i.unitInMeters}_computeConstraint(t){return D(H(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new rt({width:1,renderOccluded:nt.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get test(){}};t([M({constructOnly:!0})],ft.prototype,"analysis",void 0),t([M({constructOnly:!0})],ft.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ft.prototype,"manipulators",void 0),t([M({constructOnly:!0})],ft.prototype,"parentTool",void 0),t([M({constructOnly:!0,nonNullable:!0})],ft.prototype,"view",void 0),t([M({readOnly:!0})],ft.prototype,"updating",null),t([M()],ft.prototype,"firstGrabbedManipulator",null),t([M()],ft.prototype,"hasGrabbedManipulators",null),t([M()],ft.prototype,"snappingOptions",null),t([M()],ft.prototype,"_stagedDimension",void 0),t([M()],ft.prototype,"_activeComputation",null),t([M()],ft.prototype,"_stagedComputation",null),ft=t([v("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ft);const _t=y();export{ft as LengthDimensionSubTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,d as p,e as f,f as g,p as h,l as v,i as y,a as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import H from"../../../../geometry/Point.js";import{fromPositionAndNormal as M,create as P,signedDistance as C,getNormal as T}from"../../../../geometry/support/plane.js";import{sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as U}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as R,computeGeometryFromDimension as z,computationToGeometryDependencies as A,headingFromGeometry as D,computeOffsetForPoint as _,computeSegmentForMeasureType as F,computeOffsetAxis as L,directUp as k,directStartToEnd as E,dimensionStartToEnd as I}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as G,pointRadius as B,lengthFraction as N,markerLineSizeFraction as V,orientationCalloutOffsetPx as W,orientationCalloutWidth as q,orientationDiscScale as J,orientationFocusMultiplier as K,orientationSnapThresholdDegrees as Q,minLengthMeters as X,linePaddingPx as Y,focusedLinePaddingPx as Z}from"./settings.js";import{Manipulator3D as $}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as ee,worldScaledManipulatorSettings as te,calculateInputRotationTransform as re,calculateTranslateRotateFromBases as ne,rotateManipulatorDefaults as ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as oe}from"../../interactive/RenderObject.js";import{screenToMap3D as ae,screenToRenderPlane as se,hideManipulatorWhileDragging as ce}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as le}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as me}from"../../support/engineContent/marker.js";import{Attribute as de}from"../../webgl-engine/lib/Attribute.js";import{Geometry as ue}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as pe,createPolylineGeometry as fe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ge}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as he}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as ve}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as ye}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as we,resetProperties as Se,EventPipeline as je}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as xe,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";class He{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class Me extends ${constructor(t,r){const n=ee(e.toUnitRGBA(G(t.effectiveTheme))),i=[new oe(pe(n,1,32,32),tt)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:B,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(G(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Pe(e,t){const r=[x(-.5,0,0),x(.5,0,0)],n=fe(t.unfocusedMaterial,r.map((e=>d(S(),e,N)))),i=n.instantiate({material:t.focusedMaterial});return new $({view:e,renderObjects:[new oe(n,be.Unfocused|be.Selected|tt),new oe(i,be.Focused|tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,metadata:t.metadata,available:!1,...te})}class Ce extends ${constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:b(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(G(t.effectiveTheme))),(e=>{this._options.calloutColor=e,et(this,Te({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,et(this,Te({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Te({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*me*V*s(t)+W,calloutColor:e,calloutWidth:q,customStateMask:tt,discScale:J,focusMultiplier:K,material:r,metadata:n}}function Oe(e,t){const r=[x(-.5,0,0),x(.5,0,0)],n=fe(t.thinOffsetManipulatorMaterial,r),i=fe(t.unfocusedMaterial,r.map((e=>d(S(),e,N)))),o=i.instantiate({material:t.focusedMaterial});return new $({view:e,renderObjects:[new oe(i,be.Unfocused|tt),new oe(o,be.Focused|tt),new oe(n,tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,available:!1,metadata:t.metadata,...te})}function Ue(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=we(e,((e,t,s,c)=>{const l=ce(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(Se(n,[a,"measureType","orientation"])).next(d),t.next(l).next(ae(o)).next(...m).next((e=>{const t=U(e.mapEnd,new H);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Re(e,{computation:t,view:r}){return[we(e,((e,n,i)=>{if(!R(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=ce(e);n.next(s).next(ke(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(Se(a,["offset"]))}))]}function ze(e,{computation:t,view:r}){return[we(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function Ae(e,{computation:t,view:r}){return[we(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{De(e,t,r)}))]}function De(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=z({...A(t),orientation:90},a),c=z({...A(t),orientation:270},a);if(null==s||null==c)return;const l=D(s,a),m=D(c,a),d=Ee(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!R(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=Je(S(),l,l.directSegment,s),p=Ke(O.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=M(d,p,P()),g=n?c.orientation??D(l,a.renderCoordsHelper):c.orientation??0;o.next(se(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=T(f),r=re(m,e.renderEnd,d,t);let o=g-i(r);n||(o=Fe(o)),c.orientation=o})),t.next(Se(c,["orientation"]))}function Fe(e){const t=n.normalize(e)%90;return t<Q?e-t:90-t<Q?e+(90-t):e}function Le(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!R(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(O.get(),e.renderLocation);c.measureType=n,c.offset=_(m,n,l,i.renderCoordsHelper),c.orientation=0})),we(e,((e,r,c)=>{if(!R(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=F(ot,n,t,d),p=L(O.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=ce(e);r.next(f).next(ke(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function ke(e,t,r,n){const i=p(O.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=M(r.startRenderSpace,i,P()),a=M(r.startRenderSpace,n,P()),s=t.offset;let c,l=0;const m=new je;return m.next(se(e,o)).next((r=>{"start"===r.action&&(l=C(a,r.renderStart));const n=(C(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function Ee(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=k(O.get(),e,n),o=E(O.get(),e),a=f(O.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,O.get());return n.headingAtPosition(c,a)}function Ie(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=I(rt,t),a=h(o,j)?c(it):ne(o,i,j,it),s=Math.max(v(o),X/r.unitInMeters);l(a,a,y(rt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,rt)}function Ge(e,t,r){Ne(e,t,r,{forHeading:!0})}function Be(e,t,r){Ne(e,t,r,{forHeading:!1})}function Ne(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ve,a,i.offset>=0?1:-1),c=Ke(We,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=ne(s,c,j,it);e.modelTransform=l,e.renderLocation=Je(rt,o,o.dimensionSegment,r)}const Ve=S(),We=S();function qe(e,t,r,n){const{geometry:i}=t,o=F(ot,r,t,n),a=L(rt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(nt,o.endRenderSpace,o.startRenderSpace),c=ne(s,a,j,it),m=v(s);l(c,c,y(nt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,nt)}function Je(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Qe(t,n)?i:o;return u(e,a)}function Ke(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?k(e,r,n):I(e,r,{invert:!0})}function Qe(e,t){const r=E(Xe,e),n=k(Ye,e,t);return g(r,n)>0}const Xe=S(),Ye=S();function Ze(e){return s(e)+Y}function $e(e){return s(e)+Z}function et(e,t){const r=t.material??new ve({writeDepth:!1,textureId:t.texture?.id,renderOccluded:ge.Opaque,isDecoration:!0}),n=t.focusMultiplier??ie.focusMultiplier,i=t.calloutLength??ie.calloutLength,o=ie.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new ue(t,[[he.POSITION,new de([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[he.UV0,new de([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ie.calloutWidth,l=new ye({width:c,color:t.calloutColor,renderOccluded:ge.OccludeAndTransparent,isDecoration:!0}),m=fe(l,[[0,0,0],[i-o,0,0]]),d=fe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??xe.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new oe(s(o,r),be.Unfocused|u),new oe(m,be.Unfocused|u),new oe(s(a,r),be.Focused|u),new oe(d,be.Focused|u)]}const tt=xe.Custom1,rt=S(),nt=S(),it=m(),ot=new le;export{tt as DidPointerMoveRecentlyFlag,He as LengthDimensionManipulators,Me as LengthDimensionPointManipulator,Ce as LineOfSightOrientationManipulator,Ee as automaticHeadingFromCamera,Oe as createMeasureTypeManipulator,Pe as createOffsetManipulator,$e as focusedOffsetWidth,ze as headingManipulatorHandles,Le as measureTypeManipulatorHandles,Re as offsetManipulatorHandles,Ue as pointManipulatorHandles,Ae as rotationManipulatorHandles,Fe as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,qe as updateMeasureTypeManipulatorTransform,Ie as updateOffsetManipulatorTransform,Be as updateRotationManipulatorTransform};
5
+ import e from"../../../../Color.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,d as p,e as f,f as g,p as h,l as v,i as y,a as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import H from"../../../../geometry/Point.js";import{fromPositionAndNormal as M,create as P,signedDistance as C,getNormal as T}from"../../../../geometry/support/plane.js";import{sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as U}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as R,computeGeometryFromDimension as z,computationToGeometryDependencies as A,headingFromGeometry as _,computeOffsetForPoint as D,computeSegmentForMeasureType as F,computeOffsetAxis as L,directUp as k,directStartToEnd as E,dimensionStartToEnd as G}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as I,pointRadius as B,lengthFraction as N,markerLineSizeFraction as V,orientationCalloutOffsetPx as W,orientationCalloutWidth as q,orientationDiscScale as J,orientationFocusMultiplier as K,orientationSnapThresholdDegrees as Q,minLengthMeters as X,linePaddingPx as Y,focusedLinePaddingPx as Z}from"./settings.js";import{Manipulator3D as $}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as ee,worldScaledManipulatorSettings as te,calculateInputRotationTransform as re,calculateTranslateRotateFromBases as ne,rotateManipulatorDefaults as ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as oe}from"../../interactive/RenderObject.js";import{screenToMap3D as ae,screenToRenderPlane as se,hideManipulatorWhileDragging as ce}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as le}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as me}from"../../support/engineContent/marker.js";import{Attribute as de}from"../../webgl-engine/lib/Attribute.js";import{Geometry as ue}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as pe,createPolylineGeometry as fe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ge}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as he}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as ye,resetProperties as we,EventPipeline as Se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as je,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";class xe{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class He extends ${constructor(t,r){const n=ee(e.toUnitRGBA(I(t.effectiveTheme))),i=[new oe(pe(n,1,32,32),et)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:B,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(I(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Me(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=fe(t.unfocusedMaterial,r.map((e=>d(S(),e,N)))),i=n.instantiate({material:t.focusedMaterial});return new $({view:e,renderObjects:[new oe(n,be.Unfocused|be.Selected|et),new oe(i,be.Focused|et)],collisionType:{type:"line",paths:[r]},radius:Ze(t.lineSizePt)/2,metadata:t.metadata,available:!1,...te})}class Pe extends ${constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:x(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(I(t.effectiveTheme))),(e=>{this._options.calloutColor=e,$e(this,Ce({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,$e(this,Ce({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Ce({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*me*V*s(t)+W,calloutColor:e,calloutWidth:q,customStateMask:et,discScale:J,focusMultiplier:K,material:r,metadata:n}}function Te(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=fe(t.thinOffsetManipulatorMaterial,r),i=fe(t.unfocusedMaterial,r.map((e=>d(S(),e,N)))),o=i.instantiate({material:t.focusedMaterial});return new $({view:e,renderObjects:[new oe(i,be.Unfocused|et),new oe(o,be.Focused|et),new oe(n,et)],collisionType:{type:"line",paths:[r]},radius:Ze(t.lineSizePt)/2,available:!1,metadata:t.metadata,...te})}function Oe(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=ye(e,((e,t,s,c)=>{const l=ce(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(we(n,[a,"measureType","orientation"])).next(d),t.next(l).next(ae(o)).next(...m).next((e=>{const t=U(e.mapEnd,new H);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Ue(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{if(!R(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=ce(e);n.next(s).next(Le(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(we(a,["offset"]))}))]}function Re(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function ze(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{Ae(e,t,r)}))]}function Ae(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=z({...A(t),orientation:90},a),c=z({...A(t),orientation:270},a);if(null==s||null==c)return;const l=_(s,a),m=_(c,a),d=ke(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!R(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=qe(S(),l,l.directSegment,s),p=Je(O.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=M(d,p,P()),g=n?c.orientation??_(l,a.renderCoordsHelper):c.orientation??0;o.next(se(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=T(f),r=re(m,e.renderEnd,d,t);let o=g-i(r);n||(o=De(o)),c.orientation=o})),t.next(we(c,["orientation"]))}function De(e){const t=n.normalize(e)%90;return t<Q?e-t:90-t<Q?e+(90-t):e}function Fe(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!R(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(O.get(),e.renderLocation);c.measureType=n,c.offset=D(m,n,l,i.renderCoordsHelper),c.orientation=0})),ye(e,((e,r,c)=>{if(!R(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=F(it,n,t,d),p=L(O.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=ce(e);r.next(f).next(Le(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function Le(e,t,r,n){const i=p(O.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=M(r.startRenderSpace,i,P()),a=M(r.startRenderSpace,n,P()),s=t.offset;let c,l=0;const m=new Se;return m.next(se(e,o)).next((r=>{"start"===r.action&&(l=C(a,r.renderStart));const n=(C(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function ke(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=k(O.get(),e,n),o=E(O.get(),e),a=f(O.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,O.get());return n.headingAtPosition(c,a)}function Ee(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=G(tt,t),a=h(o,j)?c(nt):ne(o,i,j,nt),s=Math.max(v(o),X/r.unitInMeters);l(a,a,y(tt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,tt)}function Ge(e,t,r){Be(e,t,r,{forHeading:!0})}function Ie(e,t,r){Be(e,t,r,{forHeading:!1})}function Be(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ne,a,i.offset>=0?1:-1),c=Je(Ve,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=ne(s,c,j,nt);e.modelTransform=l,e.renderLocation=qe(tt,o,o.dimensionSegment,r)}const Ne=S(),Ve=S();function We(e,t,r,n){const{geometry:i}=t,o=F(it,r,t,n),a=L(tt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(rt,o.endRenderSpace,o.startRenderSpace),c=ne(s,a,j,nt),m=v(s);l(c,c,y(rt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,rt)}function qe(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Ke(t,n)?i:o;return u(e,a)}function Je(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?k(e,r,n):G(e,r,{invert:!0})}function Ke(e,t){const r=E(Qe,e),n=k(Xe,e,t);return g(r,n)>0}const Qe=S(),Xe=S();function Ye(e){return s(e)+Y}function Ze(e){return s(e)+Z}function $e(e,t){const r=t.material,n=t.focusMultiplier??ie.focusMultiplier,i=t.calloutLength??ie.calloutLength,o=ie.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new ue(t,[[he.POSITION,new de([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[he.UV0,new de([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ie.calloutWidth,l=new ve({width:c,color:t.calloutColor,renderOccluded:ge.OccludeAndTransparent,isDecoration:!0}),m=fe(l,[[0,0,0],[i-o,0,0]]),d=fe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??je.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new oe(s(o,r),be.Unfocused|u),new oe(m,be.Unfocused|u),new oe(s(a,r),be.Focused|u),new oe(d,be.Focused|u)]}const et=je.Custom1,tt=S(),rt=S(),nt=m(),it=new le;export{et as DidPointerMoveRecentlyFlag,xe as LengthDimensionManipulators,He as LengthDimensionPointManipulator,Pe as LineOfSightOrientationManipulator,ke as automaticHeadingFromCamera,Te as createMeasureTypeManipulator,Me as createOffsetManipulator,Ze as focusedOffsetWidth,Re as headingManipulatorHandles,Fe as measureTypeManipulatorHandles,Ue as offsetManipulatorHandles,Oe as pointManipulatorHandles,ze as rotationManipulatorHandles,De as snapOrientationToNearestRightAngle,Ye as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,We as updateMeasureTypeManipulatorTransform,Ee as updateOffsetManipulatorTransform,Ie as updateRotationManipulatorTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as n}from"./sliceToolUtils.js";import{Manipulator3D as s}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l}from"../../interactive/manipulatorUtils.js";import{RenderObject as a}from"../../interactive/RenderObject.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as u}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as d}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as f}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as b}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as w}from"../../../interactive/interfaces.js";class g extends s{constructor(n,s){const a=new f({writeDepth:!1,renderOccluded:d.Opaque,isDecoration:!0}),c=l.calloutWidth,m=new b({width:c,renderOccluded:d.OccludeAndTransparent,isDecoration:!0});super({view:n,...j({imageMaterial:a,calloutMaterial:m})}),this._currentTexture=null,this._themeHandle=i((()=>n.effectiveTheme.accentColor),(i=>{const o=t(i,.5),n=r(i),l=this._currentTexture,c=s(o,n);a.setParameters({textureId:c.texture.id}),m.setParameters({color:e.toUnitRGBA(i)}),this._currentTexture=c,l?.release()}),o)}destroy(){this._themeHandle.remove(),this._currentTexture?.release(),super.destroy()}}function j({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,s=o*r,d=(e,t)=>{const r=[0,1,2,2,3,0];return new m(t,[[p.POSITION,new c([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[p.UV0,new c([0,0,1,0,1,1,0,1],r,2,!0)]])},f=u(t,[[0,0,0],[i-o,0,0]]),b=u(t,[[0,0,0],[i-s,0,0]]),g=n;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new a(d(o,e),w.Unfocused|g),new a(f,w.Unfocused|g),new a(d(s,e),w.Focused|g),new a(b,w.Focused|g)],state:g}}export{g as RotateManipulator};
5
+ import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as n}from"./sliceToolUtils.js";import{Manipulator3D as l}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as a}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{Attribute as m}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as f}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as b}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as j}from"../../../interactive/interfaces.js";class w extends l{constructor(i,n){const l=t(i.effectiveTheme.accentColor,.5),c=r(i.effectiveTheme.accentColor),m=n(l,c),u=new b({texture:m.texture,writeDepth:!1,renderOccluded:f.Opaque,isDecoration:!0}),d=a.calloutWidth,p=new h({width:d,renderOccluded:f.OccludeAndTransparent,isDecoration:!0});super({view:i,...g({imageMaterial:u,calloutMaterial:p})}),this._material=u,this._textureHandle=m,this._themeHandle=o((()=>i.effectiveTheme.accentColor),(i=>{const o=t(i,.5),s=r(i),l=this._textureHandle;this._textureHandle=n(o,s),u.setParameters({texture:this._textureHandle.texture}),l?.release(),p.setParameters({color:e.toUnitRGBA(i)})}),s)}destroy(){this._textureHandle=i(this._textureHandle),this._themeHandle.remove(),this._material.dispose(),super.destroy()}}function g({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=a,s=o*r,l=(e,t)=>{const r=[0,1,2,2,3,0];return new u(t,[[p.POSITION,new m([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[p.UV0,new m([0,0,1,0,1,1,0,1],r,2,!0)]])},f=d(t,[[0,0,0],[i-o,0,0]]),b=d(t,[[0,0,0],[i-s,0,0]]),h=n;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new c(l(o,e),j.Unfocused|h),new c(f,j.Unfocused|h),new c(l(s,e),j.Focused|h),new c(b,j.Focused|h)],state:h}}export{w as RotateManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import"../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Matrix3PassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../webgl-engine/shaders/SphereIntersect.glsl.js";import"../../webgl/NoParameters.js";import"../../webgl/ShaderBuilder.js";export{C as CloudsPassParameters,b as build,c as cubeMapSize}from"../../../chunks/Clouds.glsl.js";
5
+ import"../../../core/has.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import"../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"./CloudsTechniqueConfiguration.js";import"./NoiseTextureAtlasDimensions.js";import"../webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Matrix3PassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../webgl-engine/shaders/SphereIntersect.glsl.js";import"../../webgl/NoParameters.js";import"../../webgl/ShaderBuilder.js";export{C as CloudsPassParameters,b as build,c as cubeMapSize}from"../../../chunks/Clouds.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-1e4||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(C,this.parallax.anchorPoint,v),s(this.parallax.transform,i,v[3],p(v)),f(C,this.parallaxNew.anchorPoint,v),s(this.parallaxNew.transform,i,v[3],p(v))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const C=u(0,0,1),v=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
5
+ import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this.coverage=0,this.absorption=0,this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-1e4||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(v,this.parallax.anchorPoint,C),s(this.parallax.transform,i,C[3],p(C)),f(v,this.parallaxNew.anchorPoint,C),s(this.parallaxNew.transform,i,C[3],p(C))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const v=u(0,0,1),C=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{neverReached as s}from"../../../core/compilerUtils.js";import{lerp as i}from"../../../core/mathUtils.js";import{destroyMaybe as r,disposeMaybe as o}from"../../../core/maybe.js";import{watch as a,initial as n}from"../../../core/reactiveUtils.js";import{signal as h}from"../../../core/signal.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{targetTo as d}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,equals as f,copy as _}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{clone as g,ZEROS as x,zeros as y}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as T}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{zeros as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{CubeMapState as C,CloudsTextureChannels as w}from"./Clouds.js";import{C as S,c as j}from"../../../chunks/Clouds.glsl.js";import{cloudPresets as P}from"./CloudsPresets.js";import{CloudsTechnique as z}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as R,RayMarchingSteps as M}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as I}from"./NoiseTextureAtlas.js";import{TaskPriority as H}from"../../support/Scheduler.js";import{Yield as U}from"../../support/Yield.js";import{TextureType as q,TextureWrapMode as A,ColorAttachment as D}from"../../webgl/enums.js";import{FramebufferObject as E}from"../../webgl/FramebufferObject.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";let O=class extends e{constructor(t){super(t),this._state=h(C.Idle),this._passParameters=new S,this._weatherTileCount=128,this._faceIndex=0,this._tileIndex=0,this._tilesPerFace=1,this.coverage=i(P.default.coverage[0],P.default.coverage[1],.5),this.density=i(P.default.density[0],P.default.density[1],.5),this.absorption=i(P.default.absorption[0],P.default.absorption[1],.5),this.cloudSize=i(P.default.cloudSize[0],P.default.cloudSize[1],.5),this.detailSize=i(P.default.detailSize[0],P.default.detailSize[1],.5),this.smoothness=i(P.default.smoothness[0],P.default.smoothness[1],.5),this.cloudHeight=i(P.default.cloudHeight[0],P.default.cloudHeight[1],.5),this.raymarchingSteps=P.default.raymarchingSteps,this._viewMatrix=p(),this._dirty=!0,this.running=!0,this._configuration=new R}initialize(){const t=v(this.view.spatialReference);this._passParameters.cloudRadius=.5*t.radius;const e=()=>this.setDirty();this.addHandles([this.view.resourceController.scheduler.registerTask(H.CLOUDS_GENERATOR,this),a((()=>this.coverage),e,n),a((()=>this.density),e,n),a((()=>this.absorption),e,n),a((()=>this.cloudSize),e,n),a((()=>this.detailSize),e,n),a((()=>this.smoothness),e,n),a((()=>this.cloudHeight),e,n),a((()=>this.raymarchingSteps),e,n)]);const s=g(this._computeWeatherTile());let i=0;this.addHandles(a((()=>{const t=this._computeWeatherTile();return f(s,t)||(++i,_(s,t)),i}),e))}destroy(){this.destroyCubeMap(),this._passParameters.noiseTexture=r(this._passParameters.noiseTexture)}_precompileTechniques(){this._configuration.steps=this.raymarchingSteps,this._configuration.writeTextureChannels=w.RG,this.context.techniques.precompile(z,this._configuration),this._configuration.writeTextureChannels=w.BA,this.context.techniques.precompile(z,this._configuration)}_acquireTechnique(){switch(this.raymarchingSteps){case M.SIXTEEN:this._tilesPerFace=1;break;case M.HUNDRED:this._tilesPerFace=4;break;case M.COUNT:case M.TWOHUNDRED:this._tilesPerFace=8;break;default:s(this.raymarchingSteps)}return this._configuration.writeTextureChannels=1-this.parameters.readChannels,this._configuration.steps=this.raymarchingSteps,this.context.techniques.get(z,this._configuration)}_computeWeatherTile(){const{camera:t,environment:e}=this.view,{latitude:s,longitude:i}=t.position;if(null==s||null==i)return x;m(L,(s+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*L[0]-1));L[0]=Math.floor(2*this._weatherTileCount*L[0]),L[1]=Math.floor(4*(this._weatherTileCount-r)*L[1]);let o=0,a=0;if("virtual"!==e?.lighting?.type&&null!=e?.lighting?.date){const t=new Date(e.lighting.date);t.setUTCHours(e.lighting.date.getUTCHours()+(e.lighting.displayUTCOffset??0)),o=31*t.getUTCMonth()+t.getUTCDate(),a=t.getUTCFullYear()}return L[0]=(L[0]+o)%(2*this._weatherTileCount),L[1]=(L[1]+a%100)%(4*this._weatherTileCount),L}get state(){return this._state.value}set state(t){this._state.value=t}get usedMemory(){return(this._fbo?.usedMemory??0)+(this._passParameters.noiseTexture?.textureAtlas?.usedMemory??0)}_ensureNoiseTexture(){return this._passParameters.noiseTexture??=new I({context:this.context}),this._passParameters.noiseTexture}_ensureFrameBufferCube(t){const e=this.context.renderContext.rctx;if(null==this._fbo){const s=new F(t);s.target=q.TEXTURE_2D_ARRAY,s.depth=5,s.wrapMode=A.CLAMP_TO_EDGE,this._fbo=new E(e,s),this.parameters.data=this}return e.unbindTexture(this._fbo.colorTexture),this._fbo}get cubeMap(){return this._fbo}get parameters(){return this.context.renderContext.bind.clouds}destroyCubeMap(){this._fbo=o(this._fbo),this.parameters.data=null}applyPreset(t,e){const s=t.median,r=t=>{const r=i(t[0],t[1],s);return e<.5?i(t[0],r,2*e):i(r,t[1],2*(e-.5))};this.coverage=r(t.coverage),this.density=r(t.density),this.absorption=r(t.absorption),this.cloudSize=r(t.cloudSize),this.detailSize=r(t.detailSize),this.smoothness=r(t.smoothness),this.cloudHeight=r(t.cloudHeight),this.raymarchingSteps=t.raymarchingSteps,this._precompileTechniques()}setDirty(){this._dirty=this.running=!0}runTask(t){if(this.state===C.Fading)return U;this._dirty&&(this._faceIndex=this._tileIndex=0,this.state=C.Rendering,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._ensureNoiseTexture().updateWeatherMap(this._computeWeatherTile()),this._dirty=!1);const e=this._acquireTechnique();if(!this._ensureNoiseTexture().textureAtlas||!e.compiled)return U;const s=N[this._faceIndex],i=k[this._faceIndex];d(this._viewMatrix,W,s,i),u(this._passParameters.viewMatrix,this._viewMatrix);const r=this.context.renderContext.rctx,o=r.getViewport(),a=j/this._tilesPerFace,n=this._tileIndex*a;r.setViewport(0,n,j,a);const h=this._ensureFrameBufferCube(j);r.bindFramebuffer(h),r.bindTechnique(e,this.context.renderContext.bind,this._passParameters);const c=q.TEXTURE_2D_ARRAY;return h.setColorTextureTarget(c,D.COLOR_ATTACHMENT0,this._faceIndex),r.screen.draw(),r.gl.flush(),r.setViewport(o.x,o.y,o.width,o.height),this.requestRender(),++this._tileIndex,4===this._faceIndex&&this._tileIndex===this._tilesPerFace?(this._faceIndex=this._tileIndex=0,this.state=C.Ready,this.running=!1):this._tileIndex===this._tilesPerFace&&(++this._faceIndex,this._tileIndex=0),t.madeProgress(),U}};t([c({constructOnly:!0})],O.prototype,"context",void 0),t([c({constructOnly:!0})],O.prototype,"view",void 0),t([c({constructOnly:!0})],O.prototype,"requestRender",void 0),t([c()],O.prototype,"coverage",void 0),t([c()],O.prototype,"density",void 0),t([c()],O.prototype,"absorption",void 0),t([c()],O.prototype,"cloudSize",void 0),t([c()],O.prototype,"detailSize",void 0),t([c()],O.prototype,"smoothness",void 0),t([c()],O.prototype,"cloudHeight",void 0),t([c()],O.prototype,"raymarchingSteps",void 0),t([c()],O.prototype,"running",void 0),O=t([l("esri.views.3d.environment.CloudsRenderer")],O);const N=[T(1,0,0),T(-1,0,0),T(0,1,0),T(0,-1,0),T(0,0,1)],k=[T(0,1,0),T(0,1,0),T(0,0,-1),T(0,0,1),T(0,1,0)],W=b(),L=y();export{O as CloudsRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{neverReached as s}from"../../../core/compilerUtils.js";import{lerp as i}from"../../../core/mathUtils.js";import{destroyMaybe as r,disposeMaybe as o}from"../../../core/maybe.js";import{watch as a,initial as n}from"../../../core/reactiveUtils.js";import{signal as h}from"../../../core/signal.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{targetTo as d}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,equals as _,copy as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{clone as g,ZEROS as x,zeros as y}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as T}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{zeros as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{CubeMapState as S,CloudsTextureChannels as C}from"./Clouds.js";import{C as w,c as j}from"../../../chunks/Clouds.glsl.js";import{cloudPresets as P}from"./CloudsPresets.js";import{CloudsTechnique as z}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as R,RayMarchingSteps as I}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as M}from"./NoiseTextureAtlas.js";import{TaskPriority as H}from"../../support/Scheduler.js";import{Yield as U}from"../../support/Yield.js";import{TextureType as q,TextureWrapMode as A,ColorAttachment as D}from"../../webgl/enums.js";import{FramebufferObject as E}from"../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../webgl/TextureDescriptor.js";let N=class extends t{constructor(e){super(e),this._state=h(S.Idle),this._passParameters=new w,this._weatherTileCount=128,this._sliceIndex=0,this._tileIndex=0,this._tilesPerSlice=1,this.coverage=i(P.default.coverage[0],P.default.coverage[1],.5),this.density=i(P.default.density[0],P.default.density[1],.5),this.absorption=i(P.default.absorption[0],P.default.absorption[1],.5),this.cloudSize=i(P.default.cloudSize[0],P.default.cloudSize[1],.5),this.detailSize=i(P.default.detailSize[0],P.default.detailSize[1],.5),this.smoothness=i(P.default.smoothness[0],P.default.smoothness[1],.5),this.cloudHeight=i(P.default.cloudHeight[0],P.default.cloudHeight[1],.5),this.raymarchingSteps=P.default.raymarchingSteps,this._viewMatrix=p(),this._dirty=!0,this.running=!0,this._configuration=new R}initialize(){const e=v(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius;const t=()=>this.setDirty();this.addHandles([this.view.resourceController.scheduler.registerTask(H.CLOUDS_GENERATOR,this),a((()=>this.coverage),t,n),a((()=>this.density),t,n),a((()=>this.absorption),t,n),a((()=>this.cloudSize),t,n),a((()=>this.detailSize),t,n),a((()=>this.smoothness),t,n),a((()=>this.cloudHeight),t,n),a((()=>this.raymarchingSteps),t,n)]);const s=g(this._computeWeatherTile());let i=0;this.addHandles(a((()=>{const e=this._computeWeatherTile();return _(s,e)||(++i,f(s,e)),i}),t))}destroy(){this.destroyCubeMap(),this._passParameters.noiseTexture=r(this._passParameters.noiseTexture)}_precompileTechniques(){this._configuration.steps=this.raymarchingSteps,this._configuration.writeTextureChannels=C.RG,this.context.techniques.precompile(z,this._configuration),this._configuration.writeTextureChannels=C.BA,this.context.techniques.precompile(z,this._configuration)}_acquireTechnique(){switch(this.raymarchingSteps){case I.SIXTEEN:this._tilesPerSlice=1;break;case I.HUNDRED:this._tilesPerSlice=4;break;case I.COUNT:case I.TWOHUNDRED:this._tilesPerSlice=8;break;default:s(this.raymarchingSteps)}return this._configuration.writeTextureChannels=1-this.parameters.readChannels,this._configuration.steps=this.raymarchingSteps,this.context.techniques.get(z,this._configuration)}_computeWeatherTile(){const{camera:e,environment:t}=this.view,{latitude:s,longitude:i}=e.position;if(null==s||null==i)return x;m(L,(s+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*L[0]-1));L[0]=Math.floor(2*this._weatherTileCount*L[0]),L[1]=Math.floor(4*(this._weatherTileCount-r)*L[1]);let o=0,a=0;if("virtual"!==t?.lighting?.type&&null!=t?.lighting?.date){const e=new Date(t.lighting.date);e.setUTCHours(t.lighting.date.getUTCHours()+(t.lighting.displayUTCOffset??0)),o=31*e.getUTCMonth()+e.getUTCDate(),a=e.getUTCFullYear()}return L[0]=(L[0]+o)%(2*this._weatherTileCount),L[1]=(L[1]+a%100)%(4*this._weatherTileCount),L}get state(){return this._state.value}set state(e){this._state.value=e}get usedMemory(){return(this._fbo?.usedMemory??0)+(this._passParameters.noiseTexture?.textureAtlas?.usedMemory??0)}_ensureNoiseTexture(){return this._passParameters.noiseTexture??=new M({context:this.context}),this._passParameters.noiseTexture}_ensureFrameBufferCube(e){const t=this.context.renderContext.rctx;if(null==this._fbo){const s=new O(e,e/2);s.target=q.TEXTURE_2D_ARRAY,s.depth=6,s.wrapMode=A.CLAMP_TO_EDGE,this._fbo=new E(t,s),this.parameters.data=this,this.parameters.absorption=this.absorption,this.parameters.coverage=this.coverage}return t.unbindTexture(this._fbo.colorTexture),this._fbo}get cubeMap(){return this._fbo}get parameters(){return this.context.renderContext.bind.clouds}destroyCubeMap(){this._fbo=o(this._fbo),this.parameters.data=null}applyPreset(e,t){const s=e.median,r=e=>{const r=i(e[0],e[1],s);return t<.5?i(e[0],r,2*t):i(r,e[1],2*(t-.5))};this.coverage=r(e.coverage),this.density=r(e.density),this.absorption=r(e.absorption),this.cloudSize=r(e.cloudSize),this.detailSize=r(e.detailSize),this.smoothness=r(e.smoothness),this.cloudHeight=r(e.cloudHeight),this.raymarchingSteps=e.raymarchingSteps,this._precompileTechniques()}setDirty(){this._dirty=this.running=!0}runTask(e){if(this.state===S.Fading)return U;this._dirty&&(this._sliceIndex=this._tileIndex=0,this.state=S.Rendering,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._ensureNoiseTexture().updateWeatherMap(this._computeWeatherTile()),this._dirty=!1);const t=this._acquireTechnique();if(!this._ensureNoiseTexture().textureAtlas||!t.compiled)return U;const s=k[this._sliceIndex],i=F[this._sliceIndex];d(this._viewMatrix,W,s,i),u(this._passParameters.viewMatrix,this._viewMatrix);const r=this.context.renderContext.rctx,o=r.getViewport(),a=j/this._tilesPerSlice,n=this._tileIndex*a;r.setViewport(0,n,j,a);const h=this._ensureFrameBufferCube(j);r.bindFramebuffer(h),this._passParameters.lastSlice=5===this._sliceIndex,r.bindTechnique(t,this.context.renderContext.bind,this._passParameters);const l=q.TEXTURE_2D_ARRAY;return h.setColorTextureTarget(l,D.COLOR_ATTACHMENT0,this._sliceIndex),r.screen.draw(),r.gl.flush(),r.setViewport(o.x,o.y,o.width,o.height),this.requestRender(),++this._tileIndex,5===this._sliceIndex&&this._tileIndex===this._tilesPerSlice?(this._sliceIndex=this._tileIndex=0,this.state=S.Ready,this.running=!1):this._tileIndex===this._tilesPerSlice&&(++this._sliceIndex,this._tileIndex=0),e.madeProgress(),U}};e([l({constructOnly:!0})],N.prototype,"context",void 0),e([l({constructOnly:!0})],N.prototype,"view",void 0),e([l({constructOnly:!0})],N.prototype,"requestRender",void 0),e([l()],N.prototype,"coverage",void 0),e([l()],N.prototype,"density",void 0),e([l()],N.prototype,"absorption",void 0),e([l()],N.prototype,"cloudSize",void 0),e([l()],N.prototype,"detailSize",void 0),e([l()],N.prototype,"smoothness",void 0),e([l()],N.prototype,"cloudHeight",void 0),e([l()],N.prototype,"raymarchingSteps",void 0),e([l()],N.prototype,"running",void 0),N=e([c("esri.views.3d.environment.CloudsRenderer")],N);const k=[T(1,0,0),T(-1,0,0),T(0,1,0),T(0,-1,0),T(0,0,1),T(0,0,1)],F=[T(0,0,-1),T(0,0,-1),T(0,0,-1),T(0,0,-1),T(0,1,0),T(0,1,0)],W=b(),L=y();export{N as CloudsRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as o,initial as n}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import g from"../../../rest/support/Query.js";import{isNumber as m}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as F}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as b}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as _}from"./II3SMeshView3D.js";import{applyFilterMode as w}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as j,I3SQueryFeature as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as I}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as Q,getIndexCrs as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as R}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import V from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as U,getRequiredFields as A,getFetchPopupTemplate as C}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as H}from"../../support/layerViewUtils.js";import{TaskPriority as O}from"../../support/Scheduler.js";let D=class extends(L(R(b(F(V))))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&U(this.sublayer,this.layerView?.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&x.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new x({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),o),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"!==this.sublayer.modelName&&this.layerView?this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(a){return i.getLogger(this).error("Failed to parse filterExpression: "+a),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return Q(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e)):[]}get filter(){return this._get("filter")}set filter(e){this._set("filter",x.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return w(t,l)}catch(i){this.logError(i)}return w(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer})}canResume(){return super.canResume()&&H(this.i3slayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],o=[],n=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await A(n,C(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?o.push(i):s.push(i);return 0===o.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(o,Array.from(d)).catch((e=>(a(e),o))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?C(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new g(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}async queryObjectIds(e,r){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)).filter(m)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:O.FEATURE_QUERY_ENGINE,spatialIndex:new I({featureAdapter:new j({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e(new v(r,t,i))),r,_.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:q(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():g.from(e))}};e([u()],D.prototype,"i3slayer",null),e([u()],D.prototype,"layerView",void 0),e([u()],D.prototype,"lodFactor",null),e([u({readOnly:!0})],D.prototype,"parsedFilterExpressions",null),e([u({type:h})],D.prototype,"filter",null),e([u()],D.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],D.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"availableFields",null),D=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],D);const G=D;export{G as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as o,initial as n}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import g from"../../../rest/support/Query.js";import{isNumber as m}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as F}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as b}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as _}from"./II3SMeshView3D.js";import{applyFilterMode as w}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as j,I3SQueryFeature as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as I}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as Q,getIndexCrs as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as R}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import V from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as U,getRequiredFields as A,getFetchPopupTemplate as C}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as H}from"../../support/layerViewUtils.js";import{TaskPriority as O}from"../../support/Scheduler.js";let D=class extends(L(R(b(F(V))))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&U(this.sublayer,this.layerView?.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&x.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new x({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),o),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"!==this.sublayer.modelName&&this.layerView?this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(a){return i.getLogger(this).error("Failed to parse filterExpression: "+a),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return Q(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e)):[]}get filter(){return this._get("filter")}set filter(e){this._set("filter",x.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return w(t,l)}catch(i){this.logError(i)}return w(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer})}canResume(){return super.canResume()&&H(this.i3slayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],o=[],n=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await A(n,C(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?o.push(i):s.push(i);return 0===o.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(o,Array.from(d)).catch((e=>(a(e),o))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?C(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new g(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}async queryObjectIds(e,r){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)).filter(m)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:O.FEATURE_QUERY_ENGINE,spatialIndex:new I({featureAdapter:new j({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e(new v(r,t,i))),r,_.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:q(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():g.from(e))}};e([u()],D.prototype,"i3slayer",null),e([u()],D.prototype,"layerView",void 0),e([u()],D.prototype,"lodFactor",null),e([u({readOnly:!0})],D.prototype,"parsedFilterExpressions",null),e([u({type:h})],D.prototype,"filter",null),e([u()],D.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],D.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],D.prototype,"availableFields",null),D=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],D);const G=D;export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{forEach as t,result as r}from"../../../core/asyncUtils.js";import{makeHandle as i}from"../../../core/handleUtils.js";import s from"../../../core/Logger.js";import{abortMaybe as a}from"../../../core/maybe.js";import{debounce as o,isAbortError as n,onAbort as l,isAborted as h,createAbortError as m,throwIfAborted as d}from"../../../core/promiseUtils.js";import{whenOnce as c}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{equals as f,create as y,width as w,height as _,copy as x,intersection as v}from"../../../geometry/support/aaBoundingRect.js";import{DrapeSourceType as R}from"./interfaces.js";import{LayerView3D as b}from"./LayerView3D.js";import{computeImageExportSize as E,createGeometryForExtent as j,createOuterImageGeometry as S}from"./support/overlayImageUtils.js";import{toViewIfLocal as I}from"./support/projectExtentUtils.js";import{debugFlags as A}from"../support/debugFlags.js";import{OverlayIndex as D}from"../terrain/interfaces.js";import{DirtyOperation as M}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as C}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{ImageMaterial as P}from"../webgl-engine/materials/ImageMaterial.js";import T from"../../layers/LayerView.js";import O from"../../layers/RefreshableLayerView.js";import{isInEffectiveScaleRange as U}from"../../support/layerViewUtils.js";import{TextureWrapMode as H}from"../../webgl/enums.js";let V=class extends(O(b(T))){constructor(){super(...arguments),this.drapeSourceType=R.RasterImage,this.updatePolicy=G.SYNC,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this._drapeSourceRenderer=null,this.refreshDebounced=o((async e=>{this.destroyed||await this._doRefresh(e).catch((e=>{n(e)||s.getLogger(this).error(e)}))}),2e3)}get visibleAtCurrentScale(){const e=this.layer,t="effectiveScaleRange"in e?e.effectiveScaleRange:null;return U(t,this.view.scale)}initialize(){this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.addHandles(i((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))),this.addResolvingPromise(I(this).then((e=>this._set("fullExtentInLocalViewSpatialReference",e)))),this._updatingHandles.add((()=>this.suspended),(()=>this._suspendedChangeHandler()))}destroy(){this.clear()}setDrapingExtent(e,t){this._spatialReference=t,e.forEach(((e,t)=>{this._overlays[t]=e,this._updateImageExtent(e,t)}))}_updateImageExtent(e,t){const r=this._clippedExtent(e.extent,z);if(null==r)return;const i=E(e.extent,r,e.resolution);let a=e.pixelRatio*this.view.state.pixelRatio;const{layer:o}=this;if("imageMaxWidth"in o&&null!=o.imageMaxWidth||"imageMaxHeight"in o&&null!=o.imageMaxHeight){const e=o.imageMaxWidth,t=o.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,a*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,a*=e}}const l=this._extents[t];l&&f(l.extent,r)&&this._imageSizeEquals(r,l.imageSize,i)||(this._extents[t]={extent:y(r),imageSize:i,pixelRatio:a},this.suspended||this._fetch(t).catch((e=>{n(e)||s.getLogger(this).error(e)})))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(){return this._doRefresh()}async _doRefresh(e){if(this.suspended)return;const t=[];for(let r=0;r<this._extents.length;r++)this._extents[r]&&t.push(this._fetch(r,e));await Promise.allSettled(t)}async processResult(e,t,r){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const r=t.extent;if(new p(r[0],r[1],r[2],r[3],this._spatialReference).contains(e))return t}return null}getFetchOptions(){}async redraw(e,r){await t(this._images,(async(t,i)=>{t&&(await e(t,r),await this._createStageObjects(i,t.image,r))}))}_imageSizeEquals(e,t,r){if(!this.maximumDataResolution)return!1;const i=w(e)/this.maximumDataResolution.x,s=_(e)/this.maximumDataResolution.y,a=i/t.width,o=s/t.height,n=i/r.width,l=s/r.height,h=Math.abs(a-n),m=Math.abs(o-l),d=A.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return h<=d&&m<=d}async _fetch(e,t){if(this.suspended)return;const r=this._extents[e],i=r.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:y(i)});const o=this._images[e];o.loadingAbortController=a(o.loadingAbortController);const c=new p(i[0],i[1],i[2],i[3],this._spatialReference);if(0===c.width||0===c.height)return void this._clearImage(e);const g=new AbortController;o.loadingAbortController=g,l(t,(()=>g.abort()));const u=g.signal,f=this._waitFetchReady(u).then((async()=>{const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.getFetchOptions(),signal:u},{height:i,width:s}=r.imageSize;return"imagery"===this.layer.type?this.layer.internalFetchImage(c,s,i,t):this.layer.fetchImage(c,s,i,t)})).then((e=>{if(h(u))throw s.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),m();return this.processResult(o,e)})).then((()=>{x(o.renderExtent,i)}));o.loadingPromise=f,await this._updatingHandles.addPromise(f.then((async()=>{d(u),await this._createStageObjects(e,o.image,u)})).catch((e=>{throw e&&!n(e)&&s.getLogger(this).error(e),e})).finally((()=>{f===o.loadingPromise&&(o.loadingPromise=null,o.loadingAbortController=null)})))}_clearImage(e){const t=this._images[e];if(t){null!=t.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([t.renderGeometry],M.UPDATE),t.renderGeometry=null);const e=this.view._stage,r=t.texture;r?.unload(),e.remove(r),t.texture=null,e.remove(t.material),t.material=null,t.loadingAbortController=a(t.loadingAbortController),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t,i){const s=this.view._stage,a=this._images[e],o=()=>{a.texture?.unload(),s.remove(a.texture),a.texture=null,a.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([a.renderGeometry],M.UPDATE),a.renderGeometry=null)};if(t){const n=new C(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:H.CLAMP_TO_EDGE,t:H.CLAMP_TO_EDGE}});let l;if(await r(this._images[e===D.INNER?D.OUTER:D.INNER].loadingPromise),d(i),o(),await s.schedule((()=>n.load(s.renderView.renderingContext)),i),s.add(n),a.texture=n,null==a.material?(a.material=new P({textureId:n.id}),s.add(a.material)):a.material.setParameters({textureId:n.id}),e===D.INNER)l=j(a.material,a.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void o();l=S(a.material,e,a.renderExtent)}a.renderGeometry=new L(l),a.renderGeometry.localOrigin=this._overlays[e].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([a.renderGeometry],M.UPDATE)}else o(),s.remove(a.material),a.material=null}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return x(t,e);const r=this.view.basemapTerrain;return r.ready?v(e,r.extent,t):x(t,e)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(e){await c((()=>this.view.stationary),e),d(e)}};e([g()],V.prototype,"layer",void 0),e([g()],V.prototype,"suspended",void 0),e([g({readOnly:!0})],V.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([g({readOnly:!0})],V.prototype,"visibleAtCurrentScale",null),e([g()],V.prototype,"updating",void 0),V=e([u("esri.views.3d.layers.DynamicLayerView3D")],V);const N=V,z=y();export{N as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{forEach as t,result as r}from"../../../core/asyncUtils.js";import{makeHandle as i}from"../../../core/handleUtils.js";import s from"../../../core/Logger.js";import{abortMaybe as a}from"../../../core/maybe.js";import{debounce as o,isAbortError as n,onAbort as l,isAborted as h,createAbortError as m,throwIfAborted as d}from"../../../core/promiseUtils.js";import{whenOnce as c}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{equals as f,create as y,width as w,height as _,copy as x,intersection as v}from"../../../geometry/support/aaBoundingRect.js";import{DrapeSourceType as R}from"./interfaces.js";import{LayerView3D as b}from"./LayerView3D.js";import{computeImageExportSize as E,createGeometryForExtent as j,createOuterImageGeometry as S}from"./support/overlayImageUtils.js";import{toViewIfLocal as I}from"./support/projectExtentUtils.js";import{debugFlags as A}from"../support/debugFlags.js";import{OverlayIndex as D}from"../terrain/interfaces.js";import{DirtyOperation as M}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as C}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{ImageMaterial as P}from"../webgl-engine/materials/ImageMaterial.js";import T from"../../layers/LayerView.js";import O from"../../layers/RefreshableLayerView.js";import{isInEffectiveScaleRange as U}from"../../support/layerViewUtils.js";import{TextureWrapMode as H}from"../../webgl/enums.js";let V=class extends(O(b(T))){constructor(){super(...arguments),this.drapeSourceType=R.RasterImage,this.updatePolicy=G.SYNC,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this._drapeSourceRenderer=null,this.refreshDebounced=o((async e=>{this.destroyed||await this._doRefresh(e).catch((e=>{n(e)||s.getLogger(this).error(e)}))}),2e3)}get visibleAtCurrentScale(){const e=this.layer,t="effectiveScaleRange"in e?e.effectiveScaleRange:null;return U(t,this.view.scale)}initialize(){this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.addHandles(i((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))),this.addResolvingPromise(I(this).then((e=>this._set("fullExtentInLocalViewSpatialReference",e)))),this._updatingHandles.add((()=>this.suspended),(()=>this._suspendedChangeHandler()))}destroy(){this.clear()}setDrapingExtent(e,t){this._spatialReference=t,e.forEach(((e,t)=>{this._overlays[t]=e,this._updateImageExtent(e,t)}))}_updateImageExtent(e,t){const r=this._clippedExtent(e.extent,z);if(null==r)return;const i=E(e.extent,r,e.resolution);let a=e.pixelRatio*this.view.state.pixelRatio;const{layer:o}=this;if("imageMaxWidth"in o&&null!=o.imageMaxWidth||"imageMaxHeight"in o&&null!=o.imageMaxHeight){const e=o.imageMaxWidth,t=o.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,a*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,a*=e}}const l=this._extents[t];l&&f(l.extent,r)&&this._imageSizeEquals(r,l.imageSize,i)||(this._extents[t]={extent:y(r),imageSize:i,pixelRatio:a},this.suspended||this._fetch(t).catch((e=>{n(e)||s.getLogger(this).error(e)})))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(){return this._doRefresh()}async _doRefresh(e){if(this.suspended)return;const t=[];for(let r=0;r<this._extents.length;r++)this._extents[r]&&t.push(this._fetch(r,e));await Promise.allSettled(t)}async processResult(e,t,r){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const r=t.extent;if(new p(r[0],r[1],r[2],r[3],this._spatialReference).contains(e))return t}return null}getFetchOptions(){}async redraw(e,r){await t(this._images,(async(t,i)=>{t&&(await e(t,r),await this._createStageObjects(i,t.image,r))}))}_imageSizeEquals(e,t,r){if(!this.maximumDataResolution)return!1;const i=w(e)/this.maximumDataResolution.x,s=_(e)/this.maximumDataResolution.y,a=i/t.width,o=s/t.height,n=i/r.width,l=s/r.height,h=Math.abs(a-n),m=Math.abs(o-l),d=A.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return h<=d&&m<=d}async _fetch(e,t){if(this.suspended)return;const r=this._extents[e],i=r.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:y(i)});const o=this._images[e];o.loadingAbortController=a(o.loadingAbortController);const c=new p(i[0],i[1],i[2],i[3],this._spatialReference);if(0===c.width||0===c.height)return void this._clearImage(e);const g=new AbortController;o.loadingAbortController=g,l(t,(()=>g.abort()));const u=g.signal,f=this._waitFetchReady(u).then((async()=>{const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.getFetchOptions(),signal:u},{height:i,width:s}=r.imageSize;return"imagery"===this.layer.type?this.layer.internalFetchImage(c,s,i,t):this.layer.fetchImage(c,s,i,t)})).then((e=>{if(h(u))throw s.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),m();return this.processResult(o,e)})).then((()=>{x(o.renderExtent,i)}));o.loadingPromise=f,await this._updatingHandles.addPromise(f.then((async()=>{d(u),await this._createStageObjects(e,o.image,u)})).catch((e=>{throw e&&!n(e)&&s.getLogger(this).error(e),e})).finally((()=>{f===o.loadingPromise&&(o.loadingPromise=null,o.loadingAbortController=null)})))}_clearImage(e){const t=this._images[e];if(t){null!=t.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([t.renderGeometry],M.UPDATE),t.renderGeometry=null);const e=this.view._stage,r=t.texture;r?.unload(),e.remove(r),t.texture=null,e.remove(t.material),t.material=null,t.loadingAbortController=a(t.loadingAbortController),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t,i){const s=this.view._stage,a=this._images[e],o=()=>{a.texture?.unload(),s.remove(a.texture),a.texture=null,a.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([a.renderGeometry],M.UPDATE),a.renderGeometry=null)};if(t){const n=new C(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:H.CLAMP_TO_EDGE,t:H.CLAMP_TO_EDGE}});if(await r(this._images[e===D.INNER?D.OUTER:D.INNER].loadingPromise),d(i),o(),await s.schedule((()=>n.load(s.renderView.renderingContext)),i),!n.loaded)return void o();let l;if(s.add(n),a.texture=n,a.material??=new P({texture:n}),a.material.setParameters({texture:n}),e===D.INNER)l=j(a.material,a.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void o();l=S(a.material,e,a.renderExtent)}a.renderGeometry=new L(l),a.renderGeometry.localOrigin=this._overlays[e].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([a.renderGeometry],M.UPDATE)}else o(),s.remove(a.material),a.material=null}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return x(t,e);const r=this.view.basemapTerrain;return r.ready?v(e,r.extent,t):x(t,e)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(e){await c((()=>this.view.stationary),e),d(e)}};e([g()],V.prototype,"layer",void 0),e([g()],V.prototype,"suspended",void 0),e([g({readOnly:!0})],V.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([g({readOnly:!0})],V.prototype,"visibleAtCurrentScale",null),e([g()],V.prototype,"updating",void 0),V=e([u("esri.views.3d.layers.DynamicLayerView3D")],V);const N=V,z=y();export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{when as t}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as n}from"./LayerView3D.js";import{elevationAlignPointsInFeatures as a}from"./graphics/elevationAlignPointsInFeatures.js";import{GraphicsProcessor as p}from"./graphics/GraphicsProcessor.js";import{queryForSymbologySnapping as l}from"./graphics/queryForSymbologySnapping.js";import{LayerViewPerformanceInfo as c}from"./support/LayerViewPerformanceInfo.js";import{toViewIfLocal as h}from"./support/projectExtentUtils.js";import{UpdatePolicy as d}from"../webgl-engine/lib/UpdatePolicy.js";import u from"../../layers/LayerView.js";import{defaultHighlightName as g}from"../../support/HighlightDefaults.js";let m=class extends(n(u)){constructor(){super(...arguments),this.type="graphics-3d",this.symbologySnappingSupported=!0,this._slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.ignoresMemoryFactor=!0}get highlightOptions(){return null}initialize(){this._set("processor",new p({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.addHandles(this.layer.on("graphic-update",(e=>this.processor.graphicsCore.graphicUpdateHandler(e)))),this.layer.internal?this.notifyChange("updating"):(this.addResolvingPromise(h(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.addHandles(t((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0})))}destroy(){this._updatingHandles.removeAll(),this._set("processor",s(this.processor))}get loadedGraphics(){return this.layer.graphics}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return!this.processor?.scaleVisibilitySuspended}get slicePlaneEnabled(){const e=this.layer.internal;return this._slicePlaneEnabled&&!e}set slicePlaneEnabled(e){this._slicePlaneEnabled=e}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){return this.processor.getHit(e)}async getHitAsync(e){return this.processor.getHitAsync(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){return this.processor?.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}queryGraphics(){return Promise.resolve(this.loadedGraphics)}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,r){return this.processor.highlight(e,r?.name??g)}async elevationAlignPointsInFeatures(e,s){const{processor:t}=this;if(null==t?.graphics3DGraphics)throw new r("graphicslayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");const{graphics3DGraphics:i}=t,o=e=>"number"==typeof e?i.get(e):void 0;return a(this.view,this.layer,o,e,s)}async queryForSymbologySnapping(e,r){return l(this.processor,e,r)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||d.SYNC}isUpdating(){return this.view&&this.layer&&!(!this.processor?.updating&&(this.layer.internal||this.view.basemapTerrain?.ready))}get performanceInfo(){return new c(this.usedMemory,this.loadedGraphics.length,-1,-1)}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return this.processor?.graphicsCore?.unprocessedMemoryEstimate}get test(){return{graphics3DProcessor:this.processor,loadedGraphics:this.loadedGraphics}}};e([i()],m.prototype,"highlightOptions",null),e([i()],m.prototype,"loadedGraphics",null),e([i({readOnly:!0})],m.prototype,"legendEnabled",null),e([i()],m.prototype,"layer",void 0),e([i({readOnly:!0})],m.prototype,"processor",void 0),e([i({readOnly:!0})],m.prototype,"visibleAtCurrentScale",null),e([i()],m.prototype,"_slicePlaneEnabled",void 0),e([i({type:Boolean})],m.prototype,"slicePlaneEnabled",null),m=e([o("esri.views.3d.layers.GraphicsLayerView3D")],m);const y=m;export{y as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{when as t}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as n}from"./LayerView3D.js";import{elevationAlignPointsInFeatures as a}from"./graphics/elevationAlignPointsInFeatures.js";import{GraphicsProcessor as p}from"./graphics/GraphicsProcessor.js";import{queryForSymbologySnapping as l}from"./graphics/queryForSymbologySnapping.js";import{LayerViewPerformanceInfo as c}from"./support/LayerViewPerformanceInfo.js";import{projectExtentIfLocal as h}from"./support/projectExtentUtils.js";import{UpdatePolicy as d}from"../webgl-engine/lib/UpdatePolicy.js";import u from"../../layers/LayerView.js";import{defaultHighlightName as g}from"../../support/HighlightDefaults.js";let m=class extends(n(u)){constructor(){super(...arguments),this.type="graphics-3d",this.symbologySnappingSupported=!0,this._slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.ignoresMemoryFactor=!0}get highlightOptions(){return null}initialize(){this._set("processor",new p({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.addHandles(this.layer.on("graphic-update",(e=>this.processor.graphicsCore.graphicUpdateHandler(e)))),this.layer.internal?this.notifyChange("updating"):(this.addResolvingPromise(h(this).then((e=>this.fullExtentInLocalViewSpatialReference=e||null))),this.addHandles(t((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0})))}destroy(){this._updatingHandles.removeAll(),this._set("processor",s(this.processor))}get loadedGraphics(){return this.layer.graphics}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return!this.processor?.scaleVisibilitySuspended}get slicePlaneEnabled(){const e=this.layer.internal;return this._slicePlaneEnabled&&!e}set slicePlaneEnabled(e){this._slicePlaneEnabled=e}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){return this.processor.getHit(e)}async getHitAsync(e){return this.processor.getHitAsync(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){return this.processor?.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}queryGraphics(){return Promise.resolve(this.loadedGraphics)}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,r){return this.processor.highlight(e,r?.name??g)}async elevationAlignPointsInFeatures(e,s){const{processor:t}=this;if(null==t?.graphics3DGraphics)throw new r("graphicslayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");const{graphics3DGraphics:i}=t,o=e=>"number"==typeof e?i.get(e):void 0;return a(this.view,this.layer,o,e,s)}async queryForSymbologySnapping(e,r){return l(this.processor,e,r)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||d.SYNC}isUpdating(){return this.view&&this.layer&&!(!this.processor?.updating&&(this.layer.internal||this.view.basemapTerrain?.ready))}get performanceInfo(){return new c(this.usedMemory,this.loadedGraphics.length,-1,-1)}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return this.processor?.graphicsCore?.unprocessedMemoryEstimate}get test(){return{graphics3DProcessor:this.processor,loadedGraphics:this.loadedGraphics}}};e([i()],m.prototype,"highlightOptions",null),e([i()],m.prototype,"loadedGraphics",null),e([i({readOnly:!0})],m.prototype,"legendEnabled",null),e([i()],m.prototype,"layer",void 0),e([i({readOnly:!0})],m.prototype,"processor",void 0),e([i({readOnly:!0})],m.prototype,"visibleAtCurrentScale",null),e([i()],m.prototype,"_slicePlaneEnabled",void 0),e([i({type:Boolean})],m.prototype,"slicePlaneEnabled",null),m=e([o("esri.views.3d.layers.GraphicsLayerView3D")],m);const y=m;export{y as default};