@arcgis/core 4.33.0-next.20250415 → 4.33.0-next.20250416

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 (147) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{3a84ee5d0434362286a6.js → 07f206719763173faa8d.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{029705c229ccf2e6b78d.js → 29283c19e1ccdc6cfbde.js} +8 -8
  4. package/assets/esri/core/workers/chunks/{ed517687b3728fd2eb64.js → 2fd5b48976cefe7cc0ab.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{4e711f4fa1cbedf4dae5.js → 42aab2a336ee22fd9055.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{d88544ac332be633e3fe.js → e64e0c3240f8e577a61c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +1 -0
  8. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ar.json +1 -1
  9. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bg.json +1 -1
  10. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bs.json +1 -1
  11. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ca.json +1 -1
  12. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_cs.json +1 -1
  13. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_da.json +1 -1
  14. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_de.json +1 -1
  15. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_el.json +1 -1
  16. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_es.json +1 -1
  17. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_et.json +1 -1
  18. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fi.json +1 -1
  19. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fr.json +1 -1
  20. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_he.json +1 -1
  21. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hr.json +1 -1
  22. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hu.json +1 -1
  23. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_id.json +1 -1
  24. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_it.json +1 -1
  25. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ja.json +1 -1
  26. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ko.json +1 -1
  27. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lt.json +1 -1
  28. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lv.json +1 -1
  29. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_nl.json +1 -1
  30. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_no.json +1 -1
  31. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pl.json +1 -1
  32. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-BR.json +1 -1
  33. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-PT.json +1 -1
  34. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ro.json +1 -1
  35. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ru.json +1 -1
  36. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sk.json +1 -1
  37. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sl.json +1 -1
  38. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sr.json +1 -1
  39. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sv.json +1 -1
  40. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_th.json +1 -1
  41. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_tr.json +1 -1
  42. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_uk.json +1 -1
  43. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_vi.json +1 -1
  44. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-CN.json +1 -1
  45. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-HK.json +1 -1
  46. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-TW.json +1 -1
  47. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ar.json +1 -0
  48. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bg.json +1 -0
  49. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bs.json +1 -0
  50. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ca.json +1 -0
  51. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_cs.json +1 -0
  52. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_da.json +1 -0
  53. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_de.json +1 -0
  54. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_el.json +1 -0
  55. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_es.json +1 -0
  56. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_et.json +1 -0
  57. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fi.json +1 -0
  58. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fr.json +1 -0
  59. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_he.json +1 -0
  60. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hr.json +1 -0
  61. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hu.json +1 -0
  62. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_id.json +1 -0
  63. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_it.json +1 -0
  64. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ja.json +1 -0
  65. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ko.json +1 -0
  66. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lt.json +1 -0
  67. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lv.json +1 -0
  68. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_nl.json +1 -0
  69. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_no.json +1 -0
  70. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pl.json +1 -0
  71. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-BR.json +1 -0
  72. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-PT.json +1 -0
  73. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ro.json +1 -0
  74. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ru.json +1 -0
  75. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sk.json +1 -0
  76. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sl.json +1 -0
  77. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sr.json +1 -0
  78. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sv.json +1 -0
  79. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_th.json +1 -0
  80. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_tr.json +1 -0
  81. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_uk.json +1 -0
  82. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_vi.json +1 -0
  83. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-CN.json +1 -0
  84. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-HK.json +1 -0
  85. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-TW.json +1 -0
  86. package/geometry/support/MeshTexture.js +1 -1
  87. package/interfaces.d.ts +44 -0
  88. package/package.json +1 -1
  89. package/support/revision.js +1 -1
  90. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  91. package/views/3d/interactive/Manipulator3D.js +1 -1
  92. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  93. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  94. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  95. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  96. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  97. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  98. package/views/3d/layers/DrapedSubView3D.js +1 -1
  99. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  100. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  101. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  102. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  103. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  104. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  108. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  110. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  111. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  112. package/views/3d/layers/graphics/Labeler.js +1 -1
  113. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  114. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  115. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  116. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  117. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  118. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  119. package/views/3d/support/MemoryController.js +1 -1
  120. package/views/3d/support/engineContent/line.js +1 -1
  121. package/views/3d/terrain/OverlayRenderer.js +1 -1
  122. package/views/3d/webgl-engine/Stage.js +1 -1
  123. package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +1 -1
  124. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  125. package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
  126. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  127. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  128. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  129. package/views/3d/webgl-engine/lib/IntersectableGeometry.js +5 -0
  130. package/views/3d/webgl-engine/lib/Material.js +1 -1
  131. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  132. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  133. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  134. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  135. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  136. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  137. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  139. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  140. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  141. package/views/support/Scheduler.js +1 -1
  142. package/webscene/Slide.js +1 -1
  143. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  144. package/widgets/Features/FeaturesViewModel.js +1 -1
  145. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  146. package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +0 -1
  147. package/views/3d/webgl-engine/lib/MaterialCollection.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as h}from"../../../../chunks/vec32.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as d}from"../../../../geometry/projection/projectBuffer.js";import{create as u,fromSubBuffer as g,intersectsClippingArea as b}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as _,doubleArrayFrom as y}from"../../../../geometry/support/DoubleArray.js";import{EmissiveSourceMode as v}from"../../../../symbols/support/materialUtils.js";import{needsElevationUpdates3D as w,evaluateElevationAlignmentAtPoint as x,SampleElevationInfo as P}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as j}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as S,pathNumRoundCapExtrusionSubdivisions as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as A}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as R,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as E}from"../../support/ElevationProvider.js";import{NormalType as L}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as O}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as I}from"../../webgl-engine/lib/Object3D.js";import{Path as G}from"../../webgl-engine/lib/Path.js";import{PathBuilder as B}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as F,TriangulationCapBuilder as M,NoCapBuilder as q}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as N}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as T,isPathGeometry as Z}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as J,StaticPathGeometry as K}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Q}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as X,circleProfiles as Y}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as $}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as ee}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as te}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ie}from"../../webgl-engine/materials/PathMaterial.js";const re=["polyline"];class se extends D{constructor(e,t,i,r){super(e,t,i,r,ce(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,i=null!=e.width?e.width:e.height,r=null!=e.height?e.height:i;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[i,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[i,1,r]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?k(this._context.renderer,this._vvConvertOptions):null;const n=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?W.World:W.Path;const c=e.profile||"circle";switch(c){default:case"circle":this._profile=Y[n];break;case"quad":this._profile=X[n]}switch(e.join){case"round":this._extruder=new N(0,S);break;case"bevel":this._extruder=new N(0,1);break;case"miter":this._extruder=new N(.8*Math.PI,1);break;default:this._extruder=new H}const h=e.cap||"butt";switch(h){case"none":this._startCap=new q,this._endCap=new q;break;case"butt":default:this._startCap=new M(this._profile,0),this._endCap=new M(this._profile,0,!0);break;case"square":this._startCap=new M(this._profile,-.5),this._endCap=new M(this._profile,.5,!0);break;case"round":{const e="quad"===c;this._startCap=new F({profile:this._profile,flip:!1,breakNormals:e,subdivisions:C}),this._endCap=new F({profile:this._profile,flip:!0,breakNormals:e,subdivisions:C});break}}const m=this.symbolLayer?.material?.color,f=this._getCombinedOpacityAndColor(m),d=p(f),u=f[3],g=this.needsDrivenTransparentPass,b=e.material?.emissive,_={diffuse:d,ambient:d,emissiveStrength:b?.strength??0,emissiveSource:v.Color,opacity:u,drivenOpacity:g,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let y;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?y=new ie({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=L.Compressed,y=new te(_,this._context)),y.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:y.transparent||"none"===h?O.None:O.Back}),this._materials[0]=y,this._context.stage.add(y)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,re,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t);return this._createAs3DShape(e,i)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,w)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return A.RecreateSymbol;if(!R(this._fastUpdates,t,this._vvConvertOptions))return A.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return A.FastUpdate}_getVertexData(e){let t=0;const i=e.paths,r=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of i)t+=h.length;const n=_(3*t);let l,c=0;for(const h of i){r.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||d(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=y(n):(l=_(3*t),d(n,a,0,l,o,0,t)),{pathVertexDataInfos:r,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const p=new Array,m=n.spatialReference,f=u(),d=this._context.renderCoordsHelper,_=new E(l.vertexDataES),y=a.uid;for(const u of l.pathVertexDataInfos){const e=u.numVertices;if(e<2)continue;const n=u.offset;if(null!=this._context.clippingExtent&&(g(l.vertexDataES,n,e,f),!b(f,this._context.clippingExtent)))continue;const v=new Array,w=n+3*e;for(let i=n;i<w;i+=3){_.offset=i;const e=x(_,this._context.elevationProvider,t,d);h(he,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),d.setAltitude(he,e),l.vertexDataRS[i]=he[0],l.vertexDataRS[i+1]=he[1],l.vertexDataRS[i+2]=he[2],v.push($(this._upVectorAlignment))}const P=new G(v,l.vertexDataES,l.vertexDataRS,n);ae(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new B(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,i=z(e.color?.field,a)??0,r=z(e.opacity?.field,a)??0;S=new J(j,t,i,r)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=oe(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=oe(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const i=new K(j);i.bake(e),t&&i.bakeVertexColors(t),S=i}const C=S.createGeometryData(),D=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:y,layerViewUid:this._context.layerViewUid}),V=new T(this._materials[0],C,S,m,this._stencilWidth,D);V.transformation=i(s(),r,j.path.origin),p.push(V)}if(0===p.length)return null;const v=new I({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:y}),P=new j(this,v,p,null,null,((e,t,i,r,s)=>le(e,t,r,s,this._upVectorAlignment)),t,null);return P.alignedSampledElevation=0,P.needsElevationUpdates=w(t.mode),P}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??f}}function ae(e,t,i){const{origin:r,positions:s}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)he[0]=s[a++]+r[0],he[1]=s[a++]+r[1],he[2]=s[a++]+r[2],i.worldUpAtPosition(he,he),t.setFrameFromUpVector(he);break;case W.Path:he[0]=s[a]+r[0],he[1]=s[a+1]+r[1],he[2]=s[a+2]+r[2],i.worldUpAtPosition(he,he),Q(e,he)}}function oe(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ne(e,t,i,r){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(he,l[p],l[p+1],l[p+2]),i(he,pe),s+=pe.sampledElevation,he[0]=n[p]+a[0],he[1]=n[p+1]+a[1],he[2]=n[p+2]+a[2],r.setAltitude(he,pe.z),n[p]=he[0]-a[0],n[p+1]=he[1]-a[1],n[p+2]=he[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function le(e,t,i,r,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!Z(l))continue;const e=l.path,o=e.builder.path;n+=ne(o,t,i,r),s!==W.World&&ae(o,s,r),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,ee.POSITION)}return n/o.length}function ce(e){return 1===(e.material?.color?.a??1)}const he=m(),pe=new P;export{se as Graphics3DPathSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as h}from"../../../../chunks/vec32.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as d}from"../../../../geometry/projection/projectBuffer.js";import{create as u,fromSubBuffer as b,intersectsClippingArea as g}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{EmissiveSourceMode as v}from"../../../../symbols/support/materialUtils.js";import{needsElevationUpdates3D as w,evaluateElevationAlignmentAtPoint as x,SampleElevationInfo as P}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as j}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as S,pathNumRoundCapExtrusionSubdivisions as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as A}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as R,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as E}from"../../support/ElevationProvider.js";import{NormalType as L}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as O}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as I}from"../../webgl-engine/lib/Object3D.js";import{Path as G}from"../../webgl-engine/lib/Path.js";import{PathBuilder as B}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as F,TriangulationCapBuilder as M,NoCapBuilder as q}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as N}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as T,isPathGeometry as Z}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as J,StaticPathGeometry as K}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Q}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as X,circleProfiles as Y}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as $}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as ee}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as te}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ie}from"../../webgl-engine/materials/PathMaterial.js";const re=["polyline"];class se extends D{constructor(e,t,i,r){super(e,t,i,r,ce(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,i=null!=e.width?e.width:e.height,r=null!=e.height?e.height:i;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[i,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[i,1,r]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?k(this._context.renderer,this._vvConvertOptions):null;const n=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?W.World:W.Path;const c=e.profile||"circle";switch(c){default:case"circle":this._profile=Y[n];break;case"quad":this._profile=X[n]}switch(e.join){case"round":this._extruder=new N(0,S);break;case"bevel":this._extruder=new N(0,1);break;case"miter":this._extruder=new N(.8*Math.PI,1);break;default:this._extruder=new H}const h=e.cap||"butt";switch(h){case"none":this._startCap=new q,this._endCap=new q;break;case"butt":default:this._startCap=new M(this._profile,0),this._endCap=new M(this._profile,0,!0);break;case"square":this._startCap=new M(this._profile,-.5),this._endCap=new M(this._profile,.5,!0);break;case"round":{const e="quad"===c;this._startCap=new F({profile:this._profile,flip:!1,breakNormals:e,subdivisions:C}),this._endCap=new F({profile:this._profile,flip:!0,breakNormals:e,subdivisions:C});break}}const m=this.symbolLayer?.material?.color,f=this._getCombinedOpacityAndColor(m),d=p(f),u=f[3],b=this.needsDrivenTransparentPass,g=e.material?.emissive,y={diffuse:d,ambient:d,emissiveStrength:g?.strength??0,emissiveSource:v.Color,opacity:u,drivenOpacity:b,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let _;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?_=new ie({...y,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(y.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,y.normalType=L.Compressed,_=new te(y,this._context)),_.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:_.transparent||"none"===h?O.None:O.Back}),this._materials[0]=_}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,re,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t);return this._createAs3DShape(e,i)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,w)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return A.RecreateSymbol;if(!R(this._fastUpdates,t,this._vvConvertOptions))return A.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return A.FastUpdate}_getVertexData(e){let t=0;const i=e.paths,r=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of i)t+=h.length;const n=y(3*t);let l,c=0;for(const h of i){r.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||d(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=y(3*t),d(n,a,0,l,o,0,t)),{pathVertexDataInfos:r,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const p=new Array,m=n.spatialReference,f=u(),d=this._context.renderCoordsHelper,y=new E(l.vertexDataES),_=a.uid;for(const u of l.pathVertexDataInfos){const e=u.numVertices;if(e<2)continue;const n=u.offset;if(null!=this._context.clippingExtent&&(b(l.vertexDataES,n,e,f),!g(f,this._context.clippingExtent)))continue;const v=new Array,w=n+3*e;for(let i=n;i<w;i+=3){y.offset=i;const e=x(y,this._context.elevationProvider,t,d);h(he,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),d.setAltitude(he,e),l.vertexDataRS[i]=he[0],l.vertexDataRS[i+1]=he[1],l.vertexDataRS[i+2]=he[2],v.push($(this._upVectorAlignment))}const P=new G(v,l.vertexDataES,l.vertexDataRS,n);ae(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new B(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,i=z(e.color?.field,a)??0,r=z(e.opacity?.field,a)??0;S=new J(j,t,i,r)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=oe(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=oe(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const i=new K(j);i.bake(e),t&&i.bakeVertexColors(t),S=i}const C=S.createGeometryData(),D=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:_,layerViewUid:this._context.layerViewUid}),V=new T(this._materials[0],C,S,m,this._stencilWidth,D);V.transformation=i(s(),r,j.path.origin),p.push(V)}if(0===p.length)return null;const v=new I({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:_}),P=new j(this,v,null,((e,t,i,r,s)=>le(e,t,r,s,this._upVectorAlignment)),t,null);return P.alignedSampledElevation=0,P.needsElevationUpdates=w(t.mode),P}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??f}}function ae(e,t,i){const{origin:r,positions:s}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)he[0]=s[a++]+r[0],he[1]=s[a++]+r[1],he[2]=s[a++]+r[2],i.worldUpAtPosition(he,he),t.setFrameFromUpVector(he);break;case W.Path:he[0]=s[a]+r[0],he[1]=s[a+1]+r[1],he[2]=s[a+2]+r[2],i.worldUpAtPosition(he,he),Q(e,he)}}function oe(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ne(e,t,i,r){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(he,l[p],l[p+1],l[p+2]),i(he,pe),s+=pe.sampledElevation,he[0]=n[p]+a[0],he[1]=n[p+1]+a[1],he[2]=n[p+2]+a[2],r.setAltitude(he,pe.z),n[p]=he[0]-a[0],n[p+1]=he[1]-a[1],n[p+2]=he[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function le(e,t,i,r,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!Z(l))continue;const e=l.path,o=e.builder.path;n+=ne(o,t,i,r),s!==W.World&&ae(o,s,r),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,ee.POSITION)}return n/o.length}function ce(e){return 1===(e.material?.color?.a??1)}const he=m(),pe=new P;export{se as Graphics3DPathSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,intersectsClippingArea as s,empty as n,expandWithAABB as a,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as f}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as b}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as D,PolygonCreationDataBase as A}from"./polygonUtils.js";import{initFastSymbolUpdatesState as j,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as F}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as L}from"../support/uvUtils.js";import{createGeometry as w}from"../../support/engineContent/line.js";import{geometryToRenderInfo as R,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"];class H extends f{static{this.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE}}constructor(e,t,i,r){super(e,t,i,r,Q(t)),this._needsUV=!1}async doLoad(){this._fastUpdates=j(this._context.renderer,this._vvConvertOptions)}_createMaterials(){if(this._materials.length>0)return;const e=this.symbolLayer?.material?.color,i=this._getCombinedOpacityAndColor(e);this._materials[J.Fill]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[J.Fill]instanceof T;const r=this.symbolLayer.outline;if(K(r)){const e=B(r.pattern);this._materials[J.Outline]=new k({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:O(r.patternCap||"butt")})}this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,this._getFallbackOpacityAndColor(),255),r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return v.RecreateSymbol;this._materials[J.Fill]?.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._materials[J.Fill]){const e=this._materials[J.Fill].parameters.color,t=this.symbolLayer?.material?.color,i=this._getCombinedOpacity(t);this._materials[J.Fill].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[J.Outline]){const e=this._materials[J.Outline].parameters.color;this._materials[J.Outline].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(H.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const s=y(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){if(this._materials[J.Fill]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[J.Outline]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[J.Outline].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=x(e.geometry);if(!r)return null;const o=R(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),s=new W(o,t,this._context.layerViewUid,e.uid),n=s.renderData.position.length/3;if(this._needsUV&&(s.uvMapSpace=h(4*n,!0),s.boundingRect=c(9*n,!0),G(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(e,s),this._materials[J.Outline]&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,r.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const a=new M({geometries:s.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,s.outGeometries,null,null,F,i);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=y(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:n,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(o(n,N),!s(N,this._context.clippingExtent)))continue;const i=C(n,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=D({material:this._materials[J.Fill],indices:i,mapPositions:n,attributeData:{position:r,color:h?null:t.color,colorFeature:h?P(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(o(i,N),!s(N,this._context.clippingExtent)))continue;const t=w(this._materials[J.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=x(e.geometry);if(null==i)return null;this._materials[J.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[J.Outline]&&(this._materials[J.Outline].renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new q(r,t,this._context.layerViewUid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*s,!0),L(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[J.Outline]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:n,holeIndices:l,index:c,count:p}of r){const r=o(n,N);if(!s(r,this._context.clippingExtent))continue;const h=i(n,l,3);if(0===h.length)continue;a(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=D({material:this._materials[J.Fill],indices:h,attributeData:{position:n,color:d?null:t.color,colorFeature:d?P(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new V(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(o(r,N),!s(N,this._context.clippingExtent))continue;a(e.outBoundingBox,N);const n=w(this._materials[J.Outline],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new V(n,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return b(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??r}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._getFallbackOpacityAndColor()})}}const N=l();class W extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}var J;function K(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function Q(e){return 1===(e.material?.color?.a??1)}!function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline"}(J||(J={}));export{H as Graphics3DPolygonFillSymbolLayer};
