@arcgis/core 4.34.0-next.67 → 4.34.0-next.68

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 (98) hide show
  1. package/arcade/Feature.js +1 -1
  2. package/arcade/functions/measures.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/097a5c333de28ec5e16f.js +1 -0
  5. package/assets/esri/core/workers/chunks/{997a2a1a51039ce7e4e3.js → 1ac6bbaee76684a07b64.js} +1 -1
  6. package/assets/esri/core/workers/chunks/28cfe1b270602e0c767b.js +1 -0
  7. package/assets/esri/core/workers/chunks/2ad1d458e4d18232a667.js +1 -0
  8. package/assets/esri/core/workers/chunks/{2cd27b06226e30aec5da.js → 3f164e587f8d69c306d5.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{96102a9296afd1bfe1a9.js → 451dd3bb44664b4ca2ae.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{cad03967e132a28512c2.js → 4aa98309081e6889ccbb.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{90491262b6d6a126c32f.js → 52483db12203276e726e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/5a95688651d7e8b7101d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{5d8c64693830506c8776.js → 643acb12ec6a1d4b4fbb.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{de4da985c398c8bcf2e7.js → 7336bfd57f6172ec7186.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{bafd9b0f6e817252cb31.js → 75dd0acf049c7f3271b8.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f4d4c1f13522f20b00d1.js → 900eb2aa5cb1b08e1906.js} +1 -1
  17. package/assets/esri/core/workers/chunks/a6f66492651646c18f10.js +1 -0
  18. package/assets/esri/core/workers/chunks/{0f20c0eec850a39620a1.js → ad69cceec8db593fac14.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{a44f17397d8589433dae.js → b683b0fa7fc430b4d9c5.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{2f7e192ee2066f863e1d.js → c908184d747d33366881.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{06ff5f34ad9bdf9705de.js → d3f59fbaa524b53fcbc6.js} +6 -0
  22. package/assets/esri/core/workers/chunks/{70dc7ec6474f0801bc04.js → de443d29d1a6b5300d00.js} +1 -1
  23. package/assets/esri/core/workers/chunks/e2486bf5546443408c85.js +1 -0
  24. package/assets/esri/core/workers/chunks/{d6f5297f7b323c340727.js → f060a52a9b69eb250d63.js} +1 -1
  25. package/assets/esri/core/workers/chunks/f8adac87e48ea86bec21.js +1 -0
  26. package/assets/esri/themes/base/widgets/_Expand.scss +1 -1
  27. package/assets/esri/themes/dark/main.css +1 -1
  28. package/assets/esri/themes/light/main.css +1 -1
  29. package/assets/esri/themes/light/view.css +1 -1
  30. package/chunks/ComponentShader.glsl.js +42 -36
  31. package/config.js +1 -1
  32. package/core/MemCache.js +1 -1
  33. package/editing/geometry/lineUtils.js +1 -1
  34. package/geometry/ellipsoidUtils.js +1 -1
  35. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  36. package/geometry/support/curves/circleUtils.js +1 -1
  37. package/geometry/support/curves/curveLength.js +1 -1
  38. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  39. package/kernel.js +1 -1
  40. package/layers/support/gaussianSplatUtils.js +1 -1
  41. package/package.json +1 -1
  42. package/support/elevationInfoUtils.js +1 -1
  43. package/support/revision.js +1 -1
  44. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  45. package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
  46. package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
  47. package/views/3d/interactive/editingTools/reshape/isSupportedObject.js +1 -1
  48. package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
  49. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  50. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  51. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  53. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  54. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  55. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  57. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  58. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  59. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  60. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  61. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  62. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  67. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  68. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  69. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  70. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  71. package/views/3d/layers/graphics/Labeler.js +1 -1
  72. package/views/3d/layers/graphics/elevationAlignPointsInFeatures.js +1 -1
  73. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  74. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  75. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  76. package/views/3d/support/CombinedElevationProvider.js +1 -1
  77. package/views/3d/terrain/TerrainSurface.js +1 -1
  78. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  79. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  80. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  81. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +8 -2
  82. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  83. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  84. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +17 -0
  85. package/views/GroundView.js +1 -1
  86. package/widgets/Bookmarks.js +1 -1
  87. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  88. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  89. package/widgets/Editor/support/EditorItem.js +1 -1
  90. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  91. package/widgets/Expand.js +1 -1
  92. package/assets/esri/core/workers/chunks/047d6f7b1677cc7ab271.js +0 -1
  93. package/assets/esri/core/workers/chunks/3212a476184be25d17f8.js +0 -1
  94. package/assets/esri/core/workers/chunks/39d69afc9da9db0c75ab.js +0 -1
  95. package/assets/esri/core/workers/chunks/548818df658b607a364e.js +0 -1
  96. package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +0 -1
  97. package/assets/esri/core/workers/chunks/8a104b35708a492bd614.js +0 -1
  98. package/assets/esri/core/workers/chunks/a634764dec5404f4a1d7.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/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 r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,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 h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as c}from"../../../../chunks/vec32.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as f}from"../../../../geometry/projection/projectBuffer.js";import{create as d,fromSubBuffer as u,intersectsClippingArea as g}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as y}from"../../../../geometry/support/FloatArray.js";import{needsElevationUpdates3D as v,evaluateElevationAlignmentAtPoint as w,SampleElevationInfo as x}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as P,pathNumRoundCapExtrusionSubdivisions as S}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D,nanFallbackColor as j}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ConvertOptions as U,initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as z,getAttributeValue as E}from"../support/FastSymbolUpdates.js";import{SamplePosition as R}from"../../support/ElevationProvider.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{Path as L}from"../../webgl-engine/lib/Path.js";import{PathBuilder as G}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as O,TriangulationCapBuilder as I,NoCapBuilder as B}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as M,MiterExtruder as F}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as T,isPathGeometry as q}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as H,StaticPathGeometry as N}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as W}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as Z,circleProfiles as J}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as K}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Q}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as X}from"../../webgl-engine/materials/PathMaterial.js";const Y=["polyline"];class $ extends D{constructor(e,t,r,i){super(e,t,r,i,se(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,r=null!=e.width?e.width:e.height,i=null!=e.height?e.height:r;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[r,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(j),fallbackSize:[r,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?A(this._context.renderer,this._vvConvertOptions):null;const n=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const h=e.profile||"circle";switch(h){default:case"circle":this._profile=J[n];break;case"quad":this._profile=Z[n]}switch(e.join){case"round":this._extruder=new F(0,P);break;case"bevel":this._extruder=new F(0,1);break;case"miter":this._extruder=new F(.8*Math.PI,1);break;default:this._extruder=new M}switch(this._cap){case"none":this._startCap=new B,this._endCap=new B;break;case"butt":default:this._startCap=new I(this._profile,0),this._endCap=new I(this._profile,0,!0);break;case"square":this._startCap=new I(this._profile,-.5),this._endCap=new I(this._profile,.5,!0);break;case"round":{const e="quad"===h;this._startCap=new O({profile:this._profile,flip:!1,breakNormals:e,subdivisions:S}),this._endCap=new O({profile:this._profile,flip:!0,breakNormals:e,subdivisions:S});break}}const c=this._materialColor,m=this._getCombinedOpacityAndColor(c),f=p(m),d=m[3],u=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:g?.strength??0,emissiveSource:1,opacity:d,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,r,i),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let b;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?b=new X({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,b=new Q(_,this._context)),b.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,v)}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 r in e.diff){if("visualVariables"!==r)return 0;if(!z(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of r)t+=c.length;const n=_(3*t);let l,h=0;for(const c of r){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||f(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=_(3*t),f(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,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=d(),_=this._context.renderCoordsHelper,b=new R(l.vertexDataES),x=a.uid,P=y(l.vertexDataRS.length);for(const d of l.pathVertexDataInfos){const e=d.numVertices;if(e<2)continue;const n=d.offset;if(null!=this._context.clippingExtent&&(u(l.vertexDataES,n,e,f),!g(f,this._context.clippingExtent)))continue;const y=new Array,v=n+3*e;for(let r=n;r<v;r+=3){b.offset=r;const e=w(b,this._context.elevationProvider,t,_);c(ae,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),_.setAltitude(ae,e),l.vertexDataRS[r]=ae[0],l.vertexDataRS[r+1]=ae[1],l.vertexDataRS[r+2]=ae[2],y.push(K(this._upVectorAlignment))}const C=new L(y,l.vertexDataES,l.vertexDataRS,n,P);ee(C,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new G(C,this._profile,this._extruder,this._startCap,this._endCap);let D=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=E(e.size?.field,a),r=E(e.color?.field,a),i=E(e.opacity?.field,a);D=new H(S,t,r,i)}else{const e=h(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=te(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=te(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new N(S);t.bake(e);const r=this._getDrivenColor(o);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:x,layerViewUid:this._context.layerViewUid}),U=new T(this._materials[0],j,D,m,this._stencilWidth,V);U.transformation=r(s(),i,S.path.origin),p.push(U)}if(0===p.length)return null;const S=new k({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:x}),D=new C(this,S,null,(e,t,r,i,s)=>ie(e,t,i,s,this._upVectorAlignment),t,null);return D.alignedSampledElevation=0,D.needsElevationUpdates=v(t.mode),D}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ee(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ae[0]=s[a++]+i[0],ae[1]=s[a++]+i[1],ae[2]=s[a++]+i[2],r.worldUpAtPosition(ae,ae),t.setFrameFromUpVector(ae);break;case 1:ae[0]=s[a]+i[0],ae[1]=s[a+1]+i[1],ae[2]=s[a+2]+i[2],r.worldUpAtPosition(ae,ae),W(e,ae)}}function te(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function re(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let p=e.offset;p<h;p+=3)c(ae,l[p],l[p+1],l[p+2]),r(ae,oe),s+=oe.sampledElevation,ae[0]=n[p]+a[0],ae[1]=n[p+1]+a[1],ae[2]=n[p+2]+a[2],i.setAltitude(ae,oe.z),n[p]=ae[0]-a[0],n[p+1]=ae[1]-a[1],n[p+2]=ae[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ie(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!q(l))continue;const e=l.path,o=e.builder.path;n+=re(o,t,r,i),0!==s&&ee(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function se(e){return 1===(e.material?.color?.a??0)}const ae=m(),oe=new x;export{$ as Graphics3DPathSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,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 h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as c}from"../../../../chunks/vec32.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as f}from"../../../../geometry/projection/projectBuffer.js";import{create as d,fromSubBuffer as u,intersectsClippingArea as g}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as y}from"../../../../geometry/support/FloatArray.js";import{needsElevationUpdates3D as v,evaluateElevationAlignmentAtPoint as w,SampleElevationInfo as x}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as P,pathNumRoundCapExtrusionSubdivisions as S}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D,nanFallbackColor as j}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ConvertOptions as U,initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as z,getAttributeValue as E}from"../support/FastSymbolUpdates.js";import{SamplePosition as R}from"../../support/ElevationProvider.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{Path as L}from"../../webgl-engine/lib/Path.js";import{PathBuilder as G}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as O,TriangulationCapBuilder as I,NoCapBuilder as B}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as M,MiterExtruder as F}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as T,isPathGeometry as q}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as H,StaticPathGeometry as N}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as W}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as Z,circleProfiles as J}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as K}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Q}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as X}from"../../webgl-engine/materials/PathMaterial.js";const Y=["polyline"];class $ extends D{constructor(e,t,r,i){super(e,t,r,i,se(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,r=null!=e.width?e.width:e.height,i=null!=e.height?e.height:r;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[r,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(j),fallbackSize:[r,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?A(this._context.renderer,this._vvConvertOptions):null;const n=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const h=e.profile||"circle";switch(h){default:case"circle":this._profile=J[n];break;case"quad":this._profile=Z[n]}switch(e.join){case"round":this._extruder=new F(0,P);break;case"bevel":this._extruder=new F(0,1);break;case"miter":this._extruder=new F(.8*Math.PI,1);break;default:this._extruder=new M}switch(this._cap){case"none":this._startCap=new B,this._endCap=new B;break;case"butt":default:this._startCap=new I(this._profile,0),this._endCap=new I(this._profile,0,!0);break;case"square":this._startCap=new I(this._profile,-.5),this._endCap=new I(this._profile,.5,!0);break;case"round":{const e="quad"===h;this._startCap=new O({profile:this._profile,flip:!1,breakNormals:e,subdivisions:S}),this._endCap=new O({profile:this._profile,flip:!0,breakNormals:e,subdivisions:S});break}}const c=this._materialColor,m=this._getCombinedOpacityAndColor(c),f=p(m),d=m[3],u=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:g?.strength??0,emissiveSource:1,opacity:d,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,r,i),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let b;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?b=new X({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,b=new Q(_,this._context)),b.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,v)}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 r in e.diff){if("visualVariables"!==r)return 0;if(!z(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of r)t+=c.length;const n=_(3*t);let l,h=0;for(const c of r){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||f(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=_(3*t),f(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,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=d(),_=this._context.renderCoordsHelper,b=new R(l.vertexDataES),x=a.uid,P=y(l.vertexDataRS.length);for(const d of l.pathVertexDataInfos){const e=d.numVertices;if(e<2)continue;const n=d.offset;if(null!=this._context.clippingExtent&&(u(l.vertexDataES,n,e,f),!g(f,this._context.clippingExtent)))continue;const y=new Array,v=n+3*e;for(let r=n;r<v;r+=3){b.offset=r;const e=w(b,this._context.elevationProvider,t,_);c(ae,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),_.setAltitude(ae,e),l.vertexDataRS[r]=ae[0],l.vertexDataRS[r+1]=ae[1],l.vertexDataRS[r+2]=ae[2],y.push(K(this._upVectorAlignment))}const C=new L(y,l.vertexDataES,l.vertexDataRS,n,P);ee(C,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new G(C,this._profile,this._extruder,this._startCap,this._endCap);let D=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=E(e.size?.field,a),r=E(e.color?.field,a),i=E(e.opacity?.field,a);D=new H(S,t,r,i)}else{const e=h(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=te(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=te(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new N(S);t.bake(e);const r=this._getDrivenColor(o);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:x,layerViewUid:this._context.layerViewUid}),U=new T(this._materials[0],j,D,m,this._stencilWidth,V);U.transformation=r(s(),i,S.path.origin),p.push(U)}if(0===p.length)return null;const S=new k({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:x}),D=new C(this,S,null,(e,t,r,i,s)=>ie(e,t,i,s,this._upVectorAlignment),t,null);return D.alignedSampledElevation=0,D.needsElevationUpdates=v(t.mode),D}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ee(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ae[0]=s[a++]+i[0],ae[1]=s[a++]+i[1],ae[2]=s[a++]+i[2],r.worldUpAtPosition(ae,ae),t.setFrameFromUpVector(ae);break;case 1:ae[0]=s[a]+i[0],ae[1]=s[a+1]+i[1],ae[2]=s[a+2]+i[2],r.worldUpAtPosition(ae,ae),W(e,ae)}}function te(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function re(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let p=e.offset;p<h;p+=3)c(ae,l[p],l[p+1],l[p+2]),r(ae,oe),s+=oe.sampledElevation,ae[0]=n[p]+a[0],ae[1]=n[p+1]+a[1],ae[2]=n[p+2]+a[2],i.setAltitude(ae,oe.z),n[p]=ae[0]-a[0],n[p+1]=ae[1]-a[1],n[p+2]=ae[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ie(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!q(l))continue;const e=l.path,o=e.builder.path;n+=re(o,t,r,i),0!==s&&ee(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function se(e){return 1===(e.material?.color?.a??0)}const ae=m(),oe=new x;export{$ 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{result as r}from"../../../../core/asyncUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{make as a}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as l}from"./Graphics3DLineCalloutSymbolLayer.js";import{Graphics3DSymbol as e}from"./Graphics3DSymbol.js";class s extends e{constructor(r,o,t){super(r,o,t),this._calloutSymbolLayer=null,this.symbol.hasVisibleCallout()&&(this._calloutSymbolLayer=a(this.symbol,o))}async doLoad(o){const a=this._calloutSymbolLayer?r(this._calloutSymbolLayer.load()):null;try{await super.doLoad(o),t(o)}catch(l){throw this._calloutSymbolLayer?.abortLoad(),l}a&&await a}destroy(){super.destroy(),this._calloutSymbolLayer=o(this._calloutSymbolLayer)}createGraphics3DGraphic(r,o){const t=super.createGraphics3DGraphic(r,o);if(null!=this._calloutSymbolLayer&&null!=t){const o=this._createCalloutGraphic(r);o&&t.setCalloutGraphic(o)}return t}globalPropertyChanged(r,o){return!!super.globalPropertyChanged(r,o)&&(!this._calloutSymbolLayer||this._calloutSymbolLayer.globalPropertyChanged(r,o,r=>r.calloutLayer))}updateGeometry(r,o){const t=super.updateGeometry(r,o);if(t&&this._calloutSymbolLayer){const t=r.calloutLayer;if(t)return this._calloutSymbolLayer.updateGeometry(t,o)}return t}_createCalloutGraphic(r){const o=r.renderingInfo;return r.renderingInfo=new l(o.renderer,o.symbol),this._calloutSymbolLayer.createGraphics3DGraphic(r)}}export{s as Graphics3DPointSymbol};
5
+ import{result as r}from"../../../../core/asyncUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{make as a}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as l}from"./Graphics3DLineCalloutSymbolLayer.js";import{Graphics3DSymbol as e}from"./Graphics3DSymbol.js";class s extends e{constructor(r,o,t){super(r,o,t),this._calloutSymbolLayer=null,this.symbol.hasVisibleCallout()&&(this._calloutSymbolLayer=a(this.symbol,o))}async doLoad(o){const a=this._calloutSymbolLayer?r(this._calloutSymbolLayer.load()):null;try{await super.doLoad(o),t(o)}catch(l){throw this._calloutSymbolLayer?.abortLoad(),l}a&&await a}destroy(){super.destroy(),this._calloutSymbolLayer=o(this._calloutSymbolLayer)}createGraphics3DGraphic(r,o){const t=super.createGraphics3DGraphic(r,o);if(null!=this._calloutSymbolLayer&&null!=t){const o=this._createCalloutGraphic(r);o&&t.setCalloutGraphic(o)}return t}globalPropertyChanged(r,o){return!!super.globalPropertyChanged(r,o)&&(!this._calloutSymbolLayer||this._calloutSymbolLayer.globalPropertyChanged(r,o,r=>r.calloutLayer))}updateGeometry(r){const o=super.updateGeometry(r);if(o&&this._calloutSymbolLayer){const o=r.calloutLayer;if(o)return this._calloutSymbolLayer.updateGeometry?.(r.graphic,o)??!1}return o}_createCalloutGraphic(r){const o=r.renderingInfo;return r.renderingInfo=new l(o.renderer,o.symbol),this._calloutSymbolLayer.createGraphics3DGraphic(r)}}export{s as Graphics3DPointSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,create as s,intersectsClippingArea as n,empty as a,expandWithAABB 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{elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as b,PolygonCreationDataBase as D}from"./polygonUtils.js";import{initFastSymbolUpdatesState as O,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as j,uvElevationAligner as G}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as E}from"../../support/engineContent/line.js";import{geometryToRenderInfo as M,geometryToRenderInfoDraped as V}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as I}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as F}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class z extends y{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=O(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}_createMaterials(){if(this._materials.length>0)return;const e=this._materialColor,r=this._getCombinedOpacityAndColor(e);this._materials[0]=j(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof I;const i=this.symbolLayer.outline;if(q(i)){const e=B(i.pattern);this._materials[1]=new F({width:t(i.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:v(i.patternCap||"butt")})}}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,r):this._createAs3DShape(t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=d(z.elevationModeChangeTypes,r,i);if(1!==o)return o;const s=m(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=x(e.geometry);if(!i)return null;const o=M(i,this._context.elevationProvider,this._context.renderCoordsHelper,r),s=new k(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),w(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(e,s),this._materials[1]&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,i.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const a=new L({geometries:s.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,G,r);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=m(r.mode),l}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:i,mapPositions:s,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(o(s,H),!n(H,this._context.clippingExtent)))continue;const r=C(s,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,d=b({material:this._materials[0],indices:r,mapPositions:s,attributeData:{position:i,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,olidColor:t.olidColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:i}of t){if(null!=this._context.clippingExtent&&(o(r,H),!n(H,this._context.clippingExtent)))continue;const t=E(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:i}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const r=x(e.geometry);if(null==r)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const i=V(r,this._context.overlaySR),o=new W(i,t,this._context.layerViewUid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*s,!0),A(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=a(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const i=t.renderData.polygons;for(const{position:s,holeIndices:a,index:c,count:p}of i){const i=o(s,H);if(!n(i,this._context.clippingExtent))continue;const h=r(s,a,3);if(0===h.length)continue;l(t.outBoundingBox,i);const d=this._fastUpdates?.visualVariables.color,m=b({material:this._materials[0],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,olidColor:t.olidColor}});t.outGeometries.push(new R(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:i}=t[r];if(o(i,H),!n(H,this._context.clippingExtent))continue;l(e.outBoundingBox,H);const s=E(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:i}},e.olidColor);e.outGeometries.push(new R(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,r=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,r)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,r)=>this._createAs3DShape(e,t,r)}}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:e.toUnitRGBA(this._materialColor)??i})}}const H=s();class k extends D{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends D{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{z as Graphics3DPolygonFillSymbolLayer};
5
+ import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as o,create as s,intersectsClippingArea as n,empty as a,expandWithAABB 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{elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as x,createIndices3D as C,createColorGeometry as b,PolygonCreationDataBase as D}from"./polygonUtils.js";import{initFastSymbolUpdatesState as O,updateFastSymbolUpdatesState as S,getAttributeValue as P,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as j,uvElevationAligner as G}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as E}from"../../support/engineContent/line.js";import{geometryToRenderInfo as M,geometryToRenderInfoDraped as V}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class z extends y{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=O(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}_createMaterials(){if(this._materials.length>0)return;const e=this._materialColor,r=this._getCombinedOpacityAndColor(e);this._materials[0]=j(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof F;const i=this.symbolLayer.outline;if(q(i)){const e=B(i.pattern);this._materials[1]=new I({width:t(i.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:v(i.patternCap||"butt")})}}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,r):this._createAs3DShape(t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!S(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=d(z.elevationModeChangeTypes,r,i);if(1!==o)return o;const s=m(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=x(e.geometry);if(!i)return null;const o=M(i,this._context.elevationProvider,this._context.renderCoordsHelper,r),s=new k(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),w(s.uvMapSpace,s.boundingRect,s.renderData.position,this._context.renderCoordsHelper)),s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAs3DShapeFill(e,s),this._materials[1]&&this._createAs3DShapeOutline(s),this._logGeometryCreationWarnings(s.renderData,i.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length)return null;const a=new L({geometries:s.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,G,r);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=m(r.mode),l}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:i,mapPositions:s,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(o(s,H),!n(H,this._context.clippingExtent)))continue;const r=C(s,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,d=b({material:this._materials[0],indices:r,mapPositions:s,attributeData:{position:i,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,olidColor:t.olidColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:i}of t){if(null!=this._context.clippingExtent&&(o(r,H),!n(H,this._context.clippingExtent)))continue;const t=E(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:i}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const r=x(e.geometry);if(null==r)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const i=V(r,this._context.overlaySR),o=new W(i,t,this._context.layerViewUid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=h(4*s,!0),A(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=a(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new _(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const i=t.renderData.polygons;for(const{position:s,holeIndices:a,index:c,count:p}of i){const i=o(s,H);if(!n(i,this._context.clippingExtent))continue;const h=r(s,a,3);if(0===h.length)continue;l(t.outBoundingBox,i);const d=this._fastUpdates?.visualVariables.color,m=b({material:this._materials[0],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,olidColor:t.olidColor}});t.outGeometries.push(new R(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:i}=t[r];if(o(i,H),!n(H,this._context.clippingExtent))continue;l(e.outBoundingBox,H);const s=E(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:i}},e.olidColor);e.outGeometries.push(new R(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,r=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,r)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,r)=>this._createAs3DShape(e,t,r)}}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:e.toUnitRGBA(this._materialColor)??i})}}const H=s();class k extends D{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends D{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{z 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{totalSymbolComplexities as o}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as i}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayerCreationContext as n}from"./Graphics3DSymbolCreationContext.js";import{Loadable as l}from"./Loadable.js";import{getSymbolMemorySize as y}from"./symbolMemory.js";class h extends l{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(e){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const i=[];if(!m){const{make:e}=await import("./Graphics3DSymbolLayerFactory.js");m=e}for(let t=0;t<a;t++){const r=o.at(t);if(!1===r.enabled)continue;c.renderPriority=1-(1+t)/a,c.renderPriorityStep=1/a,c.ignoreDrivers=r.ignoreDrivers;const n=m(this.symbol,r,this._context,c),l=s(e,()=>{this.symbolLayers[t]=null,n.destroy()});l&&i.push(l),this.symbolLayers[t]=n}if(await t(this.symbolLayers,async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),i.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>!0===e?.needsUpdateFocus)}createGraphics3DGraphic(e,t){const{graphic:s}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null),o=this._context.arcade||this._context.featureExpressionInfoContext?.arcade?.modules||null;return new a(s,t||this,r,e.layer,o)}get complexity(){return o(this.symbolLayers.map(e=>e?.complexity))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof i?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return 1!==this.loadStatus?0:this.symbolLayers.reduce((s,r)=>0!==s&&null!=r?Math.min(s,r.applyRendererDiff(e,t)):s,2)}prepareSymbolPatch(e){if(2===this.loadStatus)return;if("partial"!==e.diff.type)return;const t=e.diff.diff;if(!t.symbolLayers||"partial"!==t.symbolLayers.type)return;const s=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(null==t)return;const o=s[r];if(o){const s={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(s),e.symbolStatePatches.push(...s.symbolLayerStatePatches),s.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{const o=e.layers[r];null!=o&&s.graphics3DGraphicPatches.forEach(e=>e(o,t))})}})}updateGeometry(e,t){return this._updateGeometryOrTransform(e,(e,s)=>e.updateGeometry(s,t))}updateTransform(e,t,s,r){return this._updateGeometryOrTransform(e,(e,o)=>e.updateTransform(o,t,s,r))}_updateGeometryOrTransform(e,t){for(let s=0;s<this.symbolLayers.length;s++){const r=this.symbolLayers[s];if(null==r)continue;const o=e.layers[s];if(!o||!t(r,o))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){const s=this.symbolLayers[t];if(null==s)continue;const r=e.layers[t];null!=r&&s.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(const s of this.symbolLayers)if(null!=s){if(0===s.loadStatus)return 3;s.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,s,o,a){const i=this.symbolLayers.filter(e).filter(e=>null!=e.queryForSnapping).map(e=>e.queryForSnapping(t,s,o,a)),n=await Promise.all(i);return r(a),n.flat()}destroy(){if(!this.destroyed){super.destroy();for(const e of this.symbolLayers)null!=e&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get cachedMemory(){return y(this)}}let m=null;const c=new n;export{h as Graphics3DSymbol};
5
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as r,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{totalSymbolComplexities as o}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as i}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayerCreationContext as n}from"./Graphics3DSymbolCreationContext.js";import{Loadable as l}from"./Loadable.js";import{getSymbolMemorySize as y}from"./symbolMemory.js";class h extends l{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,r)=>{const s=this.symbolLayers[r];null!=s&&(s.symbol=e,s.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,r){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=r,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(e){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const i=[];if(!m){const{make:e}=await import("./Graphics3DSymbolLayerFactory.js");m=e}for(let t=0;t<a;t++){const s=o.at(t);if(!1===s.enabled)continue;c.renderPriority=1-(1+t)/a,c.renderPriorityStep=1/a,c.ignoreDrivers=s.ignoreDrivers;const n=m(this.symbol,s,this._context,c),l=r(e,()=>{this.symbolLayers[t]=null,n.destroy()});l&&i.push(l),this.symbolLayers[t]=n}if(await t(this.symbolLayers,async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),i.forEach(e=>e.remove()),s(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>!0===e?.needsUpdateFocus)}createGraphics3DGraphic(e,t){const{graphic:r}=e,s=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(r,t||this,s)}get complexity(){return o(this.symbolLayers.map(e=>e?.complexity))}globalPropertyChanged(e,t){const r=this.symbolLayers.length;for(let s=0;s<r;s++){const r=this.symbolLayers[s],o=e=>{const t=e.layers[s];return t instanceof i?t:null};if(null!=r&&!r.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return 1!==this.loadStatus?0:this.symbolLayers.reduce((r,s)=>0!==r&&null!=s?Math.min(r,s.applyRendererDiff(e,t)):r,2)}prepareSymbolPatch(e){if(2===this.loadStatus)return;if("partial"!==e.diff.type)return;const t=e.diff.diff;if(!t.symbolLayers||"partial"!==t.symbolLayers.type)return;const r=t.symbolLayers.diff;this.symbolLayers.forEach((t,s)=>{if(null==t)return;const o=r[s];if(o){const r={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(r),e.symbolStatePatches.push(...r.symbolLayerStatePatches),r.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{const o=e.layers[s];null!=o&&r.graphics3DGraphicPatches.forEach(e=>e(o,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,r)=>!!t.updateGeometry&&t.updateGeometry(e.graphic,r))}updateTransform(e,t,r,s){return this._updateGeometryOrTransform(e,(e,o)=>!!e.updateTransform&&e.updateTransform(o,t,r,s))}_updateGeometryOrTransform(e,t){for(let r=0;r<this.symbolLayers.length;r++){const s=this.symbolLayers[r];if(null==s)continue;const o=e.layers[r];if(!o||!t(s,o))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){const r=this.symbolLayers[t];if(null==r)continue;const s=e.layers[t];null!=s&&r.onRemoveGraphic(s)}}getFastUpdateStatus(){let e=!1,t=!1;for(const r of this.symbolLayers)if(null!=r){if(0===r.loadStatus)return 3;r.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,r,o,a){const i=this.symbolLayers.filter(e).filter(e=>null!=e.queryForSnapping).map(e=>e.queryForSnapping(t,r,o,a)),n=await Promise.all(i);return s(a),n.flat()}destroy(){if(!this.destroyed){super.destroy();for(const e of this.symbolLayers)null!=e&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get cachedMemory(){return y(this)}}let m=null;const c=new n;export{h as Graphics3DSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/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 r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as u}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as h}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as m}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class v extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(g().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(g().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return g().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_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 d){const r=e.geometry,i=this.getDefaultElevationInfo(r);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,t.mode=this.getGeometryElevationMode(r,i),t.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const s=o?u:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(s,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,r,i){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=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return h(null,o);const s=null!=t?e.toUnitRGB(t):r;return h(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,u=s?null:p[3];return h(c,l&&d?r??u:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),m(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);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,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&g().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 _(e,t){const r={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(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{v as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as u}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as m}from"../support/symbolColorUtils.js";const v=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class g extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=v(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&v().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):v().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(v().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(v().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return v().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.setFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.setFeatureExpressionInfoContext(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()}createElevationContextForGraphic(e){const t=new d;return this.updateElevationContextForGraphic(t,e),t}updateElevationContextForGraphic(e,t){const r=t.geometry,i=this.getDefaultElevationInfo(r);e.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,e.mode=this.getGeometryElevationMode(r,i),e.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===e.mode;o&&(e.mode="relative-to-ground",e.offsetMeters=0);const s=o?h:this._elevationContext.featureExpressionInfoContext;s?e.updateFeatureExpressionInfoContextForGraphic(s,t,this._context.layer):e.setFeatureExpressionInfoContext(null)}prepareSymbolLayerPatch(e){}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=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return u(null,o);const s=null!=t?e.toUnitRGB(t):r;return u(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,h=s?null:p[3];return u(c,l&&d?r??h:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),m(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);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,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.updateElevationContextForGraphic(o.elevationContext,t),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&v().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 _(e,t){const r={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(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{g as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/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 n,ZEROS as o,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{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{ElevationContext as u}from"./ElevationContext.js";import{focusAreaHUDColor as p}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as g}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as v}from"./graphicUtils.js";import{LabelPlacement as x,LabelParameters as b}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as O,verticalPlacementFromAlignment as w,textRenderAlignmentFromHorizontalPlacement as P,horizontalPlacementToAnchorX as j,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as E}from"./placementUtils.js";import{placePointOnGeometry as S,updateStageObjectGeometry as L,getLocalOriginForPoint as C,extendPointGraphicElevationContext as G,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as A}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as U}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as F}from"../../webgl-engine/lib/TextRenderParameters.js";import D from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as R}from"../../webgl-engine/materials/HUDMaterial.js";const T=a(0,0,1);class H extends y{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 F.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=S(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,n=this.symbolLayer.text;if(null==n||""===n)return null;const o=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=o&&!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 x(o);O(i,a.screenOffset);const l=new b(a,this.symbolLayer.horizontalAlignment,w(i));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,n,l)}get needsUpdateFocus(){return!0}createLabel(e,t,s,r,n){const o=e.graphic,i=S(o.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(i)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(o,i,l,t,s,r,n))}setGraphicElevationContext(e,t=new u,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 V(e,t,(e,t)=>{this.updateGraphicElevationContext(t,e)}),1}slicePlaneEnabledChanged(e,t){return V(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=h(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 n=S(t);if(!n)return!1;const o=L(r,this._context,n,s);if(null==o)return!1;const i=C(this._context,n);return r.geometries[0].localOrigin===i&&(e.alignedSampledElevation=o,G(e,n,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,y,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new u,m.placement.elevationOffset),O=e.uid;let w=null,j=null;if(null==v){const e=P(m.horizontalPlacement);w=new D(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 _=!has("disable-feature:non-occluded-hud"),E=W(w,m),S={occlusionTest:!_,occludedFragmentFade:_,horizonCullingEnabled:_&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:E,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(S.shaderPolygonOffset=1e-4),v?S.textureId=v.id:j&&(S.textureId=j.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;S.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const L=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,C={screenOffset:S.screenOffset,anchorPosition:E,centerOffsetUnits:S.centerOffsetUnits,verticalOffset:S.verticalOffset,shaderPolygonOffset:S.shaderPolygonOffset,occlusionTest:S.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=A(this._textRenderParameters);S.screenSizePerspective=t.overrideFontHeight(s.maxHeight),S.screenSizePerspectiveAlignment=e,C.fontHeight=s.maxHeight}S.hasSlicePlane=this._context.slicePlaneEnabled;const F=this._context.spherical,H=y?JSON.stringify(C):"";let V=y?.get(H);if(null==V){if(!m.isFocused&&L){const e=this.view.map?.focusAreas.style;S.color=p(S.color,e),S.outlineColor=p(S.outlineColor,e)}V=new R(S,F),y?.set(H,V)}const I=m.placement.translation,M=w?n(w.displayWidth,w.displayHeight):o,$=m.placement.centerOffset,k=T,N=v?l(0,0,0,0):null,q=U(V,{normal:k,position:I,size:M,centerOffsetAndDistance:$,uvi:N}),B=z(this._context,a,q,b,O);if(null==B)return null;const J=(t,s,r,n,o,i)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,n,o,i)},Y=new d(this,B.object,j,J,b);Y.alignedSampledElevation=B.sampledElevation,Y.needsElevationUpdates=h(b.mode)||"absolute-height"===b.mode,Y.getScreenSize=(e=i())=>(e[0]=w?w.displayWidth:m.displaySize[0],e[1]=w?w.displayHeight:m.displaySize[1],e);const Z=new g(m.placement.elevationOffset,c);return Y.metadata=Z,G(Y,a,this._context.elevationProvider),Y}}function V(e,t,s){e?.forEach(e=>{const r=t(e);null!=r&&s(r,e.graphic)})}function W(e,t){if("baseline"===t.verticalPlacement){const s=j[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return n(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return E[s]}const I={mode:"relative-to-ground",offset:0};export{H 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 r}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as o,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{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as u}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as d}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as y}from"./graphicUtils.js";import{LabelPlacement as v,LabelParameters as x}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as b,verticalPlacementFromAlignment as O,textRenderAlignmentFromHorizontalPlacement as w,horizontalPlacementToAnchorX as P,anchorFromPlacements as j,namedAnchorToHUDMaterialAnchorPos as _}from"./placementUtils.js";import{placePointOnGeometry as E,updateStageObjectGeometry as S,getLocalOriginForPoint as F,extendPointGraphicElevationContext as L,createStageObject as G}from"./pointUtils.js";import{getFontMetrics as C}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as z}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import U from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as D}from"../../webgl-engine/materials/HUDMaterial.js";const R=a(0,0,1);class T extends g{constructor(e,t,r,s){super(e,t,r,s),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=y(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 A.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,r=E(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const s=this.view.focusAreasView?.containsGeometry(r)??!0,n=this.symbolLayer.text;if(null==n||""===n)return null;const o=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=o&&!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 v(o);b(i,a.screenOffset);const l=new x(a,this.symbolLayer.horizontalAlignment,O(i));return l.isFocused=s??l.isFocused,this._createAs3DShape(t,r,n,l)}get needsUpdateFocus(){return!0}createLabel(e,t,r,s,n){const o=e.graphic,i=E(o.geometry);if(null==i)return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(i)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(o,i,l,t,r,s,n))}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return H(e,t,(e,t)=>{this.graphics3DGraphicLayerElevationInfoChanged(t,e)}),1}slicePlaneEnabledChanged(e,t){return H(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}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:s}=t;this.updateElevationContextForGraphic(r,e,s?.elevationOffset??0),t.needsElevationUpdates=h(r.mode)||"absolute-height"===r.mode}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:s,stageObject:n}=t;if(s.mode!==this.getGeometryElevationMode(r))return!1;const o=E(r);if(!o)return!1;s.updateFeatureExpressionFeature(e,this._context.layer);const i=S(n,this._context,o,s);if(null==i)return!1;const a=F(this._context,o);return n.geometries[0].localOrigin===a&&(t.alignedSampledElevation=i,L(t,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,g,y=null,v=()=>m.placement.elevationOffset){const x=this.createElevationContextForGraphic(e,m.placement.elevationOffset),b=e.uid;let O=null,P=null;if(null==y){const e=w(m.horizontalPlacement);O=new U(c,e,this._textRenderParameters);let s=null;if(null!=this._context.sharedResources.textures){P=this._context.sharedResources.textures.fromData(O.key,()=>O.create()),P.texture.events.on("unloaded",()=>s=t(s));const e=this._context.stage.renderView.textures.acquire(P.texture.id);if(null==e||r(e))return P.release(),null;s=e}}const j=!has("disable-feature:non-occluded-hud"),_=V(O,m),E={occlusionTest:!j,occludedFragmentFade:j,horizonCullingEnabled:j&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:_,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(E.shaderPolygonOffset=1e-4),y?E.textureId=y.id:P&&(E.textureId=P.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.placement.verticalOffset;E.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}const S=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,F={screenOffset:E.screenOffset,anchorPosition:_,centerOffsetUnits:E.centerOffsetUnits,verticalOffset:E.verticalOffset,shaderPolygonOffset:E.shaderPolygonOffset,occlusionTest:E.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,r=C(this._textRenderParameters);E.screenSizePerspective=t.overrideFontHeight(r.maxHeight),E.screenSizePerspectiveAlignment=e,F.fontHeight=r.maxHeight}E.hasSlicePlane=this._context.slicePlaneEnabled;const A=this._context.spherical,T=g?JSON.stringify(F):"";let H=g?.get(T);if(null==H){if(!m.isFocused&&S){const e=this.view.map?.focusAreas.style;E.color=u(E.color,e),E.outlineColor=u(E.outlineColor,e)}H=new D(E,A),g?.set(T,H)}const I=m.placement.translation,W=O?n(O.displayWidth,O.displayHeight):o,M=m.placement.centerOffset,$=R,k=y?l(0,0,0,0):null,N=z(H,{normal:$,position:I,size:W,centerOffsetAndDistance:M,uvi:k}),q=G(this._context,a,N,x,b);if(null==q)return null;const B=(t,r,s,n,o,i)=>{const a=v()||m.placement.elevationOffset;return this.updateElevationContextForGraphic(r,e,a),f(t,r,s,n,o,i)},J=new p(this,q.object,P,B,x);J.alignedSampledElevation=q.sampledElevation,J.needsElevationUpdates=h(x.mode)||"absolute-height"===x.mode,J.getScreenSize=(e=i())=>(e[0]=O?O.displayWidth:m.displaySize[0],e[1]=O?O.displayHeight:m.displaySize[1],e);const Y=new d(m.placement.elevationOffset,c);return J.metadata=Y,L(J,a,this._context.elevationProvider),J}}function H(e,t,r){e?.forEach(e=>{const s=t(e);null!=s&&r(s,e.graphic)})}function V(e,t){if("baseline"===t.verticalPlacement){const r=P[t.horizontalPlacement],s=null!=e?e.baselineAnchorY:0;return n(r,s)}const r=j(t.horizontalPlacement,t.verticalPlacement);return _[r]}const I={mode:"relative-to-ground",offset:0};export{T 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.34/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 i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as j,PolygonCreationDataBase as C}from"./polygonUtils.js";import{geometryToRenderInfo as G,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as O}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as P}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as A,WaterMaterial as E}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as T}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}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 A,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?M(this.symbolLayer.waveDirection):o(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=T[i];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new E(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(B.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=_(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=S(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=y(2*n);R(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new k(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new O({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=_(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,z),!h(z,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(i,2*n,2*o),m=j({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=L(t,this._context.overlaySR),i=r.position.length/3,o=y(2*i);R(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),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,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:a}of i){if(l(o,z),!h(z,this._context.clippingExtent))continue;m(e.outBoundingBox,z);const i=r(o,n,3);if(0===i.length)continue;const c=f(t,2*s,2*a),p=j({material:this._materials[0],indices:i,attributeData:{position:o,uv0:c}},e.olidColor);e.outGeometries.push(new P(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function M(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function R(e,r,o,n){const a=t(n);u(I);for(let t=0;t<o;t++)i(W,r[3*t],r[3*t+1]),g(I,W);s(I,I,a);const l=I[0]%B.unitSizeOfTexture,c=I[1]%B.unitSizeOfTexture;V[0]=I[0]-l,V[1]=I[1]-c;for(let t=0;t<o;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),I=d(),W=n(),z=c();class k extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,M 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 i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as j,PolygonCreationDataBase as C}from"./polygonUtils.js";import{geometryToRenderInfo as G,geometryToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as O}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as P}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as A,WaterMaterial as E}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as T}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(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 A,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?M(this.symbolLayer.waveDirection):o(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=T[i];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new E(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(B.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=_(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=S(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=y(2*n);R(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new k(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new O({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=_(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,z),!h(z,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(i,2*n,2*o),m=j({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=L(t,this._context.overlaySR),i=r.position.length/3,o=y(2*i);R(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),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,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:a}of i){if(l(o,z),!h(z,this._context.clippingExtent))continue;m(e.outBoundingBox,z);const i=r(o,n,3);if(0===i.length)continue;const c=f(t,2*s,2*a),p=j({material:this._materials[0],indices:i,attributeData:{position:o,uv0:c}},e.olidColor);e.outGeometries.push(new P(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function M(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function R(e,r,o,n){const a=t(n);u(I);for(let t=0;t<o;t++)i(W,r[3*t],r[3*t+1]),g(I,W);s(I,I,a);const l=I[0]%B.unitSizeOfTexture,c=I[1]%B.unitSizeOfTexture;V[0]=I[0]-l,V[1]=I[1]-c;for(let t=0;t<o;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),I=d(),W=n(),z=c();class k extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,M 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as r}from"./Loadable.js";import{getSymbolMemorySize as s}from"./symbolMemory.js";class e extends r{constructor(t,r,s){super(r),this.symbol=t,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const r=await this.symbol.fetchSymbol({signal:t});r.id=this.symbol.id,this.graphics3DSymbol=this._convert(r),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,r)}applyRendererDiff(t,r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(t,r):0}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t,r)}updateTransform(t,r,s,e){return this.graphics3DSymbol?.updateTransform(t,r,s,e)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}get cachedMemory(){return s(this)}}export{e as Graphics3DWebStyleSymbol};
5
+ import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as r}from"./Loadable.js";import{getSymbolMemorySize as s}from"./symbolMemory.js";class e extends r{constructor(t,r,s){super(r),this.symbol=t,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const r=await this.symbol.fetchSymbol({signal:t});r.id=this.symbol.id,this.graphics3DSymbol=this._convert(r),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,r)}applyRendererDiff(t,r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(t,r):0}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t)}updateTransform(t,r,s,e){return this.graphics3DSymbol?.updateTransform(t,r,s,e)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}get cachedMemory(){return s(this)}}export{e as Graphics3DWebStyleSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{disposeMaybe as l,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import c from"../../../../core/Queue.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as d}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as m,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as _}from"./LabelInfo.js";import{LabelParameters as L}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as v,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as I}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as S}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as R,isInEffectiveScaleRange as P}from"../../../support/layerViewUtils.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as V}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 F{constructor(e,t,s,i,a){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=a,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,a,l,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=a,this.elevationInfoOverride=l,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new S(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let E=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new c,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h(()=>this.view.state?.camera,()=>this.setDirty()),h(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),h(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),R()&&this.addHandles(h(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new I({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=l(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_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(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>U(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),V}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(Q(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")}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();const{graphic3DGraphic:t,labelingContext:s}=this._focusAreasLabelsQueue.pop();if(0===t.labelLayers.length)return;if(!s.active)continue;const i=A(t.graphic.geometry);if(null==i)return;const a=this.view.focusAreasView?.containsGeometry(i)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.isFocused!==a)&&(this._removeGraphic(s,t),this._addGraphic(s,t),this.setDirty())})}0===this._focusAreasLabelsQueue.length&&this.notifyChange("readyToRun")}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const l=e.graphics3DCore,r=l.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=x(l.getOrCreateGraphics3DSymbol(n));if(null==h)return void a.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;g(n)&&n.hasVisibleCallout()&&(b=f(n,l.symbolCreationContext),await b.load(),o(t));const u=await i(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const a=new F(s,h,b,i,u.value);this._updateLabelClassContextVisibility(a),e.setLabelClassContext(r,a)}else a.getLogger(this).error(`Label expression failed to evaluate: ${u.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.resetLabelClassContext()}).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,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,a,l){if(!this._textTextureAtlas)return null;const r=new L(s,v(s.anchor),G(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,a.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>l.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,a){B.graphic=e,B.layer=a;const l=i.screenOffset[0];return B.renderingInfo=new C(null,t,i.translation,i.centerOffset,l,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,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(Q(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let a=!1;const l=t.graphic,r=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],u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new _(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,l,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),R()&&b.graphics.set(l.uid,t),a=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(l,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return a&&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.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(Q(s))return;const i=e.graphics3DGraphic.graphic;for(let l=0;l<s.length;l++){const r=s[l];if(e.textRenderers[l]=null,e.textLabelPlacements[l]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?d(i,t.layer,null):i;n=o.evaluate(e)}catch(a){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,p=t.disablePlacement,y=new _(h,b,u,p).placement;if(null==y)continue;const g=v(y.anchor),f=w(g);e.textRenderers[l]=new D(n,f,r.textRenderParameters,I.maxSize),e.textLabelPlacements[l]=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 a of i.graphics3DGraphic.labelLayers){if(null==a.labelClass)continue;if(!e.labelClassContexts[a.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(a,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),e.labelClassContexts.forEach(e=>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 a=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,a),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,a=s?.elevationInfoOverride||null,l=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,a,l,W(r));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()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!R())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},a=P(i,this.view.scale),l=null==e.scaleVisibility||e.scaleVisibility!==a;e.scaleVisibility=a,l&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,a)),this.deconflictor.setDirty(),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=>H(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(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 usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function M(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function U(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function Q(e){return!e||0===e.length}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([b({constructOnly:!0})],E.prototype,"view",void 0),e([b({constructOnly:!0})],E.prototype,"deconflictor",void 0),e([b()],E.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],E.prototype,"updating",null),E=e([u("esri.views.3d.layers.graphics.Labeler")],E);const B=new m(null,null,null);export{E as Labeler,W as areLabelsVisible};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{disposeMaybe as l,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import c from"../../../../core/Queue.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as d}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as m,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as _}from"./LabelInfo.js";import{LabelParameters as L}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as v,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as I}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as S}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as R,isInEffectiveScaleRange as P}from"../../../support/layerViewUtils.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as V}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 F{constructor(e,t,s,i,a){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=a,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class z{constructor(e,t,s,i,a,l,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=a,this.elevationInfoOverride=l,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new S(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let E=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new c,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h(()=>this.view.state?.camera,()=>this.setDirty()),h(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),h(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),R()&&this.addHandles(h(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new I({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=l(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_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(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>U(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),V}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(Q(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")}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();const{graphic3DGraphic:t,labelingContext:s}=this._focusAreasLabelsQueue.pop();if(0===t.labelLayers.length||!s.active)continue;const i=A(t.graphic.geometry);if(null==i)continue;const a=this.view.focusAreasView?.containsGeometry(i)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.isFocused!==a)&&(this._removeGraphic(s,t),this._addGraphic(s,t),this.setDirty())})}0===this._focusAreasLabelsQueue.length&&(this.notifyChange("readyToRun"),this.notifyChange("updating"))}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const l=e.graphics3DCore,r=l.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=x(l.getOrCreateGraphics3DSymbol(n));if(null==h)return void a.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;g(n)&&n.hasVisibleCallout()&&(b=f(n,l.symbolCreationContext),await b.load(),o(t));const u=await i(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const a=new F(s,h,b,i,u.value);this._updateLabelClassContextVisibility(a),e.setLabelClassContext(r,a)}else a.getLogger(this).error(`Label expression failed to evaluate: ${u.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.resetLabelClassContext()}).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,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,a,l){if(!this._textTextureAtlas)return null;const r=new L(s,v(s.anchor),G(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,a.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>l.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,a){B.graphic=e,B.layer=a;const l=i.screenOffset[0];return B.renderingInfo=new C(null,t,i.translation,i.centerOffset,l,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,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(Q(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let a=!1;const l=t.graphic,r=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],u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new _(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,l,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),R()&&b.graphics.set(l.uid,t),a=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(l,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return a&&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.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(Q(s))return;const i=e.graphics3DGraphic.graphic;for(let l=0;l<s.length;l++){const r=s[l];if(e.textRenderers[l]=null,e.textLabelPlacements[l]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?d(i,t.layer,null):i;n=o.evaluate(e)}catch(a){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,p=t.disablePlacement,y=new _(h,b,u,p).placement;if(null==y)continue;const g=v(y.anchor),f=w(g);e.textRenderers[l]=new D(n,f,r.textRenderParameters,I.maxSize),e.textLabelPlacements[l]=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 a of i.graphics3DGraphic.labelLayers){if(null==a.labelClass)continue;if(!e.labelClassContexts[a.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,a))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),e.labelClassContexts.forEach(e=>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 a=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,a),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,a=s?.elevationInfoOverride||null,l=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view.stage,r,e,t,i,a,l,W(r));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()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!R())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},a=P(i,this.view.scale),l=null==e.scaleVisibility||e.scaleVisibility!==a;e.scaleVisibility=a,l&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,a)),this.deconflictor.setDirty(),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=>H(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(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 usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function M(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function U(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function Q(e){return!e||0===e.length}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([b({constructOnly:!0})],E.prototype,"view",void 0),e([b({constructOnly:!0})],E.prototype,"deconflictor",void 0),e([b()],E.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],E.prototype,"updating",null),E=e([u("esri.views.3d.layers.graphics.Labeler")],E);const B=new m(null,null,null);export{E as Labeler,W 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as r}from"../../../../geometry/projection/projectPointToVector.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{evaluateElevationInfoAtPoint as s,SampleElevationInfo as a}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{extractExpressionInfo as f,createContext as c}from"./featureExpressionInfoUtils.js";async function l(l,m,d,j,u){const{elevationProvider:v,renderCoordsHelper:g}=l,{elevationInfo:I}=m,{pointsInFeatures:x,spatialReference:y}=j,h=t.fromJSON(y),w=f(I,!0),R=await c(w,h,u);e(u);const S=[],b=new Set,z=new Set,E=new p,P=i(0,0,0,t.WGS84),U=new a,C=o();P.spatialReference=h;const F=l.elevationProvider.spatialReference??l.spatialReference;for(const{objectId:e,points:o}of x){const t=d(e);if(null==t){for(const e of o)S.push(e.z??0);b.add(e);continue}t.isDraped&&z.add(e);const i=t.graphic.geometry;E.setFromElevationInfo(n(i,I)),E.updateFeatureExpressionInfoContext(R,t.graphic,m);for(const{x:e,y:n,z:a}of o)P.x=e,P.y=n,P.z=a??0,await r(P,C,F,0,{signal:u}),s(C,v,E,g,U),S.push(U.z)}return{elevations:S,drapedObjectIds:z,failedObjectIds:b}}export{l as elevationAlignPointsInFeatures};
5
+ import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as r}from"../../../../geometry/projection/projectPointToVector.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{evaluateElevationInfoAtPoint as s,SampleElevationInfo as a}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{extractExpressionInfo as f,createContext as c}from"./featureExpressionInfoUtils.js";async function l(l,m,d,j,u){const{elevationProvider:v,renderCoordsHelper:g}=l,{elevationInfo:I}=m,{pointsInFeatures:x,spatialReference:y}=j,h=t.fromJSON(y),w=f(I,!0),R=await c(w,h,u);e(u);const S=[],b=new Set,z=new Set,E=new p,F=i(0,0,0,t.WGS84),P=new a,U=o();F.spatialReference=h;const C=l.elevationProvider.spatialReference??l.spatialReference;for(const{objectId:e,points:o}of x){const t=d(e);if(null==t){for(const e of o)S.push(e.z??0);b.add(e);continue}t.isDraped&&z.add(e);const i=t.graphic.geometry;E.setFromElevationInfo(n(i,I)),R&&E.updateFeatureExpressionInfoContextForGraphic(R,t.graphic,m);for(const{x:e,y:n,z:a}of o)F.x=e,F.y=n,F.z=a??0,await r(F,U,C,0,{signal:u}),s(U,v,E,g,P),S.push(P.z)}return{elevations:S,drapedObjectIds:z,failedObjectIds:b}}export{l as elevationAlignPointsInFeatures};