@arcgis/core 4.23.0-next.20220119 → 4.23.0-next.20220123

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 (168) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0bf079e752ab79468478.js +1 -0
  3. package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
  4. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
  5. package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{4b69129c0557852d9b3d.js → 4c9084a04948b6924749.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{1b28042fdf3f4dbc8ea5.js → 5383a8f3e4ec1a8a4fcd.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{9d9dffc8884d66a258e4.js → 5538639a49c7cc2eca63.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
  11. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
  12. package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
  13. package/assets/esri/core/workers/chunks/739e579150bf466d43ae.js +1 -0
  14. package/assets/esri/core/workers/chunks/74df1f3e1e2e524a89d2.js +1 -0
  15. package/assets/esri/core/workers/chunks/7baf6b1f3f050aa67ae4.js +1 -0
  16. package/assets/esri/core/workers/chunks/{47395d225229d237f0ac.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
  17. package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
  18. package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{e2d68bcd2f99a65387bf.js → 9cb2ae42a8e328b1d98d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9d3c58a0ef634d95b7bd.js +1 -0
  21. package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
  22. package/assets/esri/core/workers/chunks/a96afc176041f698c7a1.js +1 -0
  23. package/assets/esri/core/workers/chunks/{b10fcbe1393c812fc219.js → aa861b8eae6c85f3dad4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{a960074644c3722be71e.js → afa6912454f2a5ffadce.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
  26. package/assets/esri/core/workers/chunks/b2beb6e1fd2ee6503830.js +1 -0
  27. package/assets/esri/core/workers/chunks/bab1cfd0a901181622af.js +1 -0
  28. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
  29. package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → c080114a69fa95b88d22.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{631c5b514bb73782c570.js → cd7d83d127e085d52584.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{7e596478507466953e65.js → cef4af64860ebbfc1c47.js} +1 -1
  35. package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
  36. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
  37. package/assets/esri/core/workers/chunks/e079cb1d53aca15b7df2.js +1 -0
  38. package/assets/esri/core/workers/chunks/{f7fc4c993536e62f7f3e.js → e97e986120aaadad7d4c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/f8e7755240a94b499e1f.js +1 -0
  40. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  41. package/chunks/CloudsComposition.glsl.js +4 -4
  42. package/chunks/vxlLayer.js +1 -1
  43. package/core/has.js +1 -1
  44. package/core/workers/workerFactory.js +1 -1
  45. package/geometry/support/heightModelInfoUtils.js +1 -1
  46. package/interfaces.d.ts +279 -76
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/VoxelLayer.js +1 -1
  49. package/layers/VoxelWasmPerScene.js +1 -1
  50. package/layers/support/RasterWorker.js +1 -1
  51. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  52. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  53. package/libs/vxl/enums.js +1 -1
  54. package/package.json +1 -1
  55. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  56. package/portal/schemas/definitions.js +1 -1
  57. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  58. package/portal/schemas/pointCloudLayerItem.js +1 -1
  59. package/portal/schemas/sceneLayerItem.js +1 -1
  60. package/portal/schemas/webScene.js +1 -1
  61. package/rest/find.js +1 -1
  62. package/rest/geometryService/generalize.js +1 -1
  63. package/rest/geometryService/lengths.js +1 -1
  64. package/rest/geometryService/offset.js +1 -1
  65. package/rest/geometryService/relation.js +1 -1
  66. package/rest/geometryService/trimExtend.js +1 -1
  67. package/rest/identify.js +1 -1
  68. package/{tasks → rest}/operations/find.js +0 -0
  69. package/{tasks → rest}/operations/generalize.js +0 -0
  70. package/rest/operations/identify.js +5 -0
  71. package/{tasks → rest}/operations/lengths.js +0 -0
  72. package/{tasks → rest}/operations/offset.js +0 -0
  73. package/{tasks → rest}/operations/relation.js +0 -0
  74. package/{tasks → rest}/operations/trimExtend.js +0 -0
  75. package/{tasks → rest}/operations/urlUtils.js +0 -0
  76. package/rest/print.js +1 -1
  77. package/rest/query/operations/query.js +1 -1
  78. package/rest/query/operations/queryAttachments.js +1 -1
  79. package/rest/query/operations/queryRelatedRecords.js +1 -1
  80. package/rest/query/operations/queryTopFeatures.js +1 -1
  81. package/rest/route/utils.js +1 -1
  82. package/rest/support/NetworkServiceDescription.js +1 -1
  83. package/rest/support/RouteInfo.js +1 -1
  84. package/rest/support/RouteParameters.js +1 -1
  85. package/rest/support/RouteSettings.js +5 -0
  86. package/rest/support/Stop.js +1 -1
  87. package/rest/support/networkEnums.js +1 -1
  88. package/support/revision.js +1 -1
  89. package/symbols/Font.js +1 -1
  90. package/symbols/TextSymbol.js +1 -1
  91. package/symbols/TextSymbol3DLayer.js +1 -1
  92. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  93. package/symbols/support/cimSymbolUtils.js +1 -1
  94. package/symbols/support/textUtils.js +5 -0
  95. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  96. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  97. package/views/2d/support/engineHelpers.js +1 -1
  98. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  99. package/views/3d/environment/CloudsComposition.js +1 -1
  100. package/views/3d/environment/CloudsGenerator.js +1 -1
  101. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  102. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  103. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  104. package/views/3d/layers/GraphicsView3D.js +1 -1
  105. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  106. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  108. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  110. package/views/3d/layers/graphics/{Graphics3DFeatureLikeLayerView.js → Graphics3DFeatureProcessor.js} +1 -1
  111. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  112. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  113. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  114. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  115. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  116. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  117. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  118. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  119. package/views/3d/layers/graphics/{Graphics3DGraphicLikeLayerView.js → GraphicsProcessor.js} +1 -1
  120. package/views/3d/layers/graphics/IGraphics3DFeatureProcessor.js +4 -0
  121. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  122. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
  123. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  124. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  125. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  126. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  127. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  128. package/views/SceneView.js +1 -1
  129. package/views/webgl/ContextState.js +1 -1
  130. package/views/webgl/FramebufferObject.js +1 -1
  131. package/views/webgl/Program.js +1 -1
  132. package/views/webgl/Renderbuffer.js +1 -1
  133. package/views/webgl/RenderingContext.js +1 -1
  134. package/views/webgl/Texture.js +1 -1
  135. package/views/webgl/Util.js +1 -1
  136. package/views/webgl/enums.js +1 -1
  137. package/views/webgl/rasterUtils.js +1 -1
  138. package/views/webgl/testFloatBufferBlend.js +1 -1
  139. package/widgets/Feature/FeatureExpression.js +1 -1
  140. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  141. package/widgets/Feature/FeatureMedia.js +1 -1
  142. package/widgets/Feature/FeatureViewModel.js +1 -1
  143. package/widgets/LayerList/LayerListViewModel.js +1 -1
  144. package/widgets/support/geolocationUtils.js +1 -1
  145. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +0 -1
  146. package/assets/esri/core/workers/chunks/05db312a0ca6bd3f014a.js +0 -1
  147. package/assets/esri/core/workers/chunks/0f254c3e91e8fee55f28.js +0 -1
  148. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +0 -1
  149. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +0 -1
  150. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +0 -1
  151. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +0 -1
  152. package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
  153. package/assets/esri/core/workers/chunks/618076e6de605873e433.js +0 -1
  154. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +0 -1
  155. package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
  156. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +0 -1
  157. package/assets/esri/core/workers/chunks/8fdd5bca3716816d359b.js +0 -1
  158. package/assets/esri/core/workers/chunks/a28b53c61bddefb6616e.js +0 -1
  159. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +0 -1
  160. package/assets/esri/core/workers/chunks/c3eca92d02958732e141.js +0 -1
  161. package/assets/esri/core/workers/chunks/c8f976e53e232e8da9cc.js +0 -981
  162. package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
  163. package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
  164. package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
  165. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +0 -1
  166. package/assets/esri/core/workers/chunks/ef8b75b92cf549e0507e.js +0 -1
  167. package/symbols/support/constants.js +0 -5
  168. package/tasks/operations/identify.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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import r from"../../../../core/Handles.js";import{logOnError as n}from"../../../../core/promiseUtils.js";import{init as a}from"../../../../core/watchUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as p}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as h,project as d}from"../../../../geometry/support/webMercatorUtils.js";import c from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as u}from"./constants.js";import{Graphics3DCore as g}from"./Graphics3DCore.js";import y from"./Graphics3DElevationAlignment.js";import{Graphics3DFilterVisibility as m}from"./Graphics3DFilterVisibility.js";import f from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as b}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as x}from"./graphicUtils.js";import{attributeLookup as E}from"../support/attributeUtils.js";import{Object3DState as C}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as v}from"../../../support/WatchUpdatingTracking.js";let V=class extends i{constructor(t){super(t),this.type="graphics-3d",this._handles=new r,this.watchUpdatingTracking=new v,this.suspendResumeExtentMode="computed",this.dataExtent=null,this.suspendResumeExtent=null}get suspended(){var t;return null==(t=this.scaleVisibility)?void 0:t.suspended}get suspendInfo(){var t,e;const i={};return null!=(t=this.scaleVisibility)&&t.suspended&&(i.outsideScaleRange=!0),null!=(e=this.frustumVisibility)&&e.suspended&&(i.outsideOfView=!0),i}get updating(){var t,e,i;return!!(null!=(t=this.graphicsCore)&&t.updating||null!=(e=this.frustumVisibility)&&e.updating||null!=(i=this.watchUpdatingTracking)&&i.updating)}get featureStore(){var t;return null==(t=this.graphicsCore)?void 0:t.featureStore}normalizeCtorArgs(t){const e=t.frustumVisibilityEnabled?new f:null,i=t.scaleVisibilityEnabled?new w:null,s=(t.filterVisibilityEnabled||t.timeExtentVisibilityEnabled)&&"multipatch"!==t.layer.geometryType?new m:null,r=t.elevationAlignmentEnabled?new y:null,n=new g({owner:t.owner,layer:t.layer,preferredUpdatePolicy:t.preferredUpdatePolicy,elevationFeatureExpressionEnabled:t.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:t.owner.hasZ,hasM:t.owner.hasM}),{updateClippingExtent:a,suspendResumeExtentMode:o,dataExtent:l}=t;return{graphicsCore:n,frustumVisibility:e,scaleVisibility:i,filterVisibility:s,elevationAlignment:r,updateClippingExtent:a,suspendResumeExtentMode:o,dataExtent:l}}initialize(){this.scaleVisibility&&this.watchUpdatingTracking.add((()=>this.layer.effectiveScaleRange),(()=>this.scaleVisibility.layerMinMaxScaleChangeHandler())),this.filterVisibility&&(this.watchUpdatingTracking.add((()=>this.owner.filter),(()=>this.filterVisibility.filterChanged())),this.watchUpdatingTracking.add((()=>this.owner&&"feature-3d"===this.owner.type&&this.owner.timeExtent),(()=>this.filterVisibility.filterChanged()))),this.elevationAlignment&&this.watchUpdatingTracking.add((()=>this.layer.elevationInfo),((t,e)=>{p(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())})),this.watchUpdatingTracking.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.watchUpdatingTracking.add((()=>this.layer.labelingInfo),((t,e)=>{p(t,e)&&this.graphicsCore.updateLabelingInfo()}))}async setup(){this.frustumVisibility&&this.frustumVisibility.setup(this.owner);const t=this.owner,e=this.owner.view.basemapTerrain,i=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.scaleVisibility&&this.scaleVisibility.setup(t,this.layer,i,this.graphicsCore,e),this.filterVisibility&&("filter"in t||"timeExtent"in t)&&this.filterVisibility.setup(t,this.graphicsCore),this.elevationAlignment){const e=t.view.elevationProvider;this.elevationAlignment.setup(t,i,this.graphicsCore,e)}this._set("objectStates",new b(this.graphicsCore)),this._set("labeling",this.owner.view.labeler.addGraphicsOwner(this.graphicsCore,this.scaleVisibility)),this._set("deconfliction",t.view.deconflictor.addGraphicsOwner(this.graphicsCore)),await n(this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,filterVisibility:this.filterVisibility,deconflictor:this.deconfliction,labeler:this.labeling,objectStates:this.objectStates})),this.watchUpdatingTracking.add((()=>this.layer.renderer),(t=>this.watchUpdatingTracking.addPromise(this.graphicsCore.rendererChange(t)))),this.watchUpdatingTracking.add((()=>t.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.watchUpdatingTracking.add((()=>t.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await n(this.graphicsCore.updateLabelingInfo())}destroy(){this._handles&&(this._handles.destroy(),this._handles=null);const t=["watchUpdatingTracking","frustumVisibility","scaleVisibility","filterVisibility","elevationAlignment","objectStates","graphicsCore"];for(const e of t){const t=this[e];t&&(t.destroy(),this._set(e,null))}this._set("layer",null),this._set("owner",null)}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(C.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t,i){if(t instanceof c){const{set:e,handle:s}=this.objectStates.acquireSet(C.Highlight,i);return this.owner.queryObjectIds(t).then((t=>this.objectStates.setObjectIds(e,t))),s}if("number"==typeof t||"string"==typeof t)return this.highlight([t],i);if(t instanceof e)return this.highlight([t],i);if("toArray"in t&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t;if(null==E(this.layer.fieldsIndex,e[0].attributes,i)){const t=e.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(C.Highlight,null);return this.objectStates.setUids(i,t),s}t=e.map((t=>E(this.layer.fieldsIndex,t.attributes,i)))}if("number"==typeof t[0]||"string"==typeof t[0]){const e=t,{set:s,handle:r}=this.objectStates.acquireSet(C.Highlight,i);return this.objectStates.setObjectIds(s,e),r}}return U}_updateClippingExtent(){const t=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.owner.view.spatialReference)&&(this.updateClippingExtent(t)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this._handles.add(a(this,"suspendResumeExtentMode",(()=>{switch(this._handles.remove(S),this.suspendResumeExtentMode){case"computed":this._handles.add([a(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent(t))),this.graphicsCore.watch("extentPadding",(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],S);break;case"data":this._handles.add([a(this,"dataExtent",(t=>this._updateSuspendResumeExtent(t))),this.graphicsCore.watch("extentPadding",(()=>this._updateSuspendResumeExtent(this.dataExtent)))],S);break;default:s(this.suspendResumeExtentMode)}})))}_updateSuspendResumeExtent(t){t?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(t,this.suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(t,e){const i=this.owner.view.spatialReference;if(!t.spatialReference.equals(i)){if(!h(t,i))return;t=d(t,i)}return x(t,e,u,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(t){this.frustumVisibility&&this.frustumVisibility.setExtent(t),this.scaleVisibility&&this.scaleVisibility.setExtent(t)}};t([o()],V.prototype,"type",void 0),t([o({aliasOf:"graphicsCore.layer"})],V.prototype,"layer",void 0),t([o({aliasOf:"graphicsCore.owner"})],V.prototype,"owner",void 0),t([o({constructOnly:!0})],V.prototype,"updateClippingExtent",void 0),t([o({constructOnly:!0})],V.prototype,"graphicsCore",void 0),t([o({constructOnly:!0})],V.prototype,"scaleVisibility",void 0),t([o({constructOnly:!0})],V.prototype,"filterVisibility",void 0),t([o({constructOnly:!0})],V.prototype,"elevationAlignment",void 0),t([o({constructOnly:!0})],V.prototype,"frustumVisibility",void 0),t([o({readOnly:!0})],V.prototype,"deconfliction",void 0),t([o({readOnly:!0})],V.prototype,"labeling",void 0),t([o({readOnly:!0})],V.prototype,"objectStates",void 0),t([o({readOnly:!0})],V.prototype,"watchUpdatingTracking",void 0),t([o()],V.prototype,"suspendResumeExtentMode",void 0),t([o()],V.prototype,"dataExtent",void 0),t([o({readOnly:!0})],V.prototype,"suspended",null),t([o({readOnly:!0})],V.prototype,"suspendInfo",null),t([o({readOnly:!0,dependsOn:["graphicsCore.updating","frustumVisibility.updating","watchUpdatingTracking.updating"]})],V.prototype,"updating",null),t([o()],V.prototype,"featureStore",null),V=t([l("esri.views.3d.layers.graphics.Graphics3DFeatureLikeLayerView")],V);const j=V,S="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{j as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import r from"../../../../core/Handles.js";import{logOnError as n}from"../../../../core/promiseUtils.js";import{init as a}from"../../../../core/watchUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as p}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as h,project as c}from"../../../../geometry/support/webMercatorUtils.js";import d from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as u}from"./constants.js";import{Graphics3DCore as g}from"./Graphics3DCore.js";import y from"./Graphics3DElevationAlignment.js";import{Graphics3DFilterVisibility as m}from"./Graphics3DFilterVisibility.js";import f from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as b}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as x}from"./graphicUtils.js";import{attributeLookup as E}from"../support/attributeUtils.js";import{Object3DState as C}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as v}from"../../../support/WatchUpdatingTracking.js";let V=class extends i{constructor(t){super(t),this.type="graphics-3d",this._handles=new r,this.watchUpdatingTracking=new v,this.suspendResumeExtentMode="computed",this.dataExtent=null,this.suspendResumeExtent=null}get suspended(){var t;return null==(t=this.scaleVisibility)?void 0:t.suspended}get suspendInfo(){var t,e;const i={};return null!=(t=this.scaleVisibility)&&t.suspended&&(i.outsideScaleRange=!0),null!=(e=this.frustumVisibility)&&e.suspended&&(i.outsideOfView=!0),i}get updating(){var t,e,i;return!!(null!=(t=this.graphicsCore)&&t.updating||null!=(e=this.frustumVisibility)&&e.updating||null!=(i=this.watchUpdatingTracking)&&i.updating)}get featureStore(){var t;return null==(t=this.graphicsCore)?void 0:t.featureStore}normalizeCtorArgs(t){const e=t.frustumVisibilityEnabled?new f:null,i=t.scaleVisibilityEnabled?new w:null,s=(t.filterVisibilityEnabled||t.timeExtentVisibilityEnabled)&&"multipatch"!==t.layer.geometryType?new m:null,r=t.elevationAlignmentEnabled?new y:null,n=new g({owner:t.owner,layer:t.layer,preferredUpdatePolicy:t.preferredUpdatePolicy,elevationFeatureExpressionEnabled:t.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:t.owner.hasZ,hasM:t.owner.hasM}),{updateClippingExtent:a,suspendResumeExtentMode:o,dataExtent:l}=t;return{graphicsCore:n,frustumVisibility:e,scaleVisibility:i,filterVisibility:s,elevationAlignment:r,updateClippingExtent:a,suspendResumeExtentMode:o,dataExtent:l}}initialize(){this.scaleVisibility&&this.watchUpdatingTracking.add((()=>this.layer.effectiveScaleRange),(()=>this.scaleVisibility.layerMinMaxScaleChangeHandler())),this.filterVisibility&&(this.watchUpdatingTracking.add((()=>this.owner.filter),(()=>this.filterVisibility.filterChanged())),this.watchUpdatingTracking.add((()=>this.owner&&"feature-3d"===this.owner.type&&this.owner.timeExtent),(()=>this.filterVisibility.filterChanged()))),this.elevationAlignment&&this.watchUpdatingTracking.add((()=>this.layer.elevationInfo),((t,e)=>{p(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())})),this.watchUpdatingTracking.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.watchUpdatingTracking.add((()=>this.layer.labelingInfo),((t,e)=>{p(t,e)&&this.graphicsCore.updateLabelingInfo()}))}async setup(){this.frustumVisibility&&this.frustumVisibility.setup(this.owner);const t=this.owner,e=this.owner.view.basemapTerrain,i=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.scaleVisibility&&this.scaleVisibility.setup(t,this.layer,i,this.graphicsCore,e),this.filterVisibility&&("filter"in t||"timeExtent"in t)&&this.filterVisibility.setup(t,this.graphicsCore),this.elevationAlignment){const e=t.view.elevationProvider;this.elevationAlignment.setup(t,i,this.graphicsCore,e)}this._set("objectStates",new b(this.graphicsCore)),this._set("labeling",this.owner.view.labeler.addGraphicsOwner(this.graphicsCore,this.scaleVisibility)),this._set("deconfliction",t.view.deconflictor.addGraphicsOwner(this.graphicsCore)),await n(this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,filterVisibility:this.filterVisibility,deconflictor:this.deconfliction,labeler:this.labeling,objectStates:this.objectStates})),this.watchUpdatingTracking.add((()=>this.layer.renderer),(t=>this.watchUpdatingTracking.addPromise(this.graphicsCore.rendererChange(t)))),this.watchUpdatingTracking.add((()=>t.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.watchUpdatingTracking.add((()=>t.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await n(this.graphicsCore.updateLabelingInfo())}destroy(){this._handles&&(this._handles.destroy(),this._handles=null);const t=["watchUpdatingTracking","frustumVisibility","scaleVisibility","filterVisibility","elevationAlignment","objectStates","graphicsCore"];for(const e of t){const t=this[e];t&&(t.destroy(),this._set(e,null))}this._set("layer",null),this._set("owner",null)}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(C.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t,i){if(t instanceof d){const{set:e,handle:s}=this.objectStates.acquireSet(C.Highlight,i);return this.owner.queryObjectIds(t).then((t=>this.objectStates.setObjectIds(e,t))),s}if("number"==typeof t||"string"==typeof t)return this.highlight([t],i);if(t instanceof e)return this.highlight([t],i);if("toArray"in t&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t;if(null==E(this.layer.fieldsIndex,e[0].attributes,i)){const t=e.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(C.Highlight,null);return this.objectStates.setUids(i,t),s}t=e.map((t=>E(this.layer.fieldsIndex,t.attributes,i)))}if("number"==typeof t[0]||"string"==typeof t[0]){const e=t,{set:s,handle:r}=this.objectStates.acquireSet(C.Highlight,i);return this.objectStates.setObjectIds(s,e),r}}return U}_updateClippingExtent(){const t=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.owner.view.spatialReference)&&(this.updateClippingExtent(t)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this._handles.add(a(this,"suspendResumeExtentMode",(()=>{switch(this._handles.remove(S),this.suspendResumeExtentMode){case"computed":this._handles.add([a(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent(t))),this.graphicsCore.watch("extentPadding",(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],S);break;case"data":this._handles.add([a(this,"dataExtent",(t=>this._updateSuspendResumeExtent(t))),this.graphicsCore.watch("extentPadding",(()=>this._updateSuspendResumeExtent(this.dataExtent)))],S);break;default:s(this.suspendResumeExtentMode)}})))}_updateSuspendResumeExtent(t){t?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(t,this.suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(t,e){const i=this.owner.view.spatialReference;if(!t.spatialReference.equals(i)){if(!h(t,i))return;t=c(t,i)}return x(t,e,u,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(t){this.frustumVisibility&&this.frustumVisibility.setExtent(t),this.scaleVisibility&&this.scaleVisibility.setExtent(t)}};t([o()],V.prototype,"type",void 0),t([o({aliasOf:"graphicsCore.layer"})],V.prototype,"layer",void 0),t([o({aliasOf:"graphicsCore.owner"})],V.prototype,"owner",void 0),t([o({constructOnly:!0})],V.prototype,"updateClippingExtent",void 0),t([o({constructOnly:!0})],V.prototype,"graphicsCore",void 0),t([o({constructOnly:!0})],V.prototype,"scaleVisibility",void 0),t([o({constructOnly:!0})],V.prototype,"filterVisibility",void 0),t([o({constructOnly:!0})],V.prototype,"elevationAlignment",void 0),t([o({constructOnly:!0})],V.prototype,"frustumVisibility",void 0),t([o({readOnly:!0})],V.prototype,"deconfliction",void 0),t([o({readOnly:!0})],V.prototype,"labeling",void 0),t([o({readOnly:!0})],V.prototype,"objectStates",void 0),t([o({readOnly:!0})],V.prototype,"watchUpdatingTracking",void 0),t([o()],V.prototype,"suspendResumeExtentMode",void 0),t([o()],V.prototype,"dataExtent",void 0),t([o({readOnly:!0})],V.prototype,"suspended",null),t([o({readOnly:!0})],V.prototype,"suspendInfo",null),t([o({readOnly:!0,dependsOn:["graphicsCore.updating","frustumVisibility.updating","watchUpdatingTracking.updating"]})],V.prototype,"updating",null),t([o()],V.prototype,"featureStore",null),V=t([l("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],V);const j=V,S="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{j 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{init as i}from"../../../../core/watchUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as o}from"../../../../geometry/projectionEllipsoid.js";import{FrustumExtentIntersection as a}from"../../support/FrustumExtentIntersection.js";import{TaskPriority as l}from"../../../support/Scheduler.js";const h=1.2;let u=class extends t{constructor(){super(...arguments),this.suspended=!1,this.extent=null,this.extentIntersectionDirty=!0,this._isVisibleBelowSurface=!1,this.handles=new s,this.layerView=null,this.updating=!0}setup(e){this.layerView=e,this.extentIntersection=new a({renderCoordsHelper:e.view.renderCoordsHelper});const t=e.view,s=t.basemapTerrain,r=t.resourceController.scheduler;this.handles.add([t.on("resize",(()=>this._viewChange())),t.state.watch("camera",(()=>this._viewChange()),!0),r.registerTask(l.FRUSTUM_VISIBILITY,this),s.on("elevation-bounds-change",(()=>this._elevationBoundsChange()))]),"local"===t.viewingMode?this.isVisibleBelowSurface=!0:this.handles.add([i(s,["opacity","wireframe"],(()=>this._updateIsVisibleBelowSurface())),i(t,"map.ground.navigationConstraint.type",(()=>this._updateIsVisibleBelowSurface()))])}destroy(){this.layerView=null,this.extent=null,this.extentIntersection=null,this.handles&&(this.handles.destroy(),this.handles=null)}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this.extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationBoundsChange(){this._setDirty(),this.extentIntersectionDirty=!0}set isVisibleBelowSurface(e){this._isVisibleBelowSurface=e,this._setDirty(),this.extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){const e=this.layerView.view,t=e.basemapTerrain,s="local"===e.viewingMode,i=e.map.ground&&e.map.ground.navigationConstraint&&"none"===e.map.ground.navigationConstraint.type;this.isVisibleBelowSurface=s||!t.opaque||i}_updateExtentIntersection(){if(!this.extentIntersectionDirty)return;this.extentIntersectionDirty=!1;const e=this.layerView.view;let t;if(this._isVisibleBelowSurface)t=-.3*o(e.spatialReference).radius;else{const{min:s,max:i}=e.basemapTerrain.elevationBounds;t=s-Math.max(1,(i-s)*(h-1))}this.extentIntersection.update(this.extent,e.spatialReference,t)}get running(){return this.updating}runTask(){if(this._set("updating",!1),!this.extent)return void this._set("suspended",!1);this._updateExtentIntersection();const e=this.layerView.view.frustum,t=o(this.layerView.view.spatialReference).radius;this._set("suspended",!this.extentIntersection.isVisibleInFrustum(e,t))}};e([r({readOnly:!0})],u.prototype,"suspended",void 0),e([r({readOnly:!0})],u.prototype,"updating",void 0),u=e([n("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],u);const c=u;export{c as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{init as i}from"../../../../core/watchUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as o}from"../../../../geometry/projectionEllipsoid.js";import{FrustumExtentIntersection as a}from"../../support/FrustumExtentIntersection.js";import{TaskPriority as h}from"../../../support/Scheduler.js";const c=1.2;let p=class extends t{constructor(){super(...arguments),this.suspended=!1,this.extent=null,this.extentIntersectionDirty=!0,this._isVisibleBelowSurface=!1,this.handles=new s,this.graphicsCoreOwner=null,this.updating=!0}setup(e){this.graphicsCoreOwner=e,this.extentIntersection=new a({renderCoordsHelper:e.view.renderCoordsHelper});const t=e.view,s=t.basemapTerrain,r=t.resourceController.scheduler;this.handles.add([t.on("resize",(()=>this._viewChange())),t.state.watch("camera",(()=>this._viewChange()),!0),r.registerTask(h.FRUSTUM_VISIBILITY,this),s.on("elevation-bounds-change",(()=>this._elevationBoundsChange()))]),"local"===t.viewingMode?this.isVisibleBelowSurface=!0:this.handles.add([i(s,["opacity","wireframe"],(()=>this._updateIsVisibleBelowSurface())),i(t,"map.ground.navigationConstraint.type",(()=>this._updateIsVisibleBelowSurface()))])}destroy(){this.graphicsCoreOwner=null,this.extent=null,this.extentIntersection=null,this.handles&&(this.handles.destroy(),this.handles=null)}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this.extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationBoundsChange(){this._setDirty(),this.extentIntersectionDirty=!0}set isVisibleBelowSurface(e){this._isVisibleBelowSurface=e,this._setDirty(),this.extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){const e=this.graphicsCoreOwner.view,t=e.basemapTerrain,s="local"===e.viewingMode,i=e.map.ground&&e.map.ground.navigationConstraint&&"none"===e.map.ground.navigationConstraint.type;this.isVisibleBelowSurface=s||!t.opaque||i}_updateExtentIntersection(){if(!this.extentIntersectionDirty)return;this.extentIntersectionDirty=!1;const e=this.graphicsCoreOwner.view;let t;if(this._isVisibleBelowSurface)t=-.3*o(e.spatialReference).radius;else{const{min:s,max:i}=e.basemapTerrain.elevationBounds;t=s-Math.max(1,(i-s)*(c-1))}this.extentIntersection.update(this.extent,e.spatialReference,t)}get running(){return this.updating}runTask(){if(this._set("updating",!1),!this.extent)return void this._set("suspended",!1);this._updateExtentIntersection();const e=this.graphicsCoreOwner.view.frustum,t=o(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this.extentIntersection.isVisibleInFrustum(e,t))}};e([r({readOnly:!0})],p.prototype,"suspended",void 0),e([r({readOnly:!0})],p.prototype,"updating",void 0),p=e([n("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],p);const l=p;export{l 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import i from"../../../../core/Error.js";import{isSome as s,get as a,isNone as o,releaseMaybe as n,unwrap as l}from"../../../../core/maybe.js";import{throwIfAbortError as c,throwIfAborted as h}from"../../../../core/promiseUtils.js";import{pt2px as m,px2pt as u}from"../../../../core/screenUtils.js";import{dataComponents as d,isSVG as _}from"../../../../core/urlUtils.js";import{c as p}from"../../../../chunks/mat4f64.js";import{f,a as y}from"../../../../chunks/vec2f64.js";import{Z as g,O as b,f as x}from"../../../../chunks/vec3f64.js";import{c as S}from"../../../../chunks/vec4.js";import{f as v,c as z}from"../../../../chunks/vec4f64.js";import{projectPointToVector as P}from"../../../../geometry/projection.js";import{containsPoint as R}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as M}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as w}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as C}from"../../../../symbols/support/utils.js";import j from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as I}from"./constants.js";import{perObjectElevationAligner as E}from"./ElevationAligners.js";import{SymbolUpdateType as O,elevationModeChangeUpdateType as T,needsElevationUpdates2D as L}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import F from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as G}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as U}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A,namedAnchorToHUDMaterialAnchorPos as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{placePointOnGeometry as B,createStageObjectForHUD as N,extendPointGraphicElevationContext as q}from"./pointUtils.js";import{createTriangle as H,createX as W,createCross as Z,createKite as $,createSquare as J,createCircle as K}from"./sdfPrimitives.js";import{initFastSymbolUpdatesState as Q,updateFastSymbolUpdatesState as X,evaluateModelTransform as Y}from"../support/FastSymbolUpdates.js";import{DRAPED_Z as ee}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as te}from"../../webgl-engine/lib/basicInterfaces.js";import re from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as se}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as ae}from"../../webgl-engine/materials/HUDMaterial.js";import{TextureWrapMode as oe}from"../../../webgl/enums.js";import ne from"../../../../symbols/CIMSymbol.js";const le=p(),ce=x(0,0,1),he=16,me=1.5,ue=128,de=.5,_e=[de/2,de/2,1-de/2,1-de/2],pe=[ue*de,ue*de];class fe extends U{constructor(e,t,r,i){super(e,t,r,i),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}getCachedSize(){return{size:this._getIconSize()}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(s(r))this._prepareResourcesPrimitive(t,r);else{const r=C(this.symbol,this.symbolLayer),i=d(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?m(e.size):he);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let r=""===t?null:this._cimSymbolTextures.get(t);if(!r){const i={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol(this._cimLayers,e,"esriGeometryPoint",i,null,null);this._cimMaterialParametersInfo.anchorPos=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:te.PAD};r=new se(s.imageData,a),this._cimSymbolTextures.set(t,r),this._context.stage.add(r)}return r}_computeSize(e,t){const r=e.width/e.height;return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}_prepareMaterialParameters(){const e={anchorPos:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ye(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:m(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.slicePlaneEnabled=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ge(t)&&0===r)throw new Error("Nothing to render");this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize;const i=this._context.sharedResources.textures.fromData(t,(()=>be(t)));this._texture=i.texture,this._releaseTexture=i,e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=_e,e.textureId=this._texture.id;const s=this._getIconSize();this._size=[s,s],this._symbolTextureRatio=1/de,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,s,a){if(!r("esri-canvas-svg-support")&&_(s)){throw new i("graphics3diconsymbollayer:unsupported-image-format","IconSymbol3DLayer failed to load (SVG symbols are not supported in IE11)")}this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.layerView.view.pixelRatio,l=await t(this._context.sharedResources.textures.fromUrl(s,n,{signal:a}));if(!1===l.ok){c(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${s})`)}this._releaseTexture=l.value;const h=l.value.texture,m=h.params;this._size=this._computeSize(m,o),e.textureId=h.id,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new ne({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;h(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,o;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(i,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,r=await M(t,this._context.layer.spatialReference,s);o=(e,t,i)=>{const s=j(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||o||1;const n=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];h(r);const l=this._context.layer.fieldsIndex;this._cimRequiredFields=n.map((e=>l.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||w}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(s(t.outline)&&null!=t.outline.size)return Math.max(m(t.outline.size),0);return e=ge(this._getPrimitive())?me:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=a(r,"outline","color");if(s(i)){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(ge(this._getPrimitive()))return I;const e=o(this._getPrimitive()),t=a(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?f((t.x||0)+.5,.5-(t.y||0)):e in V?V[e]:V.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates={enabled:!1}:this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates.enabled&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let r=this._cimSymbolMaterials.get(e.textureId);return r||(r=new ae(e),this._cimSymbolMaterials.set(e.textureId,r),t.add(r)),r}return this._material=new ae(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,slicePlaneEnabled:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=n(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=m(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i;if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};i=this._createMaterialAndAddToStage(s,this._context.stage),r=[e.params.width,e.params.height]}else r=this._size,i=l(this._material);const s=B(t.geometry);if(o(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getVertexOpacityAndColor(a);let c=1;if(!this._fastUpdates.enabled||!this._fastUpdates.visualVariables.size){const e=r[0]>r[1]?r[0]:r[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=[r[0]*c,r[1]*c],m=this.setGraphicElevationContext(t,new D);return this.ensureDrapedStatus("on-the-ground"===m.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,i,n,h,e.layer.uid):this._createAs3DShape(t,s,i,n,h,m,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();return this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})),!0}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(fe.elevationModeChangeTypes,r,i);if(s!==O.UPDATE)return s;const a=L(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!!this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return k.Recreate_Symbol;if(!X(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return k.Recreate_Symbol;s(this._material)&&this._material.setParameters(this._fastUpdates.materialParameters)}return k.Fast_Update}_defaultElevationInfoNoZ(){return xe}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n?e=>Y(this._fastUpdates.materialParameters,n,e):null,c=[re.createPointGeometry(ce,null,i,s,Se,null,n)],h=N(this._context,t,c,[r],a,this._context.layer.uid,o,l);if(null===h)return null;const m=new G(this,h.object,c,null,null,E,a);return m.alignedSampledElevation=h.sampledElevation,m.needsElevationUpdates=L(a.mode)||"absolute-height"===a.mode,m.getScreenSize=this._createScreenSizeGetter(s,l),m.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(m.getScreenSize(),1,e),q(m,t,this._context.elevationProvider),m}_createAsOverlay(e,t,r,i,a,o){r.renderPriority=this._renderPriority;const n=z();P(t,n,this._context.overlaySR),n[2]=ee;const l=this._context.clippingExtent;if(s(l)&&!R(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=c?e=>Y(this._fastUpdates.materialParameters,c,e):null,m=re.createPointGeometry(ce,n,i,a,null,null,c),u=new ie(m,r,o,e.uid);n[3]=0,S(u.boundingSphere,n),u.calculateShaderTransformation=h;const d=new F(this,[u],null);return d.getScreenSize=this._createScreenSizeGetter(a,h),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates.enabled){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=y())=>{const a=t(le);return e[0]=a[0]*i+r,e[1]=a[5]*s+r,e}}{const t=e[0]/this._symbolTextureRatio+r,i=e[1]/this._symbolTextureRatio+r;return(e=y())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=this._size[0]>this._size[1]?this._size[0]:this._size[1],t=x(e,e,e),r=u(1),i=e*r;return{modelSize:t,symbolSize:x(i,i,i),unitInMeters:r,transformation:{anchor:g,scale:b,rotation:g}}}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){s(this._material)&&e(this._material),this._cimSymbolMaterials.forEach(e)}}function ye(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ge(e){return!!s(e)&&("cross"===e||"x"===e)}function be(e){let t;const r=ue,i=r*de;switch(e){case"circle":t=K(r,i);break;case"square":t=J(r,i);break;case"kite":t=$(r,i);break;case"cross":t=Z(r,i);break;case"x":t=W(r,i);break;case"triangle":t=H(r,i)}return new se(t,{mipmap:!1,wrap:{s:oe.CLAMP_TO_EDGE,t:oe.CLAMP_TO_EDGE},width:ue,height:ue,components:4,noUnpackFlip:!0})}fe.PRIMITIVE_SIZE=pe,fe.elevationModeChangeTypes={definedChanged:O.UPDATE,staysOnTheGround:O.NONE,onTheGroundChanged:O.RECREATE};const xe={mode:"relative-to-ground",offset:0},Se=v(0,0,0,1);export{fe as Graphics3DIconSymbolLayer,fe as default};
5
+ import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import i from"../../../../core/Error.js";import{isSome as s,get as a,isNone as o,releaseMaybe as n,unwrap as l}from"../../../../core/maybe.js";import{throwIfAbortError as c,throwIfAborted as h}from"../../../../core/promiseUtils.js";import{pt2px as m,px2pt as u}from"../../../../core/screenUtils.js";import{dataComponents as d,isSVG as _}from"../../../../core/urlUtils.js";import{c as p}from"../../../../chunks/mat4f64.js";import{f,a as y}from"../../../../chunks/vec2f64.js";import{Z as g,O as b,f as x}from"../../../../chunks/vec3f64.js";import{c as S}from"../../../../chunks/vec4.js";import{f as v,c as z}from"../../../../chunks/vec4f64.js";import{projectPointToVector as P}from"../../../../geometry/projection.js";import{containsPoint as R}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as M}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as w}from"../../../../symbols/support/utils.js";import j from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as I}from"./constants.js";import{perObjectElevationAligner as E}from"./ElevationAligners.js";import{SymbolUpdateType as O,elevationModeChangeUpdateType as T,needsElevationUpdates2D as L}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import F from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as G}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as U}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A,namedAnchorToHUDMaterialAnchorPos as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{placePointOnGeometry as B,createStageObjectForHUD as N,extendPointGraphicElevationContext as q}from"./pointUtils.js";import{createTriangle as H,createX as W,createCross as Z,createKite as $,createSquare as J,createCircle as K}from"./sdfPrimitives.js";import{initFastSymbolUpdatesState as Q,updateFastSymbolUpdatesState as X,evaluateModelTransform as Y}from"../support/FastSymbolUpdates.js";import{DRAPED_Z as ee}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as te}from"../../webgl-engine/lib/basicInterfaces.js";import re from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as se}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as ae}from"../../webgl-engine/materials/HUDMaterial.js";import{TextureWrapMode as oe}from"../../../webgl/enums.js";import ne from"../../../../symbols/CIMSymbol.js";const le=p(),ce=x(0,0,1),he=16,me=1.5,ue=128,de=.5,_e=[de/2,de/2,1-de/2,1-de/2],pe=[ue*de,ue*de];class fe extends U{constructor(e,t,r,i){super(e,t,r,i),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}getCachedSize(){return{size:this._getIconSize()}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(s(r))this._prepareResourcesPrimitive(t,r);else{const r=w(this.symbol,this.symbolLayer),i=d(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?m(e.size):he);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let r=""===t?null:this._cimSymbolTextures.get(t);if(!r){const i={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol(this._cimLayers,e,"esriGeometryPoint",i,null,null);this._cimMaterialParametersInfo.anchorPos=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:te.PAD};r=new se(s.imageData,a),this._cimSymbolTextures.set(t,r),this._context.stage.add(r)}return r}_computeSize(e,t){const r=e.width/e.height;return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}_prepareMaterialParameters(){const e={anchorPos:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ye(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:m(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.slicePlaneEnabled=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ge(t)&&0===r)throw new Error("Nothing to render");this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize;const i=this._context.sharedResources.textures.fromData(t,(()=>be(t)));this._texture=i.texture,this._releaseTexture=i,e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=_e,e.textureId=this._texture.id;const s=this._getIconSize();this._size=[s,s],this._symbolTextureRatio=1/de,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,s,a){if(!r("esri-canvas-svg-support")&&_(s)){throw new i("graphics3diconsymbollayer:unsupported-image-format","IconSymbol3DLayer failed to load (SVG symbols are not supported in IE11)")}this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.pixelRatio,l=await t(this._context.sharedResources.textures.fromUrl(s,n,{signal:a}));if(!1===l.ok){c(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${s})`)}this._releaseTexture=l.value;const h=l.value.texture,m=h.params;this._size=this._computeSize(m,o),e.textureId=h.id,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new ne({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;h(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,o;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(i,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,r=await M(t,this._context.layer.spatialReference,s);o=(e,t,i)=>{const s=j(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||o||1;const n=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];h(r);const l=this._context.layer.fieldsIndex;this._cimRequiredFields=n.map((e=>l.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||C}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(s(t.outline)&&null!=t.outline.size)return Math.max(m(t.outline.size),0);return e=ge(this._getPrimitive())?me:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=a(r,"outline","color");if(s(i)){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(ge(this._getPrimitive()))return I;const e=o(this._getPrimitive()),t=a(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?f((t.x||0)+.5,.5-(t.y||0)):e in V?V[e]:V.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates={enabled:!1}:this._fastUpdates=Q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates.enabled&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let r=this._cimSymbolMaterials.get(e.textureId);return r||(r=new ae(e),this._cimSymbolMaterials.set(e.textureId,r),t.add(r)),r}return this._material=new ae(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,slicePlaneEnabled:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=n(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=m(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i;if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};i=this._createMaterialAndAddToStage(s,this._context.stage),r=[e.params.width,e.params.height]}else r=this._size,i=l(this._material);const s=B(t.geometry);if(o(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getVertexOpacityAndColor(a);let c=1;if(!this._fastUpdates.enabled||!this._fastUpdates.visualVariables.size){const e=r[0]>r[1]?r[0]:r[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=[r[0]*c,r[1]*c],m=this.setGraphicElevationContext(t,new D);return this.ensureDrapedStatus("on-the-ground"===m.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,i,n,h,e.layer.uid):this._createAs3DShape(t,s,i,n,h,m,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();return this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})),!0}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(fe.elevationModeChangeTypes,r,i);if(s!==O.UPDATE)return s;const a=L(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!!this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return k.Recreate_Symbol;if(!X(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return k.Recreate_Symbol;s(this._material)&&this._material.setParameters(this._fastUpdates.materialParameters)}return k.Fast_Update}_defaultElevationInfoNoZ(){return xe}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n?e=>Y(this._fastUpdates.materialParameters,n,e):null,c=[re.createPointGeometry(ce,null,i,s,Se,null,n)],h=N(this._context,t,c,[r],a,this._context.layer.uid,o,l);if(null===h)return null;const m=new G(this,h.object,c,null,null,E,a);return m.alignedSampledElevation=h.sampledElevation,m.needsElevationUpdates=L(a.mode)||"absolute-height"===a.mode,m.getScreenSize=this._createScreenSizeGetter(s,l),m.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(m.getScreenSize(),1,e),q(m,t,this._context.elevationProvider),m}_createAsOverlay(e,t,r,i,a,o){r.renderPriority=this._renderPriority;const n=z();P(t,n,this._context.overlaySR),n[2]=ee;const l=this._context.clippingExtent;if(s(l)&&!R(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=c?e=>Y(this._fastUpdates.materialParameters,c,e):null,m=re.createPointGeometry(ce,n,i,a,null,null,c),u=new ie(m,r,o,e.uid);n[3]=0,S(u.boundingSphere,n),u.calculateShaderTransformation=h;const d=new F(this,[u],null);return d.getScreenSize=this._createScreenSizeGetter(a,h),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates.enabled){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=y())=>{const a=t(le);return e[0]=a[0]*i+r,e[1]=a[5]*s+r,e}}{const t=e[0]/this._symbolTextureRatio+r,i=e[1]/this._symbolTextureRatio+r;return(e=y())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=this._size[0]>this._size[1]?this._size[0]:this._size[1],t=x(e,e,e),r=u(1),i=e*r;return{modelSize:t,symbolSize:x(i,i,i),unitInMeters:r,transformation:{anchor:g,scale:b,rotation:g}}}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){s(this._material)&&e(this._material),this._cimSymbolMaterials.forEach(e)}}function ye(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ge(e){return!!s(e)&&("cross"===e||"x"===e)}function be(e){let t;const r=ue,i=r*de;switch(e){case"circle":t=K(r,i);break;case"square":t=J(r,i);break;case"kite":t=$(r,i);break;case"cross":t=Z(r,i);break;case"x":t=W(r,i);break;case"triangle":t=H(r,i)}return new se(t,{mipmap:!1,wrap:{s:oe.CLAMP_TO_EDGE,t:oe.CLAMP_TO_EDGE},width:ue,height:ue,components:4,noUnpackFlip:!0})}fe.PRIMITIVE_SIZE=pe,fe.elevationModeChangeTypes={definedChanged:O.UPDATE,staysOnTheGround:O.NONE,onTheGroundChanged:O.RECREATE};const xe={mode:"relative-to-ground",offset:0},Se=v(0,0,0,1);export{fe as Graphics3DIconSymbolLayer,fe 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as f,a as p,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as E,empty as w,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,VertexAttribute as te,PrimitiveType as re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as ae}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as oe}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as se}from"../../webgl-engine/lib/Object3D.js";import{Texture as ne}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new ne(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const f={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},p=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:p,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};p||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,f),this._setInternalMaterialParameters(m,d);const g=new ie(d);return f.material=g,this._materials.set(m.uid,f),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(te.POSITION),a=e.vertexAttributes.get(te.NORMAL),o=e.indices.get(te.POSITION),s=e.indices.get(te.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,fe,pe,de),f(fe,fe,pe),f(fe,fe,de),p(fe,fe,1/3);for(let e=0;e<3;e++)c.push(fe[e]);for(let e=0;e<3;e++)c.push(fe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new ae([[te.POSITION,{data:i,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(l)]],re.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new ae([[te.POSITION,{data:c,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(u)]],re.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new se({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),f=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,p=new W(this,m,i,null,null,z,a,f);return p.needsElevationUpdates=q(a.mode),p.useObjectOriginAsAttachmentOrigin=!0,p.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),p.alignedSampledElevation=z(p,p.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),p}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];fe[0]=t[a+0],fe[1]=t[a+1],fe[2]=t[a+2],d(ge,fe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),f(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,fe,pe,de),x(pe,pe,fe),x(de,de,fe),_(fe,pe,de),g(a,fe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.layerView.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.layerView.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),f=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:f,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,f),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:oe(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),w(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.layerView.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=[],d=[],g=[];let x=!1;for(const r of f){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[te.POSITION,{size:3,data:s,exclusive:!0}],[te.NORMAL,{size:3,data:o.normals,exclusive:!0}]],f=[[te.POSITION,a],[te.NORMAL,o.indices]];t(i)&&(m.push([te.COLOR,{size:4,data:i,exclusive:!0}]),f.push([te.COLOR,a])),t(l)&&(m.push([te.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),f.push([te.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([te.UV0,{size:2,data:n,exclusive:!0}]),f.push([te.UV0,a])),t(u)&&(m.push([te.TANGENT,{size:4,data:u,exclusive:!0}]),f.push([te.TANGENT,a]));const _=new ae(m,f);p.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:p,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),fe=v(),pe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=E(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,me as default};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as p,a as f,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as E,empty as w,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,VertexAttribute as te,PrimitiveType as re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as ae}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as oe}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as se}from"../../webgl-engine/lib/Object3D.js";import{Texture as ne}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new ne(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const p={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},f=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:f,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};f||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,p),this._setInternalMaterialParameters(m,d);const g=new ie(d);return p.material=g,this._materials.set(m.uid,p),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(te.POSITION),a=e.vertexAttributes.get(te.NORMAL),o=e.indices.get(te.POSITION),s=e.indices.get(te.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,pe,fe,de),p(pe,pe,fe),p(pe,pe,de),f(pe,pe,1/3);for(let e=0;e<3;e++)c.push(pe[e]);for(let e=0;e<3;e++)c.push(pe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new ae([[te.POSITION,{data:i,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(l)]],re.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new ae([[te.POSITION,{data:c,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(u)]],re.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new se({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),p=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,f=new W(this,m,i,null,null,z,a,p);return f.needsElevationUpdates=q(a.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),f.alignedSampledElevation=z(f,f.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),f}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];pe[0]=t[a+0],pe[1]=t[a+1],pe[2]=t[a+2],d(ge,pe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),p(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,pe,fe,de),x(fe,fe,pe),x(de,de,pe),_(pe,fe,de),g(a,pe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),p=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:p,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,p),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:oe(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),w(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,p=this._getOrCreateComponents(e),f=[],d=[],g=[];let x=!1;for(const r of p){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[te.POSITION,{size:3,data:s,exclusive:!0}],[te.NORMAL,{size:3,data:o.normals,exclusive:!0}]],p=[[te.POSITION,a],[te.NORMAL,o.indices]];t(i)&&(m.push([te.COLOR,{size:4,data:i,exclusive:!0}]),p.push([te.COLOR,a])),t(l)&&(m.push([te.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),p.push([te.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([te.UV0,{size:2,data:n,exclusive:!0}]),p.push([te.UV0,a])),t(u)&&(m.push([te.TANGENT,{size:4,data:u,exclusive:!0}]),p.push([te.TANGENT,a]));const _=new ae(m,p);f.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),pe=v(),fe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=E(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,me 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as c,expandWithBuffer as p,intersectsClippingArea as h,expandWithAABB as d}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewMat3f64 as m,BufferViewVec3f64 as _,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{SymbolUpdateType as g,elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{ElevationContext as v}from"./ElevationContext.js";import E from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as D}from"./graphicUtils.js";import{parseCapType as O,createGeometry as S,RemoveDuplicateStartEnd as A}from"./lineUtils.js";import{geometryAsPolygon as P,geometryToRenderInfo as C,createColorGeometry as U,geometryToRenderInfoDraped as w}from"./polygonUtils.js";import{createMaterial as G,uvElevationAligner as T}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as R}from"../support/uvUtils.js";import{VertexAttribute as B}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as V}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"];class W extends x{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=G(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,vertexColors:!0,writeLinearDepth:!0,slicePlaneEnabled:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof F,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=V(e.pattern);return new I({width:t,color:this._getOutlineColor(),polygonOffset:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:O(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new v);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}return!0}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=f(W.elevationModeChangeTypes,i,r);if(n!==g.UPDATE)return n;const o=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={slicePlaneEnabled:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=P(e.geometry);if(r(n))return null;z.renderData=C(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),z.color=t;const o=z.renderData.position.length/3;if(this._needsUV&&(z.uvMapSpace=new Float32Array(4*o),z.boundingRect=new Float64Array(9*o)),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._createAs3DShapeFill(z),this._hasOutline&&this._createAs3DShapeOutline(z),this._logGeometryCreationWarnings(z.renderData,n.rings,"rings","FillSymbol3DLayer"),0===z.outNum)return null;this._needsUV&&j(y.fromTypedArray(z.uvMapSpace),_.fromTypedArray(z.renderData.position),this._context.renderCoordsHelper,m.fromTypedArray(z.boundingRect));const a=new L({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),s=new M(this,a,z.outGeometries,null,null,T,i);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=b(i.mode),s}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPosition:o,holeIndices:l,index:u,count:d}of i){if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const i=a(o,l,3);if(0===i.length)continue;const m=new Uint32Array(i),_=U({indices:m,attributeData:{position:r,color:e.color,mapPosition:o,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*u*e.uvMapSpace.BYTES_PER_ELEMENT,4*d):null,boundingRect:this._needsUV?new Float64Array(e.boundingRect.buffer,9*u*e.boundingRect.BYTES_PER_ELEMENT,9*d):null}});e.outGeometries.push(_),e.outMaterials.push(n(this._material)),e.outTransforms.push(s),e.outNum++}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPosition:o,position:a}=i[r];if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const l=S({overlayInfo:null,removeDuplicateStartEnd:A.REMOVE,attributeData:{position:a,mapPosition:o}}),u=l.vertexAttributes.get(B.POSITION);u.data===a&&(u.data=new Float64Array(a)),e.outGeometries.push(l),e.outMaterials.push(n(this._outlineMaterial)),e.outTransforms.push(s),e.outNum++}}_createAsOverlay(e,i){const o=P(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority),Y.renderData=w(o,this._context.overlaySR),Y.color=i;const a=Y.renderData.position.length/3;return this._needsUV&&(Y.uvMapSpace=new Float32Array(4*a)),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=c(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayFill(Y),this._hasOutline&&this._createAsOverlayOutline(Y),this._logGeometryCreationWarnings(Y.renderData,o.rings,"rings","FillSymbol3DLayer"),0===Y.outNum?null:(this._needsUV&&R(y.fromTypedArray(Y.uvMapSpace),_.fromTypedArray(Y.renderData.position),this._context.overlaySR,this._context.layerView.view.state.viewingMode),Y.outNum>0?new E(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:s}of t){if(c(k),p(k,i),!h(k,this._context.clippingExtent))continue;const t=a(i,r,3);if(0===t.length)continue;d(e.outBoundingBox,k);const u=new Uint32Array(t),m=U({indices:u,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*o*e.uvMapSpace.BYTES_PER_ELEMENT,4*s):null}}),_=new N(m,n(this._material),e.layerUid,e.graphicsUid),y=k;l(_.boundingSphere,.5*(y[0]+y[3]),.5*(y[1]+y[4]),0,.5*Math.sqrt((y[3]-y[0])*(y[3]-y[0])+(y[4]-y[1])*(y[4]-y[1]))),e.outGeometries.push(_),e.outNum++}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(k),p(k,r),!h(k,this._context.clippingExtent))continue;d(e.outBoundingBox,k);const o=S({overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:A.REMOVE,attributeData:{position:r}}),a=new N(o,n(this._outlineMaterial),e.layerUid,e.graphicsUid),s=k;l(a.boundingSphere,.5*(s[0]+s[3]),.5*(s[1]+s[4]),0,.5*Math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))),e.outGeometries.push(a),e.outNum++}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return D(t(r)?e.toUnitRGB(r):null,n)}get test(){return{createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}W.elevationModeChangeTypes={definedChanged:g.RECREATE,staysOnTheGround:g.NONE,onTheGroundChanged:g.RECREATE};const k=u(),z={renderData:null,color:null,uvMapSpace:null,boundingRect:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,color:null,uvMapSpace:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{W as Graphics3DPolygonFillSymbolLayer,W as default};
5
+ import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as c,expandWithBuffer as p,intersectsClippingArea as h,expandWithAABB as d}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewMat3f64 as m,BufferViewVec3f64 as _,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{SymbolUpdateType as g,elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{ElevationContext as v}from"./ElevationContext.js";import E from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as O}from"./graphicUtils.js";import{parseCapType as D,createGeometry as S,RemoveDuplicateStartEnd as A}from"./lineUtils.js";import{geometryAsPolygon as P,geometryToRenderInfo as C,createColorGeometry as U,geometryToRenderInfoDraped as w}from"./polygonUtils.js";import{createMaterial as G,uvElevationAligner as T}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as R}from"../support/uvUtils.js";import{VertexAttribute as B}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as V}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"];class W extends x{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=G(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,vertexColors:!0,writeLinearDepth:!0,slicePlaneEnabled:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof V,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=F(e.pattern);return new I({width:t,color:this._getOutlineColor(),polygonOffset:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:D(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new v);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}return!0}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=f(W.elevationModeChangeTypes,i,r);if(n!==g.UPDATE)return n;const o=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={slicePlaneEnabled:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=P(e.geometry);if(r(n))return null;z.renderData=C(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),z.color=t;const o=z.renderData.position.length/3;if(this._needsUV&&(z.uvMapSpace=new Float32Array(4*o),z.boundingRect=new Float64Array(9*o)),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._createAs3DShapeFill(z),this._hasOutline&&this._createAs3DShapeOutline(z),this._logGeometryCreationWarnings(z.renderData,n.rings,"rings","FillSymbol3DLayer"),0===z.outNum)return null;this._needsUV&&j(y.fromTypedArray(z.uvMapSpace),_.fromTypedArray(z.renderData.position),this._context.renderCoordsHelper,m.fromTypedArray(z.boundingRect));const a=new L({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),s=new M(this,a,z.outGeometries,null,null,T,i);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=b(i.mode),s}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPosition:o,holeIndices:l,index:u,count:d}of i){if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const i=a(o,l,3);if(0===i.length)continue;const m=new Uint32Array(i),_=U({indices:m,attributeData:{position:r,color:e.color,mapPosition:o,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*u*e.uvMapSpace.BYTES_PER_ELEMENT,4*d):null,boundingRect:this._needsUV?new Float64Array(e.boundingRect.buffer,9*u*e.boundingRect.BYTES_PER_ELEMENT,9*d):null}});e.outGeometries.push(_),e.outMaterials.push(n(this._material)),e.outTransforms.push(s),e.outNum++}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPosition:o,position:a}=i[r];if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const l=S({overlayInfo:null,removeDuplicateStartEnd:A.REMOVE,attributeData:{position:a,mapPosition:o}}),u=l.vertexAttributes.get(B.POSITION);u.data===a&&(u.data=new Float64Array(a)),e.outGeometries.push(l),e.outMaterials.push(n(this._outlineMaterial)),e.outTransforms.push(s),e.outNum++}}_createAsOverlay(e,i){const o=P(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority),Y.renderData=w(o,this._context.overlaySR),Y.color=i;const a=Y.renderData.position.length/3;return this._needsUV&&(Y.uvMapSpace=new Float32Array(4*a)),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=c(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayFill(Y),this._hasOutline&&this._createAsOverlayOutline(Y),this._logGeometryCreationWarnings(Y.renderData,o.rings,"rings","FillSymbol3DLayer"),0===Y.outNum?null:(this._needsUV&&R(y.fromTypedArray(Y.uvMapSpace),_.fromTypedArray(Y.renderData.position),this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode),Y.outNum>0?new E(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:s}of t){if(c(k),p(k,i),!h(k,this._context.clippingExtent))continue;const t=a(i,r,3);if(0===t.length)continue;d(e.outBoundingBox,k);const u=new Uint32Array(t),m=U({indices:u,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*o*e.uvMapSpace.BYTES_PER_ELEMENT,4*s):null}}),_=new N(m,n(this._material),e.layerUid,e.graphicsUid),y=k;l(_.boundingSphere,.5*(y[0]+y[3]),.5*(y[1]+y[4]),0,.5*Math.sqrt((y[3]-y[0])*(y[3]-y[0])+(y[4]-y[1])*(y[4]-y[1]))),e.outGeometries.push(_),e.outNum++}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(k),p(k,r),!h(k,this._context.clippingExtent))continue;d(e.outBoundingBox,k);const o=S({overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:A.REMOVE,attributeData:{position:r}}),a=new N(o,n(this._outlineMaterial),e.layerUid,e.graphicsUid),s=k;l(a.boundingSphere,.5*(s[0]+s[3]),.5*(s[1]+s[4]),0,.5*Math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))),e.outGeometries.push(a),e.outNum++}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return O(t(r)?e.toUnitRGB(r):null,n)}get test(){return{createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}W.elevationModeChangeTypes={definedChanged:g.RECREATE,staysOnTheGround:g.NONE,onTheGroundChanged:g.RECREATE};const k=u(),z={renderData:null,color:null,uvMapSpace:null,boundingRect:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,color:null,uvMapSpace:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{W as Graphics3DPolygonFillSymbolLayer,W 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{isSome as s,isNone as a}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{VisibilityFlag as n,VisibilityGroup as c}from"./enums.js";import{scaleBoundsPredicate as h}from"../../../support/layerViewUtils.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let p=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.layerView=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,a){this.layerView=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=a,this.updateScaleRangeActive();const r=this.layerView.view.resourceController.scheduler;this.handles.add(r.registerTask(o.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.layerView=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&y(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&y(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(u)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),u),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),u)):!t&&this.handles.has(u)&&this.handles.remove(u),s}get running(){return!(!this.layerView.view.basemapTerrain||!this.updating)}runTask(){const e=this.layerView.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||h(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return h(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(s(e.centroid)?i=e.centroid:s(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.layerView.view.basemapTerrain?this.layerView.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(n.SCALE_RANGE,i,c.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.layerView.view.deconflictor.setDirty(),this.layerView.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(n.SCALE_RANGE,s,c.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.layerView.suspended)return;const i=e.extent,t=e.scale,r=this._visibleAtLayerScale(t);let l=!1;this.queryGraphicUIDsInExtent(i,e.spatialReference,(e=>{const h=this.graphicsCore.getGraphics3DGraphicById(e);if(a(h))return;const o=h.centroid;s(o)&&(i[0]>o.x||i[1]>o.y||i[2]<o.x||i[3]<o.y)||(h.setVisibilityFlag(n.SCALE_RANGE,r,c.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(h,t)&&(l=!0))})),l&&(this.layerView.view.deconflictor.setDirty(),this.layerView.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(n.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function y(e,i){return e>0||i>0}e([r({constructOnly:!0})],p.prototype,"layerScaleEnabled",void 0),e([r({readOnly:!0})],p.prototype,"suspended",void 0),e([r({readOnly:!0})],p.prototype,"updating",void 0),p=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],p);const u="terrain-events",d=p;export{d as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{isSome as s,isNone as a}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{VisibilityFlag as n,VisibilityGroup as c}from"./enums.js";import{scaleBoundsPredicate as h}from"../../../support/layerViewUtils.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let p=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,a){this.graphicsCoreOwner=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=a,this.updateScaleRangeActive();const r=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(r.registerTask(o.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.graphicsCoreOwner=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&u(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&u(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(d)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),d),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),d)):!t&&this.handles.has(d)&&this.handles.remove(d),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||h(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return h(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(s(e.centroid)?i=e.centroid:s(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(n.SCALE_RANGE,i,c.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(n.SCALE_RANGE,s,c.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.graphicsCoreOwner.suspended)return;const i=e.extent,t=e.scale,r=this._visibleAtLayerScale(t);let l=!1;this.queryGraphicUIDsInExtent(i,e.spatialReference,(e=>{const h=this.graphicsCore.getGraphics3DGraphicById(e);if(a(h))return;const o=h.centroid;s(o)&&(i[0]>o.x||i[1]>o.y||i[2]<o.x||i[3]<o.y)||(h.setVisibilityFlag(n.SCALE_RANGE,r,c.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(h,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(n.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function u(e,i){return e>0||i>0}e([r({constructOnly:!0})],p.prototype,"layerScaleEnabled",void 0),e([r({readOnly:!0})],p.prototype,"suspended",void 0),e([r({readOnly:!0})],p.prototype,"updating",void 0),p=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],p);const d="terrain-events",y=p;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){this.schedule=e,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.layerView=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.isAsync=!1}}class l{}export{e as Graphics3DSymbolCreationContext,l as Graphics3DSymbolLayerCreationContext};
5
+ class e{constructor(e){this.schedule=e,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.isAsync=!1}}class l{}export{e as Graphics3DSymbolCreationContext,l as Graphics3DSymbolLayerCreationContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as o,unwrap as i,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,o,i){super(o.schedule),this._context=o,this._elevationInfoOverride=null,this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.symbol=e,this.symbolLayer=t,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._updateDrivenProperties(i.ignoreDrivers),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,o,i){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${i} geometry failed to be created`;let a=null;r?!t.length||1===t.length&&!t[0].length?a=`${s} (no ${o} were defined)`:Array.isArray(t)&&Array.isArray(t[0])?n&&0===n.length&&"rings"===o&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (${o} should be defined as a 2D array)`:a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_validateGeometry(e,t=null,i=null){if(o(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){o(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const o=i(e.geometry),n=this.getDefaultElevationInfo(o);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(o,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_updateDrivenProperties(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};if(e)return void(this._drivenProperties=t);const o=this._context.renderer;o&&"visualVariables"in o&&o.visualVariables&&o.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let o=0;o<e.stops.length;o++){const i=e.stops[o].color;i&&(t.opacity=!0,i.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),this._drivenProperties=t}_getLayerOpacity(){if(this._context.layerView&&"fullOpacity"in this._context.layerView)return this._context.layerView.fullOpacity;const e=this._context.layer.opacity;return null==e?1:e}_getCombinedOpacity(e,t=_){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(o(e)?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,i=_){const r=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return d(null,r);const s=o(t)?e.toUnitRGB(t):n;return d(s,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=d(i,r);return o(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,o){switch(e){case"opacity":return this.layerOpacityChanged(t,o);case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,o,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,o);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,i){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(o(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return c.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,o=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(o,i,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}}function v(e,t){const o=null!=e?t.attributes[e]:0;return null!=o&&isFinite(o)?o:0}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},_={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,y as default,v as getAttributeValue};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as o,unwrap as i,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,o,i){super(o.schedule),this._context=o,this._elevationInfoOverride=null,this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.symbol=e,this.symbolLayer=t,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._updateDrivenProperties(i.ignoreDrivers),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,o,i){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${i} geometry failed to be created`;let a=null;r?!t.length||1===t.length&&!t[0].length?a=`${s} (no ${o} were defined)`:Array.isArray(t)&&Array.isArray(t[0])?n&&0===n.length&&"rings"===o&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (${o} should be defined as a 2D array)`:a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_validateGeometry(e,t=null,i=null){if(o(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){o(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const o=i(e.geometry),n=this.getDefaultElevationInfo(o);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(o,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_updateDrivenProperties(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};if(e)return void(this._drivenProperties=t);const o=this._context.renderer;o&&"visualVariables"in o&&o.visualVariables&&o.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let o=0;o<e.stops.length;o++){const i=e.stops[o].color;i&&(t.opacity=!0,i.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),this._drivenProperties=t}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity;const e=this._context.layer.opacity;return null==e?1:e}_getCombinedOpacity(e,t=_){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(o(e)?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,i=_){const r=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return d(null,r);const s=o(t)?e.toUnitRGB(t):n;return d(s,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=d(i,r);return o(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,o){switch(e){case"opacity":return this.layerOpacityChanged(t,o);case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,o,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,o);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,i){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(o(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return c.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,o=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(o,i,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}}function v(e,t){const o=null!=e?t.attributes[e]:0;return null!=o&&isFinite(o)?o:0}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},_={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,y as default,v as getAttributeValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{isNone as t,get as r,isSome as n}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{a as o}from"../../../../chunks/vec2f64.js";import{isCalloutSupport as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{ElevationContext as h}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as f,namedAnchorToHUDMaterialAnchorPos as p}from"./graphicUtils.js";import{placePointOnGeometry as g,createStageObjectForHUD as u,extendPointGraphicElevationContext as y}from"./pointUtils.js";import b from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as x}from"../../webgl-engine/lib/TextRenderParameters.js";import v from"../../webgl-engine/lib/TextTexture.js";import{HUDMaterial as O}from"../../webgl-engine/materials/HUDMaterial.js";const w=[0,0,1];class P extends m{constructor(e,t,r,n){super(e,t,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=f(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.layerView.view.pixelRatio;this._textRenderParameters=await x.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const r=e.graphic,n=g(r.geometry);if(t(n))return this.logger.warn(`unsupported geometry type for text symbol: ${r.geometry.type}`),null;const s=this.symbolLayer.text;if(t(s)||""===s)return null;const o=i(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol:null,a={..._,anchor:this._anchorFromAlignment(this.symbolLayer.horizontalAlignment,this.symbolLayer.verticalAlignment)};return this._createAs3DShape(r,n,s,o,a)}createLabel(e,r,n,s){const o=e.graphic,i=g(o.geometry);if(t(i))return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=r.text;return!a||/^\s+$/.test(a)?null:this._createAs3DShape(o,i,a,r,r,n,s)}setGraphicElevationContext(e,t,r=0){const n=super.setGraphicElevationContext(e,t);return n.addOffsetRenderUnits(r),n}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return E(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),l.UPDATE}slicePlaneEnabledChanged(e,t){return E(e,t,(e=>{for(const t of e.stageObject.geometryRecords)t.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,t.metadata.elevationOffset),t.needsElevationUpdates=c(t.elevationContext.mode)||"absolute-height"===t.elevationContext.mode}_defaultElevationInfoNoZ(){return S}_createAs3DShape(e,i,l,m,f=_,g,x){const P=this.setGraphicElevationContext(e,new h,f.elevationOffset),E="polyline"===r(e.geometry,"type"),S=e.uid,j=this._context.stage.renderView.renderingContext,L=f.anchor in p?f.anchor:"center",C=p[L],G=t(x)?new v(j,l,this._textRenderParameters):null,D={occlusionTest:!0,screenOffset:f.screenOffset,anchorPos:C,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:f.centerOffsetUnits,debugDrawLabelBorder:f.debugDrawLabelBorder,drawInSecondSlot:!0};if(n(G)&&(D.textureId=G.id,D.texCoordScale=G.texcoordScale),n(x)&&(D.textureId=x.id),n(m)&&n(m.verticalOffset)){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.verticalOffset;D.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources;D.screenSizePerspective=t.overridePadding(this._textRenderParameters.haloSize),D.screenSizePerspectiveAlignment=e}let U;if(E&&(D.shaderPolygonOffset=1e-4),D.slicePlaneEnabled=this._context.slicePlaneEnabled,n(g)){const e=JSON.stringify(D);U=g.get(e),t(U)&&(U=new O(D),g.add(e,U))}else U=new O(D);const A=[U],R=f.translation,z=n(G)?[G.displayWidth,G.displayHeight]:[0,0],T=f.centerOffset,W=w,I=[0,0],B=[b.createPointGeometry(W,R,null,z,T,I,null)],H=this._context.layer.uid,V=u(this._context,i,B,A,P,H,S);if(null===V)return null;const $=new d(this,V.object,B,t(g)?A:null,n(G)?[G]:null,a,P);$.alignedSampledElevation=V.sampledElevation,$.needsElevationUpdates=c(P.mode)||"absolute-height"===P.mode;const{displayWidth:F,displayHeight:N}=n(G)?G:f;$.getScreenSize=(e=o())=>(e[0]=F,e[1]=N,e);const k={labelText:l,elevationOffset:f.elevationOffset};return $.metadata=k,y($,i,this._context.elevationProvider),$}_anchorFromAlignment(e,t){switch(t){case"bottom":return"left"===e?"bottom-left":"right"===e?"bottom-right":"bottom";case"baseline":case"middle":return"justify"===e?"center":e;case"top":return"left"===e?"top-left":"right"===e?"top-right":"top"}}}function E(e,t,r){e&&e.forEach((e=>{const s=t(e);n(s)&&r(s,e.graphic)}))}const S={mode:"relative-to-ground",offset:0},_={text:null,translation:[0,0,0],elevationOffset:0,centerOffset:[0,0,0,1],screenOffset:[0,0],anchor:"center",verticalOffset:null,centerOffsetUnits:null,debugDrawLabelBorder:!1,displayWidth:0,displayHeight:0};export{P as Graphics3DTextSymbolLayer,P as default};
5
+ import e from"../../../../core/Error.js";import{isNone as t,get as r,isSome as n}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{a as o}from"../../../../chunks/vec2f64.js";import{isCalloutSupport as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{ElevationContext as h}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as f,namedAnchorToHUDMaterialAnchorPos as p}from"./graphicUtils.js";import{placePointOnGeometry as g,createStageObjectForHUD as u,extendPointGraphicElevationContext as y}from"./pointUtils.js";import b from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as x}from"../../webgl-engine/lib/TextRenderParameters.js";import v from"../../webgl-engine/lib/TextTexture.js";import{HUDMaterial as O}from"../../webgl-engine/materials/HUDMaterial.js";const w=[0,0,1];class P extends m{constructor(e,t,r,n){super(e,t,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=f(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.pixelRatio;this._textRenderParameters=await x.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const r=e.graphic,n=g(r.geometry);if(t(n))return this.logger.warn(`unsupported geometry type for text symbol: ${r.geometry.type}`),null;const s=this.symbolLayer.text;if(t(s)||""===s)return null;const o=i(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol:null,a={..._,anchor:this._anchorFromAlignment(this.symbolLayer.horizontalAlignment,this.symbolLayer.verticalAlignment)};return this._createAs3DShape(r,n,s,o,a)}createLabel(e,r,n,s){const o=e.graphic,i=g(o.geometry);if(t(i))return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=r.text;return!a||/^\s+$/.test(a)?null:this._createAs3DShape(o,i,a,r,r,n,s)}setGraphicElevationContext(e,t,r=0){const n=super.setGraphicElevationContext(e,t);return n.addOffsetRenderUnits(r),n}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return E(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),l.UPDATE}slicePlaneEnabledChanged(e,t){return E(e,t,(e=>{for(const t of e.stageObject.geometryRecords)t.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,t.metadata.elevationOffset),t.needsElevationUpdates=c(t.elevationContext.mode)||"absolute-height"===t.elevationContext.mode}_defaultElevationInfoNoZ(){return S}_createAs3DShape(e,i,l,m,f=_,g,x){const P=this.setGraphicElevationContext(e,new h,f.elevationOffset),E="polyline"===r(e.geometry,"type"),S=e.uid,j=this._context.stage.renderView.renderingContext,L=f.anchor in p?f.anchor:"center",C=p[L],G=t(x)?new v(j,l,this._textRenderParameters):null,D={occlusionTest:!0,screenOffset:f.screenOffset,anchorPos:C,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:f.centerOffsetUnits,debugDrawLabelBorder:f.debugDrawLabelBorder,drawInSecondSlot:!0};if(n(G)&&(D.textureId=G.id,D.texCoordScale=G.texcoordScale),n(x)&&(D.textureId=x.id),n(m)&&n(m.verticalOffset)){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.verticalOffset;D.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources;D.screenSizePerspective=t.overridePadding(this._textRenderParameters.haloSize),D.screenSizePerspectiveAlignment=e}let U;if(E&&(D.shaderPolygonOffset=1e-4),D.slicePlaneEnabled=this._context.slicePlaneEnabled,n(g)){const e=JSON.stringify(D);U=g.get(e),t(U)&&(U=new O(D),g.add(e,U))}else U=new O(D);const A=[U],R=f.translation,z=n(G)?[G.displayWidth,G.displayHeight]:[0,0],T=f.centerOffset,W=w,I=[0,0],B=[b.createPointGeometry(W,R,null,z,T,I,null)],H=this._context.layer.uid,V=u(this._context,i,B,A,P,H,S);if(null===V)return null;const $=new d(this,V.object,B,t(g)?A:null,n(G)?[G]:null,a,P);$.alignedSampledElevation=V.sampledElevation,$.needsElevationUpdates=c(P.mode)||"absolute-height"===P.mode;const{displayWidth:F,displayHeight:N}=n(G)?G:f;$.getScreenSize=(e=o())=>(e[0]=F,e[1]=N,e);const k={labelText:l,elevationOffset:f.elevationOffset};return $.metadata=k,y($,i,this._context.elevationProvider),$}_anchorFromAlignment(e,t){switch(t){case"bottom":return"left"===e?"bottom-left":"right"===e?"bottom-right":"bottom";case"baseline":case"middle":return"justify"===e?"center":e;case"top":return"left"===e?"top-left":"right"===e?"top-right":"top"}}}function E(e,t,r){e&&e.forEach((e=>{const s=t(e);n(s)&&r(s,e.graphic)}))}const S={mode:"relative-to-ground",offset:0},_={text:null,translation:[0,0,0],elevationOffset:0,centerOffset:[0,0,0,1],screenOffset:[0,0],anchor:"center",verticalOffset:null,centerOffsetUnits:null,debugDrawLabelBorder:!1,displayWidth:0,displayHeight:0};export{P as Graphics3DTextSymbolLayer,P 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{isSome as a,destroyMaybe as o,isNone as n}from"../../../../core/maybe.js";import{isAbortError as c}from"../../../../core/promiseUtils.js";import{init as p}from"../../../../core/watchUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as d}from"../../../../core/accessorSupport/diffUtils.js";import u from"../../../../layers/Layer.js";import{hydrateGraphic as g}from"../../../../layers/graphics/hydratedFeatures.js";import m from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as y}from"./constants.js";import{Graphics3DCore as f}from"./Graphics3DCore.js";import b from"./Graphics3DElevationAlignment.js";import{Graphics3DObjectStates as j}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as C}from"./graphicUtils.js";import{UpdatePolicy as S,Object3DState as v}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as x}from"../../../support/WatchUpdatingTracking.js";let E=class extends i{constructor(t){super(t),this.type="graphics-3d",this.graphicsCore=null,this.elevationAlignment=new b,this.watchUpdatingTracking=new x,this.handles=new r,this.suspendResumeExtent=null}normalizeCtorArgs(t){let e=null;t.scaleVisibilityEnabled&&(delete(t={...t}).scaleVisibilityEnabled,e=new w);const i=new f({owner:t.owner,layer:t.layer,preferredUpdatePolicy:S.SYNC,graphicSymbolSupported:!0});return{...t,graphicsCore:i,scaleVisibility:e}}initialize(){const{layer:t,scaleVisibility:e}=this;a(e)&&"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.effectiveScaleRange),(()=>e.layerMinMaxScaleChangeHandler())),"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.elevationInfo),((t,e)=>{d(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())}))}async setup(){const t=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.elevationAlignment.setup(this.owner,t,this.graphicsCore,this.view.elevationProvider),a(this.scaleVisibility)&&"effectiveScaleRange"in this.layer){const e=this.owner.view.basemapTerrain;this.scaleVisibility.setup(this.owner,this.layer,t,this.graphicsCore,e)}this._set("objectStates",new j(this.graphicsCore));try{await this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,objectStates:this.objectStates})}catch(e){if(c(e))return;throw e}this.destroyed||(this.handles.add(this.view.watch("clippingArea",(()=>this._updateClippingExtent()),!0)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this.handles=o(this.handles),this.watchUpdatingTracking.destroy(),this._set("elevationAlignment",o(this.elevationAlignment)),this._set("scaleVisibility",o(this.scaleVisibility)),this._set("objectStates",o(this.objectStates)),this._set("graphicsCore",o(this.graphicsCore))}get suspended(){return!(!a(this.scaleVisibility)||!this.scaleVisibility.suspended)}get updating(){var t,e;return!!(null!=(t=this.graphicsCore)&&t.updating||a(this.scaleVisibility)&&this.scaleVisibility.updating||null!=(e=this.watchUpdatingTracking)&&e.updating)}getGraphicFromGraphicUid(t){if(this.owner.loadedGraphics){const e=this.owner.loadedGraphics.find((e=>e.uid===t));if(e){const t=this.layer instanceof u?this.layer:null;return g(e,t)}}}whenGraphicBounds(t,e){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(t,e):Promise.reject()}computeAttachmentOrigin(t,e){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(t,e):null}getSymbolLayerSize(t,e){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(t,e):null}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(v.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t){if(t instanceof m)return V;if("number"==typeof t)return this.highlight([t]);if(t instanceof e)return this.highlight([t]);if(t instanceof s&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setUids(i,e),s}if("number"==typeof t[0]){const e=t,{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setObjectIds(i,e),s}}return V}_updateClippingExtent(){const t=this.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}_updateSuspendResumeExtent(){n(this.scaleVisibility)||(this.suspendResumeExtent=C(this.graphicsCore.computedExtent,this.suspendResumeExtent,y,this.graphicsCore.extentPadding),this.scaleVisibility.setExtent(this.suspendResumeExtent))}_setupSuspendResumeExtent(){n(this.scaleVisibility)||(p(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent()),!0),this.graphicsCore.watch("extentPadding",(t=>this._updateSuspendResumeExtent())))}};t([h()],E.prototype,"type",void 0),t([h({constructOnly:!0})],E.prototype,"owner",void 0),t([h({constructOnly:!0})],E.prototype,"layer",void 0),t([h({readOnly:!0,aliasOf:"owner.view"})],E.prototype,"view",void 0),t([h({constructOnly:!0})],E.prototype,"graphicsCore",void 0),t([h({constructOnly:!0})],E.prototype,"scaleVisibility",void 0),t([h({readOnly:!0})],E.prototype,"elevationAlignment",void 0),t([h({readOnly:!0})],E.prototype,"objectStates",void 0),t([h({readOnly:!0})],E.prototype,"watchUpdatingTracking",void 0),t([h({readOnly:!0})],E.prototype,"suspended",null),t([h({readOnly:!0})],E.prototype,"updating",null),E=t([l("esri.views.3d.layers.graphics.Graphics3DGraphicLikeLayerView")],E);const V={remove(){},pause(){},resume(){}},A=E;export{A as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{isSome as a,destroyMaybe as o,isNone as n}from"../../../../core/maybe.js";import{isAbortError as c}from"../../../../core/promiseUtils.js";import{init as p}from"../../../../core/watchUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as d}from"../../../../core/accessorSupport/diffUtils.js";import u from"../../../../layers/Layer.js";import{hydrateGraphic as g}from"../../../../layers/graphics/hydratedFeatures.js";import m from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as y}from"./constants.js";import{Graphics3DCore as f}from"./Graphics3DCore.js";import b from"./Graphics3DElevationAlignment.js";import{Graphics3DObjectStates as j}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as C}from"./graphicUtils.js";import{UpdatePolicy as S,Object3DState as v}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as x}from"../../../support/WatchUpdatingTracking.js";let E=class extends i{constructor(t){super(t),this.type="graphics-3d",this.graphicsCore=null,this.elevationAlignment=new b,this.watchUpdatingTracking=new x,this.handles=new r,this.suspendResumeExtent=null}normalizeCtorArgs(t){let e=null;t.scaleVisibilityEnabled&&(delete(t={...t}).scaleVisibilityEnabled,e=new w);const i=new f({owner:t.owner,layer:t.layer,preferredUpdatePolicy:S.SYNC,graphicSymbolSupported:!0});return{...t,graphicsCore:i,scaleVisibility:e}}initialize(){const{layer:t,scaleVisibility:e}=this;a(e)&&"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.effectiveScaleRange),(()=>e.layerMinMaxScaleChangeHandler())),"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.elevationInfo),((t,e)=>{d(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())}))}async setup(){const t=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.elevationAlignment.setup(this.owner,t,this.graphicsCore,this.view.elevationProvider),a(this.scaleVisibility)&&"effectiveScaleRange"in this.layer){const e=this.owner.view.basemapTerrain;this.scaleVisibility.setup(this.owner,this.layer,t,this.graphicsCore,e)}this._set("objectStates",new j(this.graphicsCore));try{await this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,objectStates:this.objectStates})}catch(e){if(c(e))return;throw e}this.destroyed||(this.handles.add(this.view.watch("clippingArea",(()=>this._updateClippingExtent()),!0)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this.handles=o(this.handles),this.watchUpdatingTracking.destroy(),this._set("elevationAlignment",o(this.elevationAlignment)),this._set("scaleVisibility",o(this.scaleVisibility)),this._set("objectStates",o(this.objectStates)),this._set("graphicsCore",o(this.graphicsCore))}get suspended(){return!(!a(this.scaleVisibility)||!this.scaleVisibility.suspended)}get updating(){var t,e;return!!(null!=(t=this.graphicsCore)&&t.updating||a(this.scaleVisibility)&&this.scaleVisibility.updating||null!=(e=this.watchUpdatingTracking)&&e.updating)}getGraphicFromGraphicUid(t){if(this.owner.loadedGraphics){const e=this.owner.loadedGraphics.find((e=>e.uid===t));if(e){const t=this.layer instanceof u?this.layer:null;return g(e,t)}}}whenGraphicBounds(t,e){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(t,e):Promise.reject()}computeAttachmentOrigin(t,e){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(t,e):null}getSymbolLayerSize(t,e){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(t,e):null}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(v.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t){if(t instanceof m)return V;if("number"==typeof t)return this.highlight([t]);if(t instanceof e)return this.highlight([t]);if(t instanceof s&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setUids(i,e),s}if("number"==typeof t[0]){const e=t,{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setObjectIds(i,e),s}}return V}_updateClippingExtent(){const t=this.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}_updateSuspendResumeExtent(){n(this.scaleVisibility)||(this.suspendResumeExtent=C(this.graphicsCore.computedExtent,this.suspendResumeExtent,y,this.graphicsCore.extentPadding),this.scaleVisibility.setExtent(this.suspendResumeExtent))}_setupSuspendResumeExtent(){n(this.scaleVisibility)||(p(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent()),!0),this.graphicsCore.watch("extentPadding",(t=>this._updateSuspendResumeExtent())))}};t([h()],E.prototype,"type",void 0),t([h({constructOnly:!0})],E.prototype,"owner",void 0),t([h({constructOnly:!0})],E.prototype,"layer",void 0),t([h({readOnly:!0,aliasOf:"owner.view"})],E.prototype,"view",void 0),t([h({constructOnly:!0})],E.prototype,"graphicsCore",void 0),t([h({constructOnly:!0})],E.prototype,"scaleVisibility",void 0),t([h({readOnly:!0})],E.prototype,"elevationAlignment",void 0),t([h({readOnly:!0})],E.prototype,"objectStates",void 0),t([h({readOnly:!0})],E.prototype,"watchUpdatingTracking",void 0),t([h({readOnly:!0})],E.prototype,"suspended",null),t([h({readOnly:!0})],E.prototype,"updating",null),E=t([l("esri.views.3d.layers.graphics.GraphicsProcessor")],E);const V={remove(){},pause(){},resume(){}},A=E;export{A as default};
@@ -0,0 +1,4 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{isNone as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Extent.js";import o from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let l=class extends r{constructor(e){super(e),this._dataQueryEngineInstance=null}get queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get dataQueryEngine(){return this._ensureDataQueryEngine()}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,r){return this.dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e),r)}async executeQueryForCount(e,r){return this.dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:t,extent:s}=await this.dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:t,extent:n.fromJSON(s)}}async executeQueryForIds(e,r){return this.dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQueryForLatestObservations(e,r){const t=await this.dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,r){const t=await this.dataQueryEngine.executeQuery(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e){return t(e)?this.defaultQueryJSON:("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),e.toJSON())}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,r=this.layer.objectIdField,t=y.toJSON(this.queryGeometryType),s=this.layer.fields.map((e=>e.toJSON())),a=this.layerView.view.resourceController.scheduler,n=this.priority,o=this.spatialReference.toJSON(),i=this.layerView.graphics3d.featureStore,{hasZ:u,hasM:l}=this.layerView;return this._dataQueryEngineInstance=new c({hasZ:u,hasM:l,geometryType:t,fields:s,timeInfo:e,spatialReference:o,objectIdField:r,featureStore:i,scheduler:a,priority:n}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],l.prototype,"layerView",void 0),e([s({constructOnly:!0})],l.prototype,"priority",void 0),e([s({readOnly:!0,aliasOf:"layerView.view.spatialReference"})],l.prototype,"spatialReference",void 0),e([s({readOnly:!0,aliasOf:"layerView.layer"})],l.prototype,"layer",void 0),e([s({readOnly:!0})],l.prototype,"queryGeometryType",null),e([s({readOnly:!0})],l.prototype,"defaultQueryJSON",null),l=e([a("esri.views.3d.layers.graphics.QueryEngine")],l);const p=l;export{l as QueryEngine,p as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{isNone as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Extent.js";import o from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let l=class extends r{constructor(e){super(e),this._dataQueryEngineInstance=null}get queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get dataQueryEngine(){return this._ensureDataQueryEngine()}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,r){return this.dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e),r)}async executeQueryForCount(e,r){return this.dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:t,extent:s}=await this.dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:t,extent:n.fromJSON(s)}}async executeQueryForIds(e,r){return this.dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQueryForLatestObservations(e,r){const t=await this.dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,r){const t=await this.dataQueryEngine.executeQuery(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e){return t(e)?this.defaultQueryJSON:("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),e.toJSON())}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,r=this.layer.objectIdField,t=y.toJSON(this.queryGeometryType),s=this.layer.fields.map((e=>e.toJSON())),a=this.layerView.view.resourceController.scheduler,n=this.priority,o=this.spatialReference.toJSON(),i=this.layerView.processor.featureStore,{hasZ:u,hasM:l}=this.layerView;return this._dataQueryEngineInstance=new c({hasZ:u,hasM:l,geometryType:t,fields:s,timeInfo:e,spatialReference:o,objectIdField:r,featureStore:i,scheduler:a,priority:n}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],l.prototype,"layerView",void 0),e([s({constructOnly:!0})],l.prototype,"priority",void 0),e([s({readOnly:!0,aliasOf:"layerView.view.spatialReference"})],l.prototype,"spatialReference",void 0),e([s({readOnly:!0,aliasOf:"layerView.layer"})],l.prototype,"layer",void 0),e([s({readOnly:!0})],l.prototype,"queryGeometryType",null),e([s({readOnly:!0})],l.prototype,"defaultQueryJSON",null),l=e([a("esri.views.3d.layers.graphics.QueryEngine")],l);const p=l;export{l as QueryEngine,p as default};