5
+ import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,intersectsClippingArea as n,empty as s,expandWithAABB as a,create as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as f}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as b}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as D,PolygonCreationDataBase as A}from"./polygonUtils.js";import{initFastSymbolUpdatesState as j,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as F}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as L}from"../support/uvUtils.js";import{createGeometry as w}from"../../support/engineContent/line.js";import{geometryToRenderInfo as R,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as M}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as k}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"];class H extends f{static{this.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE}}constructor(e,t,i,r){super(e,t,i,r,Q(t)),this._needsUV=!1}async doLoad(){this._fastUpdates=j(this._context.renderer,this._vvConvertOptions)}_createMaterials(){if(this._materials.length>0)return;const e=this.symbolLayer?.material?.color,i=this._getCombinedOpacityAndColor(e);this._materials[J.Fill]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[J.Fill]instanceof T;const r=this.symbolLayer.outline;if(K(r)){const e=B(r.pattern);this._materials[J.Outline]=new k({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:O(r.patternCap||"butt")})}}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,this._getFallbackOpacityAndColor(),255),r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return v.RecreateSymbol;this._materials[J.Fill]?.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._materials[J.Fill]){const e=this._materials[J.Fill].parameters.color,t=this.symbolLayer?.material?.color,i=this._getCombinedOpacity(t);this._materials[J.Fill].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[J.Outline]){const e=this._materials[J.Outline].parameters.color;this._materials[J.Outline].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(H.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const n=y(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){if(this._materials[J.Fill]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[J.Outline]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[J.Outline].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=x(e.geometry);if(!r)return null;const o=R(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new W(o,t,this._context.layerViewUid,e.uid),s=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=h(4*s,!0),n.boundingRect=c(9*s,!0),G(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[J.Outline]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,r.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const a=new V({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,F,i);return l.alignedSampledElevation=n.renderData.sampledElevation,l.needsElevationUpdates=y(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:s,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(o(s,N),!n(N,this._context.clippingExtent)))continue;const i=C(s,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=D({material:this._materials[J.Fill],indices:i,mapPositions:s,attributeData:{position:r,color:h?null:t.color,colorFeature:h?P(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(o(i,N),!n(N,this._context.clippingExtent)))continue;const t=w(this._materials[J.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=x(e.geometry);if(null==i)return null;this._materials[J.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[J.Outline]&&(this._materials[J.Outline].renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new q(r,t,this._context.layerViewUid,e.uid),n=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*n,!0),L(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=s(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[J.Outline]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:s,holeIndices:l,index:c,count:p}of r){const r=o(s,N);if(!n(r,this._context.clippingExtent))continue;const h=i(s,l,3);if(0===h.length)continue;a(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=D({material:this._materials[J.Fill],indices:h,attributeData:{position:s,color:d?null:t.color,colorFeature:d?P(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new M(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[J.Outline])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(o(r,N),!n(N,this._context.clippingExtent))continue;a(e.outBoundingBox,N);const s=w(this._materials[J.Outline],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new M(s,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return b(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??r}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._getFallbackOpacityAndColor()})}}const N=l();class W extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends A{constructor(e,t,i,r){super(e,i,r),this.color=t}}var J;function K(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function Q(e){return 1===(e.material?.color?.a??1)}!function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline"}(J||(J={}));export{H as Graphics3DPolygonFillSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as u}from"../support/FastSymbolUpdates.js";const h=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r,o=!0){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=h(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.updateComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer,o)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}*_validMaterials(){for(const e of this._materials)null!=e&&(yield e)}get usedMemory(){const e=this.complexity;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e,this._drivenOpacityFallbackAlwaysOpaque);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size||i.rotation!==t.rotation}get needsDrivenTransparentPass(){return(this._drivenProperties.color||this._drivenProperties.opacity)&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&h().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):h().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}updateFocus(e,t){}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(h().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(h().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return h().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&h().warnOnce("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){null!=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=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){const i=this.draped?1:this._getLayerOpacity();return this._drivenProperties.opacity||this._drivenProperties.color?i:e?i*e.a:t.hasIntrinsicColor?i:0}_getCombinedOpacityAndColor(t,r=v){const o=this._getCombinedOpacity(t,r);if(this._drivenProperties.color)return p(null,o);const n=null!=t?e.toUnitRGB(t):i;return p(n,o)}_getVertexOpacityAndColor(e,t,i=null){const r=this._drivenProperties.color?e.color??t:null,o=this._drivenProperties.opacity?e.opacity??t[3]:null,n=p(r,o);return i&&(n[0]*=i,n[1]*=i,n[2]*=i,n[3]*=i),n}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return n(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==s.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let r=s.UPDATE;return e.forEach((e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=i(o.elevationContext.mode)}else r=s.RECREATE})),r}applyRendererDiff(e,t){return c.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?u(t.size.field,e):0,o=t.color?u(t.color.field,e):0,n=t.opacity?u(t.opacity.field,e):0;return r(i,o,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&h().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)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function f(e,t){const i={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(i.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const r=e.stops[t].color;r&&r.a<1&&(i.opacityAlwaysOpaque=!1)}break;case"opacity":i.opacity=!0,i.opacityAlwaysOpaque=!1;break;case"size":i.size=!0;break;case"rotation":i.rotation=!0}})),i}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},v={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,f as getDrivenProperties};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as u}from"../support/FastSymbolUpdates.js";const h=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r,o=!0){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=h(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.updateComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer,o)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get usedMemory(){const e=this.complexity;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e,this._drivenOpacityFallbackAlwaysOpaque);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size||i.rotation!==t.rotation}get needsDrivenTransparentPass(){return(this._drivenProperties.color||this._drivenProperties.opacity)&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&h().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):h().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}updateFocus(e,t){}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(h().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(h().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return h().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&h().warnOnce("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){null!=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=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){const i=this.draped?1:this._getLayerOpacity();return this._drivenProperties.opacity||this._drivenProperties.color?i:e?i*e.a:t.hasIntrinsicColor?i:0}_getCombinedOpacityAndColor(t,r=v){const o=this._getCombinedOpacity(t,r);if(this._drivenProperties.color)return p(null,o);const n=null!=t?e.toUnitRGB(t):i;return p(n,o)}_getVertexOpacityAndColor(e,t,i=null){const r=this._drivenProperties.color?e.color??t:null,o=this._drivenProperties.opacity?e.opacity??t[3]:null,n=p(r,o);return i&&(n[0]*=i,n[1]*=i,n[2]*=i,n[3]*=i),n}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return n(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==s.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let r=s.UPDATE;return e.forEach((e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=i(o.elevationContext.mode)}else r=s.RECREATE})),r}applyRendererDiff(e,t){return c.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?u(t.size.field,e):0,o=t.color?u(t.color.field,e):0,n=t.opacity?u(t.opacity.field,e):0;return r(i,o,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&h().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)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function f(e,t){const i={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(i.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const r=e.stops[t].color;r&&r.a<1&&(i.opacityAlwaysOpaque=!1)}break;case"opacity":i.opacity=!0,i.opacityAlwaysOpaque=!1;break;case"size":i.size=!0;break;case"rotation":i.rotation=!0}})),i}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},v={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,f as getDrivenProperties};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as n,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{focusAreaHUDColor as f}from"../../../FocusAreas.js";import{perObjectElevationAligner as h}from"./ElevationAligners.js";import{SymbolUpdateType as u,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{ElevationContext as d}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as v}from"./graphicUtils.js";import{LabelParameters as b,LabelPlacement as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as P,verticalPlacementFromAlignment as w,textRenderAlignmentFromHorizontalPlacement as _,horizontalPlacementToAnchorX as j,anchorFromPlacements as E,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as F}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as U}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const H=a(0,0,1);class W extends x{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=v(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this._context.stage.view.focusAreas.containsGeometry(s),o=this.symbolLayer.text;if(null==o||""===o)return null;const n=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=n&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:i}=this.symbolLayer,a=new O(n);P(i,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,w(i));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this._context.stage.view.focusAreas.containsGeometry(s);t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this){const o=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r));o&&e(t)}}))}))}createLabel(e,t,s,r,o){const n=e.graphic,i=L(n.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${n.geometry.type}`),null;const a=this._context.stage.view.focusAreas.containsGeometry(i),l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(n,i,l,t,s,r,o))}setGraphicElevationContext(e,t=new d,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return $(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),u.UPDATE}slicePlaneEnabledChanged(e,t){return $(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=p(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const n=G(r,this._context,o,s);if(null==n)return!1;const i=A(this._context,o);return r.geometries[0].localOrigin===i&&(e.alignedSampledElevation=n,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return M}_createAs3DShape(e,a,c,m,u=null,x=null,v=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new d,m.placement.elevationOffset),O="polyline"===e.geometry?.type,P=e.uid;let w=null,j=null;if(null==x){const e=_(m.horizontalPlacement);w=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){j=this._context.sharedResources.textures.fromData(w.key,(()=>w.create())),j.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(j.texture.id);if(null==e||s(e))return j.release(),null;r=e}}const E=!has("disable-feature:non-occluded-hud"),S=I(w,m),L={occlusionTest:!E,occludedFragmentFade:E,horizonCullingEnabled:E&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if(O&&(L.shaderPolygonOffset=1e-4),x?L.textureId=x.id:j&&(L.textureId=j.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;L.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const G=this._context.graphicsCoreOwner.view.focusAreas.activePolygons.length,A={screenOffset:L.screenOffset,anchorPosition:S,centerOffsetUnits:L.centerOffsetUnits,verticalOffset:L.verticalOffset,shaderPolygonOffset:L.shaderPolygonOffset,occlusionTest:L.occlusionTest,isFocused:m.isFocused,focusEffect:this._context.stage.view.focusAreas?.style};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=F(this._textRenderParameters);L.screenSizePerspective=t.overrideFontHeight(s.maxHeight),L.screenSizePerspectiveAlignment=e,A.fontHeight=s.maxHeight}L.hasSlicePlane=this._context.slicePlaneEnabled;const D=this._context.spherical,W=u?JSON.stringify(A):"";let $=u?.get(W);if(null==$){if(!m.isFocused&&G>0){const e=this._context.stage.view.focusAreas?.style;L.color=f(L.color,e),L.outlineColor=f(L.outlineColor,e)}$=new T(L,D),u?.add(W,$)}const M=m.placement.translation,V=w?o(w.displayWidth,w.displayHeight):n,k=m.placement.centerOffset,N=H,q=x?l(0,0,0,0):null,B=U($,{normal:N,position:M,size:V,centerOffsetAndDistance:k,uvi:q}),J=z(this._context,a,B,b,P);if(null==J)return null;const Y=(t,s,r,o,n,i)=>{const a=v()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return h(t,l,r,o,n,i)},Z=new g(this,J.object,[B],null==u?[$]:null,j,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.needsElevationUpdates=p(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=i())=>(e[0]=w?w.displayWidth:m.displaySize[0],e[1]=w?w.displayHeight:m.displaySize[1],e);const K=new y(m.placement.elevationOffset,c);return Z.metadata=K,C(Z,a,this._context.elevationProvider),Z}}function $(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function I(e,t){if("baseline"===t.verticalPlacement){const s=j[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=E(t.horizontalPlacement,t.verticalPlacement);return S[s]}const M={mode:"relative-to-ground",offset:0};export{W as Graphics3DTextSymbolLayer};
5
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as n,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{focusAreaHUDColor as f}from"../../../FocusAreas.js";import{perObjectElevationAligner as h}from"./ElevationAligners.js";import{SymbolUpdateType as u,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{ElevationContext as d}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as v}from"./graphicUtils.js";import{LabelParameters as b,LabelPlacement as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as P,verticalPlacementFromAlignment as w,textRenderAlignmentFromHorizontalPlacement as _,horizontalPlacementToAnchorX as j,anchorFromPlacements as E,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as F}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as U}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const H=a(0,0,1);class W extends x{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=v(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this._context.stage.view.focusAreas.containsGeometry(s),o=this.symbolLayer.text;if(null==o||""===o)return null;const n=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=n&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:i}=this.symbolLayer,a=new O(n);P(i,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,w(i));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this._context.stage.view.focusAreas.containsGeometry(s);t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this){const o=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r));o&&e(t)}}))}))}createLabel(e,t,s,r,o){const n=e.graphic,i=L(n.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${n.geometry.type}`),null;const a=this._context.stage.view.focusAreas.containsGeometry(i),l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(n,i,l,t,s,r,o))}setGraphicElevationContext(e,t=new d,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return $(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),u.UPDATE}slicePlaneEnabledChanged(e,t){return $(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=p(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const n=G(r,this._context,o,s);if(null==n)return!1;const i=A(this._context,o);return r.geometries[0].localOrigin===i&&(e.alignedSampledElevation=n,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return M}_createAs3DShape(e,a,c,m,u,x=null,v=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new d,m.placement.elevationOffset),O="polyline"===e.geometry?.type,P=e.uid;let w=null,j=null;if(null==x){const e=_(m.horizontalPlacement);w=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){j=this._context.sharedResources.textures.fromData(w.key,(()=>w.create())),j.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(j.texture.id);if(null==e||s(e))return j.release(),null;r=e}}const E=!has("disable-feature:non-occluded-hud"),S=I(w,m),L={occlusionTest:!E,occludedFragmentFade:E,horizonCullingEnabled:E&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if(O&&(L.shaderPolygonOffset=1e-4),x?L.textureId=x.id:j&&(L.textureId=j.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;L.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const G=this._context.graphicsCoreOwner.view.focusAreas.activePolygons.length,A={screenOffset:L.screenOffset,anchorPosition:S,centerOffsetUnits:L.centerOffsetUnits,verticalOffset:L.verticalOffset,shaderPolygonOffset:L.shaderPolygonOffset,occlusionTest:L.occlusionTest,isFocused:m.isFocused,focusEffect:this._context.stage.view.focusAreas?.style};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=F(this._textRenderParameters);L.screenSizePerspective=t.overrideFontHeight(s.maxHeight),L.screenSizePerspectiveAlignment=e,A.fontHeight=s.maxHeight}L.hasSlicePlane=this._context.slicePlaneEnabled;const D=this._context.spherical,W=u?JSON.stringify(A):"";let $=u?.get(W);if(null==$){if(!m.isFocused&&G>0){const e=this._context.stage.view.focusAreas?.style;L.color=f(L.color,e),L.outlineColor=f(L.outlineColor,e)}$=new T(L,D),u?.set(W,$)}const M=m.placement.translation,V=w?o(w.displayWidth,w.displayHeight):n,k=m.placement.centerOffset,N=H,q=x?l(0,0,0,0):null,B=U($,{normal:N,position:M,size:V,centerOffsetAndDistance:k,uvi:q}),J=z(this._context,a,B,b,P);if(null==J)return null;const Y=(t,s,r,o,n,i)=>{const a=v()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return h(t,l,r,o,n,i)},Z=new g(this,J.object,j,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.needsElevationUpdates=p(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=i())=>(e[0]=w?w.displayWidth:m.displaySize[0],e[1]=w?w.displayHeight:m.displaySize[1],e);const K=new y(m.placement.elevationOffset,c);return Z.metadata=K,C(Z,a,this._context.elevationProvider),Z}}function $(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function I(e,t){if("baseline"===t.verticalPlacement){const s=j[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=E(t.horizontalPlacement,t.verticalPlacement);return S[s]}const M={mode:"relative-to-ground",offset:0};export{W as Graphics3DTextSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,intersectsClippingArea as c,empty as h,expandWithAABB as m,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as d,expandPointInPlace as u,create as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as v,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=v(I.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,a.outGeometries,null,null,_,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:h}of t){if(null!=this._context.clippingExtent&&(l(a,k),!c(k,this._context.clippingExtent)))continue;const t=r(a,h,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=h(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!c(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const h=f(t,2*s,2*a),p=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:h}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);d(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),u(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=g(),z=n(),k=p();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,intersectsClippingArea as c,empty as h,expandWithAABB as m,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,expandPointInPlace as d,create as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as x}from"./ElevationAligners.js";import{SymbolUpdateType as v,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:v.RECREATE,staysOnTheGround:v.NONE,onTheGroundChanged:v.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(I.elevationModeChangeTypes,r,o);if(i!==v.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,null,x,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:h}of t){if(null!=this._context.clippingExtent&&(l(a,k),!c(k,this._context.clippingExtent)))continue;const t=r(a,h,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=h(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!c(k,this._context.clippingExtent))continue;m(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const h=f(t,2*s,2*a),p=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:h}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),d(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=g(),z=n(),k=p();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{Deconflictor as e,State as o}from"./Deconflictor.js";import{VisibilityGroup as i}from"./enums.js";import{RenderState as a}from"../../../support/RenderState.js";import{Yield as c}from"../../../support/Yield.js";const n=2e3;let p=class extends e{constructor(r){super(r),this.visibilityGroup=i.LABEL,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(r){if(this.parent.running)return c;const t=performance.now();if(r.state!==a.IDLE&&t-this._lastDeconfliction<n)return c;super.runTask(r),this.state===o.Idle&&(this._lastDeconfliction=t)}enabledChanged(r,t){this.setGraphicsActive(t,r.labelsEnabled)}getGraphicsLayers(r){return r.labelLayers}};r([t({constructOnly:!0})],p.prototype,"parent",void 0),p=r([s("esri.views.3d.layers.graphics.LabelDeconflictor")],p);export{p as LabelDeconflictor};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{Deconflictor as s,State as o}from"./Deconflictor.js";import{VisibilityGroup as i}from"./enums.js";import{RenderState as a}from"../../../support/RenderState.js";import{Yield as c}from"../../../support/Yield.js";const n=2e3;let p=class extends s{constructor(r){super(r),this.visibilityGroup=i.LABEL,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(r){if(this.parent.running)return c;const t=performance.now();if(this.view.state.mode!==a.IDLE&&t-this._lastDeconfliction<n)return c;super.runTask(r),this.state===o.Idle&&(this._lastDeconfliction=t)}enabledChanged(r,t){this.setGraphicsActive(t,r.labelsEnabled)}getGraphicsLayers(r){return r.labelLayers}};r([t({constructOnly:!0})],p.prototype,"parent",void 0),p=r([e("esri.views.3d.layers.graphics.LabelDeconflictor")],p);export{p as LabelDeconflictor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as r,abortMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as T}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as R}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as P}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E}from"../../../support/Scheduler.js";import{Yield as O}from"../../../support/Yield.js";class V{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class F{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0}}class U{constructor(e,t,s,i,l,r,a,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=r,this.disablePlacement=a,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let z=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreas.activePolygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new R({view:this.view}),this._hudMaterialCollection=new I(this.view.stage),this._calloutMaterialCollection=new I(this.view.stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),Z.graphic=null,Z.renderingInfo=null,Z.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreas.containsGeometry(s);t.labelLayers.forEach((s=>{const l=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i));l&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>H(t.stageObject,e)))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(k(t))this._dirty=!0;else if(B(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const r=e.graphics3DCore,a=r.layer,n=a.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,a)=>{const n=s.symbol,h=_(r.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,r.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[a]=new F(s,h,b,i,p.value)}else l.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,a(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,r){const a=new v(s,G(s.anchor),w(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return Z.graphic=t,Z.layer=i,Z.renderingInfo=null,l.createLabel(Z,a,this._hudMaterialCollection,this._textTextureAtlas,(()=>r.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,l){Z.graphic=e,Z.layer=l;const r=i.screenOffset[0];return Z.renderingInfo=new C(null,t,i.translation,i.centerOffset,r,i.centerOffsetUnits,i.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(Z)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(B(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const r=t.graphic,a=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=N(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,r,h,a,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),l=!0;const C=b.graphics3DCalloutSymbolLayer;if(C&&h.hasLabelVerticalOffset){C.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(r,u,C,h,a);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(B(s))return;const i=e.graphics3DGraphic.graphic;for(let r=0;r<s.length;r++){const a=s[r];if(e.textRenderers[r]=null,e.textLabelPlacements[r]=null,null==a?.textRenderParameters)continue;const o=a.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=a.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=D(g);e.textRenderers[r]=new T(n,m,a.textRenderParameters,R.maxSize),e.textLabelPlacements[r]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l._labelClass)continue;if(!e.labelClassContexts[l._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,r=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const a=e.layer,o=new U(this.view.stage,a,e,t,i,l,r,W(a));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>k(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(k(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function M(e,t){e.geometries[0].setAttributeData(P.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],P.SIZE)}function H(e,t){e.geometries[0].setAttributeData(P.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],P.UVI,!0)}function k(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function B(e){return!e||0===e.length}function N(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],z.prototype,"view",void 0),e([h({constructOnly:!0})],z.prototype,"deconflictor",void 0),e([h()],z.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],z.prototype,"updating",null),z=e([b("esri.views.3d.layers.graphics.Labeler")],z);const Z=new x(null,null,null);export{z as Labeler,W as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as x,LineCalloutCreationContext as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,i,r){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=r,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,i,r,a,l,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=r,this.elevationInfoOverride=a,this.disablePlacement=l,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let U=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreas.activePolygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),this._textTextureAtlas=new S({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),W.graphic=null,W.renderingInfo=null,W.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreas.containsGeometry(s);t.labelLayers.forEach((s=>{const r=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i));r&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>H(t.stageObject,e)))),z(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),E}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(M(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,l=a.layer,n=l.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,l)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void r.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[l]=new V(s,h,b,i,p.value)}else r.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,l(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,r,a){const l=new v(s,G(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return W.graphic=t,W.layer=i,W.renderingInfo=null,r.createLabel(W,l,this._hudMaterials,this._textTextureAtlas,(()=>a.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,r){W.graphic=e,W.layer=r;const a=i.screenOffset[0];return W.renderingInfo=new x(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(W,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(k(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let r=!1;const a=t.graphic,l=s.layer,o=N(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=B(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,l,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),r=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,l);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return r&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const l=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==l?.textRenderParameters)continue;const o=l.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(r){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=l.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=l.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=w(g);e.textRenderers[a]=new I(n,m,l.textRenderParameters,S.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const r of i.graphics3DGraphic.labelLayers){if(null==r._labelClass)continue;if(!e.labelClassContexts[r._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(r,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const r=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,r),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=N(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,r=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const l=e.layer,o=new F(this.view.stage,l,e,t,i,r,a,N(l));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>N(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>M(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(M(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function z(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function H(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function M(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return"label-3d"===e.symbol?.type?e.symbol:null}function N(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({constructOnly:!0})],U.prototype,"deconflictor",void 0),e([h()],U.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),U=e([b("esri.views.3d.layers.graphics.Labeler")],U);const W=new C(null,null,null);export{U as Labeler,N as areLabelsVisible};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{DefaultMaterial as a}from"../../webgl-engine/materials/DefaultMaterial.js";class r{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(r,t,e){r.enableFastTransformUpdates((r=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(r))return r;const a=t.byMaterial(r);return this._fastTransformOriginalMaterials.set(r,a),t.delete(r),r}const s=new a(r.parameters,e);return e.stage.add(s),this._fastTransformClonedMaterials.set(s,r),s}),e.localOriginFactory)}disable(a,r,t){const e=new Set,s=new Set;a.disableFastTransformUpdates((a=>{if(!this._fastTransformClonedMaterials.has(a)){const t=a,i=this._fastTransformOriginalMaterials.get(t);return r.has(i.uid)?(e.add(t),r.byUid(i.uid).material):(s.add(t),i.material)}const i=a,n=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),t.stage.remove(i),n}));for(const i of e)this._fastTransformOriginalMaterials.delete(i),t.stage.remove(i);for(const i of s){const a=this._fastTransformOriginalMaterials.get(i);this._fastTransformOriginalMaterials.delete(i),r.set(a.uid,a)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(a,r,t){this._graphicReferenceCount--,this.disable(a,r,t)}forEachMaterialInfo(a){this._fastTransformOriginalMaterials.forEach(a)}forEachClonedMaterial(a){this._fastTransformClonedMaterials.forEach(a)}destroy(a){a.removeMany(Array.from(this._fastTransformClonedMaterials.keys())),a.removeMany(Array.from(this._fastTransformOriginalMaterials.values(),(({material:a})=>a))),this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class t{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),(a=>a.material))}byUid(a){return this._byUid.get(a)}byMaterial(a){return this._byMaterial.get(a)}set(a,r){this._byUid.set(a,r),this._byMaterial.set(r.material,r)}delete(a){const r=this._byMaterial.get(a)?.uid;r&&(this._byUid.delete(r),this._byMaterial.delete(a))}has(a){return this._byUid.has(a)}forEachMaterialInfo(a){this._byUid.forEach(a)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{t as MaterialInfoCache,r as MeshFastUpdateProcessor};
5
+ import{DefaultMaterial as a}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,e,r){t.enableFastTransformUpdates((t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;const a=e.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,a),e.delete(t),t}const s=new a(t.parameters,r);return this._fastTransformClonedMaterials.set(s,t),s}),r.localOriginFactory)}disable(a,t){const e=new Set,r=new Set;a.disableFastTransformUpdates((a=>{if(!this._fastTransformClonedMaterials.has(a)){const s=a,i=this._fastTransformOriginalMaterials.get(s);return t.has(i.uid)?(e.add(s),t.byUid(i.uid).material):(r.add(s),i.material)}const s=a,i=this._fastTransformClonedMaterials.get(s);return this._fastTransformClonedMaterials.delete(s),i}));for(const s of e)this._fastTransformOriginalMaterials.delete(s);for(const s of r){const a=this._fastTransformOriginalMaterials.get(s);this._fastTransformOriginalMaterials.delete(s),t.set(a.uid,a)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(a,t){this._graphicReferenceCount--,this.disable(a,t)}forEachMaterialInfo(a){this._fastTransformOriginalMaterials.forEach(a)}forEachClonedMaterial(a){this._fastTransformClonedMaterials.forEach(a)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class e{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),(a=>a.material))}byUid(a){return this._byUid.get(a)}byMaterial(a){return this._byMaterial.get(a)}set(a,t){this._byUid.set(a,t),this._byMaterial.set(t.material,t)}delete(a){const t=this._byMaterial.get(a)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(a))}has(a){return this._byUid.has(a)}forEachMaterialInfo(a){this._byUid.forEach(a)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{e as MaterialInfoCache,t as MeshFastUpdateProcessor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as v,BufferViewVec3u8 as R,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as A}from"../../../../chunks/vec3.js";import{t as F,b as E}from"../../../../chunks/vec4.js";import{a as C}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as I}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as L}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as P}from"./ProcessedObjectResource.js";import{load as U,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as z,advancedMRRFactors as K,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):U(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new I(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:z}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:K},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex,n);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s,i){const n=e.model,l=new Array,a=new Map,u=new Map,c=n.lods.length,m=x();return n.lods.forEach(((e,f)=>{const d=!0===o.skipHighLods&&(c>1&&0===f||c>3&&1===f)||!1===o.skipHighLods&&null!=s&&f!==s;if(d&&0!==f)return;const p=new P(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=d?new $({},o):re(n,e,p,r,t,a,u,o,i),{geometry:l,vertexCount:c}=te(e,s??new $({},o)),g=l.boundingInfo;null!=g&&0===f&&(b(m,g.bbMin),b(m,g.bbMax)),null!=s&&(p.stageResources.geometries.push(l),p.numberOfVertices+=c)})),d||l.push(p)})),{engineResources:l,referenceBoundingBox:m}}function re(r,t,o,s,i,n,l,u,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),b=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,h=se(m.alphaMode);if(!n.has(x)){if(b){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data;l.set(e,new W(O(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!O(r)&&o,encoding:O(r)?r.encoding:void 0,compressionHandle:t&&!O(r)?u.compressionHandle:void 0,compressionCallback:u.compressionCallback}))}}},t=h!==_.Opaque&&!c;e(m.colorTexture,t,h!==_.Opaque),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture,!0),e(m.metallicRoughnessTexture,!0)}const o=1/e,f=m.color[0]**o,d=m.color[1]**o,p=m.color[2]**o,g=m.emissiveFactor[0]**o,y=m.emissiveFactor[1]**o,w=m.emissiveFactor[2]**o,v=null!=m.colorTexture&&b?l.get(m.colorTexture):null,R=J(m),j=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:a;n.set(x,new $({...s,customDepthTest:q.Lequal,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[f,d,p],ambient:[f,d,p],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclustion,textureId:null!=v?v.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&b?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=v&&!!v.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&b?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&b?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&b?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[g,y,w],mrrFactors:R?X:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:k(m.colorTextureTransform),normalTextureTransformMatrix:k(m.normalTextureTransform),scale:[j[0],j[1]],occlusionTextureTransformMatrix:k(m.occlusionTextureTransform),emissiveTextureTransformMatrix:k(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(m.metallicRoughnessTextureTransform),...i},u))}const y=n.get(x);if(o.stageResources.materials.push(y),b){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function te(e,r){const i=e.attributes.position.count,n=L(e.indices||i,e.primitiveType),l=T(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[Q.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=T(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([Q.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=T(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),F(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([Q.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=T(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;C(r,t,2,o),c.push([Q.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof v?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof R||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([Q.COLOR,new D(r,n,4,!0)])}return{geometry:new H(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,b=g(),T=g(),y=g(),w=new Float32Array(4*x),R=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,T),s.getVec(n,b),u(T,T,i.transform),c(y,T,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,b,l>-1?.2:Math.min(-4*l-3.8,1)),R[B]=y[0],R[B+1]=y[1],R[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new v(R),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
5
+ import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as v,BufferViewVec3u8 as R,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as A}from"../../../../chunks/vec3.js";import{t as F,b as E}from"../../../../chunks/vec4.js";import{a as C}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as I}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as L}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as P}from"./ProcessedObjectResource.js";import{load as U,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as z,advancedMRRFactors as K,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):U(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new I(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:z}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:K},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex,n);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s,i){const n=e.model,l=new Array,a=new Map,u=new Map,c=n.lods.length,m=x();return n.lods.forEach(((e,f)=>{const d=!0===o.skipHighLods&&(c>1&&0===f||c>3&&1===f)||!1===o.skipHighLods&&null!=s&&f!==s;if(d&&0!==f)return;const p=new P(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=d?new $({},o):re(n,e,p,r,t,a,u,o,i),{geometry:l,vertexCount:c}=te(e,s??new $({},o)),g=l.boundingInfo;null!=g&&0===f&&(b(m,g.bbMin),b(m,g.bbMax)),null!=s&&(p.stageResources.geometries.push(l),p.numberOfVertices+=c)})),d||l.push(p)})),{engineResources:l,referenceBoundingBox:m}}function re(r,t,o,s,i,n,l,u,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),b=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,h=se(m.alphaMode);if(!n.has(x)){if(b){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!O(r);l.set(e,new W(O(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!O(r)&&o,encoding:O(r)?r.encoding:void 0,compressionHandle:i?u.compressionHandle:void 0,compressionCallback:i?u.compressionCallback:void 0}))}}},t=h!==_.Opaque&&!c;e(m.colorTexture,t,h!==_.Opaque),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=1/e,f=m.color[0]**o,d=m.color[1]**o,p=m.color[2]**o,g=m.emissiveFactor[0]**o,y=m.emissiveFactor[1]**o,w=m.emissiveFactor[2]**o,v=null!=m.colorTexture&&b?l.get(m.colorTexture):null,R=J(m),j=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:a;n.set(x,new $({...s,customDepthTest:q.Lequal,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[f,d,p],ambient:[f,d,p],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclustion,textureId:null!=v?v.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&b?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=v&&!!v.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&b?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&b?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&b?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[g,y,w],mrrFactors:R?X:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:k(m.colorTextureTransform),normalTextureTransformMatrix:k(m.normalTextureTransform),scale:[j[0],j[1]],occlusionTextureTransformMatrix:k(m.occlusionTextureTransform),emissiveTextureTransformMatrix:k(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(m.metallicRoughnessTextureTransform),...i},u))}const y=n.get(x);if(o.stageResources.materials.push(y),b){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function te(e,r){const i=e.attributes.position.count,n=L(e.indices||i,e.primitiveType),l=T(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[Q.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=T(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([Q.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=T(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),F(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([Q.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=T(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;C(r,t,2,o),c.push([Q.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof v?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof R||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([Q.COLOR,new D(r,n,4,!0)])}return{geometry:new H(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,b=g(),T=g(),y=g(),w=new Float32Array(4*x),R=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,T),s.getVec(n,b),u(T,T,i.transform),c(y,T,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,b,l>-1?.2:Math.min(-4*l-3.8,1)),R[B]=y[0],R[B+1]=y[1],R[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new v(R),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerViewUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerViewUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerViewUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerViewUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerViewUid=e.layerViewUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerViewUid:this.layerViewUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerViewUid=e.layerViewUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials(),d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerViewUid:this.layerViewUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,l as createColorGeometry,p as createIndices3D,m as createWaterGeometry,b as geometryAsPolygon};
5
+ import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as s}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as u}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as c}from"../../webgl-engine/lib/IntersectableGeometry.js";function l(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function m(t){const e=[[u.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([u.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([u.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([u.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([u.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new s(t.material,e,t.mapPositions,c.Mesh,t.attributeData.objectAndLayerIdColor)}function p(t,e=null){const r=[[u.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[u.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new s(t.material,r,t.mapPositions,c.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,m as createColorGeometry,l as createIndices3D,p as createWaterGeometry,b as geometryAsPolygon};