@arcgis/core 5.2.0-next.89 → 5.2.0-next.90

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 (140) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/05fbd1f373cfa3724f0c.js +1 -0
  3. package/assets/esri/core/workers/chunks/{f7f2102b16d201e5f531.js → 0d2e2d90a4e4a28e2c0c.js} +1 -1
  4. package/assets/esri/core/workers/chunks/1554feab934e8e1bcd28.js +1 -0
  5. package/assets/esri/core/workers/chunks/{823dd85b008ae4db6793.js → 188c6ff5f4664827c254.js} +2 -2
  6. package/assets/esri/core/workers/chunks/{d30a7fc8dab4ebb8893b.js → 1ab8307ba9981124f669.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{5ed89c862eee1345e3af.js → 20f7b5fe64a217cb3d3d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{013a4ee14c44eb824c7c.js → 24c44541046576fee7e0.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{f3716ce04d09af31cfb1.js → 2754ba5cc094028a7a3c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{e8b4f12dfbf568377cef.js → 3a65693964e3976d8035.js} +1 -1
  11. package/assets/esri/core/workers/chunks/423c2692df662b3dddd4.js +1 -0
  12. package/assets/esri/core/workers/chunks/{996211727ed1617162da.js → 48726010778d6004e347.js} +2 -2
  13. package/assets/esri/core/workers/chunks/{680557b8832fbdab7f46.js → 4bf7c0c874d30b1c0760.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{db180f8d25471cfa48af.js → 545bec045167c433af8f.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5782c0362a1799ceef41.js +1 -0
  16. package/assets/esri/core/workers/chunks/{5bf65dbfd9c7a5ea187d.js → 5aa23b0f4521ba9a07ad.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{eda04911553cf99fb99b.js → 606ac9358f508bda94f2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/625a692f00357629f609.js +1 -0
  19. package/assets/esri/core/workers/chunks/{bd2602195e265f8fdb15.js → 69c9a12c97ead8963817.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{2f3bbc1f7d4abbbeec2f.js → 6ab7bb3834841834f839.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{afa6b74d9ca9ed0154af.js → 6fd0d9431b141f2a3252.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3f82410d9f701e7ad8eb.js → 76e7d3cde2da4bdd7820.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{ea75c23c44452f45a949.js → 7cf903db44f3647c8fd4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/848a9f0e5373bbf289a5.js +1 -0
  25. package/assets/esri/core/workers/chunks/{a88bf8ae93077e1b48cf.js → 8a87e1a89a0d8c6203a7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{a3b403f8acb90af19adb.js → 91ac9328afff8a51bd96.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{00181785a180e934bf7c.js → 91de343844ac578e7c93.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{d871572997600930e017.js → 95a3f09751bff63f4fab.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{ffe749d790320dddfa74.js → 97e41500fc2d24a88938.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{6fe7060235f601b180ea.js → 98d614d6fc9de8ebaf94.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1e087fb13b7b0a5d6fec.js → 9d3cdfa08ef4d2805625.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{0460ea5a85e9c3c2e1b7.js → a89dbef8155d7c4354da.js} +2 -2
  33. package/assets/esri/core/workers/chunks/{e9f29019aa78f07ace66.js → aed7b80145b22c246098.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{4aefe6fd4d725a107758.js → b7ed5f130661e9ca00b9.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c07d2fb9940b2c6eda9f.js +1 -0
  36. package/assets/esri/core/workers/chunks/{a8b878c12cb1a6ea012b.js → c4a0d3149947a1d2c484.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{31a0620a6028e94c7532.js → c6ec0e966106f66360d9.js} +2 -2
  38. package/assets/esri/core/workers/chunks/{5df0639839a354cb2751.js → c7f69d010f1cb32f5d37.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{23addf8b11938e0c96e9.js → cb983f65995e57fff7a1.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{f665fb4c5633e0a459d8.js → d24125a791247019e2ca.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{7b7d0e93689aab8da83d.js → d44338bf5edafa3ca926.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{2ceb07b125c84b51f02a.js → d7d5275d8b3c9430de1f.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{ce227146fcaabf088da1.js → da8a314800944706511b.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{705f459aab890fda134b.js → e018cbd97e6e0e4ca5c4.js} +1 -1
  45. package/assets/esri/core/workers/chunks/e55507e4114b34d1ef4e.js +1 -0
  46. package/assets/esri/core/workers/chunks/{6b06858bb9e976c1ef33.js → e594b6db9caee1f7b9fc.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{4057d97a4ec234978697.js → e90076ac1cf88a83a7f9.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{e40e08029325f43452d0.js → f4d351b4cd9d1aa10632.js} +1 -1
  49. package/assets/esri/core/workers/chunks/f5f5b54cab722abe88e0.js +1 -0
  50. package/assets/esri/core/workers/chunks/{d8e2d78fc4526612aad6.js → ff83d0337ac489ab08de.js} +2 -2
  51. package/config.js +1 -1
  52. package/core/EuclideanDistanceTransform.js +2 -0
  53. package/geometry/support/convexPolyhedron.js +1 -1
  54. package/geometry/support/frustumPlanes.js +2 -0
  55. package/kernel.js +1 -1
  56. package/layers/ParquetLayer.d.ts +3 -2
  57. package/layers/ParquetLayer.js +1 -1
  58. package/layers/support/dataSeriesUtils.js +1 -1
  59. package/package.json +3 -3
  60. package/popup/FeatureContentCollection.d.ts +6 -0
  61. package/popup/FeatureContentCollection.js +1 -1
  62. package/rest/support/AlgorithmicColorRamp.d.ts +2 -2
  63. package/rest/support/types.d.ts +2 -2
  64. package/smartMapping/raster/support/colorRamps.d.ts +4 -3
  65. package/support/revision.js +1 -1
  66. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  67. package/symbols/cim/CIMSymbolHelper.js +1 -1
  68. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  69. package/symbols/cim/Rasterizer.js +1 -1
  70. package/symbols/cim/cimAnalyzer.js +1 -1
  71. package/symbols/cim/rasterizingUtils.js +1 -1
  72. package/symbols/cim/utils.js +1 -1
  73. package/views/2d/engine/webgl/GlyphSDFCreator.js +1 -1
  74. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  75. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  76. package/views/2d/engine/webgl/TextureManager.js +1 -1
  77. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  78. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  84. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  85. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  86. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  87. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  88. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  90. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  91. package/views/2d/tiling/LODInfo.js +1 -1
  92. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  93. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  94. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  95. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  96. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  97. package/views/3d/state/Frustum.js +1 -1
  98. package/views/3d/state/controllers/RopePullController.js +1 -1
  99. package/views/3d/state/controllers/momentum/RopePullMomentumController.js +2 -0
  100. package/views/3d/support/SweptSphereVolume.js +2 -0
  101. package/views/3d/support/viewpointUtils.js +1 -1
  102. package/views/3d/terrain/PatchRenderData.js +1 -1
  103. package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
  104. package/views/3d/terrain/PlanarPatch.js +1 -1
  105. package/views/3d/terrain/SphericalPatch.js +1 -1
  106. package/views/3d/terrain/TerrainSurface.js +1 -1
  107. package/views/3d/terrain/Tile.js +1 -1
  108. package/views/3d/webgl/RenderCamera.js +1 -1
  109. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  110. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  111. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  112. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  113. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  114. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  115. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  116. package/views/3d/webgl-engine/lib/screenPolygonIntersectionUtils.js +1 -1
  117. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  118. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  119. package/views/navigation/RopePullMomentumEstimator.js +2 -0
  120. package/views/support/LayerLayerViewInfo.js +1 -1
  121. package/views/support/LayerViewManager.js +1 -1
  122. package/widgets/Features/FeaturesViewModel.d.ts +6 -0
  123. package/widgets/Features/FeaturesViewModel.js +1 -1
  124. package/widgets/Features.js +1 -1
  125. package/assets/esri/core/workers/chunks/028bee58f7bc19e5e39e.js +0 -1
  126. package/assets/esri/core/workers/chunks/39b6a5222f45cb8dbc94.js +0 -1
  127. package/assets/esri/core/workers/chunks/51c9bd7c03d780fadebc.js +0 -1
  128. package/assets/esri/core/workers/chunks/71308dca3fd05687e7bd.js +0 -1
  129. package/assets/esri/core/workers/chunks/8d8708789843844eb9e1.js +0 -1
  130. package/assets/esri/core/workers/chunks/9246e2468528650bdc7c.js +0 -1
  131. package/assets/esri/core/workers/chunks/94453d075ce02eff4844.js +0 -1
  132. package/assets/esri/core/workers/chunks/a176727a1148ca4fb432.js +0 -1
  133. package/assets/esri/core/workers/chunks/f106cc7f559856f69b9f.js +0 -1
  134. package/geometry/support/frustum.js +0 -2
  135. package/views/3d/layers/i3s/SweptSphereVolume.js +0 -2
  136. /package/assets/esri/core/workers/chunks/{823dd85b008ae4db6793.js.LICENSE.txt → 188c6ff5f4664827c254.js.LICENSE.txt} +0 -0
  137. /package/assets/esri/core/workers/chunks/{013a4ee14c44eb824c7c.js.LICENSE.txt → 24c44541046576fee7e0.js.LICENSE.txt} +0 -0
  138. /package/assets/esri/core/workers/chunks/{996211727ed1617162da.js.LICENSE.txt → 48726010778d6004e347.js.LICENSE.txt} +0 -0
  139. /package/assets/esri/core/workers/chunks/{0460ea5a85e9c3c2e1b7.js.LICENSE.txt → a89dbef8155d7c4354da.js.LICENSE.txt} +0 -0
  140. /package/assets/esri/core/workers/chunks/{d8e2d78fc4526612aad6.js.LICENSE.txt → ff83d0337ac489ab08de.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{packFloatRGBA as t}from"../../core/floatRGBA.js";import o from"../../core/Logger.js";import{nextPowerOfTwo as e}from"../../core/mathUtils.js";import{dashSdfRasterizationScale as n,dashSdfDistanceNormalization as r,dashRadius as a}from"./constants.js";import{defaultCIMValues as l}from"./defaultCIMValues.js";import{gradientTextureExternalPadding as s}from"../../views/2d/engine/webgl/definitions.js";const i=()=>o.getLogger("esri.symbols.cim.rasterizingUtils"),c=32,h=t=>"vertical"===t||"horizontal"===t||"cross"===t||"esriSFSCross"===t||"esriSFSVertical"===t||"esriSFSHorizontal"===t;function f(t,o,n){const r=o.style,a=e(Math.ceil(n)),l=h(r)?8*a:16*a,s=2*a;t.width=l,t.height=l;const i=t.getContext("2d");i.strokeStyle="#ffffff",i.lineWidth=a,i.beginPath(),"vertical"!==r&&"cross"!==r&&"esriSFSCross"!==r&&"esriSFSVertical"!==r||(i.moveTo(l/2,-s),i.lineTo(l/2,l+s)),"horizontal"!==r&&"cross"!==r&&"esriSFSCross"!==r&&"esriSFSHorizontal"!==r||(i.moveTo(-s,l/2),i.lineTo(l+s,l/2)),"backward-diagonal"!==r&&"diagonal-cross"!==r&&"esriSFSDiagonalCross"!==r&&"esriSFSBackwardDiagonal"!==r||(i.moveTo(-s,-s),i.lineTo(l+s,l+s),i.moveTo(l-s,-s),i.lineTo(l+s,s),i.moveTo(-s,l-s),i.lineTo(s,l+s)),"forward-diagonal"!==r&&"diagonal-cross"!==r&&"esriSFSForwardDiagonal"!==r&&"esriSFSDiagonalCross"!==r||(i.moveTo(l+s,-s),i.lineTo(-s,l+s),i.moveTo(s,-s),i.lineTo(-s,s),i.moveTo(l+s,l-s),i.lineTo(l-s,l+s)),i.stroke();const c=i.getImageData(0,0,t.width,t.height),f=new Uint8Array(c.data);let u;for(let e=0;e<f.length;e+=4)u=f[e+3]/255,f[e]=f[e]*u,f[e+1]=f[e+1]*u,f[e+2]=f[e+2]*u;return[f,t.width,t.height,a]}function u(o){o.length%2==1&&(o=[...o,...o]);let e=0,a=o.length-1;for(;e<o.length&&0===o[e];)e++;for(;a>=0&&0===o[a];)a--;let l=0;const s=[];for(let t=e;t<=a;t++)0===o[t]?l++:0===l?s.push(o[t]):1&l?(s[s.length-1]+=o[t],l=0):(s.push(o[t]),l=0);if(l=e+o.length-1-a,(o=s).length<=1)return 0===o.length||e%2==0?[new Uint8Array,0,1]:[new Uint8Array([255,255,255,255]),1,1];const i=o.reduce((t,o)=>t+o,0),c=Math.round(i*n),h=1,f=c*h,u=new Float32Array(f);let m=0,g=0,d=.5,p=e%2==0;const C=l%2==1;for(let t=0;t<o.length;t++){for(m=g,g+=o[t]*n,0===t&&C&&(m-=o[o.length-1]*n),t===o.length-1&&C&&(g+=o[0]*n);d<=g&&d-.5<f;){const t=d-.5,o=Math.min(Math.abs(d-m),Math.abs(d-g));u[t]=p?-o:o,d++}p=!p}const M=u.length,x=new Uint8Array(4*M);for(let w=0;w<M;++w){const o=u[w]/n;t(o/r*.5+.5,x,4*w)}return[x,c,h]}function m(o,e){null==o&&(o=[]);const n="Butt"===e,r="Square"===e,l=!n&&!r;o.length%2==1&&(o=[...o,...o]);const s=a,i=2*s;let c=0;for(const t of o)c+=t;const h=Math.round(c*s),f=new Float32Array(h*i),u=.5*s;let m=0,g=0,d=.5,p=!0;for(const t of o){for(m=g,g+=t*s;d<=g;){let t=.5;for(;t<i;){const o=(t-.5)*h+d-.5,e=l?(t-s)*(t-s):Math.abs(t-s);f[o]=p?n?Math.max(Math.max(m+u-d,e),Math.max(d-g+u,e)):e:l?Math.min((d-m)*(d-m)+e,(d-g)*(d-g)+e):r?Math.min(Math.max(d-m,e),Math.max(g-d,e)):Math.min(Math.max(d-m+u,e),Math.max(g+u-d,e)),t++}d++}p=!p}const C=f.length,M=new Uint8Array(4*C);for(let a=0;a<C;++a){const o=(l?Math.sqrt(f[a]):f[a])/s;t(o,M,4*a)}return[M,h,i]}function g(t,o){const{colorRamp:e,gradientType:n}=o,r="CIMFixedColorRamp"===e.type,a=o.interval||l.CIMGradientFill.interval;let s=C(e);return r&&(s=M(s,a)),"Discrete"===n||r?w(t,s,a):x(t,s)}let d;function p(t,o){const{colorRamp:e,gradientType:n}=o,r=C(e),a="CIMFixedColorRamp"===e.type;if("Continuous"===n&&!a)return y(t,r);const s=o.interval??l.CIMGradientFill.interval;if(a){return y(t,M(r,s))}const i=[];d??=document.createElement("canvas"),S(d,r,s,1,0);const c=d.getContext("2d").getImageData(0,0,s,1).data;for(let l=0,h=0;l<s;l++,h=4*l){const t=[c[h+0],c[h+1],c[h+2],c[h+3]];i.push({offset:l/s,color:t}),i.push({offset:(l+1)/s,color:t})}return y(t,i)}function C(t){const o=[];switch(t.type){case"CIMPolarContinuousColorRamp":case"CIMLinearContinuousColorRamp":{"CIMPolarContinuousColorRamp"===t.type&&i().warnOnce("CIMPolarContinuousColorRamp is currently unsupported. Falling back to CIMLinearContinuousColorRamp.");const e=t;o.push({offset:0,color:[e.fromColor[0],e.fromColor[1],e.fromColor[2],e.fromColor[3]/255]}),o.push({offset:1,color:[e.toColor[0],e.toColor[1],e.toColor[2],e.toColor[3]/255]});break}case"CIMFixedColorRamp":{const e=t,n=1/(e.colors.length-1);let r=0;for(const t of e.colors)o.push({offset:r,color:[t[0],t[1],t[2],t[3]/255]}),r+=n;break}case"CIMMultipartColorRamp":{const e=t,n=e.weights.reduce((t,o)=>t+o,0);let r=0;for(let t=0;t<e.colorRamps.length;t++){const a=e.colorRamps[t],l=e.weights[t],s=C(a);for(const t of s)o.push({offset:(r+t.offset*l)/n,color:t.color});r+=l}break}default:i().error(`Color ramp "${t.type}" currently unsupported.`)}return o}function M(t,o){const e=[],n=(t.length-1)/(o-1);for(let r=0;r<o;r++){const a=t[Math.round(r*n)].color;e.push({offset:r/o,color:a}),e.push({offset:(r+1)/o,color:a})}return e}function x(t,o){return S(t,o,c,1,s),F(t)}function w(t,o,e){return S(t,o,e,1,s),F(t)}function y(t,o,e=0){for(const{offset:n,color:r}of o)t.addColorStop(Math.min(Math.max(n,e),1-e),`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${r[3]})`)}function S(t,o,e,n,r){const a=e+2*r;t.width=a,t.height=n;const l=(r+1)/a,s=t.getContext("2d",{willReadFrequently:!0});if(o.length>0){const t=s.createLinearGradient(0,0,a,n);y(t,o,l),s.fillStyle=t}else s.fillStyle="rgba(128, 128, 128, 1)";s.fillRect(0,0,a,n)}function F(t){const{width:o,height:e}=t,n=t.getContext("2d").getImageData(0,0,o,e),r=new Uint8Array(n.data);for(let a=0;a<r.length;a+=4){const t=r[a+3]/255;r[a]*=t,r[a+1]*=t,r[a+2]*=t}return[r,o,e]}function v(t){const o=t[0]?.[0]?.[0]??0,e=t[0]?.[0]?.[1]??0,n={ymin:e,xmin:o,ymax:e,xmax:o,width:0,height:0};for(let r=0;r<t.length;r++){const o=t[r];for(let t=0;t<o.length;t++){const e=o[t][0],r=o[t][1];e<n.xmin&&(n.xmin=e),e>n.xmax&&(n.xmax=e),r<n.ymin&&(n.ymin=r),r>n.ymax&&(n.ymax=r)}}return n.width=Math.abs(n.xmax-n.xmin),n.height=Math.abs(n.ymax-n.ymin),n}function T(t,o){const e=v(t),n=0===e.width?1:e.width,r=0===e.height?1:e.height,a=[];for(let l=0;l<t.length;l++){const s=t[l],i=[];for(let t=0;t<s.length;t++){let a=Math.round(s[t][0]-e.xmin),l=Math.round(s[t][1]-e.ymin);if(a=o.xmin+a*o.width/n,l=o.ymin+l*o.height/r,isNaN(a)||isNaN(l))throw new Error("Scaled shape has NaN values");i.push([a,l])}a.push(i)}return a}function R(t,o,e){const n=[];for(let r=0;r<t.length;r++){const a=t[r],l=[];for(let t=0;t<a.length;t++){const n=a[t][0]+o,r=a[t][1]+e;if(isNaN(n)||isNaN(r))throw new Error("Scaled shape has NaN values");l.push([n,r])}n.push(l)}return n}export{p as addColorStops,m as rasterizeDash,u as rasterizeDash1D,f as rasterizeFillStyle,g as rasterizeGradient,T as scale,R as translate};
2
+ import{EuclideanDistanceTransform as t}from"../../core/EuclideanDistanceTransform.js";import{packFloatRGBA as o}from"../../core/floatRGBA.js";import e from"../../core/Logger.js";import{nextPowerOfTwo as n}from"../../core/mathUtils.js";import{dashSdfRasterizationScale as r,dashSdfDistanceNormalization as a,dashRadius as s}from"./constants.js";import{defaultCIMValues as i}from"./defaultCIMValues.js";import{gradientTextureExternalPadding as l}from"../../views/2d/engine/webgl/definitions.js";const c=()=>e.getLogger("esri.symbols.cim.rasterizingUtils"),h=32,f=t=>"vertical"===t||"horizontal"===t||"cross"===t||"esriSFSCross"===t||"esriSFSVertical"===t||"esriSFSHorizontal"===t;function u(o,e,n,r){const a=e*n,s=new Float64Array(a);let i=!1;for(let t=0;t<a;t++){const e=o[4*t+3]/255;i||=e>0,s[t]=0===e?Number.MAX_VALUE:1===e?0:(1-e)*(1-e)}const l=new Uint8Array(4*a);if(!i)return l;new t(Math.max(e,n)).compute(s,e,n);for(let t=0;t<a;t++){const o=Math.min(Math.max(r+.5-s[t],0),1);l[4*t]=255*o,l[4*t+1]=255*o,l[4*t+2]=255*o,l[4*t+3]=255*o}return l}function m(e,n,r,a){const s=n*r,i=new Float64Array(s),l=new Float64Array(s);let c=!1;for(let t=0;t<s;t++){const o=e[4*t+3]/255;if(c||=o>0,0===o)i[t]=Number.MAX_VALUE,l[t]=0;else if(1===o)i[t]=0,l[t]=Number.MAX_VALUE;else{const e=.5-o;i[t]=e>0?e*e:0,l[t]=e<0?e*e:0}}const h=new Uint8Array(4*s),f=Math.max(Math.ceil(a)+1,1);if(!c)return{image:h,encodingRadius:f};const u=new t(Math.max(n,r));u.compute(i,n,r),u.compute(l,n,r);for(let t=0;t<s;t++){const e=i[t]-l[t]-a,n=Math.min(Math.max(.5-e/(2*f),0),1);o(n,h,4*t)}return{image:h,encodingRadius:f}}function g(t,o,e,n=128){const r=new Map,a=(t,o,e,n)=>{const a=`${t},${o}`,s=r.get(a),i=[[t,o],[e,n]];s?s.push(i):r.set(a,[i])},s=(r,a)=>r>=0&&r<o&&a>=0&&a<e&&t[4*(a*o+r)+3]>=n;for(let l=0;l<e;l++)for(let t=0;t<o;t++)s(t,l)&&(s(t,l-1)||a(t,l,t+1,l),s(t+1,l)||a(t+1,l,t+1,l+1),s(t,l+1)||a(t+1,l+1,t,l+1),s(t-1,l)||a(t,l+1,t,l));const i=[];for(;r.size>0;){const t=r.entries().next();if(t.done)break;const[o,e]=t.value,n=e.pop();if(!n){r.delete(o);continue}0===e.length&&r.delete(o);const a=[n[0],n[1]],s=n[0];let l=n[1];for(;l[0]!==s[0]||l[1]!==s[1];){const t=`${l[0]},${l[1]}`,o=r.get(t);if(!o)break;const e=o.pop();if(!e){r.delete(t);break}0===o.length&&r.delete(t),l=e[1],a.push(l)}a.length>=4&&l[0]===s[0]&&l[1]===s[1]&&i.push(a)}return i}function d(t,o){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n+=4){const r=t[n+3]*o[n+3]/65025;e[n]=t[n]*r,e[n+1]=t[n+1]*r,e[n+2]=t[n+2]*r,e[n+3]=255*r}return e}function p(t,o,e){const r=o.style,a=n(Math.ceil(e)),s=f(r)?8*a:16*a,i=2*a;t.width=s,t.height=s;const l=t.getContext("2d");l.strokeStyle="#ffffff",l.lineWidth=a,l.beginPath(),"vertical"!==r&&"cross"!==r&&"esriSFSCross"!==r&&"esriSFSVertical"!==r||(l.moveTo(s/2,-i),l.lineTo(s/2,s+i)),"horizontal"!==r&&"cross"!==r&&"esriSFSCross"!==r&&"esriSFSHorizontal"!==r||(l.moveTo(-i,s/2),l.lineTo(s+i,s/2)),"backward-diagonal"!==r&&"diagonal-cross"!==r&&"esriSFSDiagonalCross"!==r&&"esriSFSBackwardDiagonal"!==r||(l.moveTo(-i,-i),l.lineTo(s+i,s+i),l.moveTo(s-i,-i),l.lineTo(s+i,i),l.moveTo(-i,s-i),l.lineTo(i,s+i)),"forward-diagonal"!==r&&"diagonal-cross"!==r&&"esriSFSForwardDiagonal"!==r&&"esriSFSDiagonalCross"!==r||(l.moveTo(s+i,-i),l.lineTo(-i,s+i),l.moveTo(i,-i),l.lineTo(-i,i),l.moveTo(s+i,s-i),l.lineTo(s-i,s+i)),l.stroke();const c=l.getImageData(0,0,t.width,t.height),h=new Uint8Array(c.data);let u;for(let n=0;n<h.length;n+=4)u=h[n+3]/255,h[n]=h[n]*u,h[n+1]=h[n+1]*u,h[n+2]=h[n+2]*u;return[h,t.width,t.height,a]}function M(t){t.length%2==1&&(t=[...t,...t]);let e=0,n=t.length-1;for(;e<t.length&&0===t[e];)e++;for(;n>=0&&0===t[n];)n--;let s=0;const i=[];for(let o=e;o<=n;o++)0===t[o]?s++:0===s?i.push(t[o]):1&s?(i[i.length-1]+=t[o],s=0):(i.push(t[o]),s=0);if(s=e+t.length-1-n,(t=i).length<=1)return 0===t.length||e%2==0?[new Uint8Array,0,1]:[new Uint8Array([255,255,255,255]),1,1];const l=t.reduce((t,o)=>t+o,0),c=Math.round(l*r),h=1,f=c*h,u=new Float32Array(f);let m=0,g=0,d=.5,p=e%2==0;const M=s%2==1;for(let o=0;o<t.length;o++){for(m=g,g+=t[o]*r,0===o&&M&&(m-=t[t.length-1]*r),o===t.length-1&&M&&(g+=t[0]*r);d<=g&&d-.5<f;){const t=d-.5,o=Math.min(Math.abs(d-m),Math.abs(d-g));u[t]=p?-o:o,d++}p=!p}const C=u.length,w=new Uint8Array(4*C);for(let x=0;x<C;++x){const t=u[x]/r;o(t/a*.5+.5,w,4*x)}return[w,c,h]}function C(t,e){null==t&&(t=[]);const n="Butt"===e,r="Square"===e,a=!n&&!r;t.length%2==1&&(t=[...t,...t]);const i=s,l=2*i;let c=0;for(const o of t)c+=o;const h=Math.round(c*i),f=new Float32Array(h*l),u=.5*i;let m=0,g=0,d=.5,p=!0;for(const o of t){for(m=g,g+=o*i;d<=g;){let t=.5;for(;t<l;){const o=(t-.5)*h+d-.5,e=a?(t-i)*(t-i):Math.abs(t-i);f[o]=p?n?Math.max(Math.max(m+u-d,e),Math.max(d-g+u,e)):e:a?Math.min((d-m)*(d-m)+e,(d-g)*(d-g)+e):r?Math.min(Math.max(d-m,e),Math.max(g-d,e)):Math.min(Math.max(d-m+u,e),Math.max(g+u-d,e)),t++}d++}p=!p}const M=f.length,C=new Uint8Array(4*M);for(let s=0;s<M;++s){const t=(a?Math.sqrt(f[s]):f[s])/i;o(t,C,4*s)}return[C,h,l]}function w(t,o){const{colorRamp:e,gradientType:n}=o,r="CIMFixedColorRamp"===e.type,a=o.interval||i.CIMGradientFill.interval;let s=S(e);return r&&(s=F(s,a)),"Discrete"===n||r?A(t,s,a):b(t,s)}let x;function y(t,o){const{colorRamp:e,gradientType:n}=o,r=S(e),a="CIMFixedColorRamp"===e.type;if("Continuous"===n&&!a)return v(t,r);const s=o.interval??i.CIMGradientFill.interval;if(a){return v(t,F(r,s))}const l=[];x??=document.createElement("canvas"),T(x,r,s,1,0);const c=x.getContext("2d").getImageData(0,0,s,1).data;for(let i=0,h=0;i<s;i++,h=4*i){const t=[c[h+0],c[h+1],c[h+2],c[h+3]];l.push({offset:i/s,color:t}),l.push({offset:(i+1)/s,color:t})}return v(t,l)}function S(t){const o=[];switch(t.type){case"CIMPolarContinuousColorRamp":case"CIMLinearContinuousColorRamp":{"CIMPolarContinuousColorRamp"===t.type&&c().warnOnce("CIMPolarContinuousColorRamp is currently unsupported. Falling back to CIMLinearContinuousColorRamp.");const e=t;o.push({offset:0,color:[e.fromColor[0],e.fromColor[1],e.fromColor[2],e.fromColor[3]/255]}),o.push({offset:1,color:[e.toColor[0],e.toColor[1],e.toColor[2],e.toColor[3]/255]});break}case"CIMFixedColorRamp":{const e=t,n=1/(e.colors.length-1);let r=0;for(const t of e.colors)o.push({offset:r,color:[t[0],t[1],t[2],t[3]/255]}),r+=n;break}case"CIMMultipartColorRamp":{const e=t,n=e.weights.reduce((t,o)=>t+o,0);let r=0;for(let t=0;t<e.colorRamps.length;t++){const a=e.colorRamps[t],s=e.weights[t],i=S(a);for(const t of i)o.push({offset:(r+t.offset*s)/n,color:t.color});r+=s}break}default:c().error(`Color ramp "${t.type}" currently unsupported.`)}return o}function F(t,o){const e=[],n=(t.length-1)/(o-1);for(let r=0;r<o;r++){const a=t[Math.round(r*n)].color;e.push({offset:r/o,color:a}),e.push({offset:(r+1)/o,color:a})}return e}function b(t,o){return T(t,o,h,1,l),R(t)}function A(t,o,e){return T(t,o,e,1,l),R(t)}function v(t,o,e=0){for(const{offset:n,color:r}of o)t.addColorStop(Math.min(Math.max(n,e),1-e),`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${r[3]})`)}function T(t,o,e,n,r){const a=e+2*r;t.width=a,t.height=n;const s=(r+1)/a,i=t.getContext("2d",{willReadFrequently:!0});if(o.length>0){const t=i.createLinearGradient(0,0,a,n);v(t,o,s),i.fillStyle=t}else i.fillStyle="rgba(128, 128, 128, 1)";i.fillRect(0,0,a,n)}function R(t){const{width:o,height:e}=t,n=t.getContext("2d").getImageData(0,0,o,e),r=new Uint8Array(n.data);for(let a=0;a<r.length;a+=4){const t=r[a+3]/255;r[a]*=t,r[a+1]*=t,r[a+2]*=t}return[r,o,e]}function I(t){const o=t[0]?.[0]?.[0]??0,e=t[0]?.[0]?.[1]??0,n={ymin:e,xmin:o,ymax:e,xmax:o,width:0,height:0};for(let r=0;r<t.length;r++){const o=t[r];for(let t=0;t<o.length;t++){const e=o[t][0],r=o[t][1];e<n.xmin&&(n.xmin=e),e>n.xmax&&(n.xmax=e),r<n.ymin&&(n.ymin=r),r>n.ymax&&(n.ymax=r)}}return n.width=Math.abs(n.xmax-n.xmin),n.height=Math.abs(n.ymax-n.ymin),n}function N(t,o){const e=I(t),n=0===e.width?1:e.width,r=0===e.height?1:e.height,a=[];for(let s=0;s<t.length;s++){const i=t[s],l=[];for(let t=0;t<i.length;t++){let a=Math.round(i[t][0]-e.xmin),s=Math.round(i[t][1]-e.ymin);if(a=o.xmin+a*o.width/n,s=o.ymin+s*o.height/r,isNaN(a)||isNaN(s))throw new Error("Scaled shape has NaN values");l.push([a,s])}a.push(l)}return a}function U(t,o,e){const n=[];for(let r=0;r<t.length;r++){const a=t[r],s=[];for(let t=0;t<a.length;t++){const n=a[t][0]+o,r=a[t][1]+e;if(isNaN(n)||isNaN(r))throw new Error("Scaled shape has NaN values");s.push([n,r])}n.push(s)}return n}export{y as addColorStops,d as applyAlphaMask,g as createAlphaMaskRings,u as createHaloImage,m as createHaloSDF,C as rasterizeDash,M as rasterizeDash1D,p as rasterizeFillStyle,w as rasterizeGradient,N as scale,U as translate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function l(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.slice(n,o)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,a(t)])}return r}function c(e,t,r){let n="",o=null;for(const i of t){const[t,r,a]=i;if(null!=t&&""!==t)a?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,l]=a;if(null!=t&&""!==t)l?i=t:(null!=i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=X(n,r));const a=e.attributes[t];null!=a&&""!==a&&(null!=i&&(o+=i,i=null),o+=a)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,i,a=!0){const l=t/o,c=r/i,s=Math.ceil(l/2),u=Math.ceil(c/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let y=0,m=0,C=0,h=0,I=0,b=0,p=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*l,a=o*o;for(let c=Math.floor(r*l);c<(r+1)*l;c++){let r=Math.abs(i-(c+.5))/s;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(c+n*t),p+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),h+=y*e[r],I+=y*e[r+1],b+=y*e[r+2],m+=y))}}n[M]=h/m,n[M+1]=I/m,n[M+2]=b/m,n[M+3]=p/C}}function M(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function y(e){return e.data?.symbol??null}function m(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function h(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function I(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const b=(e,t=0)=>null==e||isNaN(e)?t:e,p=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?M(e.tintColor):[255,255,255,1];function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function g(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function P(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function w(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function L(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=L(t);if(null!=e)return e}break;case"CIMTextSymbol":return L(e.symbol);case"CIMSolidFill":return e.color}return null}function G(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=G(e);if(null!=t)return t}break}case"CIMTextSymbol":return G(e.symbol);case"CIMSolidStroke":return e.color}}function E(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function A(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=A(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return A(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function T(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":return"center";case"Justify":return"justify"}}function x(e){switch(e){default:case"Bottom":return"bottom";case"Top":return"top";case"Center":return"middle";case"Baseline":return"baseline"}}function v(e){return(e?Object.keys(e):[]).map(t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"}))}const N=e=>e.includes("data:image/svg+xml");function F(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function z(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function V(e,t,r,n,o,i,a=!0){const{infos:l}=i;let c=1,s=0,u=0,f=0,M=1;for(const{absoluteAnchorPoint:C,offsetX:h,offsetY:I,rotation:b,size:p,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:S}of l){M=C?1:c;u=K(h,I,s,M,u),f=$(h,I,s,M,f),d&&(S||a)&&(c*=p/d),s=Q(b,k,s)}const y=K(n,o,s,M,u),m=$(n,o,s,M,f);return{size:e*c,rotation:Q(t,r,s),offsetX:y,offsetY:m}}function O(e){if(null==e)return!1;if(Array.isArray(e))return e.every(e=>O(e));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function R(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function D(e){return e.split(" ").map(e=>Number(e))}function W(e){return"string"==typeof e?D(e):e}function j(e){return e?.dashTemplate&&(e.dashTemplate=W(e.dashTemplate)),e}function q(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return q(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return q(e.symbol)}}return"Normal"}function B(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&I(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function X(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function Y(e){return e.map(e=>({...e,propertyName:z(e.propertyName)}))}function H(e){const t={};for(const r in e){const n=e[r];t[z(r)]=n}return t}function J(e){if(!e)return 0;let t=0;for(const r of e)t+=U(r);return t}function U(e){if(!e)return 0;if(te(e))return e.inflateSize??256;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectCircularSector":return Math.abs(e.radius??25);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(b(e.offsetX)),Math.abs(b(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRadial":return Math.abs(e.length??5);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function $(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function K(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function Q(e,t,r){return t?r-e:r+e}function Z(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let i=t[z(r)];if(null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180)),null==i&&(i=R(t.type,r.toLowerCase()),null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]]:o&&(i*=Math.PI/180))),null!=t.primitiveName){const a=e[t.primitiveName];if(null!=a){const e=a[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(i=e,null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180))):(i={valueExpressionInfo:e,defaultValue:i},null!=i&&(n?i={type:"Process",op:"ArcadeColor",value:i}:o&&(i={type:"Process",op:"Divide",left:i,right:180/Math.PI}))))}}if(null==i)throw new Error(`Failed to derive a value or an expression for "${r}".`);return i}function _(e,t,r){if(null!=t[z(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function ee(e,t){return Math.max(Math.min((e??t)/100,1),0)}function te(e){return e.type.startsWith("Private")}function re(e){return null!=e&&ne(e)?e:void 0}function ne(e){return"setControlPoint"in e&&"getControlPoint"in e&&"setControlPointAt"in e&&"getControlPointAt"in e}export{u as adjustTextCase,l as analyzeTextParts,V as applyParentTransform,re as asCIMGeometryCursor,s as assignTextValuesFromFeature,v as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,w as fromCIMFontDecoration,P as fromCIMFontStyle,T as fromCIMHorizontalAlignment,x as fromCIMVerticalAlignment,R as getDefaultCIMValue,J as getEffectsInflateSize,d as getEnum,X as getFieldName,L as getFillColor,S as getFontStyle,g as getFontWeight,b as getNumericValue,Z as getProcessParam,ee as getRelativeGradientSize,B as getSize,G as getStrokeColor,A as getStrokeWidth,q as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,p as getValue,_ as hasProcessParam,E as hasStrokeLayer,h as isCIMFill,m as isCIMMarker,I as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,te as isPrivateGeometricEffect,N as isSVGImage,O as isValidCIMValue,F as mapCIMSymbolToGeometryType,M as normalizeAlpha,j as normalizeDashEffectTemplate,W as normalizeDashTemplate,Y as normalizePrimitiveOverrideProps,D as parseDashTemplate,f as resampleHermite,y as toCIMSymbolJSON,H as toLowerCaseProps,z as uncapitalize};
2
+ import{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function l(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.slice(n,o)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,a(t)])}return r}function c(e,t,r){let n="",o=null;for(const i of t){const[t,r,a]=i;if(null!=t&&""!==t)a?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,l]=a;if(null!=t&&""!==t)l?i=t:(null!=i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=Y(n,r));const a=e.attributes[t];null!=a&&""!==a&&(null!=i&&(o+=i,i=null),o+=a)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,i,a=!0){const l=t/o,c=r/i,s=Math.ceil(l/2),u=Math.ceil(c/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let y=0,m=0,C=0,h=0,I=0,b=0,p=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*l,a=o*o;for(let c=Math.floor(r*l);c<(r+1)*l;c++){let r=Math.abs(i-(c+.5))/s;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(c+n*t),p+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),h+=y*e[r],I+=y*e[r+1],b+=y*e[r+2],m+=y))}}n[M]=h/m,n[M+1]=I/m,n[M+2]=b/m,n[M+3]=p/C}}function M(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function y(e){return e.data?.symbol??null}function m(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function h(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function I(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const b=(e,t=0)=>null==e||isNaN(e)?t:e,p=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?M(e.tintColor):[255,255,255,1];function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function g(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function P(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function w(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function L(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=L(t);if(null!=e)return e}break;case"CIMTextSymbol":return L(e.symbol);case"CIMSolidFill":return e.color}return null}function G(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=G(e);if(null!=t)return t}break}case"CIMTextSymbol":return G(e.symbol);case"CIMSolidStroke":return e.color}}function E(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function A(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=A(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return A(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function x(t){let r=0;for(const n of t??[])!1!==n.enable&&C(n)&&(r=Math.max(r,b(n.width,e[n.type].width)));return r}function T(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":return"center";case"Justify":return"justify"}}function v(e){switch(e){default:case"Bottom":return"bottom";case"Top":return"top";case"Center":return"middle";case"Baseline":return"baseline"}}function N(e){return(e?Object.keys(e):[]).map(t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"}))}const F=e=>e.includes("data:image/svg+xml");function z(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function V(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function O(e,t,r,n,o,i,a=!0){const{infos:l}=i;let c=1,s=0,u=0,f=0,M=1;for(const{absoluteAnchorPoint:C,offsetX:h,offsetY:I,rotation:b,size:p,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:S}of l){M=C?1:c;u=Q(h,I,s,M,u),f=K(h,I,s,M,f),d&&(S||a)&&(c*=p/d),s=Z(b,k,s)}const y=Q(n,o,s,M,u),m=K(n,o,s,M,f);return{size:e*c,rotation:Z(t,r,s),offsetX:y,offsetY:m}}function R(e){if(null==e)return!1;if(Array.isArray(e))return e.every(e=>R(e));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function D(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function W(e){return e.split(" ").map(e=>Number(e))}function j(e){return"string"==typeof e?W(e):e}function q(e){return e?.dashTemplate&&(e.dashTemplate=j(e.dashTemplate)),e}function B(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return B(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return B(e.symbol)}}return"Normal"}function X(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&I(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function Y(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function H(e){return e.map(e=>({...e,propertyName:V(e.propertyName)}))}function J(e){const t={};for(const r in e){const n=e[r];t[V(r)]=n}return t}function U(e){if(!e)return 0;let t=0;for(const r of e)t+=$(r);return t}function $(e){if(!e)return 0;if(re(e))return e.inflateSize??256;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectCircularSector":return Math.abs(e.radius??25);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(b(e.offsetX)),Math.abs(b(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRadial":return Math.abs(e.length??5);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function K(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function Q(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function Z(e,t,r){return t?r-e:r+e}function _(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let i=t[V(r)];if(null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180)),null==i&&(i=D(t.type,r.toLowerCase()),null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]]:o&&(i*=Math.PI/180))),null!=t.primitiveName){const a=e[t.primitiveName];if(null!=a){const e=a[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(i=e,null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180))):(i={valueExpressionInfo:e,defaultValue:i},null!=i&&(n?i={type:"Process",op:"ArcadeColor",value:i}:o&&(i={type:"Process",op:"Divide",left:i,right:180/Math.PI}))))}}if(null==i)throw new Error(`Failed to derive a value or an expression for "${r}".`);return i}function ee(e,t,r){if(null!=t[V(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function te(e,t){return Math.max(Math.min((e??t)/100,1),0)}function re(e){return e.type.startsWith("Private")}function ne(e){return null!=e&&oe(e)?e:void 0}function oe(e){return"setControlPoint"in e&&"getControlPoint"in e&&"setControlPointAt"in e&&"getControlPointAt"in e}export{u as adjustTextCase,l as analyzeTextParts,O as applyParentTransform,ne as asCIMGeometryCursor,s as assignTextValuesFromFeature,N as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,w as fromCIMFontDecoration,P as fromCIMFontStyle,T as fromCIMHorizontalAlignment,v as fromCIMVerticalAlignment,D as getDefaultCIMValue,U as getEffectsInflateSize,d as getEnum,Y as getFieldName,L as getFillColor,S as getFontStyle,g as getFontWeight,x as getMaxStrokeWidth,b as getNumericValue,_ as getProcessParam,te as getRelativeGradientSize,X as getSize,G as getStrokeColor,A as getStrokeWidth,B as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,p as getValue,ee as hasProcessParam,E as hasStrokeLayer,h as isCIMFill,m as isCIMMarker,I as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,re as isPrivateGeometricEffect,F as isSVGImage,R as isValidCIMValue,z as mapCIMSymbolToGeometryType,M as normalizeAlpha,q as normalizeDashEffectTemplate,j as normalizeDashTemplate,H as normalizePrimitiveOverrideProps,W as parseDashTemplate,f as resampleHermite,y as toCIMSymbolJSON,J as toLowerCaseProps,V as uncapitalize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const t=1e20;class e{constructor(t){this.pxDensity=4,this.sdfSizePx=t.sdfSizePx,this.sdfBufferPx=t.sdfBufferPx,this.rasterSizePx=this.pxDensity*this.sdfSizePx,this.rasterBufferPx=this.pxDensity*this.sdfBufferPx,this.radius=t.radius,this.cutoff=t.cutoff;const e=this.pxDensity*t.sdfSizePx*3;this.canvasSize=e;const s=new OffscreenCanvas(e,e);this.context=s.getContext("2d",{willReadFrequently:!0}),this.context.imageSmoothingEnabled=!1,this.gridOuter=new Float64Array(e*e),this.gridInner=new Float64Array(e*e),this.gridValues=new Float64Array(e),this.parabolaBoundaries=new Float64Array(e+1),this.parabolaIndices=new Uint16Array(e)}draw(e,s){const{context:i,gridInner:n,gridOuter:r,rasterSizePx:a,rasterBufferPx:h,canvasSize:o,radius:l,cutoff:c}=this,f=a/e.units_per_em();this.context.fillStyle="black",this.context.strokeStyle="black",this.context.resetTransform(),this.context.clearRect(0,0,o,o),this.context.translate(a,a),this.context.scale(f,f);const x=e.paintCurves(s,i);if(!x)return null;const d=x.xMin*f,u=x.xMax*f,y=x.yMin*f,p=x.yMax*f;x.free();const M=Math.ceil(u-d),D=Math.ceil(p-y),g=Math.floor(a+d-h),w=Math.floor(a+y-h),P=M+2*h,S=D+2*h,_=new Float32Array(Math.max(P*S,0)),b=i.getImageData(g,w,P,S);r.fill(t,0,_.length),n.fill(0,0,_.length);for(let C=0;C<S;C++)for(let e=0;e<P;e++){const s=S-1-C,i=b.data[4*(s*P+e)+3]/255;if(0===i)continue;const a=C*P+e;if(1===i)r[a]=0,n[a]=t;else{const t=.5-i;r[a]=t>0?t*t:0,n[a]=t<0?t*t:0}}this._edt(r,0,0,P,S,P),this._edt(n,0,0,P,S,P);for(let t=0;t<_.length;t++)_[t]=Math.sqrt(r[t])-Math.sqrt(n[t]);const m=Math.ceil(P/this.pxDensity),z=Math.ceil(S/this.pxDensity),A=this.pxDensity*this.pxDensity,B=new Uint8ClampedArray(Math.max(m*z,0));for(let t=0;t<z;t++)for(let e=0;e<m;e++){let s=0;for(let n=0;n<this.pxDensity;n++)for(let i=0;i<this.pxDensity;i++){if(e+i>P||t+n>S)continue;s+=_[(this.pxDensity*t+n)*P+(this.pxDensity*e+i)]}const i=s/this.pxDensity/A/l+c;B[t*m+e]=Math.round(255-255*i)}const F=f*e.face_height(),I=Math.round(p-F+2*h),v=Math.round(d-h);return{buffer:B,rect:{width:Math.ceil(M/this.pxDensity),height:Math.ceil(D/this.pxDensity),top:Math.round(I/this.pxDensity),left:Math.round(v/this.pxDensity)}}}_edt(t,e,s,i,n,r){for(let a=e;a<e+i;a++)this._edt1d(t,s*r+a,r,n);for(let a=s;a<s+n;a++)this._edt1d(t,a*r+e,1,i)}_edt1d(e,s,i,n){const r=this.parabolaIndices,a=this.parabolaBoundaries,h=this.gridValues;r[0]=0,a[0]=-t,a[1]=t,h[0]=e[s];let o=0;for(let l=1;l<n;l++){h[l]=e[s+l*i];const n=l*l;let c;do{const t=r[o];c=(h[l]-h[t]+n-t*t)/(l-t)/2}while(c<=a[o]&&--o>-1);o++,r[o]=l,a[o]=c,a[o+1]=t}for(let t=0,l=0;t<n;t++){for(;a[l+1]<t;)l++;const n=r[l],o=t-n;e[s+t*i]=h[n]+o*o}}}export{e as GlyphSDFCreator};
2
+ import{EuclideanDistanceTransform as t}from"../../../../core/EuclideanDistanceTransform.js";class e{constructor(e){this.pxDensity=4,this.sdfSizePx=e.sdfSizePx,this.sdfBufferPx=e.sdfBufferPx,this.rasterSizePx=this.pxDensity*this.sdfSizePx,this.rasterBufferPx=this.pxDensity*this.sdfBufferPx,this.radius=e.radius,this.cutoff=e.cutoff;const s=this.pxDensity*e.sdfSizePx*3;this.canvasSize=s;const i=new OffscreenCanvas(s,s);this.context=i.getContext("2d",{willReadFrequently:!0}),this.context.imageSmoothingEnabled=!1,this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.distanceTransform=new t(s)}draw(t,e){const{context:s,gridInner:i,gridOuter:n,rasterSizePx:r,rasterBufferPx:a,canvasSize:h,radius:o,cutoff:c}=this,f=r/t.units_per_em();this.context.fillStyle="black",this.context.strokeStyle="black",this.context.resetTransform(),this.context.clearRect(0,0,h,h),this.context.translate(r,r),this.context.scale(f,f);const l=t.paintCurves(e,s);if(!l)return null;const x=l.xMin*f,u=l.xMax*f,d=l.yMin*f,y=l.yMax*f;l.free();const p=Math.ceil(u-x),M=Math.ceil(y-d),D=Math.floor(r+x-a),m=Math.floor(r+d-a),g=p+2*a,P=M+2*a,S=new Float32Array(Math.max(g*P,0)),w=s.getImageData(D,m,g,P);n.fill(Number.MAX_VALUE,0,S.length),i.fill(0,0,S.length);for(let C=0;C<P;C++)for(let t=0;t<g;t++){const e=P-1-C,s=w.data[4*(e*g+t)+3]/255;if(0===s)continue;const r=C*g+t;if(1===s)n[r]=0,i[r]=Number.MAX_VALUE;else{const t=.5-s;n[r]=t>0?t*t:0,i[r]=t<0?t*t:0}}this.distanceTransform.compute(n,g,P),this.distanceTransform.compute(i,g,P);for(let C=0;C<S.length;C++)S[C]=n[C]-i[C];const z=Math.ceil(g/this.pxDensity),A=Math.ceil(P/this.pxDensity),b=this.pxDensity*this.pxDensity,B=new Uint8ClampedArray(Math.max(z*A,0));for(let C=0;C<A;C++)for(let t=0;t<z;t++){let e=0;for(let i=0;i<this.pxDensity;i++)for(let s=0;s<this.pxDensity;s++){if(t+s>g||C+i>P)continue;e+=S[(this.pxDensity*C+i)*g+(this.pxDensity*t+s)]}const s=e/this.pxDensity/b/o+c;B[C*z+t]=Math.round(255-255*s)}const T=f*t.face_height(),_=Math.round(y-T+2*a),v=Math.round(x-a);return{buffer:B,rect:{width:Math.ceil(p/this.pxDensity),height:Math.ceil(M/this.pxDensity),top:Math.round(_/this.pxDensity),left:Math.round(v/this.pxDensity)}}}}export{e as GlyphSDFCreator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as i,createHiddenSvg as r,createSvgElement as n}from"../svgUtils.js";const o=1e20;class a{constructor(t,e=2){this._textureSize=t,this._rasterizationScale=e,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:s}=this,i=document.createElement("canvas");i.width=i.height=s,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(s*s),this._gridInner=new Float64Array(s*s),this._f=new Float64Array(s),this._d=new Float64Array(s),this._z=new Float64Array(s+1),this._v=new Int16Array(s)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=i(this._svg)}draw(i,r,n){const{_canvasSize:a,_textureSize:h,_rasterizationScale:_}=this,l=h/4;this._initSVG();const c=this.createSVGString(i,r);return new Promise((i,r)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(c),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(d,0,0,a,a);const e=this._context.getImageData(0,0,a,a),s=new Uint8Array(h*h*4);for(let t=0;t<a*a;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?o:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?o:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,a,a),this._edt(this._gridInner,a,a);for(let i=0;i<h*h;i++){let e=0;for(let t=0;t<_;t++){const s=Math.floor(i/h)*_+t;for(let t=0;t<_;t++){const r=s*a+(i%h*_+t);e+=this._gridOuter[r]-this._gridInner[r]}}e/=_*_,e/=_;t(.5-e/(2*l),s,4*i)}i(s)};const g=n?.signal;g&&e(g,()=>r(s()))})}_initSVG(){return this._svg||(this._svg=r()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=n("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),o=r.width/r.height,a=this._canvasSize/2;let h,_,l;if(o>1){h=a/r.width;const t=a*(1/o);_=this._canvasSize/4,l=a-t/2}else{h=a/r.height;_=a-a*o/2,l=this._canvasSize/4}const c=-r.x*h+_,d=-r.y*h+l;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${c}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}_edt(t,e,s){const i=this._f,r=this._d,n=this._v,o=this._z;for(let a=0;a<e;a++){for(let r=0;r<s;r++)i[r]=t[r*e+a];this._edt1d(i,r,n,o,s);for(let i=0;i<s;i++)t[i*e+a]=r[i]}for(let a=0;a<s;a++){for(let s=0;s<e;s++)i[s]=t[a*e+s];this._edt1d(i,r,n,o,e);for(let s=0;s<e;s++)t[a*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,i,r){s[0]=0,i[0]=-o,i[1]=+o;for(let n=1,a=0;n<r;n++){let e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);for(;e<=i[a];)a--,e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);a++,s[a]=n,i[a]=e,i[a+1]=+o}for(let n=0,o=0;n<r;n++){for(;i[o+1]<n;)o++;e[n]=(n-s[o])*(n-s[o])+t[s[o]]}}}export{a as default};
2
+ import{EuclideanDistanceTransform as t}from"../../../../core/EuclideanDistanceTransform.js";import{packFloatRGBA as e}from"../../../../core/floatRGBA.js";import{onAbort as s,createAbortError as i}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as r,createHiddenSvg as n,createSvgElement as a}from"../svgUtils.js";class o{constructor(e,s=2){this._textureSize=e,this._rasterizationScale=s,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:i}=this,r=document.createElement("canvas");r.width=r.height=i,this._context=r.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(i*i),this._gridInner=new Float64Array(i*i),this._distanceTransform=new t(i)}dispose(){this._context=this._gridOuter=this._gridInner=null,this._distanceTransform=null,this._svg=r(this._svg)}draw(t,r,n){const{_canvasSize:a,_textureSize:o,_rasterizationScale:h}=this,c=o/4;this._initSVG();const _=this.createSVGString(t,r);return new Promise((t,r)=>{const l=new Image;l.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(_),l.onload=()=>{l.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(l,0,0,a,a);const s=this._context.getImageData(0,0,a,a),i=new Uint8Array(o*o*4);for(let t=0;t<a*a;t++){const e=s.data[4*t+3]/255;this._gridOuter[t]=1===e?0:0===e?Number.MAX_VALUE:Math.max(0,.5-e)**2,this._gridInner[t]=1===e?Number.MAX_VALUE:0===e?0:Math.max(0,e-.5)**2}this._distanceTransform.compute(this._gridOuter,a,a),this._distanceTransform.compute(this._gridInner,a,a);for(let t=0;t<o*o;t++){let s=0;for(let e=0;e<h;e++){const i=Math.floor(t/o)*h+e;for(let e=0;e<h;e++){const r=i*a+(t%o*h+e);s+=this._gridOuter[r]-this._gridInner[r]}}s/=h*h,s/=h;e(.5-s/(2*c),i,4*t)}t(i)};const d=n?.signal;d&&s(d,()=>r(i()))})}_initSVG(){return this._svg||(this._svg=n()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=a("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),n=r.width/r.height,o=this._canvasSize/2;let h,c,_;if(n>1){h=o/r.width;const t=o*(1/n);c=this._canvasSize/4,_=o-t/2}else{h=o/r.height;c=o-o*n/2,_=this._canvasSize/4}const l=-r.x*h+c,d=-r.y*h+_;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${l}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}}export{o as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import r from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function h(t){return t&&"static"===t.type}class c{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,c,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(h(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:c,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),h(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=g(t,a.size),a.texture=o),o.setSamplingMode(e),t.bindTexture(o,s),h(r))a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{const t=r.data;t.hasFrameData&&(t.loadFrame(o),o.generateMipmap())}a.dirty=!1}getTexture(t,e=0){const{context:i}=t,s=this._mosaicPages[e],a=s.mosaicsData;let r=s.texture;if(r||(r=g(i,s.size),s.texture=r),h(a))s.dirty&&(r.setData(new Uint8Array(a.data.buffer)),r.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{const e=a.data;e.update(t),e.hasFrameData&&(e.loadFrame(r),r.generateMipmap())}return s.dirty=!1,r}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!h(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!h(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;c._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const c=this._binPack.allocate(t,r);if(c.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&h(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*n++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!h(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const c=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),c.putImageData(n,0,0),document.body.appendChild(o)}}let n=0;function g(t,e){const i=new o(e[0],e[1]);return i.wrapMode=33071,new r(t,i,null)}export{c as default};
2
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import r from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function h(t){return t&&"static"===t.type}class c{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getSize(t){return t>=this._mosaicPages.length?[0,0]:this._mosaicPages[t].size}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,c,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(h(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:c,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),h(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=g(t,a.size),a.texture=o),o.setSamplingMode(e),t.bindTexture(o,s),h(r))a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{const t=r.data;t.hasFrameData&&(t.loadFrame(o),o.generateMipmap())}a.dirty=!1}getTexture(t,e=0){const{context:i}=t,s=this._mosaicPages[e],a=s.mosaicsData;let r=s.texture;if(r||(r=g(i,s.size),s.texture=r),h(a))s.dirty&&(r.setData(new Uint8Array(a.data.buffer)),r.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{const e=a.data;e.update(t),e.hasFrameData&&(e.loadFrame(r),r.generateMipmap())}return s.dirty=!1,r}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!h(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!h(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;c._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const c=this._binPack.allocate(t,r);if(c.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&h(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*n++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!h(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const c=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),c.putImageData(n,0,0),document.body.appendChild(o)}}let n=0;function g(t,e){const i=new o(e[0],e[1]);return i.wrapMode=33071,new r(t,i,null)}export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{throwIfAborted as s,isAbortError as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{numericHash as c}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as l}from"../../../../symbols/cim/CIMSymbolHelper.js";import h from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as p,textureBindingSpriteAtlas as d,textureBindingGlyphAtlas as g}from"./definitions.js";import{GlyphMosaic as f}from"./GlyphMosaic.js";import y from"./Rect.js";import M from"./SDFConverter.js";import _ from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as I}from"./urlUtils.js";import{getCIMMarkerPlacementHash as w,isSVGImage as S}from"./Utils.js";import{AnimatableTextureResource as z}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as T}from"./animations/store/AnimationStore.js";const C=()=>r.getLogger("esri.views.MapView"),R=(e,t,r)=>C().error(new i(e,t,r));class P{static fromMosaic(e,t){return new P(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class x{constructor(r){this._requestRender=r,this._resourceManager=new u,this._sdfConverter=new M(p),this._hashToBindingInfo=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new n({concurrency:10,process:async(e,r)=>{s(r);try{return await t(e,{responseType:"image",signal:r})}catch(n){if(!a(n))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,n);throw n}}}),this.animationStore=new T,this._spriteMosaic=new _(2048,2048,500),this._glyphMosaic=new f(1024,1024,!1,e=>this._setTextureBinding(1,e)),this._rasterizer=new h(this.resourceManager),this._baseUrl=`${e.fontsUrl}/{fontstack}/{range}.pbf`}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingInfo.clear(),this._hashToBindingInfo=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}openMessagePorts(){return this._glyphMosaic.openMessagePorts()}async rasterizeItem(e,t){if(null==e)return R("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new y(r.column,r.row,t.length,1),page:r.page,textureBinding:1,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return R("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);return this._forEachGlyphItem(e,e=>this._setTextureBinding(1,e.mosaicItem)),e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(R("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?d:g}:(R("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._hashToBindingInfo.get(t);if(!s)return R("mapview-texture-manager",`Could not find binding info for textureKey/mosaicHash ${t}!`),null;const a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,g),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return R("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_setTextureBinding(e,t){const{sdf:i,samplingMode:r,page:s}=t,a=B(e,s,!!i,r);if(!this._hashToBindingInfo.has(a)){const i=P.fromMosaic(e,t);this._hashToBindingInfo.set(a,i)}return t.textureBinding=a,a}async _rasterizeText(e,t){return this._glyphMosaic.rasterizeText(this._baseUrl,e,t)}_forEachGlyphItem(e,t){if(e)if("glyphs"!==e.type)for(const i of e.runs)i.glyphs.glyphs.forEach(t);else e.glyphs.forEach(t)}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${w(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(I(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=c(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await l.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:u,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},$(t),a,n,o,c,u,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[p,p],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return R("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},$(e),o,!1)}let o,c,u;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},u=e.startGroup||0):(o=$(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},u=0);const l=new z(s,this._requestRender,c,u);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(v(s)||k(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return R("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(S(s))if("width"in e&&"height"in e)i.width=o(e.width),i.height=o(e.height);else if("cim"in e){const t=e;i.width=o(t.width??t.scaleX*t.size),i.height=o(t.size)}if(!i.width||!i.height)return null;const n=i.width,c=i.height,u="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:h,image:m}=this._rasterizer.rasterizeImageResource(n,c,i,u);return this._addItemToMosaic(t,l,{type:"static",data:m},$(e),h,!1)}catch(R){if(!a(R))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${R.message}`);throw R}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,u){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,u)}}function $(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return A(e);default:return!0}}const b=e=>null!=e&&e.startsWith("data:image/gif"),v=e=>e&&(e.includes(".gif")||b(e)),j=e=>null!=e&&e.startsWith("data:image/png"),k=e=>e&&(e.includes(".png")||j(e)),A=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;function B(e,t,i,r){return 1|e<<1|(i?1:0)<<2|("Nearest"===r?1:0)<<3|t<<4}export{x as TextureManager,B as hashMosaic};
2
+ import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{throwIfAborted as s,isAbortError as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{numericHash as c}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as h}from"../../../../symbols/cim/CIMSymbolHelper.js";import u from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as p,textureBindingGlyphAtlas as d,textureBindingSpriteAtlas as g}from"./definitions.js";import{GlyphMosaic as f}from"./GlyphMosaic.js";import y from"./Rect.js";import M from"./SDFConverter.js";import _ from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as I}from"./urlUtils.js";import{getCIMMarkerPlacementHash as w,isSVGImage as S}from"./Utils.js";import{AnimatableTextureResource as z}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as T}from"./animations/store/AnimationStore.js";const C=()=>r.getLogger("esri.views.MapView"),R=(e,t,r)=>C().error(new i(e,t,r));class P{static fromMosaic(e,t){return new P(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class b{constructor(r){this._requestRender=r,this._resourceManager=new l,this._sdfConverter=new M(p),this._hashToBindingInfo=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new n({concurrency:10,process:async(e,r)=>{s(r);try{return await t(e,{responseType:"image",signal:r})}catch(n){if(!a(n))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,n);throw n}}}),this.animationStore=new T,this._spriteMosaic=new _(2048,2048,500),this._glyphMosaic=new f(1024,1024,!1,e=>this._setTextureBinding(1,e)),this._rasterizer=new u(this.resourceManager),this._baseUrl=`${e.fontsUrl}/{fontstack}/{range}.pbf`}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingInfo.clear(),this._hashToBindingInfo=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}openMessagePorts(){return this._glyphMosaic.openMessagePorts()}async rasterizeItem(e,t){if(null==e)return R("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new y(r.column,r.row,t.length,1),page:r.page,textureBinding:1,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return R("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);return this._forEachGlyphItem(e,e=>this._setTextureBinding(1,e.mosaicItem)),e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getBindingInfo(e,t,i){const{context:r}=e,s=this._hashToBindingInfo.get(t);if(!s)return R("mapview-texture-manager",`Could not find binding info for textureKey ${t}!`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};const a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;let o,c,l;if(0===s.mosaicType)c=this._spriteMosaic.getTexture(e,a),l=g,o=this._spriteMosaic.getSize(a);else{if(1!==s.mosaicType)return R("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};c=this._glyphMosaic.getTexture(r,a),l=d,o=[this.glyphs.width,this.glyphs.height],this._glyphMosaic.bind(r,n,a,d)}return c.setSamplingMode(n),{mosaicInfo:{size:o},mosaicTexture:{texture:c,unit:l}}}_setTextureBinding(e,t){const{sdf:i,samplingMode:r,page:s}=t,a=F(e,s,!!i,r);if(!this._hashToBindingInfo.has(a)){const i=P.fromMosaic(e,t);this._hashToBindingInfo.set(a,i)}return t.textureBinding=a,a}async _rasterizeText(e,t){return this._glyphMosaic.rasterizeText(this._baseUrl,e,t)}_forEachGlyphItem(e,t){if(e)if("glyphs"!==e.type)for(const i of e.runs)i.glyphs.glyphs.forEach(t);else e.glyphs.forEach(t)}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${w(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(I(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":case"cim-point-symbol-halo":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=c(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type||"cim-point-symbol-halo"===e.type){const t="cim-point-symbol-halo"===e.type?e.symbol:{type:"CIMPointSymbol",symbolLayers:[e]};await h.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"cim-point-symbol-halo":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:l,sdfDecodeCoeff:h}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},$(t),a,n,o,c,l,h)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[p,p],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return R("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},$(e),o,!1)}let o,c,l;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},l=e.startGroup||0):(o=$(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},l=0);const h=new z(s,this._requestRender,c,l);return this._addItemToMosaic(t,[h.width,h.height],{type:"animated",data:h},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(j(s)||v(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return R("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(S(s))if("width"in e&&"height"in e)i.width=o(e.width),i.height=o(e.height);else if("cim"in e){const t=e;i.width=o(t.width??t.scaleX*t.size),i.height=o(t.size)}if(!i.width||!i.height)return null;const n=i.width,c=i.height,l="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:h,sdf:u,image:m}=this._rasterizer.rasterizeImageResource(n,c,i,l);return this._addItemToMosaic(t,h,{type:"static",data:m},$(e),u,!1)}catch(R){if(!a(R))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${R.message}`);throw R}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,l){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,l)}}function $(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return A(e);case"cim-point-symbol-halo":return!1;default:return!0}}const x=e=>null!=e&&e.startsWith("data:image/gif"),j=e=>e&&(e.includes(".gif")||x(e)),k=e=>null!=e&&e.startsWith("data:image/png"),v=e=>e&&(e.includes(".png")||k(e)),A=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;function F(e,t,i,r){return 1|e<<1|(i?1:0)<<2|("Nearest"===r?1:0)<<3|t<<4}export{b as TextureManager,F as hashMosaic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{animationDebugFlags as e}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as a,getSelectionDefines as i,getFeatureTextures as n,getLocalTileOffset as r,getFeatureUniforms as o,resolveDynamicUniforms as s,getFeaturePipelineState as u}from"../featureTechniqueUtils.js";class m extends t{render(t,m){const{context:c,painter:l}=t,{target:g}=m,{freezeGlobalTime:d}=e,f=0,x=l.textureManager.animationStore.getTexture(c,f),p=m.instance.getInput(),T=l.textureManager.getMosaicInfo(t,m.textureKey,!1),{optionalAttributes:b}=p,h=b.zoomRange,D=b.value1Position2Value2,M="accumulatedDistance"in b&&!!b.accumulatedDistance,y="segmentDirection"in b&&!!b.segmentDirection,z="normal"in b&&!!b.normal;l.setShader({shader:this.shaders.geometry,uniforms:{...s(t,m.target,p.uniforms),...o(t,m.target),mosaicInfo:T,animationInfo:{globalTime:t.animationsEnabled?!1===d?t.time/1e3:d:0,animationTextureSize:[x.descriptor.width,x.descriptor.height]},localTileOffset:r(m.target)},textures:{...n(t),mosaicTexture:l.textureManager.getMosaicTexture(t,m.textureKey,!1),animationTexture:{unit:6,texture:x}},defines:{...i(t)},optionalAttributes:{zoomRange:h,value1Position2Value2:D,accumulatedDistance:M,segmentDirection:y,normal:z},useComputeBuffer:a(t)}),l.setPipelineState({...u(t)}),l.submitDraw(t,m),!1===d&&t.animationsEnabled&&g.requestRender()}}export{m as AnimatedTechnique};
2
+ import{animationDebugFlags as e}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as i,getSelectionDefines as a,getFeatureTextures as n,getLocalTileOffset as o,getFeatureUniforms as r,resolveDynamicUniforms as s,getFeaturePipelineState as m}from"../featureTechniqueUtils.js";class u extends t{render(t,u){const{context:c,painter:l}=t,{target:g}=u,{freezeGlobalTime:d}=e,f=0,x=l.textureManager.animationStore.getTexture(c,f),p=u.instance.getInput(),{mosaicInfo:T,mosaicTexture:b}=l.textureManager.getBindingInfo(t,u.textureKey,!1),{optionalAttributes:h}=p,D=h.zoomRange,I=h.value1Position2Value2,z="accumulatedDistance"in h&&!!h.accumulatedDistance,S="segmentDirection"in h&&!!h.segmentDirection,j="normal"in h&&!!h.normal;l.setShader({shader:this.shaders.geometry,uniforms:{...s(t,u.target,p.uniforms),...r(t,u.target),mosaicInfo:T,animationInfo:{globalTime:t.animationsEnabled?!1===d?t.time/1e3:d:0,animationTextureSize:[x.descriptor.width,x.descriptor.height]},localTileOffset:o(u.target)},textures:{...n(t),mosaicTexture:b,animationTexture:{unit:6,texture:x}},defines:{...a(t)},optionalAttributes:{zoomRange:D,value1Position2Value2:I,accumulatedDistance:z,segmentDirection:S,normal:j},useComputeBuffer:i(t)}),l.setPipelineState({...m(t)}),l.submitDraw(t,u),!1===d&&t.animationsEnabled&&g.requestRender()}}export{u as AnimatedTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as a,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as u}from"../featureTechniqueUtils.js";import{ComplexFillShader as n}from"../shaders/ComplexFillShader.js";class m extends e{constructor(){super(...arguments),this.type=10,this.shaders={geometry:new n}}render(e,n){const{painter:m}=e,f=n.instance.getInput();m.setShader({shader:this.shaders.geometry,uniforms:{...o(e,n.target,f.uniforms),...i(e,n.target),mosaicInfo:m.textureManager.getMosaicInfo(e,n.textureKey),localTileOffset:a(n.target)},textures:{...s(e),mosaicTexture:m.textureManager.getMosaicTexture(e,n.textureKey)},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(u(e)),m.submitDraw(e,n)}}export{m as ComplexFillTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as i,getFeatureUniforms as o,resolveDynamicUniforms as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{ComplexFillShader as u}from"../shaders/ComplexFillShader.js";class m extends e{constructor(){super(...arguments),this.type=10,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput(),{mosaicInfo:p,mosaicTexture:c}=m.textureManager.getBindingInfo(e,u.textureKey,!1);m.setShader({shader:this.shaders.geometry,uniforms:{...a(e,u.target,f.uniforms),...o(e,u.target),mosaicInfo:p,localTileOffset:i(u.target)},textures:{...s(e),mosaicTexture:c},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as ComplexFillTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as i,getFeatureUniforms as a,resolveDynamicUniforms as o,getFeaturePipelineState as u}from"../featureTechniqueUtils.js";import{ComplexOutlineFillShader as n}from"../shaders/ComplexOutlineFillShader.js";class m extends e{constructor(){super(...arguments),this.type=11,this.shaders={geometry:new n}}render(e,n){const{painter:m}=e,f=n.instance.getInput();m.setShader({shader:this.shaders.geometry,uniforms:{...o(e,n.target,f.uniforms),...a(e,n.target),mosaicInfo:m.textureManager.getMosaicInfo(e,n.textureKey),localTileOffset:i(n.target)},textures:{...s(e),mosaicTexture:m.textureManager.getMosaicTexture(e,n.textureKey)},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(u(e)),m.submitDraw(e,n)}}export{m as ComplexOutlineFillTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as i,getFeatureUniforms as o,resolveDynamicUniforms as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{ComplexOutlineFillShader as u}from"../shaders/ComplexOutlineFillShader.js";class m extends e{constructor(){super(...arguments),this.type=11,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput(),{mosaicInfo:p,mosaicTexture:c}=m.textureManager.getBindingInfo(e,u.textureKey,!1);m.setShader({shader:this.shaders.geometry,uniforms:{...a(e,u.target,f.uniforms),...o(e,u.target),mosaicInfo:p,localTileOffset:i(u.target)},textures:{...s(e),mosaicTexture:c},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as ComplexOutlineFillTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as i,resolveDynamicUniforms as a,getFeaturePipelineState as o}from"../featureTechniqueUtils.js";import{GradientFillShader as n}from"../shaders/GradientFillShader.js";class u extends e{constructor(){super(...arguments),this.type=16,this.shaders={geometry:new n},this.symbologyPlane=0}render(e,n){const{painter:u}=e,m=n.instance.getInput();u.setShader({shader:this.shaders.geometry,uniforms:{...a(e,n.target,m.uniforms),...i(e,n.target),mosaicInfo:u.textureManager.getMosaicInfo(e,n.textureKey)},textures:{...s(e),mosaicTexture:u.textureManager.getMosaicTexture(e,n.textureKey)},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(o(e)),u.submitDraw(e,n)}}export{u as GradientFillTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as a}from"../featureTechniqueUtils.js";import{GradientFillShader as n}from"../shaders/GradientFillShader.js";class u extends e{constructor(){super(...arguments),this.type=16,this.shaders={geometry:new n},this.symbologyPlane=0}render(e,n){const{painter:u}=e,m=n.instance.getInput(),{mosaicInfo:f,mosaicTexture:h}=u.textureManager.getBindingInfo(e,n.textureKey,!1);u.setShader({shader:this.shaders.geometry,uniforms:{...o(e,n.target,m.uniforms),...i(e,n.target),mosaicInfo:f},textures:{...s(e),mosaicTexture:h},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(a(e)),u.submitDraw(e,n)}}export{u as GradientFillTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as a,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{PatternFillShader as u}from"../shaders/PatternFillShader.js";class m extends e{constructor(){super(...arguments),this.type=28,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput();m.setShader({shader:this.shaders.geometry,uniforms:{...o(e,u.target,f.uniforms),...i(e,u.target),mosaicInfo:m.textureManager.getMosaicInfo(e,u.textureKey),localTileOffset:a(u.target)},textures:{...s(e),mosaicTexture:m.textureManager.getMosaicTexture(e,u.textureKey)},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as PatternFillTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as i,getFeatureUniforms as o,resolveDynamicUniforms as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{PatternFillShader as u}from"../shaders/PatternFillShader.js";class m extends e{constructor(){super(...arguments),this.type=28,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput(),{mosaicInfo:c,mosaicTexture:p}=m.textureManager.getBindingInfo(e,u.textureKey,!1);m.setShader({shader:this.shaders.geometry,uniforms:{...a(e,u.target,f.uniforms),...o(e,u.target),mosaicInfo:c,localTileOffset:i(u.target)},textures:{...s(e),mosaicTexture:p},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as PatternFillTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as a,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{PatternOutlineFillShader as u}from"../shaders/PatternOutlineFillShader.js";class m extends e{constructor(){super(...arguments),this.type=29,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput();m.setShader({shader:this.shaders.geometry,uniforms:{...o(e,u.target,f.uniforms),...i(e,u.target),mosaicInfo:m.textureManager.getMosaicInfo(e,u.textureKey),localTileOffset:a(u.target)},textures:{...s(e),mosaicTexture:m.textureManager.getMosaicTexture(e,u.textureKey)},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as PatternOutlineFillTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getLocalTileOffset as i,getFeatureUniforms as o,resolveDynamicUniforms as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{PatternOutlineFillShader as u}from"../shaders/PatternOutlineFillShader.js";class m extends e{constructor(){super(...arguments),this.type=29,this.shaders={geometry:new u}}render(e,u){const{painter:m}=e,f=u.instance.getInput(),{mosaicInfo:c,mosaicTexture:p}=m.textureManager.getBindingInfo(e,u.textureKey,!1);m.setShader({shader:this.shaders.geometry,uniforms:{...a(e,u.target,f.uniforms),...o(e,u.target),mosaicInfo:c,localTileOffset:i(u.target)},textures:{...s(e),mosaicTexture:p},defines:{...r(e)},optionalAttributes:f.optionalAttributes,useComputeBuffer:t(e)}),m.setPipelineState(n(e)),m.submitDraw(e,u)}}export{m as PatternOutlineFillTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as t,getFeaturePipelineState as s,isHittest as r,getFeatureTextures as a,getFeatureUniforms as i,resolveDynamicUniforms as n}from"../featureTechniqueUtils.js";import{TextShader as o}from"../text/TextShader.js";class u extends e{constructor(){super(...arguments),this.type=20,this.shaders={geometry:new o},this.drawPhase=14,this.symbologyPlane=3}render(e,o){const{painter:u}=e,c=t(e),d={...s(e),stencil:{write:!1,test:{compare:516,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}},m=o.instance.getInput(),f={shader:this.shaders.geometry,uniforms:{...n(e,o.target,m.uniforms),...i(e,o.target),mosaicInfo:u.textureManager.getMosaicInfo(e,o.textureKey)},textures:{...a(e),mosaicTexture:u.textureManager.getMosaicTexture(e,o.textureKey)},defines:{...c,textRenderPassType:0,isBackgroundPass:!0,isLabel:!0},optionalAttributes:m.optionalAttributes,useComputeBuffer:r(e)};u.setPipelineState(d),u.setShader(f),u.submitDraw(e,o,{stencilRef:255}),u.setShader({...f,defines:{...c,textRenderPassType:2,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,o,{stencilRef:255}),u.setShader({...f,defines:{...c,textRenderPassType:0,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,o,{stencilRef:255})}}export{u as LabelTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as t,getFeaturePipelineState as s,isHittest as r,getFeatureTextures as a,getFeatureUniforms as i,resolveDynamicUniforms as n}from"../featureTechniqueUtils.js";import{TextShader as o}from"../text/TextShader.js";class u extends e{constructor(){super(...arguments),this.type=20,this.shaders={geometry:new o},this.drawPhase=14,this.symbologyPlane=3}render(e,o){const{painter:u}=e,m=t(e),d={...s(e),stencil:{write:!1,test:{compare:516,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}},c=o.instance.getInput(),{mosaicInfo:f,mosaicTexture:p}=u.textureManager.getBindingInfo(e,o.textureKey,!1),l={shader:this.shaders.geometry,uniforms:{...n(e,o.target,c.uniforms),...i(e,o.target),mosaicInfo:f},textures:{...a(e),mosaicTexture:p},defines:{...m,textRenderPassType:0,isBackgroundPass:!0,isLabel:!0},optionalAttributes:c.optionalAttributes,useComputeBuffer:r(e)};u.setPipelineState(d),u.setShader(l),u.submitDraw(e,o,{stencilRef:255}),u.setShader({...l,defines:{...m,textRenderPassType:2,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,o,{stencilRef:255}),u.setShader({...l,defines:{...m,textRenderPassType:0,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,o,{stencilRef:255})}}export{u as LabelTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as s,getFeatureTextures as r,getFeatureUniforms as i,resolveDynamicUniforms as a,isHighlight as o,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{GradientStrokeShader as p}from"../shaders/GradientStrokeShader.js";class u extends e{constructor(){super(...arguments),this.type=17,this.shaders={geometry:new p},this.symbologyPlane=1}_getShaderOptions(e,o,n){const{painter:p}=e,u=o.instance.getInput();return{shader:this.shaders.geometry,uniforms:{...a(e,o.target,u.uniforms),...i(e,o.target),mosaicInfo:p.textureManager.getMosaicInfo(e,o.textureKey),technique:{isColorPass:n}},textures:{...r(e),mosaicTexture:p.textureManager.getMosaicTexture(e,o.textureKey)},defines:{...s(e)},optionalAttributes:u.optionalAttributes,useComputeBuffer:t(e)}}render(e,s){const{painter:r}=e;if(t(e)||o(e)){const t=n(e);return r.setPipelineState(t),r.setShader(this._getShaderOptions(e,s,1)),void r.submitDraw(e,s)}e.context.setClearDepth(1),e.context.clear(256);const i={color:!1,depth:{write:{zNear:0,zFar:1},test:513},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(e,s,0)),r.setPipelineState(i),r.submitDraw(e,s);const a={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:515},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(e,s,1)),r.setPipelineState(a),r.submitDraw(e,s)}}export{u as GradientStrokeTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as s,getFeatureTextures as r,getFeatureUniforms as i,resolveDynamicUniforms as o,isHighlight as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{GradientStrokeShader as p}from"../shaders/GradientStrokeShader.js";class c extends e{constructor(){super(...arguments),this.type=17,this.shaders={geometry:new p},this.symbologyPlane=1}_getShaderOptions(e,a,n){const{painter:p}=e,c=a.instance.getInput(),{mosaicInfo:h,mosaicTexture:u}=p.textureManager.getBindingInfo(e,a.textureKey,!1);return{shader:this.shaders.geometry,uniforms:{...o(e,a.target,c.uniforms),...i(e,a.target),mosaicInfo:h,technique:{isColorPass:n}},textures:{...r(e),mosaicTexture:u},defines:{...s(e)},optionalAttributes:c.optionalAttributes,useComputeBuffer:t(e)}}render(e,s){const{painter:r}=e;if(t(e)||a(e)){const t=n(e);return r.setPipelineState(t),r.setShader(this._getShaderOptions(e,s,1)),void r.submitDraw(e,s)}e.context.setClearDepth(1),e.context.clear(256);const i={color:!1,depth:{write:{zNear:0,zFar:1},test:513},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(e,s,0)),r.setPipelineState(i),r.submitDraw(e,s);const o={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:515},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(e,s,1)),r.setPipelineState(o),r.submitDraw(e,s)}}export{c as GradientStrokeTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{thinLineHalfWidthThreshold as s}from"../../../definitions.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r}from"../../../mesh/templates/templateUtils.js";import{processLineCapInput as o,processLineJoinInput as n,packRounded as a,processColorInput as c,getMinMaxZoom as h}from"../fill/meshWriterUtils.js";import{MeshWriter as l}from"../mesh/MeshWriter.js";import{getLineClippingMargin as u}from"../mesh/utils.js";import{DataType as f}from"../../../../../../webgl/enums.js";class m{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const p={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:f.HALF_FLOAT,count:2,pack:({scaleInfo:t},{tileInfo:e})=>h(t,e)}},attributes:{id:{type:f.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:f.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:f.UNSIGNED_BYTE,count:1},color:{type:f.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>c(t)},offset:{type:f.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[a(t,16),a(e,16)]},normal:{type:f.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[a(t,16),a(e,16)]},halfWidth:{type:f.HALF_FLOAT,count:1,pack:({width:e})=>t(.5*e)},referenceHalfWidth:{type:f.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>t(.5*e)}}};class d{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const _=65535;class x extends l{get _effectRotation(){const{effectRotation:t,effectRotationType:e,useEffectOrigin:s,viewRotation:i}=this.evaluatedMeshParams;return null==t&&null==i?null:{value:t,type:e,useEffectOrigin:!!s,viewRotation:i}}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=p,this._currentWrite=new d,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:_,textured:!1},this._tessParams=new m,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,{target:s,effectGeometry:i}){const r=i??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return r(t,u(this.evaluatedMeshParams))}_writeVertices(e,i,r){const{_currentWrite:a,_tessellationOptions:c,evaluatedMeshParams:h}=this,{width:l,capType:u,joinType:f,miterLimit:m,hasSizeVV:p}=h,d=t(.5*l);c.halfWidth=d,c.capType=o(u),c.joinType=n(f),c.miterLimit=m;const x=!p;a.out=e,a.id=i.getDisplayId(),a.vertexCount=0,a.indexCount=0,a.vertexFrom=e.vertexCount(),a.vertexBounds=x&&d<s?0:1;for(const{line:t,start:s,pathLength:o}of r)c.initialDistance=s%_,a.pathLength=o,a.distanceOffset=Math.floor(s/_)*_,this._lineTessellator.tessellate(t,c,x)}_writeTesselatedVertex(t,e,s,i,r,o,n,a,c,h,l){const{out:u,id:f,vertexBounds:m,pathLength:p,distanceOffset:d}=this._currentWrite;return this.hasEffects&&u.recordBounds(t,e,m,m),this._tessParams.extrusionOffsetX=n,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=h,this._tessParams.directionX=r,this._tessParams.directionY=o,this._tessParams.distance=l,this._tessParams.pathLength=p,this._tessParams.distanceOffset=d,this._writeVertex(u,f,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{x as LineMeshWriter,m as LineTessellationParams,p as LineVertexSpec};
2
+ import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{thinLineHalfWidthThreshold as s}from"../../../definitions.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r}from"../../../mesh/templates/templateUtils.js";import{processLineCapInput as n,processLineJoinInput as o,packRounded as a,processColorInput as c,getMinMaxZoom as h}from"../fill/meshWriterUtils.js";import{MeshWriter as l}from"../mesh/MeshWriter.js";import{getLineClippingMargin as u}from"../mesh/utils.js";import{DataType as f}from"../../../../../../webgl/enums.js";class m{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const p={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:f.HALF_FLOAT,count:2,pack:({scaleInfo:t},{tileInfo:e})=>h(t,e)}},attributes:{id:{type:f.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:f.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:f.UNSIGNED_BYTE,count:1},color:{type:f.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>c(t)},offset:{type:f.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[a(t,16),a(e,16)]},normal:{type:f.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[a(t,16),a(e,16)]},halfWidth:{type:f.HALF_FLOAT,count:1,pack:({width:e})=>t(.5*e)},referenceHalfWidth:{type:f.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>t(.5*e)}}};class d{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const _=65535;function x(t,e,i=0){const r=e&&t<s?0:Math.max(1,2*t+1);return Math.max(r,i)}class T extends l{get _effectRotation(){const{effectRotation:t,effectRotationType:e,useEffectOrigin:s,viewRotation:i}=this.evaluatedMeshParams;return null==t&&null==i?null:{value:t,type:e,useEffectOrigin:!!s,viewRotation:i}}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=p,this._currentWrite=new d,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:_,textured:!1},this._tessParams=new m,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,{target:s,effectGeometry:i}){const r=i??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return r(t,u(this.evaluatedMeshParams))}_writeVertices(e,s,i){const{_currentWrite:r,_tessellationOptions:a,evaluatedMeshParams:c}=this,{width:h,capType:l,joinType:u,miterLimit:f,hasSizeVV:m}=c,p=t(.5*h);a.halfWidth=p,a.capType=n(l),a.joinType=o(u),a.miterLimit=f;const d=!m;r.out=e,r.id=s.getDisplayId(),r.vertexCount=0,r.indexCount=0,r.vertexFrom=e.vertexCount(),r.vertexBounds=x(p,d,c.minPixelBuffer);for(const{line:t,start:n,pathLength:o}of i)a.initialDistance=n%_,r.pathLength=o,r.distanceOffset=Math.floor(n/_)*_,this._lineTessellator.tessellate(t,a,d)}_writeTesselatedVertex(t,e,s,i,r,n,o,a,c,h,l){const{out:u,id:f,vertexBounds:m,pathLength:p,distanceOffset:d}=this._currentWrite;return this.hasEffects&&u.recordBounds(t,e,m,m),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=h,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=p,this._tessParams.distanceOffset=d,this._writeVertex(u,f,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{T as LineMeshWriter,m as LineTessellationParams,p as LineVertexSpec,x as getLinePixelBufferSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as a}from"../featureTechniqueUtils.js";import{TexturedLineShader as n}from"../shaders/TexturedLineShader.js";class u extends e{constructor(){super(...arguments),this.type=33,this.shaders={geometry:new n},this.symbologyPlane=1}render(e,n){const{painter:u}=e,m=n.instance.getInput();u.setShader({shader:this.shaders.geometry,uniforms:{...o(e,n.target,m.uniforms),...i(e,n.target),mosaicInfo:u.textureManager.getMosaicInfo(e,n.textureKey)},textures:{...s(e),mosaicTexture:u.textureManager.getMosaicTexture(e,n.textureKey)},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(a(e)),u.submitDraw(e,n)}}export{u as TexturedLineTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TexturedLineShader as a}from"../shaders/TexturedLineShader.js";class u extends e{constructor(){super(...arguments),this.type=33,this.shaders={geometry:new a},this.symbologyPlane=1}render(e,a){const{painter:u}=e,m=a.instance.getInput(),{mosaicInfo:f,mosaicTexture:h}=u.textureManager.getBindingInfo(e,a.textureKey,!1);u.setShader({shader:this.shaders.geometry,uniforms:{...o(e,a.target,m.uniforms),...i(e,a.target),mosaicInfo:f},textures:{...s(e),mosaicTexture:h},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(n(e)),u.submitDraw(e,a)}}export{u as TexturedLineTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as o,resolveDynamicUniforms as a,getFeaturePipelineState as i}from"../featureTechniqueUtils.js";import{MarkerShader as n}from"./MarkerShader.js";class u extends e{constructor(){super(...arguments),this.type=23,this.shaders={geometry:new n},this.symbologyPlane=2}render(e,n){const{painter:u}=e,m=n.instance.getInput();u.setShader({shader:this.shaders.geometry,uniforms:{...a(e,n.target,m.uniforms),...o(e,n.target),mosaicInfo:u.textureManager.getMosaicInfo(e,n.textureKey,!0)},textures:{...s(e),mosaicTexture:u.textureManager.getMosaicTexture(e,n.textureKey,!0)},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(i(e)),u.submitDraw(e,n)}}export{u as MarkerTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{isHittest as t,getSelectionDefines as r,getFeatureTextures as s,getFeatureUniforms as i,resolveDynamicUniforms as o,getFeaturePipelineState as a}from"../featureTechniqueUtils.js";import{MarkerShader as n}from"./MarkerShader.js";class u extends e{constructor(){super(...arguments),this.type=23,this.shaders={geometry:new n},this.symbologyPlane=2}render(e,n){const{painter:u}=e,m=n.instance.getInput(),{mosaicInfo:f,mosaicTexture:p}=u.textureManager.getBindingInfo(e,n.textureKey,!0);u.setShader({shader:this.shaders.geometry,uniforms:{...o(e,n.target,m.uniforms),...i(e,n.target),mosaicInfo:f},textures:{...s(e),mosaicTexture:p},defines:{...r(e)},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)}),u.setPipelineState(a(e)),u.submitDraw(e,n)}}export{u as MarkerTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../../../../../core/arrayUtils.js";import r from"../../../../../../../core/Error.js";import{clone as t}from"../../../../../../../core/lang.js";import s from"../../../../../../../core/Logger.js";import{collectExpressionDependencies as o}from"../../../../../../../support/ArcadeExpression.js";import{getStartGroup as a}from"../../../grouping.js";import{hydrate as i}from"../../../animations/infos.js";import{createParamList as n,compileAnimationParam as c,fromJSON as p,resolveToAnimationInfo as m,encodeParamList as f,getAnimationExpressions as l}from"../../../animations/utils.js";import{applyComputedValue as d}from"./utils.js";import{DictionaryValue as u}from"../../../../../layers/features/support/DictionaryValue.js";const y=()=>s.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function h(e,r,t,s){const{defaultValue:o,valueExpressionInfo:a,value:i}=r;if(a){if("dictionary-template"===a.type)return{...r,computed:e.createDictionaryTemplateField(a,t),defaultValue:o};const{expression:i}=a,n=await e.createComputedField({expression:i},s);return n?{...r,computed:n,defaultValue:o}:null}return{...r,computed:new u(i),defaultValue:o}}async function v(e,r,t){const{valueExpressionInfo:s}=r,o="dictionary-template"===s.type?e.createDictionaryTemplateField(s,t):await e.createComputedField({expression:s.expression});return o?{...r,computed:o}:null}function P(e){return"object"==typeof e&&null!=e&&(!(!("valueExpressionInfo"in e)||!e.valueExpressionInfo)||"type"in e&&"Process"===e.type&&"op"in e&&"Random"===e.op)}function _(e){if(Array.isArray(e))for(const r of e)if(_(r))return!0;if("object"==typeof e){if(P(e))return!0;for(const r in e){if(_(e[r]))return!0}}return!1}class I{static async create(r,t,s,o){const a={},i=new Map,m=new Map,f=new Map,l=new Map,d=new Map,u=new Map;for(const y in s){const I=s[y];if(null!=I&&"object"==typeof I)if(Array.isArray(I)){if("object"==typeof I[0])throw new Error(`InternalError: Cannot handle ${y}. Nested array params are not supported`);a[y]=I}else{if("valueExpressionInfo"in I){if(I.value){a[y]=I.value;continue}const e=await v(r,I,o);if(!e){a[y]=I.defaultValue;continue}i.set(y,e),a[y]=null;continue}switch(I.type){case"cim-effect-infos":if(I.effectInfos.some(e=>e.overrides.length)){m.set(y,{effects:await Promise.all(I.effectInfos.map(async t=>{const s=t.overrides.map(e=>h(r,e,o,!1));return{effect:t.effect,compiledOverrides:(await Promise.all(s)).filter(e)}}))});break}a[y]=I.effectInfos.map(e=>e.effect);break;case"cim-marker-placement-param":I.overrides.length&&f.set(y,{placementInfo:I,compiledOverrides:(await Promise.all(I.overrides.map(e=>h(r,e,o,!1)))).filter(e)}),a[y]=I.placement;break;case"text-rasterization-param":{if(I.overrides.length){const t=I.overrides.map(e=>h(r,e,o,I.useLegacyLabelEvaluationRules??!1));l.set(y,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:I,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:I.resource};a[y]=await t.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(I.overrides.length){const t=I.overrides.map(e=>h(r,e,o,!1));l.set(y,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:I,objectIdToResourceId:new Map});continue}if("animated"===I.resource.type){l.set(y,{compiledOverrides:[],rasterizationParam:I,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:I.resource};a[y]=await t.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=I;if(_(e)){const t={compiledMarkerInfos:[]};await Promise.all(e.map(async e=>{const s={props:{}};for(const t in e)if(P(e[t])){const a=await v(r,e[t],o);s.compiledExpressionMap||(s.compiledExpressionMap=new Map);const i=s.compiledExpressionMap;a&&i.set(t,a)}else s.props[t]=e[t];t.compiledMarkerInfos.push(s)})),d.set(y,t)}else a[y]={type:"cim-marker-transform-info",infos:e};break}case"animation-params":{const{params:e}=I,s=n(e);if(_(s)){const e=await Promise.all(s.map(e=>c(e,r)));u.set(y,{params:e,propertyIdToResourceId:new Map,key:y})}else{const e=p(s),r=await t.fetchResourceImmediate({type:"animation-info",resource:e});null!=r&&"sprite"===r.type&&(a[y]={dataRow:r.rect.y,dataColumn:r.rect.x})}break}default:a[y]=I}}else a[y]=I}return new I(s,a,i,m,f,l,d,u)}constructor(e,r,t,s,a,i,n,c){this.inputMeshParams=e,this._resolvedMeshParams=r,this._dynamicProperties=t,this._dynamicEffectProperties=s,this._dynamicPlacementProperties=a,this._dynamicAsyncProperties=i,this._dynamicTransformProperties=n,this._dynamicAsyncAnimations=c,this.evaluator=e=>e,this._arcadeDependencies=new Set;for(const p of this._expressions())o(this._arcadeDependencies,p)}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size||this._dynamicAsyncAnimations.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,s,o){for(const i of this._dynamicAsyncProperties.values()){const c=t(i.rasterizationParam.resource);"animated"===i.rasterizationParam.resource.type&&i.rasterizationParam.resource.randomizeStartTime&&(c.primitiveName="__RESERVED__PRIMITIVE__NAME__",c.startGroup=a(s.getObjectId()||0));for(const{primitiveName:e,propertyName:t,computed:a,defaultValue:m,valueExpressionInfo:f}of i.compiledOverrides)try{const r="animated"===i.rasterizationParam.resource.type?c.primitiveName:e;d(c,r,t,a,s,o,m)}catch(n){y().errorOnce(new r("invalid-arcade-expression","Encountered an error when evaluating the arcade expression",{error:n,valueExpressionInfo:f}))}const p=e.enqueueRequest({type:"cim-rasterization-info",resource:c});i.objectIdToResourceId.set(s.getObjectId(),p)}for(const r of this._dynamicAsyncAnimations.values()){const t=r.params.map(e=>m(e,s,o)).map(i).map(e=>e.simplify()),a=f(t),n=e.enqueueRequest({type:"animation-info",resource:a});r.propertyIdToResourceId.set(s.getObjectId()+"."+r.key,n)}}evaluateMeshParams(e,r,t){for(const[s,o]of this._dynamicProperties.entries())this._resolvedMeshParams[s]=o.computed.readWithDefault(r,t,o.defaultValue);for(const[s,o]of this._dynamicPlacementProperties.entries())for(const{computed:e,defaultValue:a,propertyName:i}of o.compiledOverrides){const n=e.readWithDefault(r,t,a);o.placementInfo.placement[i]=n,this._resolvedMeshParams[s]=o.placementInfo.placement}for(const[s,o]of this._dynamicEffectProperties.entries())for(const e of o.effects){for(const{computed:s,defaultValue:o,propertyName:a}of e.compiledOverrides){const i=s.readWithDefault(r,t,o);e.effect[a]=i}this._resolvedMeshParams[s]=o.effects.map(e=>e.effect)}for(const[s,o]of this._dynamicTransformProperties.entries()){const e={type:"cim-marker-transform-info",infos:[]};for(const s of o.compiledMarkerInfos){const o={...s.props};if(s.compiledExpressionMap)for(const[e,a]of s.compiledExpressionMap){const s=a.computed.readWithDefault(r,t,a.defaultValue);o[e]="number"==typeof s||"boolean"==typeof s?s:a.defaultValue}e.infos.push(o)}this._resolvedMeshParams[s]=e}for(const[s,o]of this._dynamicAsyncProperties.entries()){const t=o.objectIdToResourceId.get(r.getObjectId());if(null==t)continue;const a=e.getResource(t);this._resolvedMeshParams[s]=a}for(const[s,o]of this._dynamicAsyncAnimations.entries()){const t=o.propertyIdToResourceId.get(r.getObjectId()+"."+s);if(null==t)continue;const a=e.getResource(t);this._resolvedMeshParams[s]={dataRow:a.rect.y,dataColumn:a.rect.x}}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}*_expressions(){for(const e of this._dynamicProperties.values())yield e.computed;for(const e of this._dynamicEffectProperties.values())for(const r of e.effects)for(const e of r.compiledOverrides)yield e.computed;for(const e of this._dynamicPlacementProperties.values())for(const r of e.compiledOverrides)yield r.computed;for(const e of this._dynamicAsyncProperties.values())for(const r of e.compiledOverrides)yield r.computed;for(const e of this._dynamicTransformProperties.values())for(const r of e.compiledMarkerInfos)if(null!=r.compiledExpressionMap)for(const e of r.compiledExpressionMap.values())yield e.computed;for(const e of this._dynamicAsyncAnimations.values())for(const r of e.params)yield*l(r)}}export{I as MeshWriterInputEvaluator,P as hasExpression};
2
+ import{isSome as e}from"../../../../../../../core/arrayUtils.js";import r from"../../../../../../../core/Error.js";import{clone as t}from"../../../../../../../core/lang.js";import s from"../../../../../../../core/Logger.js";import{collectExpressionDependencies as o}from"../../../../../../../support/ArcadeExpression.js";import{getStartGroup as a}from"../../../grouping.js";import{hydrate as i}from"../../../animations/infos.js";import{createParamList as n,compileAnimationParam as c,fromJSON as m,resolveToAnimationInfo as p,encodeParamList as f,getAnimationExpressions as l}from"../../../animations/utils.js";import{applyComputedValue as d}from"./utils.js";import{DictionaryValue as u}from"../../../../../layers/features/support/DictionaryValue.js";const y=()=>s.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function h(e,r,t,s){const{defaultValue:o,valueExpressionInfo:a,value:i}=r;if(a){if("dictionary-template"===a.type)return{...r,computed:e.createDictionaryTemplateField(a,t),defaultValue:o};const{expression:i}=a,n=await e.createComputedField({expression:i},s);return n?{...r,computed:n,defaultValue:o}:null}return{...r,computed:new u(i),defaultValue:o}}async function v(e,r,t){const{valueExpressionInfo:s}=r,o="dictionary-template"===s.type?e.createDictionaryTemplateField(s,t):await e.createComputedField({expression:s.expression});return o?{...r,computed:o}:null}function P(e){return"object"==typeof e&&null!=e&&(!(!("valueExpressionInfo"in e)||!e.valueExpressionInfo)||"type"in e&&"Process"===e.type&&"op"in e&&"Random"===e.op)}function _(e){if(Array.isArray(e))for(const r of e)if(_(r))return!0;if("object"==typeof e){if(P(e))return!0;for(const r in e){if(_(e[r]))return!0}}return!1}class I{static async create(r,t,s,o){const a={},i=new Map,p=new Map,f=new Map,l=new Map,d=new Map,u=new Map;for(const y in s){const I=s[y];if(null!=I&&"object"==typeof I)if(Array.isArray(I)){if("object"==typeof I[0])throw new Error(`InternalError: Cannot handle ${y}. Nested array params are not supported`);a[y]=I}else{if("valueExpressionInfo"in I){if(I.value){a[y]=I.value;continue}const e=await v(r,I,o);if(!e){a[y]=I.defaultValue;continue}i.set(y,e),a[y]=null;continue}switch(I.type){case"cim-effect-infos":if(I.effectInfos.some(e=>e.overrides.length)){p.set(y,{effects:await Promise.all(I.effectInfos.map(async t=>{const s=t.overrides.map(e=>h(r,e,o,!1));return{effect:t.effect,compiledOverrides:(await Promise.all(s)).filter(e)}}))});break}a[y]=I.effectInfos.map(e=>e.effect);break;case"cim-marker-placement-param":I.overrides.length&&f.set(y,{placementInfo:I,compiledOverrides:(await Promise.all(I.overrides.map(e=>h(r,e,o,!1)))).filter(e)}),a[y]=I.placement;break;case"text-rasterization-param":{if(I.overrides.length){const t=I.overrides.map(e=>h(r,e,o,I.useLegacyLabelEvaluationRules??!1));l.set(y,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:I,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:I.resource};a[y]=await t.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(I.overrides.length){const t=I.overrides.map(e=>h(r,e,o,!1));l.set(y,{compiledOverrides:(await Promise.all(t)).filter(e),rasterizationParam:I,objectIdToResourceId:new Map});continue}if("animated"===I.resource.type){l.set(y,{compiledOverrides:[],rasterizationParam:I,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:I.resource};a[y]=await t.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=I;if(_(e)){const t={compiledMarkerInfos:[]};await Promise.all(e.map(async e=>{const s={props:{}};for(const t in e)if(P(e[t])){const a=await v(r,e[t],o);s.compiledExpressionMap||(s.compiledExpressionMap=new Map);const i=s.compiledExpressionMap;a&&i.set(t,a)}else s.props[t]=e[t];t.compiledMarkerInfos.push(s)})),d.set(y,t)}else a[y]={type:"cim-marker-transform-info",infos:e};break}case"animation-params":{const{params:e}=I,s=n(e);if(_(s)){const e=await Promise.all(s.map(e=>c(e,r)));u.set(y,{params:e,propertyIdToResourceId:new Map,key:y})}else{const e=m(s),r=await t.fetchResourceImmediate({type:"animation-info",resource:e});null!=r&&"sprite"===r.type&&(a[y]={dataRow:r.rect.y,dataColumn:r.rect.x})}break}default:a[y]=I}}else a[y]=I}return new I(s,a,i,p,f,l,d,u)}constructor(e,r,t,s,a,i,n,c){this.inputMeshParams=e,this._resolvedMeshParams=r,this._dynamicProperties=t,this._dynamicEffectProperties=s,this._dynamicPlacementProperties=a,this._dynamicAsyncProperties=i,this._dynamicTransformProperties=n,this._dynamicAsyncAnimations=c,this.evaluator=e=>e,this._arcadeDependencies=new Set;for(const m of this._expressions())o(this._arcadeDependencies,m)}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size||this._dynamicAsyncAnimations.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,s,o){for(const i of this._dynamicAsyncProperties.values()){const c=t(i.rasterizationParam.resource);"animated"===i.rasterizationParam.resource.type&&i.rasterizationParam.resource.randomizeStartTime&&(c.primitiveName="__RESERVED__PRIMITIVE__NAME__",c.startGroup=a(s.getObjectId()||0));for(const{primitiveName:e,propertyName:t,computed:a,defaultValue:p,valueExpressionInfo:f}of i.compiledOverrides)try{const r="animated"===i.rasterizationParam.resource.type?c.primitiveName:e,n="cim-point-symbol-halo"===c.type?c.symbol:c;d(n,r,t,a,s,o,p)}catch(n){y().errorOnce(new r("invalid-arcade-expression","Encountered an error when evaluating the arcade expression",{error:n,valueExpressionInfo:f}))}const m=e.enqueueRequest({type:"cim-rasterization-info",resource:c});i.objectIdToResourceId.set(s.getObjectId(),m)}for(const r of this._dynamicAsyncAnimations.values()){const t=r.params.map(e=>p(e,s,o)).map(i).map(e=>e.simplify()),a=f(t),n=e.enqueueRequest({type:"animation-info",resource:a});r.propertyIdToResourceId.set(s.getObjectId()+"."+r.key,n)}}evaluateMeshParams(e,r,t){for(const[s,o]of this._dynamicProperties.entries())this._resolvedMeshParams[s]=o.computed.readWithDefault(r,t,o.defaultValue);for(const[s,o]of this._dynamicPlacementProperties.entries())for(const{computed:e,defaultValue:a,propertyName:i}of o.compiledOverrides){const n=e.readWithDefault(r,t,a);o.placementInfo.placement[i]=n,this._resolvedMeshParams[s]=o.placementInfo.placement}for(const[s,o]of this._dynamicEffectProperties.entries())for(const e of o.effects){for(const{computed:s,defaultValue:o,propertyName:a}of e.compiledOverrides){const i=s.readWithDefault(r,t,o);e.effect[a]=i}this._resolvedMeshParams[s]=o.effects.map(e=>e.effect)}for(const[s,o]of this._dynamicTransformProperties.entries()){const e={type:"cim-marker-transform-info",infos:[]};for(const s of o.compiledMarkerInfos){const o={...s.props};if(s.compiledExpressionMap)for(const[e,a]of s.compiledExpressionMap){const s=a.computed.readWithDefault(r,t,a.defaultValue);o[e]="number"==typeof s||"boolean"==typeof s?s:a.defaultValue}e.infos.push(o)}this._resolvedMeshParams[s]=e}for(const[s,o]of this._dynamicAsyncProperties.entries()){const t=o.objectIdToResourceId.get(r.getObjectId());if(null==t)continue;const a=e.getResource(t);this._resolvedMeshParams[s]=a}for(const[s,o]of this._dynamicAsyncAnimations.entries()){const t=o.propertyIdToResourceId.get(r.getObjectId()+"."+s);if(null==t)continue;const a=e.getResource(t);this._resolvedMeshParams[s]={dataRow:a.rect.y,dataColumn:a.rect.x}}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}*_expressions(){for(const e of this._dynamicProperties.values())yield e.computed;for(const e of this._dynamicEffectProperties.values())for(const r of e.effects)for(const e of r.compiledOverrides)yield e.computed;for(const e of this._dynamicPlacementProperties.values())for(const r of e.compiledOverrides)yield r.computed;for(const e of this._dynamicAsyncProperties.values())for(const r of e.compiledOverrides)yield r.computed;for(const e of this._dynamicTransformProperties.values())for(const r of e.compiledMarkerInfos)if(null!=r.compiledExpressionMap)for(const e of r.compiledExpressionMap.values())yield e.computed;for(const e of this._dynamicAsyncAnimations.values())for(const r of e.params)yield*l(r)}}export{I as MeshWriterInputEvaluator,P as hasExpression};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as t,isHittest as s,getFeatureTextures as r,getFeatureUniforms as a,resolveDynamicUniforms as i,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TextShader as o}from"./TextShader.js";class u extends e{constructor(){super(...arguments),this.type=32,this.shaders={geometry:new o},this.symbologyPlane=3}render(e,o){const{painter:u}=e,d=t(e),m=o.instance.getInput(),p={shader:this.shaders.geometry,uniforms:{...i(e,o.target,m.uniforms),...a(e,o.target),mosaicInfo:u.textureManager.getMosaicInfo(e,o.textureKey)},textures:{...r(e),mosaicTexture:u.textureManager.getMosaicTexture(e,o.textureKey)},defines:{...d,isBackgroundPass:!0,isLabel:!1,textRenderPassType:0},optionalAttributes:m.optionalAttributes,useComputeBuffer:s(e)};u.setShader(p),u.setPipelineState(n(e)),u.submitDraw(e,o),u.setShader({...p,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:2}}),u.submitDraw(e,o),u.setShader({...p,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:1}}),u.submitDraw(e,o),u.setShader({...p,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:0}}),u.submitDraw(e,o)}}export{u as TextTechnique};
2
+ import{FeatureTechnique as e}from"../FeatureTechnique.js";import{getSelectionDefines as s,isHittest as t,getFeatureTextures as r,getFeatureUniforms as a,resolveDynamicUniforms as i,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TextShader as o}from"./TextShader.js";class u extends e{constructor(){super(...arguments),this.type=32,this.shaders={geometry:new o},this.symbologyPlane=3}render(e,o){const{painter:u}=e,d=s(e),m=o.instance.getInput(),{mosaicInfo:p,mosaicTexture:c}=u.textureManager.getBindingInfo(e,o.textureKey,!1),f={shader:this.shaders.geometry,uniforms:{...i(e,o.target,m.uniforms),...a(e,o.target),mosaicInfo:p},textures:{...r(e),mosaicTexture:c},defines:{...d,isBackgroundPass:!0,isLabel:!1,textRenderPassType:0},optionalAttributes:m.optionalAttributes,useComputeBuffer:t(e)};u.setShader(f),u.setPipelineState(n(e)),u.submitDraw(e,o),u.setShader({...f,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:2}}),u.submitDraw(e,o),u.setShader({...f,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:1}}),u.submitDraw(e,o),u.setShader({...f,defines:{...d,isBackgroundPass:!1,isLabel:!1,textRenderPassType:0}}),u.submitDraw(e,o)}}export{u as TextTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../../../core/Logger.js";import{CIMSymbolHelper as a}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as i}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as n}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{getMaxSizeVVSize as t,noVisualVariables as l}from"../VisualVariablesSchema.js";import{getAnimatedTechniqueSprite as o,hasSizeVVUniform as r}from"./utils.js";function s(a,i){if(a&&i){const n=a.toLowerCase(),t=i.get(n);if(void 0!==t)return{name:n,index:t};e.getLogger("esri.views.2d.layers.features.schema.processor.symbols/ComplexSymbolSchema").warn(`Invalid symbol layer name: "${a}"`)}return null}function c(e,a){if(a?.enabled&&a.drawOrder){const i=a.drawOrder.map(e=>e.toLowerCase()).slice().reverse(),n=new Map;for(const a of e)if(a.groupName&&a.name){const e=a.name.toLowerCase(),t=a.groupName.toLowerCase(),l=i.indexOf(t);-1!==l&&(n.has(l)||n.set(l,[]),n.get(l).push(e))}const t=[];i.forEach((e,a)=>{n.has(a)?t.push(...n.get(a)):t.push(e)});const l=new Map;return t.forEach((e,a)=>{l.set(e,a)}),l}return null}function u(e){return e.minScale||e.maxScale?{minScale:e.minScale??0,maxScale:e.maxScale??0}:null}function f(e){if(null==e)return null;if(Array.isArray(e)){const[a,i,n,t]=e;return[a,i,n,255*t]}return"string"==typeof e?e:{...e,defaultValue:f(e?.defaultValue)}}async function m(e,i){const{cimResourceManager:n,cimAnalyzer:t,scaleExpression:l,symbolLayerDrawing:o}=i.schemaOptions,r=e.symbol;if(null==r)return[];await a.normalizeSymbolAndFetchResources(r,n);const s=t.analyzeSymbolReference(e,!1),f=u(e),m=c(s,o),S="CIMPointSymbol"===r.type&&"Map"!==r.angleAlignment?i.schemaOptions.viewRotation:null,b={scaleInfo:f,scaleExpression:l,rotationVariable:i.rotationVariable??null,viewRotation:S,layerOrderMap:m},V=[];for(const a of s)switch(a.type){case"marker":V.push(...p(a,i,b));break;case"fill":V.push(...y(a,i,b));break;case"outlineFill":V.push(...d(a,i,b));break;case"gradientFill":V.push(...I(a,i,b));break;case"line":V.push(...R(a,i,b));break;case"gradientStroke":V.push(...k(a,i,b));break;case"text":V.push(...w(a,i,b))}return V}function p(e,a,i){const{uniforms:t,schemaOptions:o}=a,{store:r}=o,{layerOrderMap:c}=i,u=e.isOutline?{...l,visualVariableSizeScaleStops:t.visualVariableSizeOutlineScaleStops}:{visualVariableColor:t.visualVariableColor,visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue,visualVariableRotation:t.visualVariableRotation};if(e.animationParams){const{hasShiftAnimation:a}=e.animationParams.params,t=a?n.animatedMarkerShift:n.animatedMarker;return S(r.ensureInstance(t,{uniforms:u,optionalAttributes:{zoomRange:!0,value1Position2Value2:e.animationParams.params.hasShiftAnimation,lineLength:a}},s(e.name,c)),e,l,i)}return V(r.ensureInstance(n.marker,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,c)),e,t,i)}function S(e,a,i,n){if(!a.animationParams)return[];return[e.createMeshInfo({pixelDimensions:a.pixelDimensions,texelDimensions:a.texelDimensions,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,sprite:o(a),animations:a.animationParams,scaleInfo:n.scaleInfo,scaleSymbolsProportionally:a.scaleSymbolsProportionally,strokeWidth:a.outlineWidth,isMapAligned:1===a.alignment,colorLocked:a.colorLocked,isStroke:a.isStroke,baseSize:a.baseSize,placement:a.markerPlacement,referenceSize:a.referenceSize,angleToLine:!!a.markerPlacement&&(a.markerPlacement.placement&&"angleToLine"in a.markerPlacement.placement&&a.markerPlacement.placement.angleToLine),sizeRatio:a.sizeRatio,patternHeight:null})]}function b(e,a,i,n){if(!a.animationParams)return[];return[e.createMeshInfo({effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,sprite:o(a),animations:a.animationParams,scaleInfo:n.scaleInfo,scaleSymbolsProportionally:!1,strokeWidth:1,isMapAligned:!0,colorLocked:a.colorLocked||!1,isStroke:!1,baseSize:"width"in a?a.width:-1,placement:null,referenceSize:2,angleToLine:!1,sizeRatio:1,patternHeight:"fill"===a.type&&a.spriteRasterizationParam?a.height:null,joinType:"join"in a?a.join:"round",capType:"cap"in a?a.cap:"round",miterLimit:"miterLimit"in a&&a.miterLimit||2,angle:"angle"in a?a.angle:0})]}function V(e,a,n,{scaleInfo:l,scaleExpression:o}){const s=r(n);return[e.createMeshInfo({size:a.size,scaleX:a.scaleX,anchorX:a.anchorPoint.x,anchorY:a.anchorPoint.y,angle:a.rotation,color:f(a.color)??[0,0,0,0],colorLocked:a.colorLocked,frameHeight:a.frameHeight,widthRatio:a.widthRatio,scaleInfo:l,offsetX:a.offsetX,offsetY:a.offsetY,outlineColor:f(a.outlineColor)??[0,0,0,0],outlineSize:a.outlineWidth,referenceSize:a.referenceSize||i.CIMVectorMarker.size,rotateClockwise:a.rotateClockwise,scaleFactor:o??1,sizeRatio:a.sizeRatio,alignment:a.alignment,isAbsoluteAnchorPoint:a.isAbsoluteAnchorPoint,scaleSymbolsProportionally:a.scaleSymbolsProportionally,sprite:a.spriteRasterizationParam,hasSizeVV:s,placement:a.markerPlacement,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,transforms:a.transform,minPixelBuffer:t(n)})]}function h(e,a,i){const{uniforms:t,schemaOptions:o}=a,{store:r}=o,{layerOrderMap:c}=i,u={visualVariableColor:e.colorLocked?null:t.visualVariableColor,visualVariableOpacity:t.visualVariableOpacity};if(e.animationParams){const a=n.animatedFill;return b(r.ensureInstance(a,{uniforms:{...u,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1}},s(e.name,c)),e,l,i)}return v(r.ensureInstance(n.fill,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,c)),e,i)}function d(e,a,i){const{uniforms:t,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return z(o.ensureInstance(n.outlineFill,{uniforms:{visualVariableColor:e.colorLocked?null:t.visualVariableColor,visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:null,visualVariableSizeScaleStops:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,r)),e,i)}function z(e,a,i){const n=f(a.color)??[0,0,0,0],t=f(a.outlineColor)??[0,0,0,0];return[e.createMeshInfo({color:n,outlineColor:t,width:a.outlineWidth,referenceWidth:a.referenceWidth,capType:a.cap,joinType:a.join,miterLimit:a.miterLimit,outlineUsesColorVV:!a.outlineColorLocked,hasSizeVV:!1,scaleInfo:i.scaleInfo,...P(a,i),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,outlineEffects:a.outlineEffects?{type:"cim-effect-infos",effectInfos:a.outlineEffects}:null})]}function v(e,a,i){const{scaleInfo:n}=i;return[e.createMeshInfo({color:f(a.color)??[0,0,0,0],scaleInfo:n,...P(a,i),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function y(e,a,i){const{layerOrderMap:t}=i;if(!e.spriteRasterizationParam)return h(e,a,i);const{uniforms:o,schemaOptions:r}=a,{store:c}=r,u={visualVariableColor:e.colorLocked?null:o.visualVariableColor,visualVariableOpacity:o.visualVariableOpacity};if(e.animationParams){const a=n.animatedFill;return b(c.ensureInstance(a,{uniforms:{...u,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1,angle:!!e.angle}},s(e.name,t)),e,l,i)}return g(c.ensureInstance(n.complexFill,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,t)),e,null!=o.visualVariableColor,i)}function g(e,a,i,n){const{scaleInfo:t}=n;if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const l=!!a.hasUnresolvedReplacementColor&&(!i||a.colorLocked),o=a.sampleAlphaOnly&&!l,r=a.spriteRasterizationParam;return[e.createMeshInfo({color:f(a.color)??[0,0,0,0],height:a.height,aspectRatio:a.scaleX,offsetX:a.offsetX,offsetY:a.offsetY,scaleX:1,scaleY:1,angle:a.angle,applyRandomOffset:a.applyRandomOffset,sampleAlphaOnly:o,scaleProportionally:"CIMHatchFill"===r.resource.type,sprite:r,scaleInfo:t,...P(a,n),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function I(e,a,i){const{uniforms:t,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return M(o.ensureInstance(n.gradientFill,{uniforms:{visualVariableColor:null,visualVariableOpacity:t.visualVariableOpacity},optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,r)),e,i)}function M(e,a,i){const{scaleInfo:n}=i;if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const t=a.spriteRasterizationParam;return[e.createMeshInfo({color:f(a.color)??[0,0,0,0],angle:a.angle,gradientMethod:a.gradientMethod,gradientSize:a.gradientSize,gradientSizeUnits:a.gradientSizeUnits,gradientType:a.gradientType,sprite:t,scaleInfo:n,...P(a,i),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function R(e,a,i){const{uniforms:t,schemaOptions:o}=a,{store:r}=o,{layerOrderMap:c}=i,u=e.isOutline?{...l,visualVariableSizeScaleStops:t.visualVariableSizeOutlineScaleStops}:{visualVariableColor:e.colorLocked?null:t.visualVariableColor,visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue};if(e.animationParams){const{hasShiftAnimation:a}=e.animationParams.params,t=n.animatedLine;return b(r.ensureInstance(t,{uniforms:{...u,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,accumulatedDistance:!0,segmentDirection:!0,normal:!0,lineLength:a,angle:!1}},s(e.name,c)),e,l,i)}const f={uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},m=!!(u.visualVariableSizeMinMaxValue||u.visualVariableSizeScaleStops||u.visualVariableSizeStops||u.visualVariableSizeUnitValue);if(!e.spriteRasterizationParam){return C(r.ensureInstance(n.line,f,s(e.name,c)),e,m,i)}return L(r.ensureInstance(n.texturedLine,f,s(e.name,c)),e,m,i)}function O(e,a,i){const{scaleInfo:n}=i;return{color:f(e.color)??[0,0,0,0],width:e.width,referenceWidth:e.referenceWidth,capType:e.cap,joinType:e.join,miterLimit:e.miterLimit,scaleInfo:n,hasSizeVV:a,...P(e,i),effects:e.effects?{type:"cim-effect-infos",effectInfos:e.effects}:null}}function P(e,{rotationVariable:a,viewRotation:i}){if(!e.effects?.length&&!e.outlineEffects?.length)return{};const n={};if(e.effectsChangeGeometryType&&(n.useEffectOrigin=!0),null!=i&&(n.viewRotation=i),!a)return n;const t=a.valueExpression??(a.field?`$feature[${JSON.stringify(a.field)}]`:null);return t?(n.effectRotation={valueExpressionInfo:{type:"CIMExpressionInfo",expression:t},defaultValue:0},n.effectRotationType=a.rotationType,n):n}function C(e,a,i,n){if(a.spriteRasterizationParam)throw new Error("InternalError: Sprite should not be defined");const t=O(a,i,n);return[e.createMeshInfo(t)]}function L(e,a,i,n){const{spriteRasterizationParam:t,scaleDash:l,sampleAlphaOnly:o}=a;if(!t)throw new Error("InternalError: Sprite should be defined");return[e.createMeshInfo({...O(a,i,n),offsetAlongLine:a.offsetAlongLine??0,shouldScaleDash:l??!1,shouldSampleAlphaOnly:o,isSDF:"CIMPictureStroke"!==t.resource.type&&"CIMGradientStroke"!==t.resource.type,sprite:t})]}function k(e,a,i){const{uniforms:t,schemaOptions:o}=a,{store:r}=o,{layerOrderMap:c}=i;return x(r.ensureInstance(n.gradientStroke,{uniforms:e.isOutline?{...l,visualVariableSizeScaleStops:t.visualVariableSizeOutlineScaleStops}:{visualVariableColor:null,visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!i.scaleInfo}},s(e.name,c)),e,i)}function x(e,a,i){if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const n=a.spriteRasterizationParam;return[e.createMeshInfo({...O(a,!1,i),gradientMethod:a.gradientMethod,gradientSize:a.gradientSize,gradientSizeUnits:a.gradientSizeUnits,gradientType:a.gradientType,sprite:n,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function w(e,a,i){const{uniforms:t,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return A(o.ensureInstance(n.text,{uniforms:{visualVariableColor:e.colorLocked?null:t.visualVariableColor,visualVariableOpacity:t.visualVariableOpacity,visualVariableRotation:t.visualVariableRotation,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!i.scaleInfo,referenceSymbol:!1,clipAngle:!1,visibility:!1}},s(e.name,r)),e,t,i)}function A(e,a,i,{scaleInfo:n,scaleExpression:l}){return[e.createMeshInfo({alignment:a.alignment,boxBackgroundColor:f(a.backgroundColor),boxBorderLineColor:f(a.borderLineColor),boxBorderLineSize:a.borderLineWidth??0,color:f(a.color)??[0,0,0,0],offsetX:a.offsetX,offsetY:a.offsetY,postAngle:a.angle,fontSize:a.size,referenceSize:a.referenceSize,decoration:a.decoration,haloColor:f(a.haloColor)??[0,0,0,0],haloSize:a.haloSize??0,outlineColor:f(a.outlineColor)??[0,0,0,0],outlineSize:a.outlineSize,lineWidth:a.lineWidth||512,lineHeightRatio:1,horizontalAlignment:a.horizontalAlignment??"center",verticalAlignment:a.verticalAlignment??"baseline",useCIMAngleBehavior:!1,glyphs:a.textRasterizationParam,scaleInfo:n,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,placement:a.markerPlacement,transforms:a.transform,scaleFactor:l??1,minPixelBuffer:t(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}export{S as createAnimatedMarkerMeshInfos,b as createAnimatedPolyMeshInfos,g as createComplexFillMeshInfos,V as createComplexMarkerMeshInfos,v as createComplexSimpleFillMeshInfos,C as createComplexSimpleLineMeshInfos,z as createComplexSimpleOutlineFillMeshInfos,m as createComplexSymbolInstances,A as createComplexTextMeshInfos,L as createComplexTexturedLineMeshInfos,M as createGradientFillMeshInfos,x as createGradientStrokeMeshInfos,u as getScaleInfo};
2
+ import e from"../../../../../../../core/Logger.js";import{pt2px as a}from"../../../../../../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as n}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as t}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{getMaxSizeVVSize as l,noVisualVariables as o}from"../VisualVariablesSchema.js";import{getAnimatedTechniqueSprite as r,hasSizeVVUniform as s}from"./utils.js";function c(a,i){if(a&&i){const n=a.toLowerCase(),t=i.get(n);if(void 0!==t)return{name:n,index:t};e.getLogger("esri.views.2d.layers.features.schema.processor.symbols/ComplexSymbolSchema").warn(`Invalid symbol layer name: "${a}"`)}return null}function u(e,a){if(a?.enabled&&a.drawOrder){const i=a.drawOrder.map(e=>e.toLowerCase()).slice().reverse(),n=new Map;for(const a of e)if(a.groupName&&a.name){const e=a.name.toLowerCase(),t=a.groupName.toLowerCase(),l=i.indexOf(t);-1!==l&&(n.has(l)||n.set(l,[]),n.get(l).push(e))}const t=[];i.forEach((e,a)=>{n.has(a)?t.push(...n.get(a)):t.push(e)});const l=new Map;return t.forEach((e,a)=>{l.set(e,a)}),l}return null}function f(e){return e.minScale||e.maxScale?{minScale:e.minScale??0,maxScale:e.maxScale??0}:null}function m(e){if(null==e)return null;if(Array.isArray(e)){const[a,i,n,t]=e;return[a,i,n,255*t]}return"string"==typeof e?e:{...e,defaultValue:m(e?.defaultValue)}}async function p(e,a){const{cimResourceManager:n,cimAnalyzer:t,scaleExpression:l,symbolLayerDrawing:o}=a.schemaOptions,r=e.symbol;if(null==r)return[];await i.normalizeSymbolAndFetchResources(r,n);const s=t.analyzeSymbolReference(e,!1),c=f(e),m=u(s,o),p="CIMPointSymbol"===r.type&&"Map"!==r.angleAlignment?a.schemaOptions.viewRotation:null,b={scaleInfo:c,scaleExpression:l,rotationVariable:a.rotationVariable??null,viewRotation:p,layerOrderMap:m},V=[];for(const i of s)switch(i.type){case"marker":V.push(...S(i,a,b));break;case"fill":V.push(...g(i,a,b));break;case"outlineFill":V.push(...z(i,a,b));break;case"gradientFill":V.push(...M(i,a,b));break;case"line":V.push(...O(i,a,b));break;case"gradientStroke":V.push(...k(i,a,b));break;case"text":V.push(...A(i,a,b))}return V}function S(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:r}=l,{layerOrderMap:s}=i,u=e.isOutline?{...o,visualVariableSizeScaleStops:n.visualVariableSizeOutlineScaleStops}:{visualVariableColor:n.visualVariableColor,visualVariableOpacity:n.visualVariableOpacity,visualVariableSizeMinMaxValue:n.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:n.visualVariableSizeScaleStops,visualVariableSizeStops:n.visualVariableSizeStops,visualVariableSizeUnitValue:n.visualVariableSizeUnitValue,visualVariableRotation:n.visualVariableRotation};if(e.animationParams){const{hasShiftAnimation:a}=e.animationParams.params,n=a?t.animatedMarkerShift:t.animatedMarker;return b(r.ensureInstance(n,{uniforms:u,optionalAttributes:{zoomRange:!0,value1Position2Value2:e.animationParams.params.hasShiftAnimation,lineLength:a}},c(e.name,s)),e,o,i)}return h(r.ensureInstance(t.marker,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,s)),e,n,i)}function b(e,a,i,n){if(!a.animationParams)return[];return[e.createMeshInfo({pixelDimensions:a.pixelDimensions,texelDimensions:a.texelDimensions,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,sprite:r(a),animations:a.animationParams,scaleInfo:n.scaleInfo,scaleSymbolsProportionally:a.scaleSymbolsProportionally,strokeWidth:a.outlineWidth,isMapAligned:1===a.alignment,colorLocked:a.colorLocked,isStroke:a.isStroke,baseSize:a.baseSize,placement:a.markerPlacement,referenceSize:a.referenceSize,angleToLine:!!a.markerPlacement&&(a.markerPlacement.placement&&"angleToLine"in a.markerPlacement.placement&&a.markerPlacement.placement.angleToLine),sizeRatio:a.sizeRatio,patternHeight:null})]}function V(e,a,i,n){if(!a.animationParams)return[];return[e.createMeshInfo({effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,sprite:r(a),animations:a.animationParams,scaleInfo:n.scaleInfo,scaleSymbolsProportionally:!1,strokeWidth:1,isMapAligned:!0,colorLocked:a.colorLocked||!1,isStroke:!1,baseSize:"width"in a?a.width:-1,placement:null,referenceSize:2,angleToLine:!1,sizeRatio:1,patternHeight:"fill"===a.type&&a.spriteRasterizationParam?a.height:null,joinType:"join"in a?a.join:"round",capType:"cap"in a?a.cap:"round",miterLimit:"miterLimit"in a&&a.miterLimit||2,angle:"angle"in a?a.angle:0})]}function h(e,a,i,{scaleInfo:t,scaleExpression:o}){const r=s(i);return[e.createMeshInfo({size:a.size,scaleX:a.scaleX,anchorX:a.anchorPoint.x,anchorY:a.anchorPoint.y,angle:a.rotation,color:m(a.color)??[0,0,0,0],colorLocked:a.colorLocked,frameHeight:a.frameHeight,widthRatio:a.widthRatio,scaleInfo:t,offsetX:a.offsetX,offsetY:a.offsetY,outlineColor:m(a.outlineColor)??[0,0,0,0],outlineSize:a.outlineWidth,referenceSize:a.referenceSize||n.CIMVectorMarker.size,rotateClockwise:a.rotateClockwise,scaleFactor:o??1,sizeRatio:a.sizeRatio,alignment:a.alignment,isAbsoluteAnchorPoint:a.isAbsoluteAnchorPoint,scaleSymbolsProportionally:a.scaleSymbolsProportionally,sprite:a.spriteRasterizationParam,hasSizeVV:r,placement:a.markerPlacement,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,transforms:a.transform,minPixelBuffer:l(i)})]}function d(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:r}=l,{layerOrderMap:s}=i,u={visualVariableColor:e.colorLocked?null:n.visualVariableColor,visualVariableOpacity:n.visualVariableOpacity};if(e.animationParams){const a=t.animatedFill;return V(r.ensureInstance(a,{uniforms:{...u,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1}},c(e.name,s)),e,o,i)}return y(r.ensureInstance(t.fill,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,s)),e,i)}function z(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return v(o.ensureInstance(t.outlineFill,{uniforms:{visualVariableColor:e.colorLocked?null:n.visualVariableColor,visualVariableOpacity:n.visualVariableOpacity,visualVariableSizeMinMaxValue:null,visualVariableSizeScaleStops:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,r)),e,i)}function v(e,i,n){const t=m(i.color)??[0,0,0,0],l=m(i.outlineColor)??[0,0,0,0];return[e.createMeshInfo({color:t,outlineColor:l,width:i.outlineWidth,referenceWidth:i.referenceWidth,minPixelBuffer:null!=i.pixelBufferSize?a(i.pixelBufferSize)+1:0,capType:i.cap,joinType:i.join,miterLimit:i.miterLimit,outlineUsesColorVV:!i.outlineColorLocked,hasSizeVV:!1,scaleInfo:n.scaleInfo,...C(i,n),effects:i.effects?{type:"cim-effect-infos",effectInfos:i.effects}:null,outlineEffects:i.outlineEffects?{type:"cim-effect-infos",effectInfos:i.outlineEffects}:null})]}function y(e,a,i){const{scaleInfo:n}=i;return[e.createMeshInfo({color:m(a.color)??[0,0,0,0],scaleInfo:n,...C(a,i),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function g(e,a,i){const{layerOrderMap:n}=i;if(!e.spriteRasterizationParam)return d(e,a,i);const{uniforms:l,schemaOptions:r}=a,{store:s}=r,u={visualVariableColor:e.colorLocked?null:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity};if(e.animationParams){const a=t.animatedFill;return V(s.ensureInstance(a,{uniforms:{...u,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1,angle:!!e.angle}},c(e.name,n)),e,o,i)}return I(s.ensureInstance(t.complexFill,{uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,n)),e,null!=l.visualVariableColor,i)}function I(e,a,i,n){const{scaleInfo:t}=n;if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const l=!!a.hasUnresolvedReplacementColor&&(!i||a.colorLocked),o=a.sampleAlphaOnly&&!l,r=a.spriteRasterizationParam;return[e.createMeshInfo({color:m(a.color)??[0,0,0,0],height:a.height,aspectRatio:a.scaleX,offsetX:a.offsetX,offsetY:a.offsetY,scaleX:1,scaleY:1,angle:a.angle,applyRandomOffset:a.applyRandomOffset,sampleAlphaOnly:o,scaleProportionally:"CIMHatchFill"===r.resource.type,sprite:r,scaleInfo:t,...C(a,n),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function M(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return R(o.ensureInstance(t.gradientFill,{uniforms:{visualVariableColor:null,visualVariableOpacity:n.visualVariableOpacity},optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,r)),e,i)}function R(e,a,i){const{scaleInfo:n}=i;if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const t=a.spriteRasterizationParam;return[e.createMeshInfo({color:m(a.color)??[0,0,0,0],angle:a.angle,gradientMethod:a.gradientMethod,gradientSize:a.gradientSize,gradientSizeUnits:a.gradientSizeUnits,gradientType:a.gradientType,sprite:t,scaleInfo:n,...C(a,i),effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function O(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:r}=l,{layerOrderMap:s}=i,u=e.isOutline?{...o,visualVariableSizeScaleStops:n.visualVariableSizeOutlineScaleStops}:{visualVariableColor:e.colorLocked?null:n.visualVariableColor,visualVariableOpacity:n.visualVariableOpacity,visualVariableSizeMinMaxValue:n.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:n.visualVariableSizeScaleStops,visualVariableSizeStops:n.visualVariableSizeStops,visualVariableSizeUnitValue:n.visualVariableSizeUnitValue};if(e.animationParams){const{hasShiftAnimation:a}=e.animationParams.params,n=t.animatedLine;return V(r.ensureInstance(n,{uniforms:{...u,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,accumulatedDistance:!0,segmentDirection:!0,normal:!0,lineLength:a,angle:!1}},c(e.name,s)),e,o,i)}const f={uniforms:u,optionalAttributes:{zoomRange:!!i.scaleInfo}},m=!!(u.visualVariableSizeMinMaxValue||u.visualVariableSizeScaleStops||u.visualVariableSizeStops||u.visualVariableSizeUnitValue);if(!e.spriteRasterizationParam){return x(r.ensureInstance(t.line,f,c(e.name,s)),e,m,i)}return L(r.ensureInstance(t.texturedLine,f,c(e.name,s)),e,m,i)}function P(e,a,i){const{scaleInfo:n}=i;return{color:m(e.color)??[0,0,0,0],width:e.width,referenceWidth:e.referenceWidth,capType:e.cap,joinType:e.join,miterLimit:e.miterLimit,scaleInfo:n,hasSizeVV:a,...C(e,i),effects:e.effects?{type:"cim-effect-infos",effectInfos:e.effects}:null}}function C(e,{rotationVariable:a,viewRotation:i}){if(!e.effects?.length&&!e.outlineEffects?.length)return{};const n={};if(e.effectsChangeGeometryType&&(n.useEffectOrigin=!0),null!=i&&(n.viewRotation=i),!a)return n;const t=a.valueExpression??(a.field?`$feature[${JSON.stringify(a.field)}]`:null);return t?(n.effectRotation={valueExpressionInfo:{type:"CIMExpressionInfo",expression:t},defaultValue:0},n.effectRotationType=a.rotationType,n):n}function x(e,a,i,n){if(a.spriteRasterizationParam)throw new Error("InternalError: Sprite should not be defined");const t=P(a,i,n);return[e.createMeshInfo(t)]}function L(e,a,i,n){const{spriteRasterizationParam:t,scaleDash:l,sampleAlphaOnly:o}=a;if(!t)throw new Error("InternalError: Sprite should be defined");return[e.createMeshInfo({...P(a,i,n),offsetAlongLine:a.offsetAlongLine??0,shouldScaleDash:l??!1,shouldSampleAlphaOnly:o,isSDF:"CIMPictureStroke"!==t.resource.type&&"CIMGradientStroke"!==t.resource.type,sprite:t})]}function k(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:r}=l,{layerOrderMap:s}=i;return w(r.ensureInstance(t.gradientStroke,{uniforms:e.isOutline?{...o,visualVariableSizeScaleStops:n.visualVariableSizeOutlineScaleStops}:{visualVariableColor:null,visualVariableOpacity:n.visualVariableOpacity,visualVariableSizeMinMaxValue:n.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:n.visualVariableSizeScaleStops,visualVariableSizeStops:n.visualVariableSizeStops,visualVariableSizeUnitValue:n.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!i.scaleInfo}},c(e.name,s)),e,i)}function w(e,a,i){if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const n=a.spriteRasterizationParam;return[e.createMeshInfo({...P(a,!1,i),gradientMethod:a.gradientMethod,gradientSize:a.gradientSize,gradientSizeUnits:a.gradientSizeUnits,gradientType:a.gradientType,sprite:n,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null})]}function A(e,a,i){const{uniforms:n,schemaOptions:l}=a,{store:o}=l,{layerOrderMap:r}=i;return E(o.ensureInstance(t.text,{uniforms:{visualVariableColor:e.colorLocked?null:n.visualVariableColor,visualVariableOpacity:n.visualVariableOpacity,visualVariableRotation:n.visualVariableRotation,visualVariableSizeMinMaxValue:n.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:n.visualVariableSizeScaleStops,visualVariableSizeStops:n.visualVariableSizeStops,visualVariableSizeUnitValue:n.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!i.scaleInfo,referenceSymbol:!1,clipAngle:!1,visibility:!1}},c(e.name,r)),e,n,i)}function E(e,a,i,{scaleInfo:n,scaleExpression:t}){return[e.createMeshInfo({alignment:a.alignment,boxBackgroundColor:m(a.backgroundColor),boxBorderLineColor:m(a.borderLineColor),boxBorderLineSize:a.borderLineWidth??0,color:m(a.color)??[0,0,0,0],offsetX:a.offsetX,offsetY:a.offsetY,postAngle:a.angle,fontSize:a.size,referenceSize:a.referenceSize,decoration:a.decoration,haloColor:m(a.haloColor)??[0,0,0,0],haloSize:a.haloSize??0,outlineColor:m(a.outlineColor)??[0,0,0,0],outlineSize:a.outlineSize,lineWidth:a.lineWidth||512,lineHeightRatio:1,horizontalAlignment:a.horizontalAlignment??"center",verticalAlignment:a.verticalAlignment??"baseline",useCIMAngleBehavior:!1,glyphs:a.textRasterizationParam,scaleInfo:n,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,placement:a.markerPlacement,transforms:a.transform,scaleFactor:t??1,minPixelBuffer:l(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}export{b as createAnimatedMarkerMeshInfos,V as createAnimatedPolyMeshInfos,I as createComplexFillMeshInfos,h as createComplexMarkerMeshInfos,y as createComplexSimpleFillMeshInfos,x as createComplexSimpleLineMeshInfos,v as createComplexSimpleOutlineFillMeshInfos,p as createComplexSymbolInstances,E as createComplexTextMeshInfos,L as createComplexTexturedLineMeshInfos,R as createGradientFillMeshInfos,w as createGradientStrokeMeshInfos,f as getScaleInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getInfo as t}from"../../../geometry/support/spatialReferenceUtils.js";import r from"./TileKey.js";function i(t,r){return[t,r]}function o(t,r,i){return t[0]=r,t[1]=i,t}function e(t,r,i,o,e){return t[0]=r,t[1]=i,t[2]=o,t[3]=e,t}const s=new r("0/0/0/0");class l{static create(r,e,s=null){const n=t(r.spatialReference),a=e.origin||i(r.origin.x,r.origin.y),h=i(r.size[0]*e.resolution,r.size[1]*e.resolution),u=i(-1/0,-1/0),c=i(1/0,1/0),m=i(1/0,1/0);null!=s&&(o(u,Math.max(0,Math.floor((s.xmin-a[0])/h[0])),Math.max(0,Math.floor((a[1]-s.ymax)/h[1]))),o(c,Math.max(0,Math.floor((s.xmax-a[0])/h[0])),Math.max(0,Math.floor((a[1]-s.ymin)/h[1]))),o(m,c[0]-u[0]+1,c[1]-u[1]+1));const{cols:g,rows:w}=e;let d,f,p,z;return!s&&g&&w&&(o(u,g[0],w[0]),o(c,g[1],w[1]),o(m,g[1]-g[0]+1,w[1]-w[0]+1)),r.isWrappable?(d=i(Math.ceil(Math.round((n.valid[1]-n.valid[0])/e.resolution)/r.size[0]),m[1]),f=!0,p=n.origin,z=n.valid):(d=m,f=!1),new l(e.level,e.resolution,e.scale,a,u,c,m,h,d,f,p,z)}constructor(t,r,i,o,e,s,l,n,a,h,u,c){this.level=t,this.resolution=r,this.scale=i,this.origin=o,this.first=e,this.last=s,this.size=l,this.norm=n,this.worldSize=a,this.wrap=h,this._spatialReferenceOrigin=u,this._spatialReferenceValid=c}normalizeCol(t){if(!this.wrap)return t;const r=this.worldSize[0];return t<0?r-1-Math.abs((t+1)%r):t%r}normalizeKey(t){if(!this.wrap)return;const r=this.worldSize[0],i=t.col;i<0?(t.col=i+r,t.world-=1):i>=r&&(t.col=i-r,t.world+=1)}denormalizeCol(t,r){return this.wrap?this.worldSize[0]*r+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){const r=this.origin[0]+t*this.norm[0],i=this._spatialReferenceOrigin,o=this._spatialReferenceValid;return this.wrap&&i&&o?r===i[0]?o[0]:this.origin[0]===i[0]&&t===this.worldSize[0]?o[1]:r:r}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,r,i=!1){s.set(r);const o=i?s.col:this.denormalizeCol(s.col,s.world),l=s.row;return e(t,this.getXForColumn(o),this.getYForRow(l+1),this.getXForColumn(o+1),this.getYForRow(l)),t}getTileCoords(t,r,i=!1){s.set(r);const e=i?s.col:this.denormalizeCol(s.col,s.world);return Array.isArray(t)?o(t,this.getXForColumn(e),this.getYForRow(s.row)):(t.x=this.getXForColumn(e),t.y=this.getYForRow(s.row)),t}}export{l as default};
2
+ import{getInfo as t}from"../../../geometry/support/spatialReferenceUtils.js";import r from"./TileKey.js";function i(t,r){return[t,r]}function o(t,r,i){return t[0]=r,t[1]=i,t}function e(t,r,i,o,e){return t[0]=r,t[1]=i,t[2]=o,t[3]=e,t}const s=new r("0/0/0/0");class n{static create(r,e,s=null){const l=t(r.spatialReference),a=e.origin||i(r.origin.x,r.origin.y),h=i(r.size[0]*e.resolution,r.size[1]*e.resolution),u=i(-1/0,-1/0),c=i(1/0,1/0),m=i(1/0,1/0);null!=s&&(o(u,Math.max(0,Math.floor((s.xmin-a[0])/h[0])),Math.max(0,Math.floor((a[1]-s.ymax)/h[1]))),o(c,Math.max(0,Math.floor((s.xmax-a[0])/h[0])),Math.max(0,Math.floor((a[1]-s.ymin)/h[1]))),o(m,c[0]-u[0]+1,c[1]-u[1]+1));const{cols:g,rows:w}=e;let d,f,p,z;return!s&&g&&w&&(o(u,g[0],w[0]),o(c,g[1],w[1]),o(m,g[1]-g[0]+1,w[1]-w[0]+1)),r.isWrappable?(d=i(Math.round(Math.round((l.valid[1]-l.valid[0])/e.resolution)/r.size[0]),m[1]),f=!0,p=l.origin,z=l.valid):(d=m,f=!1),new n(e.level,e.resolution,e.scale,a,u,c,m,h,d,f,p,z)}constructor(t,r,i,o,e,s,n,l,a,h,u,c){this.level=t,this.resolution=r,this.scale=i,this.origin=o,this.first=e,this.last=s,this.size=n,this.norm=l,this.worldSize=a,this.wrap=h,this._spatialReferenceOrigin=u,this._spatialReferenceValid=c}normalizeCol(t){if(!this.wrap)return t;const r=this.worldSize[0];return t<0?r-1-Math.abs((t+1)%r):t%r}normalizeKey(t){if(!this.wrap)return;const r=this.worldSize[0],i=t.col;i<0?(t.col=i+r,t.world-=1):i>=r&&(t.col=i-r,t.world+=1)}denormalizeCol(t,r){return this.wrap?this.worldSize[0]*r+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){const r=this.origin[0]+t*this.norm[0],i=this._spatialReferenceOrigin,o=this._spatialReferenceValid;return this.wrap&&i&&o?r===i[0]?o[0]:this.origin[0]===i[0]&&t===this.worldSize[0]?o[1]:r:r}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,r,i=!1){s.set(r);const o=i?s.col:this.denormalizeCol(s.col,s.world),n=s.row;return e(t,this.getXForColumn(o),this.getYForRow(n+1),this.getXForColumn(o+1),this.getYForRow(n)),t}getTileCoords(t,r,i=!1){s.set(r);const e=i?s.col:this.denormalizeCol(s.col,s.world);return Array.isArray(t)?o(t,this.getXForColumn(e),this.getYForRow(s.row)):(t.x=this.getXForColumn(e),t.y=this.getYForRow(s.row)),t}}export{n as default};