@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721

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 (284) hide show
  1. package/Camera.js +1 -1
  2. package/analysis/DimensioningAnalysis.js +1 -1
  3. package/analysis/LineOfSightAnalysis.js +1 -1
  4. package/analysis/SliceAnalysis.js +1 -1
  5. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  6. package/arcade/functions/featuresetgeom.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
  9. package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
  10. package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
  11. package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
  15. package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
  16. package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
  17. package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
  19. package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
  20. package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
  21. package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
  22. package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
  27. package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
  28. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  29. package/assets/esri/themes/dark/main.css +1 -1
  30. package/assets/esri/themes/light/main.css +1 -1
  31. package/assets/esri/themes/light/view.css +1 -1
  32. package/chunks/ComponentShader.glsl.js +39 -33
  33. package/chunks/Laserlines.glsl.js +4 -4
  34. package/chunks/Precipitation.glsl.js +2 -2
  35. package/chunks/RibbonLine.glsl.js +46 -44
  36. package/chunks/Stars.glsl.js +2 -2
  37. package/chunks/Terrain.glsl.js +25 -17
  38. package/chunks/boundedPlane.js +1 -1
  39. package/chunks/lerc-wasm.js +1 -1
  40. package/chunks/mat2d.js +1 -1
  41. package/chunks/quatf32.js +1 -1
  42. package/core/BidiEngine.js +1 -1
  43. package/core/accessorSupport/watch.js +1 -1
  44. package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
  45. package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
  46. package/core/perspectiveUtils.js +1 -1
  47. package/core/promiseUtils.js +1 -1
  48. package/core/reactiveUtils.js +1 -1
  49. package/core/unitUtils.js +1 -1
  50. package/geometry/projection.js +1 -1
  51. package/geometry/projectionEllipsoid.js +1 -1
  52. package/geometry/support/MeshTexture.js +1 -1
  53. package/geometry/support/axisAngleDegrees.js +1 -1
  54. package/geometry/support/coordinateSystem.js +1 -1
  55. package/geometry/support/geodesicUtils.js +1 -1
  56. package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
  57. package/geometry/support/meshUtils/loadExternal.js +1 -1
  58. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  59. package/geometry/support/scaleUtils.js +1 -1
  60. package/geometry/support/spatialReferenceUtils.js +1 -1
  61. package/identity/IdentityManagerBase.js +1 -1
  62. package/identity/IdentityModal.js +1 -1
  63. package/interfaces.d.ts +3 -33
  64. package/layers/FeatureLayer.js +1 -1
  65. package/layers/effects/parser.js +1 -1
  66. package/layers/graphics/hydratedFeatures.js +1 -1
  67. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  68. package/layers/mixins/ArcGISImageService.js +1 -1
  69. package/layers/ogc/wfsUtils.js +1 -1
  70. package/layers/support/ContingentValue.js +1 -1
  71. package/layers/support/ElevationQuery.js +1 -1
  72. package/layers/support/PixelBlock.js +1 -1
  73. package/layers/support/kmlUtils.js +1 -1
  74. package/layers/support/rasterDatasets/CloudRaster.js +1 -1
  75. package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
  76. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  77. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  78. package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
  79. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  80. package/layers/support/rasterFormats/Lerc.js +1 -1
  81. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  82. package/layers/support/rasterFormats/Raw.js +1 -1
  83. package/layers/support/rasterFormats/TiffTags.js +1 -1
  84. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  85. package/layers/support/vectorTileLayerLoader.js +1 -1
  86. package/layers/support/wmtsUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/renderers/RasterShadedReliefRenderer.js +1 -1
  89. package/renderers/RasterStretchRenderer.js +1 -1
  90. package/renderers/UniqueValueRenderer.js +1 -1
  91. package/renderers/support/AuthoringInfo.js +1 -1
  92. package/renderers/support/RasterSymbolizer.js +1 -1
  93. package/rest/query/operations/query.js +1 -1
  94. package/rest/query/operations/queryTopFeatures.js +1 -1
  95. package/rest/support/DirectionsFeatureSet.js +1 -1
  96. package/rest/support/ImageHistogramParameters.js +1 -1
  97. package/rest/support/ImageSampleParameters.js +1 -1
  98. package/smartMapping/labels/clusters.js +1 -1
  99. package/smartMapping/renderers/relationship.js +1 -1
  100. package/smartMapping/support/adapters/support/utils.js +1 -1
  101. package/support/basemapUtils.js +1 -1
  102. package/support/revision.js +1 -1
  103. package/symbols/LabelSymbol3D.js +1 -1
  104. package/symbols/PointSymbol3D.js +1 -1
  105. package/symbols/cim/CIMCursor.js +1 -1
  106. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  107. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  108. package/symbols/support/previewSymbol3D.js +1 -1
  109. package/symbols/support/webStyleSymbolUtils.js +1 -1
  110. package/views/2d/ViewState.js +1 -1
  111. package/views/2d/engine/vectorTiles/Feature.js +1 -1
  112. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  113. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  114. package/views/2d/engine/webgl/TurboLine.js +1 -1
  115. package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
  116. package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
  117. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  118. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  119. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  120. package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
  121. package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
  122. package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
  123. package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
  124. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  125. package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
  126. package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
  127. package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
  128. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  129. package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
  130. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  131. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  132. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  133. package/views/2d/input/MapViewInputManager.js +1 -1
  134. package/views/2d/layers/features/createSymbolSchema.js +1 -1
  135. package/views/2d/viewpointUtils.js +1 -1
  136. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  137. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  138. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  139. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  140. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  141. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  142. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  143. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  144. package/views/3d/camera/constraintUtils/distance.js +1 -1
  145. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
  146. package/views/3d/environment/CloudsComposition.js +1 -1
  147. package/views/3d/environment/FogTechnique.js +1 -1
  148. package/views/3d/glTF/internal/Resource.js +1 -1
  149. package/views/3d/input/SceneInputManager.js +1 -1
  150. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  151. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  152. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  153. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  154. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  155. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  156. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  157. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  158. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/lineUtils.js +1 -1
  168. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  169. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  170. package/views/3d/layers/i3s/IDBCache.js +1 -1
  171. package/views/3d/layers/i3s/IDBMockCache.js +1 -1
  172. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  173. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  174. package/views/3d/state/ViewState.js +1 -1
  175. package/views/3d/support/cameraUtils.js +1 -1
  176. package/views/3d/support/orientedBoundingBox.js +1 -1
  177. package/views/3d/support/viewpointUtils.js +1 -1
  178. package/views/3d/terrain/Overlay.js +1 -1
  179. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  180. package/views/3d/terrain/OverlayRenderer.js +1 -1
  181. package/views/3d/terrain/TerrainRenderer.js +1 -1
  182. package/views/3d/terrain/TerrainSurface.js +1 -1
  183. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  184. package/views/3d/terrain/interfaces.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  189. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  190. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  191. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  192. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  193. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  194. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
  195. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  196. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
  197. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
  198. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  199. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  200. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  201. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
  202. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  203. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  204. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  205. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  206. package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  208. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  209. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  210. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  211. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  212. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  218. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  219. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  220. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  221. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  222. package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
  223. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  224. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  225. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  226. package/views/DOMContainer.js +1 -1
  227. package/views/MapView.js +1 -1
  228. package/views/SceneView.js +1 -1
  229. package/views/View.js +1 -1
  230. package/views/analysis/analysisViewUtils.js +1 -1
  231. package/views/animation/pointToPoint/apex/planning.js +1 -1
  232. package/views/draw/PolygonDrawAction.js +1 -1
  233. package/views/draw/PolylineDrawAction.js +1 -1
  234. package/views/draw/support/createUtils.js +1 -1
  235. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  236. package/views/input/InputManager.js +1 -1
  237. package/views/input/handlers/LatestPointer.js +1 -1
  238. package/views/input/handlers/MultiTouch.js +5 -0
  239. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  240. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  241. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
  242. package/views/interactive/tooltip/Tooltip.js +1 -1
  243. package/views/interactive/tooltip/support/measurements.js +1 -1
  244. package/views/layers/GroupLayerView.js +1 -1
  245. package/views/navigation/FilteredFiniteDifference.js +1 -1
  246. package/views/navigation/MomentumEstimator.js +1 -1
  247. package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
  248. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  249. package/views/navigation/RotationMomentumEstimator.js +1 -1
  250. package/views/support/GroundViewElevationSampler.js +1 -1
  251. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  252. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  253. package/views/support/screenshotUtils.js +1 -1
  254. package/views/webgl/BufferObject.js +1 -1
  255. package/views/webgl/FramebufferObject.js +1 -1
  256. package/views/webgl/Texture.js +1 -1
  257. package/views/webgl/capabilities/Capabilities.js +1 -1
  258. package/views/webgl/capabilities.js +1 -1
  259. package/views/webgl/renderState.js +1 -1
  260. package/webscene/spec-certification/api.js +1 -1
  261. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  262. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  263. package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
  264. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  265. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  266. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  267. package/widgets/Expand.js +1 -1
  268. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  269. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  270. package/widgets/Popup/PopupViewModel.js +1 -1
  271. package/widgets/Popup/actionUtils.js +1 -1
  272. package/widgets/ScaleRangeSlider.js +1 -1
  273. package/widgets/Slider/SliderViewModel.js +1 -1
  274. package/widgets/Widget.js +1 -1
  275. package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
  276. package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
  277. package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
  278. package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
  279. package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
  280. package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
  281. package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
  282. package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
  283. package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
  284. package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{noDominantCategoryField as n}from"../../../statistics/support/predominanceUtils.js";import{isIntegerField as o,castIntegerFieldToFloat as e,getDateDiffSQL as a}from"../../utils.js";import{getEqualIntervalBins as l}from"../../../../statistics/utils.js";const i=/_value$/i,r=Math.LOG10E;function u(t){return t.map((t=>t.toJSON()))}async function s(t,n,o){const e=[];if(n)for(const a of n){const n=t.getField(a);"availableFields"in o&&!o.availableFields.includes(n.name)&&e.push(n.name)}return e}function c(t,n){const o=t&&t.features,e=o&&o[0]&&o[0].attributes,a={};for(const l in e)a[l.replace(i,"").toLowerCase()]=e[l];return null!=a.totalcount&&a.totalcount>=a.count&&(a.nullcount=a.totalcount-a.count),delete a.totalcount,a.min===a.max&&null!=a.min&&null==a.stddev&&(a.stddev=a.variance=0),n&&(["min","max","avg","stddev","sum","variance"].forEach((t=>{null!=a[t]&&(a[t]=Math.ceil(a[t]))})),a.min===a.max&&null!=a.min&&(a.avg=a.min,a.stddev=a.variance=0)),a}function f(t){const n=[],o=t.classBreaks,e=o[0].minValue,a=o[o.length-1].maxValue;o.forEach((t=>{n.push([t.minValue,t.maxValue])}));const l={field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,layer:t.layer};return{min:e,max:a,intervals:n,sqlExpr:m(l),excludeZerosExpr:t.where,normTotal:t.normalizationTotal}}function m(t){const{field:n,normalizationType:a,normalizationField:l,normalizationTotal:i,layer:u}=t,s=o(u,n);let c=n;return"percent-of-total"===a?c=`((${s?e(n):n} / ${i}) * 100)`:"log"===a?c=`(log(${n}) * ${r})`:"field"===a?c=`(${s?e(n):n} / ${l})`:"natural-log"===a?c=`(log(${s?e(n):n}))`:"square-root"===a&&(c=`(power(${s?e(n):n}, 0.5))`),c}function p(t,n){let o;if(n=n.toLowerCase(),t)for(const e in t)if(e.toLowerCase()!==n){o=t[e];break}return o}function d(t,n){let o;if(n=n.toLowerCase(),t)for(const e in t)if(e.toLowerCase()===n){o=t[e];break}return o}function v(t,n,o,e,a){const i={},r="countOFExpr";t&&t.features&&t.features.forEach((t=>{const n=t.attributes,o=p(n,r),e=d(n,r);0!==o&&(i[o]=e)}));const u=[];return l(n,o,e).forEach(((t,n)=>{const o=(n+1).toString();u.push({minValue:t[0],maxValue:t[1],count:i.hasOwnProperty(o)?i[o]:0})})),{bins:u,minValue:n,maxValue:o,normalizationTotal:a}}function h(n,o,e,a,l,i){const r=n&&n.features,u="countOF"+(e||"Expr"),s={};let c=!1;if(r.forEach((t=>{const n=t.attributes,o=d(n,u);let a=e?d(n,e):p(n,u);null===a&&0===o&&(c=!0),(null==a||"string"==typeof a&&""===a.trim())&&(a=null),null==s[a]?s[a]={count:o,data:a}:s[a].count=s[a].count+o})),e&&c){const n=e+" is NULL";return o.queryFeatureCount({whereClause:n,view:a,signal:i}).then((t=>(t=t||0,s.null.count=s.null.count+t,x(s,l)))).catch((()=>(t(i),x(s,l))))}return Promise.resolve(x(s,l))}function x(t,n){if(n)for(const o in t)t[o].label=n[o];return{count:t}}function g(t,n){return a(t,new Date(0),n,"milliseconds").sqlExpression}function w(t){return{viewingMode:"2d"===t.type?"map":t.viewingMode,scale:t.scale,spatialReference:t.spatialReference?.toJSON()}}function y(t,o){const e=t.map((t=>t.value)),a=o.filter((t=>!e.includes(t)));for(const n of a)t.push({value:n,count:0});t.sort(((t,n)=>o.indexOf(t.value)-o.indexOf(n.value)));for(const l of t)l.value===n&&(l.value=null);return{predominantCategoryInfos:t}}export{u as ensureFeaturesJSON,f as generateBinParams,m as getFieldExpr,v as getHistogramFromFeatureSet,s as getMissingFields,y as getPredominantCategoriesFromUVInfos,c as getSummaryStatisticsFromFeatureSet,h as getUniqueValuesFromFeatureSet,w as getViewInfoParams,g as msSinceUnixEpochSQL};
5
+ import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{noDominantCategoryField as n}from"../../../statistics/support/predominanceUtils.js";import{isIntegerField as o,getDateDiffSQL as e,castIntegerFieldToFloat as a}from"../../utils.js";import{getEqualIntervalBins as l}from"../../../../statistics/utils.js";const i=/_value$/i,r=Math.LOG10E;function u(t){return t.map((t=>t.toJSON()))}async function s(t,n,o){const e=[];if(n)for(const a of n){const n=t.getField(a);"availableFields"in o&&!o.availableFields.includes(n.name)&&e.push(n.name)}return e}function c(t,n){const o=t&&t.features,e=o&&o[0]&&o[0].attributes,a={};for(const l in e)a[l.replace(i,"").toLowerCase()]=e[l];return null!=a.totalcount&&a.totalcount>=a.count&&(a.nullcount=a.totalcount-a.count),delete a.totalcount,a.min===a.max&&null!=a.min&&null==a.stddev&&(a.stddev=a.variance=0),n&&(["min","max","avg","stddev","sum","variance"].forEach((t=>{null!=a[t]&&(a[t]=Math.ceil(a[t]))})),a.min===a.max&&null!=a.min&&(a.avg=a.min,a.stddev=a.variance=0)),a}function f(t){const n=[],o=t.classBreaks,e=o[0].minValue,a=o[o.length-1].maxValue;o.forEach((t=>{n.push([t.minValue,t.maxValue])}));const l={field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,layer:t.layer};return{min:e,max:a,intervals:n,sqlExpr:m(l),excludeZerosExpr:t.where,normTotal:t.normalizationTotal}}function m(t){const{field:n,normalizationType:e,normalizationField:l,normalizationTotal:i,layer:u}=t,s=o(u,n);let c=n;return"percent-of-total"===e?c=`((${s?a(n):n} / ${i}) * 100)`:"log"===e?c=`(log(${n}) * ${r})`:"field"===e?c=`(${s?a(n):n} / ${l})`:"natural-log"===e?c=`(log(${s?a(n):n}))`:"square-root"===e&&(c=`(power(${s?a(n):n}, 0.5))`),c}function p(t,n){let o;if(n=n.toLowerCase(),t)for(const e in t)if(e.toLowerCase()!==n){o=t[e];break}return o}function d(t,n){let o;if(n=n.toLowerCase(),t)for(const e in t)if(e.toLowerCase()===n){o=t[e];break}return o}function v(t,n,o,e,a){const i={},r="countOFExpr";t&&t.features&&t.features.forEach((t=>{const n=t.attributes,o=p(n,r),e=d(n,r);0!==o&&(i[o]=e)}));const u=[];return l(n,o,e).forEach(((t,n)=>{const o=(n+1).toString();u.push({minValue:t[0],maxValue:t[1],count:i.hasOwnProperty(o)?i[o]:0})})),{bins:u,minValue:n,maxValue:o,normalizationTotal:a}}function h(n,o,e,a,l,i){const r=n&&n.features,u="countOF"+(e||"Expr"),s={};let c=!1;if(r.forEach((t=>{const n=t.attributes,o=d(n,u);let a=e?d(n,e):p(n,u);null===a&&0===o&&(c=!0),(null==a||"string"==typeof a&&""===a.trim())&&(a=null),null==s[a]?s[a]={count:o,data:a}:s[a].count=s[a].count+o})),e&&c){const n=e+" is NULL";return o.queryFeatureCount({whereClause:n,view:a,signal:i}).then((t=>(t=t||0,s.null.count=s.null.count+t,x(s,l)))).catch((()=>(t(i),x(s,l))))}return Promise.resolve(x(s,l))}function x(t,n){if(n)for(const o in t)t[o].label=n[o];return{count:t}}function g(t,n){return e(t,new Date(0),n,"milliseconds").sqlExpression}function w(t){return{viewingMode:"2d"===t.type?"map":t.viewingMode,scale:t.scale,spatialReference:t.spatialReference?.toJSON()}}function y(t,o){const e=t.map((t=>t.value)),a=o.filter((t=>!e.includes(t)));for(const n of a)t.push({value:n,count:0});t.sort(((t,n)=>o.indexOf(t.value)-o.indexOf(n.value)));for(const l of t)l.value===n&&(l.value=null);return{predominantCategoryInfos:t}}export{u as ensureFeaturesJSON,f as generateBinParams,m as getFieldExpr,v as getHistogramFromFeatureSet,s as getMissingFields,y as getPredominantCategoriesFromUVInfos,c as getSummaryStatisticsFromFeatureSet,h as getUniqueValuesFromFeatureSet,w as getViewInfoParams,g as msSinceUnixEpochSQL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../Basemap.js";import r from"../config.js";import a from"../core/Collection.js";import t from"../core/Logger.js";import{isSome as n,isNone as i}from"../core/maybe.js";import{normalize as s,Url as l,makeAbsolute as c}from"../core/urlUtils.js";import{ensureType as u}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as o}from"./basemapDefinitions.js";const f=t.getLogger("esri.support.basemapUtils");function p(){return{}}function y(e){for(const r in e){const a=e[r];!1===a?.destroyed&&a.destroy(),delete e[r]}}function m(a,t){let n;if("string"==typeof a){if(!(a in o)){const e=Object.entries(o).filter((([e,a])=>r.apiKey&&!a.classic||!r.apiKey&&a.classic&&!a.deprecated)).map((([e])=>`"${e}"`)).join(", ");return f.warn(`Unable to find basemap definition for: ${a}. Try one of these: ${e}`),null}t&&(n=t[a]),n||(n=e.fromId(a),t&&(t[a]=n))}else n=u(e,a);return n?.destroyed&&(f.warn("The provided basemap is already destroyed",{basemap:n}),n=null),n}function d(r,a=null){const t=m(r);if(!t)return null;const n=new e({id:t.id,title:t.title,baseLayers:t.baseLayers.slice(),referenceLayers:t.referenceLayers.slice()});return a&&(n.baseLayers=g(n.baseLayers,a.baseLayers),n.referenceLayers=g(n.referenceLayers,a.referenceLayers)),n.load().catch((()=>{})),n.portalItem=t.portalItem,n}function b(e){let r=null;const a=T(e),t=!a.baseLayers.length;for(const n in o){const e=M(a,q(o[n]),{mustMatchReferences:t});if("equal"===e){r=n;break}"base-layers-equal"===e&&(r=n)}return r}function L(e,r){if(e===r)return!0;return"equal"===M(T(e),T(r),{mustMatchReferences:!0})}function g(e,r){const t=new a;return e.forEach((e=>{const a=r.find((r=>$(j(e),j(r))))||e;t.includes(a)?t.push(e):t.push(a)})),t}function v(e){return!!e?.baseLayers.concat(e.referenceLayers).some(S)}function S(e){if(I(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){if(I(e.sourceNameToSource[r]?.sourceUrl))return!0}return!1}function h(e,r){if(i(r)||i(e))return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const a=r.baseLayers.getItemAt(0);switch(a.loadStatus){case"not-loaded":a.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const t=(("supportedSpatialReferences"in a?a.supportedSpatialReferences:null)||["tileInfo"in a?a.tileInfo?.spatialReference:a.spatialReference]).filter(Boolean);return e.spatialReference?{spatialReference:t.find((r=>e.spatialReference.equals(r)))??t[0]??null,updating:!1}:{spatialReference:t[0],updating:!1}}const R=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function I(e){if(!e)return!1;const r=new l(c(e));return R.test(r.authority)}function T(e){return e?!e.loaded&&e.resourceInfo?q(e.resourceInfo.data):{baseLayers:w(e.baseLayers),referenceLayers:w(e.referenceLayers)}:null}function w(e){return(a.isCollection(e)?e.toArray():e).map(j)}function j(e){return{type:e.type,url:A("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||!n(e.sublayers)?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function q(e){return e?{baseLayers:x(e.baseMapLayers.filter((e=>!e.isReference))),referenceLayers:x(e.baseMapLayers.filter((e=>e.isReference)))}:null}function x(e){return e.map((e=>U(e)))}function U(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:A(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function M(e,r,a){if(null!=e!=(null!=r))return"not-equal";if(!e)return"equal";if(!k(e.baseLayers,r.baseLayers))return"not-equal";return k(e.referenceLayers,r.referenceLayers)?"equal":a.mustMatchReferences?"not-equal":"base-layers-equal"}function k(e,r){if(e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!$(e[a],r[a]))return!1;return!0}function $(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(n(e.activeLayerId)||n(r.activeLayerId))return e.activeLayerId===r.activeLayerId;if(n(e.sublayers)||n(r.sublayers)){if(i(e.sublayers)||i(r.sublayers)||e.sublayers.length!==r.sublayers.length)return!1;for(let a=0;a<e.sublayers.length;a++){const t=e.sublayers.at(a),n=r.sublayers.at(a);if(t.id!==n.id||t.visible!==n.visible)return!1}}return!0}function A(e){return e?s(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{d as clonePreservingTiledLayers,L as contentEquals,p as createCache,y as destroyCache,m as ensureType,h as findSpatialReference,b as getWellKnownBasemapId,v as hasDeveloperBasemapLayer,S as isDeveloperBasemapLayer};
5
+ import e from"../Basemap.js";import r from"../config.js";import a from"../core/Collection.js";import t from"../core/Logger.js";import{isNone as n,isSome as i}from"../core/maybe.js";import{Url as s,makeAbsolute as l,normalize as c}from"../core/urlUtils.js";import{ensureType as u}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as o}from"./basemapDefinitions.js";const f=t.getLogger("esri.support.basemapUtils");function p(){return{}}function y(e){for(const r in e){const a=e[r];!1===a?.destroyed&&a.destroy(),delete e[r]}}function m(a,t){let n;if("string"==typeof a){if(!(a in o)){const e=Object.entries(o).filter((([e,a])=>r.apiKey&&!a.classic||!r.apiKey&&a.classic&&!a.deprecated)).map((([e])=>`"${e}"`)).join(", ");return f.warn(`Unable to find basemap definition for: ${a}. Try one of these: ${e}`),null}t&&(n=t[a]),n||(n=e.fromId(a),t&&(t[a]=n))}else n=u(e,a);return n?.destroyed&&(f.warn("The provided basemap is already destroyed",{basemap:n}),n=null),n}function d(r,a=null){const t=m(r);if(!t)return null;const n=new e({id:t.id,title:t.title,baseLayers:t.baseLayers.slice(),referenceLayers:t.referenceLayers.slice()});return a&&(n.baseLayers=g(n.baseLayers,a.baseLayers),n.referenceLayers=g(n.referenceLayers,a.referenceLayers)),n.load().catch((()=>{})),n.portalItem=t.portalItem,n}function b(e){let r=null;const a=T(e),t=!a.baseLayers.length;for(const n in o){const e=M(a,q(o[n]),{mustMatchReferences:t});if("equal"===e){r=n;break}"base-layers-equal"===e&&(r=n)}return r}function L(e,r){if(e===r)return!0;return"equal"===M(T(e),T(r),{mustMatchReferences:!0})}function g(e,r){const t=new a;return e.forEach((e=>{const a=r.find((r=>$(j(e),j(r))))||e;t.includes(a)?t.push(e):t.push(a)})),t}function v(e){return!!e?.baseLayers.concat(e.referenceLayers).some(S)}function S(e){if(I(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){if(I(e.sourceNameToSource[r]?.sourceUrl))return!0}return!1}function h(e,r){if(n(r)||n(e))return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const a=r.baseLayers.getItemAt(0);switch(a.loadStatus){case"not-loaded":a.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const t=(("supportedSpatialReferences"in a?a.supportedSpatialReferences:null)||["tileInfo"in a?a.tileInfo?.spatialReference:a.spatialReference]).filter(Boolean);return e.spatialReference?{spatialReference:t.find((r=>e.spatialReference.equals(r)))??t[0]??null,updating:!1}:{spatialReference:t[0],updating:!1}}const R=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function I(e){if(!e)return!1;const r=new s(l(e));return R.test(r.authority)}function T(e){return e?!e.loaded&&e.resourceInfo?q(e.resourceInfo.data):{baseLayers:w(e.baseLayers),referenceLayers:w(e.referenceLayers)}:null}function w(e){return(a.isCollection(e)?e.toArray():e).map(j)}function j(e){return{type:e.type,url:A("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||!i(e.sublayers)?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function q(e){return e?{baseLayers:x(e.baseMapLayers.filter((e=>!e.isReference))),referenceLayers:x(e.baseMapLayers.filter((e=>e.isReference)))}:null}function x(e){return e.map((e=>U(e)))}function U(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:A(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function M(e,r,a){if(null!=e!=(null!=r))return"not-equal";if(!e)return"equal";if(!k(e.baseLayers,r.baseLayers))return"not-equal";return k(e.referenceLayers,r.referenceLayers)?"equal":a.mustMatchReferences?"not-equal":"base-layers-equal"}function k(e,r){if(e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!$(e[a],r[a]))return!1;return!0}function $(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(i(e.activeLayerId)||i(r.activeLayerId))return e.activeLayerId===r.activeLayerId;if(i(e.sublayers)||i(r.sublayers)){if(n(e.sublayers)||n(r.sublayers)||e.sublayers.length!==r.sublayers.length)return!1;for(let a=0;a<e.sublayers.length;a++){const t=e.sublayers.at(a),n=r.sublayers.at(a);if(t.id!==n.id||t.visible!==n.visible)return!1}}return!0}function A(e){return e?c(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{d as clonePreservingTiledLayers,L as contentEquals,p as createCache,y as destroyCache,m as ensureType,h as findSpatialReference,b as getWellKnownBasemapId,v as hasDeveloperBasemapLayer,S as isDeveloperBasemapLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const c="20220718",e="319f32dc45e6b810cee42cce9a1777a1f85381dc";export{c as buildDate,e as commitHash};
5
+ const d="20220721",c="da8f6db97c8af3da470cb1fd178fccd1bade917f";export{d as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import i from"./Symbol3D.js";import a from"./TextSymbol3DLayer.js";import{calloutProperty as p,hasVisibleCallout as c,hasVisibleVerticalOffset as m}from"./callouts/calloutUtils.js";import y from"./support/Symbol3DVerticalOffset.js";var n;const u=o.ofType({base:null,key:"type",typeMap:{text:a}});let f=n=class extends i{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.symbolLayers=new u,this.type="label-3d"}supportsCallout(){return!0}hasVisibleCallout(){return c(this)}hasVisibleVerticalOffset(){return m(this)}clone(){return new n({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail),callout:r(this.callout),verticalOffset:r(this.verticalOffset)})}static fromTextSymbol(t){return new n({symbolLayers:[a.fromTextSymbol(t)]})}};t([e({type:y,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([e(p)],f.prototype,"callout",void 0),t([e({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([e({type:u})],f.prototype,"symbolLayers",void 0),t([s({LabelSymbol3D:"label-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=n=t([l("esri.symbols.LabelSymbol3D")],f);const b=f;export{b as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import i from"./Symbol3D.js";import a from"./TextSymbol3DLayer.js";import{hasVisibleCallout as p,hasVisibleVerticalOffset as c,calloutProperty as m}from"./callouts/calloutUtils.js";import y from"./support/Symbol3DVerticalOffset.js";var n;const u=o.ofType({base:null,key:"type",typeMap:{text:a}});let f=n=class extends i{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.symbolLayers=new u,this.type="label-3d"}supportsCallout(){return!0}hasVisibleCallout(){return p(this)}hasVisibleVerticalOffset(){return c(this)}clone(){return new n({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail),callout:r(this.callout),verticalOffset:r(this.verticalOffset)})}static fromTextSymbol(t){return new n({symbolLayers:[a.fromTextSymbol(t)]})}};t([e({type:y,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([e(m)],f.prototype,"callout",void 0),t([e({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([e({type:u})],f.prototype,"symbolLayers",void 0),t([s({LabelSymbol3D:"label-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=n=t([l("esri.symbols.LabelSymbol3D")],f);const b=f;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import i from"./IconSymbol3DLayer.js";import m from"./ObjectSymbol3DLayer.js";import a from"./Symbol3D.js";import y from"./TextSymbol3DLayer.js";import{calloutProperty as c,hasVisibleCallout as n,hasVisibleVerticalOffset as p}from"./callouts/calloutUtils.js";import u from"./support/Symbol3DVerticalOffset.js";var b;const f=o.ofType({base:null,key:"type",typeMap:{icon:i,object:m,text:y}});let S=b=class extends a{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new f,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return n(this)}hasVisibleVerticalOffset(){return p(this)}clone(){return new b({verticalOffset:r(this.verticalOffset),callout:r(this.callout),styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new b({symbolLayers:[i.fromSimpleMarkerSymbol(t)]})}static fromPictureMarkerSymbol(t){return new b({symbolLayers:[i.fromPictureMarkerSymbol(t)]})}static fromCIMSymbol(t){const o=t.data?.symbol?.type;if("CIMPointSymbol"!==o)return null;return t.data.symbol.callout?new b({symbolLayers:[i.fromCIMSymbol(t)],callout:{type:"line",size:.5,color:[0,0,0]},verticalOffset:{screenLength:40}}):new b({symbolLayers:[i.fromCIMSymbol(t)]})}static fromTextSymbol(t){return new b({symbolLayers:[y.fromTextSymbol(t)]})}};t([e({type:u,json:{write:!0}})],S.prototype,"verticalOffset",void 0),t([e(c)],S.prototype,"callout",void 0),t([e({type:f,json:{origins:{"web-scene":{write:!0}}}})],S.prototype,"symbolLayers",void 0),t([s({PointSymbol3D:"point-3d"},{readOnly:!0})],S.prototype,"type",void 0),S=b=t([l("esri.symbols.PointSymbol3D")],S);const h=S;export{h as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import i from"./IconSymbol3DLayer.js";import m from"./ObjectSymbol3DLayer.js";import a from"./Symbol3D.js";import y from"./TextSymbol3DLayer.js";import{hasVisibleCallout as c,hasVisibleVerticalOffset as n,calloutProperty as p}from"./callouts/calloutUtils.js";import u from"./support/Symbol3DVerticalOffset.js";var b;const f=o.ofType({base:null,key:"type",typeMap:{icon:i,object:m,text:y}});let S=b=class extends a{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new f,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return c(this)}hasVisibleVerticalOffset(){return n(this)}clone(){return new b({verticalOffset:r(this.verticalOffset),callout:r(this.callout),styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new b({symbolLayers:[i.fromSimpleMarkerSymbol(t)]})}static fromPictureMarkerSymbol(t){return new b({symbolLayers:[i.fromPictureMarkerSymbol(t)]})}static fromCIMSymbol(t){const o=t.data?.symbol?.type;if("CIMPointSymbol"!==o)return null;return t.data.symbol.callout?new b({symbolLayers:[i.fromCIMSymbol(t)],callout:{type:"line",size:.5,color:[0,0,0]},verticalOffset:{screenLength:40}}):new b({symbolLayers:[i.fromCIMSymbol(t)]})}static fromTextSymbol(t){return new b({symbolLayers:[y.fromTextSymbol(t)]})}};t([e({type:u,json:{write:!0}})],S.prototype,"verticalOffset",void 0),t([e(p)],S.prototype,"callout",void 0),t([e({type:f,json:{origins:{"web-scene":{write:!0}}}})],S.prototype,"symbolLayers",void 0),t([s({PointSymbol3D:"point-3d"},{readOnly:!0})],S.prototype,"type",void 0),S=b=t([l("esri.symbols.PointSymbol3D")],S);const h=S;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{clone as t}from"../../core/lang.js";import{isPolygon as i,isPolyline as n,isMultipoint as s,isExtent as h,isPoint as e}from"../../geometry/support/jsonUtils.js";import{Placement as o}from"./CIMPlacements.js";function a(i){const n=t(i);return P(n),n}function r(t){if(!t)return null;e(t)?t.y=-t.y:i(t)?l(t.rings):n(t)?l(t.paths):s(t)&&u(t.points)}function u(t){if(t){const i=t.length;for(let n=0;n<i;n++)t[n][1]=-t[n][1]}}function l(t){if(t)for(const i of t)u(i)}function c(t){if(t){for(let i=t.length-1;i>0;--i)t[i][0]-=t[i-1][0],t[i][1]-=t[i-1][1]}}function f(t){if(t)for(const i of t)c(i)}function p(t){if(t){const i=t.length;for(let n=1;n<i;++n)t[n][0]+=t[n-1][0],t[n][1]+=t[n-1][1]}}function m(t){if(t)for(const i of t)p(i)}function P(t){t&&(i(t)?m(t.rings):n(t)?m(t.paths):s(t)&&p(t.points),r(t))}function x(t){t&&(r(t),i(t)?f(t.rings):n(t)?f(t.paths):s(t)&&c(t.points))}function g(t){if(t)for(const i of t)d(i)}function d(t){t&&t.reverse()}function y(t,i,n){return[t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]}function C(t){return!(!t||0===t.length)&&(t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1])}function I(t){return t[4]}function j(t,i){t[4]=i}class G{constructor(t,s,e,a){this.acceptPolygon=s,this.acceptPolyline=e,this.geomUnitsPerPoint=a,this.pathCount=-1,this.pathIndex=-1,this.iteratePath=!1,t&&(i(t)?s&&(this.multiPath=t.rings,this.isClosed=!0):n(t)?e&&(this.multiPath=t.paths,this.isClosed=!1):h(t)&&s&&(this.multiPath=b(t).rings,this.isClosed=!0),this.multiPath&&(this.pathCount=this.multiPath.length)),this.internalPlacement=new o}next(){if(!this.multiPath)return null;for(;this.iteratePath||this.pathIndex<this.pathCount-1;){this.iteratePath||this.pathIndex++;const t=this.processPath(this.multiPath[this.pathIndex]);if(t)return t}return this.pathCount=-1,this.pathIndex=-1,this.multiPath=null,null}}class U{constructor(t,i,n,s){this.inputGeometries=t,this.acceptPolygon=i,this.acceptPolyline=n,this.geomUnitsPerPoint=s,this.pathCount=-1,this.pathIndex=-1,this.iteratePath=!1}next(){for(;;){if(!this.multiPath){let t=this.inputGeometries.next();for(;t;){if(i(t)?this.acceptPolygon&&(this.multiPath=t.rings,this.isClosed=!0):n(t)?this.acceptPolyline&&(this.multiPath=t.paths,this.isClosed=!1):h(t)&&this.acceptPolygon&&(this.multiPath=b(t).rings,this.isClosed=!0),this.multiPath){this.pathCount=this.multiPath.length,this.pathIndex=-1;break}t=this.inputGeometries.next()}if(!this.multiPath)return null}for(;this.iteratePath||this.pathIndex<this.pathCount-1;){this.iteratePath||this.pathIndex++;const t=this.processPath(this.multiPath[this.pathIndex]);if(t)return t}this.pathCount=-1,this.pathIndex=-1,this.multiPath=null}}}function b(t){return{rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}}export{U as PathGeometryCursor,G as PathTransformationCursor,a as cloneAndDecodeGeometry,P as deltaDecodeGeometry,x as deltaEncodeGeometry,y as getCoord2D,I as getId,C as isClosedPath,g as reverseMultipath,d as reversePath,j as setId};
5
+ import{clone as t}from"../../core/lang.js";import{isPolygon as i,isPolyline as n,isMultipoint as s,isExtent as h,isPoint as e}from"../../geometry/support/jsonUtils.js";import{Placement as o}from"./CIMPlacements.js";function a(i){const n=t(i);return P(n),n}function l(t){t&&(e(t)?t.y=-t.y:i(t)?u(t.rings):n(t)?u(t.paths):s(t)&&r(t.points))}function r(t){if(t){const i=t.length;for(let n=0;n<i;n++)t[n][1]=-t[n][1]}}function u(t){if(t)for(const i of t)r(i)}function c(t){if(t){for(let i=t.length-1;i>0;--i)t[i][0]-=t[i-1][0],t[i][1]-=t[i-1][1]}}function f(t){if(t)for(const i of t)c(i)}function p(t){if(t){const i=t.length;for(let n=1;n<i;++n)t[n][0]+=t[n-1][0],t[n][1]+=t[n-1][1]}}function m(t){if(t)for(const i of t)p(i)}function P(t){t&&(i(t)?m(t.rings):n(t)?m(t.paths):s(t)&&p(t.points),l(t))}function x(t){t&&(l(t),i(t)?f(t.rings):n(t)?f(t.paths):s(t)&&c(t.points))}function g(t){if(t)for(const i of t)d(i)}function d(t){t&&t.reverse()}function C(t,i,n){return[t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]}function y(t){return!(!t||0===t.length)&&(t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1])}function I(t){return t[4]}function j(t,i){t[4]=i}class G{constructor(t,s,e,a=0){this.isClosed=!1,this.multiPath=null,this.acceptPolygon=s,this.acceptPolyline=e,this.geomUnitsPerPoint=a,this.pathCount=-1,this.pathIndex=-1,this.iteratePath=!1,t&&(i(t)?s&&(this.multiPath=t.rings,this.isClosed=!0):n(t)?e&&(this.multiPath=t.paths,this.isClosed=!1):h(t)&&s&&(this.multiPath=b(t).rings,this.isClosed=!0),this.multiPath&&(this.pathCount=this.multiPath.length)),this.internalPlacement=new o}next(){if(!this.multiPath)return null;for(;this.iteratePath||this.pathIndex<this.pathCount-1;){this.iteratePath||this.pathIndex++;const t=this.processPath(this.multiPath[this.pathIndex]);if(t)return t}return this.pathCount=-1,this.pathIndex=-1,this.multiPath=null,null}}class U{constructor(t,i,n,s=0){this.isClosed=!1,this.multiPath=null,this.inputGeometries=t,this.acceptPolygon=i,this.acceptPolyline=n,this.geomUnitsPerPoint=s,this.pathCount=-1,this.pathIndex=-1,this.iteratePath=!1}next(){for(;;){if(!this.multiPath){let t=this.inputGeometries.next();for(;t;){if(i(t)?this.acceptPolygon&&(this.multiPath=t.rings,this.isClosed=!0):n(t)?this.acceptPolyline&&(this.multiPath=t.paths,this.isClosed=!1):h(t)&&this.acceptPolygon&&(this.multiPath=b(t).rings,this.isClosed=!0),this.multiPath){this.pathCount=this.multiPath.length,this.pathIndex=-1;break}t=this.inputGeometries.next()}if(!this.multiPath)return null}for(;this.iteratePath||this.pathIndex<this.pathCount-1;){this.iteratePath||this.pathIndex++;const t=this.processPath(this.multiPath[this.pathIndex]);if(t)return t}this.pathCount=-1,this.pathIndex=-1,this.multiPath=null}}}function b(t){return{rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}}export{U as PathGeometryCursor,G as PathTransformationCursor,a as cloneAndDecodeGeometry,P as deltaDecodeGeometry,x as deltaEncodeGeometry,C as getCoord2D,I as getId,y as isClosedPath,g as reverseMultipath,d as reversePath,j as setId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{bidiText as t}from"../../core/BidiText.js";import e from"../../core/Logger.js";import{isNone as s,isSome as r}from"../../core/maybe.js";import i from"../../core/ObjectPool.js";import{pt2px as n}from"../../core/screenUtils.js";import{create as o,fromValues as a}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as h}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as l}from"../../geometry/support/centroid.js";import{isPoint as c,isPolygon as m,isPolyline as f,isExtent as u,isMultipoint as _}from"../../geometry/support/jsonUtils.js";import{SimpleGeometryCursor as d}from"./CIMEffects.js";import{getEffectOperator as p,getPlacementOperator as y}from"./CIMOperators.js";import{Placement as g}from"./CIMPlacements.js";import x from"./CIMResourceManager.js";import{LineCapStyle as P,LineJoinStyle as w}from"./enums.js";import M from"./Rect.js";import b from"./TextRasterizer.js";import{HAlign as S,VAlign as k}from"../../views/2d/engine/webgl/alignmentUtils.js";import{GLYPH_SIZE as C,MAGIC_LABEL_LINE_HEIGHT as T}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as R}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";const I=Math.PI/180,v=10,L=e.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class z{constructor(t){this._t=t}static createIdentity(){return new z([1,0,0,0,1,0])}clone(){const t=this._t;return new z(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new z([t,0,0,0,e,0])}scale(t,e){const s=this._t;return s[0]*=t,s[1]*=t,s[2]*=t,s[3]*=e,s[4]*=e,s[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new z([0,0,t,0,0,e])}translate(t,e){const s=this._t;return s[2]+=t,s[5]+=e,this}static createRotate(t){const e=Math.cos(t),s=Math.sin(t);return new z([e,-s,0,s,e,0])}rotate(t){return z.multiply(this,z.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],s=Math.sqrt(t*t+e*e);return[t/s,e/s]}static multiply(t,e,s){const r=t._t,i=e._t,n=r[0]*i[0]+r[3]*i[1],o=r[1]*i[0]+r[4]*i[1],a=r[2]*i[0]+r[5]*i[1]+i[2],h=r[0]*i[3]+r[3]*i[4],l=r[1]*i[3]+r[4]*i[4],c=r[2]*i[3]+r[5]*i[4]+i[5],m=s._t;return m[0]=n,m[1]=o,m[2]=a,m[3]=h,m[4]=l,m[5]=c,s}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new z([0,0,0,0,0,0]);e=1/e;const s=(t[1]*t[5]-t[2]*t[4])*e,r=(t[2]*t[3]-t[0]*t[5])*e,i=t[4]*e,n=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new z([i,n,s,o,a,r])}}class F{constructor(t,e){this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new i(g,null,null,100),this._earlyReturn=!1,this._mapRotation=0,this._resourceManager=t||new x,this._transfos.push(e||z.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||z.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const s=e?t.scaleRatio():1;z.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*s)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e)}}drawMultiLayerSymbol(t,e){if(!t)return;const s=t.symbolLayers;if(!s)return;const r=t.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(s,e),e=t.next()}}else this.drawSymbolLayers(s,e)}executeEffects(t,e){const s=this._resourceManager.geometryEngine;let r=new d(e);for(const i of t){const t=p(i);t&&(r=t.execute(r,i,this.geomUnitsPerPoint(),s))}return r}drawSymbolLayers(t,e){let s=t.length;for(;s--;){const r=t[s];if(!r||!1===r.enable)continue;const i=r.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(r,e),!this._earlyReturn););}}else this.drawSymbolLayer(r,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const s=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());s&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,s),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const s=t.markerPlacement;if(s){const r=y(s);if(r){const i="CIMMarkerPlacementInsidePolygon"===s.type;i&&this.pushClipPath(e);const n=r.execute(e,s,this.geomUnitsPerPoint(),this._resourceManager.geometryEngine);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}i&&this.popClipPath()}}else{const s=this._placementPool.acquire();if(c(e))s.tx=e.x,s.ty=e.y,this.drawMarker(t,s);else if(m(e))[s.tx,s.ty]=l(e),this.drawMarker(t,s);else for(const r of e.points)if(s.tx=r[0],s.ty=r[1],this.drawMarker(t,s),this._earlyReturn)break;this._placementPool.release(s)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=t.size??10;if(s(r)||i<=0)return;const n=r.width,o=r.height;if(!n||!o)return;const a=n/o,h=t.scaleX??1,l=z.createIdentity(),c=t.anchorPoint;if(c){let e=c.x,s=c.y;"Absolute"!==t.anchorPointUnits&&(e*=i*a*h,s*=i),l.translate(-e,-s)}let m=t.rotation??0;t.rotateClockwise&&(m=-m),this._mapRotation&&(m+=this._mapRotation),m&&l.rotate(m*I);let f=t.offsetX??0,u=t.offsetY??0;if(f||u){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),r=f*s+u*e;f=f*e-u*s,u=r}l.translate(f,u)}const _=this.geomUnitsPerPoint();1!==_&&l.scale(_,_);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t.url,i,t.scaleX),this.pop()}drawVectorMarker(t,e){if(!t)return;const s=t.markerGraphics;if(!s)return;const r=t.size??10,i=t.frame,n=i?i.ymax-i.ymin:0,o=r&&n?r/n:1,a=z.createIdentity();i&&a.translate(.5*-(i.xmax+i.xmin),.5*-(i.ymax+i.ymin));const h=t.anchorPoint;if(h){let e=h.x,s=h.y;"Absolute"!==t.anchorPointUnits?i&&(e*=i.xmax-i.xmin,s*=i.ymax-i.ymin):(e/=o,s/=o),a.translate(-e,-s)}1!==o&&a.scale(o,o);let l=t.rotation??0;t.rotateClockwise&&(l=-l),this._mapRotation&&(l+=this._mapRotation),l&&a.rotate(l*I);let c=t.offsetX??0,m=t.offsetY??0;if(c||m){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),r=c*s+m*e;c=c*e-m*s,m=r}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const _ of s)if(_&&_.symbol&&_.geometry||L.error("Invalid marker graphic",_),this.drawSymbol(_.symbol,_.geometry),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e){if(!t)return;if(!c(e))return;if((t.height??10)<=0)return;const s=z.createIdentity();let r=t.angle??0;r=-r,r&&s.rotate(r*I);const i=t.offsetX??0,n=t.offsetY??0;(i||n)&&s.translate(i,n);const o=this.geomUnitsPerPoint();1!==o&&s.scale(o,o),s.translate(e.x,e.y),this.push(s,!1),this.drawText(t),this.pop()}_buildHatchPolyline(t,e,s){let r=(void 0!==t.separation?t.separation:4)*s,i=void 0!==t.rotation?t.rotation:0;if(0===r)return null;r<0&&(r=-r);let n=0;const a=.5*r;for(;n>a;)n-=r;for(;n<-a;)n+=r;const l=o();h(l,e),l[0]-=a,l[1]-=a,l[2]+=a,l[3]+=a;const c=[[l[0],l[1]],[l[0],l[3]],[l[2],l[3]],[l[2],l[1]]];for(;i>180;)i-=180;for(;i<0;)i+=180;const m=Math.cos(i*I),f=Math.sin(i*I),u=-r*f,_=r*m;let d,p,y,g;n=(void 0!==t.offsetX?t.offsetX*s:0)*f-(void 0!==t.offsetY?t.offsetY*s:0)*m,d=y=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const o of c){const t=o[0],e=o[1],s=m*t+f*e,r=-f*t+m*e;d=Math.min(d,s),y=Math.min(y,r),p=Math.max(p,s),g=Math.max(g,r)}y=Math.floor(y/r)*r;let x=m*d-f*y-u*n/r,P=f*d+m*y-_*n/r,w=m*p-f*y-u*n/r,M=f*p+m*y-_*n/r;const b=1+Math.round((g-y)/r),S=[];for(let o=0;o<b;o++)x+=u,P+=_,w+=u,M+=_,S.push([[x,P],[w,M]]);return{paths:S}}}class U extends F{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new M(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return a(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(m(t))this._processPath(t.rings,0);else if(f(t))this._processPath(t.paths,0);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,s){if(!t||this._clipCount>0)return;const r=.5*this.transformSize(s);if(m(t))this._processPath(t.rings,r);else if(f(t))this._processPath(t.paths,r);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,r)}else console.error("drawSolidStroke unexpected geometry type!")}pushClipPath(t){this.drawSolidFill(t),++this._clipCount}popClipPath(){--this._clipCount}drawImage(t,e,s){let i=s*e,n=e;const o=this._resourceManager.getResource(t);!e&&r(o)&&(i=s*o.width,n=o.height),this._merge(this.transformPt([-i/2,-n/2]),0),this._merge(this.transformPt([-i/2,n/2]),0),this._merge(this.transformPt([i/2,-n/2]),0),this._merge(this.transformPt([i/2,n/2]),0)}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_processPath(t,e){if(t)for(const s of t){const t=s?s.length:0;if(t>1){this._merge(this.transformPt(s[0]),e);for(let r=1;r<t;++r)this._merge(this.transformPt(s[r]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class j extends F{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0}hitTest(t,e,s,r,i,o){const a=o*n(1);this.setTransform(),this.setGeomUnitsPerPoint(a),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/a,this._textInfo=r;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);return this._mapRotation=h?i:0,this._earlyReturn=!1,this.drawSymbol(e,s),this._earlyReturn}drawSolidFill(t,e){this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,s,r,i,n){this._hitTestStroke(t,s)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e,r){const i=this._resourceManager.getResource(t);if(s(i)||0===i.height||0===e)return;const n=e*this.geomUnitsPerPoint(),o=n*r*(i.width/i.height),a=this.reverseTransformPt(this._searchPoint),h=this._searchDistPoint;Math.abs(a[0])<o/2+h&&Math.abs(a[1])<n/2+h&&(this._earlyReturn=!0)}drawText(e){const s=this._textInfo;if(!s)return;const r=s.get(e);if(!r)return;const{text:i,mosaicItem:n}=r;if(!n||0===n.glyphMosaicItems.length)return;const o=e.height??v,a=B(e.lineGapType,e.lineGap??0,o),h=t(i)[1],l=n.glyphMosaicItems,c=R(l,h,{scale:o/C,angle:0,xOffset:0,yOffset:0,hAlign:E(e.horizontalAlignment),vAlign:H(e.verticalAlignment),maxLineWidth:512,lineHeight:T*Math.max(.25,Math.min(a||1,4)),decoration:e.font.decoration||"none",isCIM:!0}),m=this.reverseTransformPt(this._searchPoint),f=m[0],u=m[1];for(const t of c.glyphs)if(f>t.xTopLeft&&f<t.xBottomRight&&u>-t.yBottomRight&&u<-t.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(u(t)){const s=t;e=[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]]}else if(m(t))e=t.rings;else{if(!f(t))return;e=t.paths}const s=this.reverseTransformPt(this._searchPoint);if(this._pointInPolygon(s,e)&&(this._earlyReturn=!0),!this._earlyReturn){const t=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(s,e,t)&&(this._earlyReturn=!0)}}_hitTestStroke(t,e){let s=null;if(u(t)){const e=t;s=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(m(t))s=t.rings;else{if(!f(t))return;s=t.paths}const r=this.reverseTransformPt(this._searchPoint),i=e*this.geomUnitsPerPoint(),n=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(r,s,i/2+n)&&(this._earlyReturn=!0)}_pointInPolygon(t,e){let s=0;for(const r of e){const e=r.length;for(let i=1;i<e;++i){const e=r[i-1],n=r[i];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?s++:s--}}return 0!==s}_nearLine(t,e,s){for(const r of e){const e=r.length;for(let i=1;i<e;++i){const e=r[i-1],n=r[i];let o=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===o)continue;o=Math.sqrt(o);const a=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/o;if(Math.abs(a)<s){const r=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/o;if(r>-s&&r<o+s)return!0}}}return!1}}class A extends F{constructor(t,e,s){super(e,s),this._ctx=t}drawSolidFill(t,e){if(!t)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else if(u(t))this._buildPath(G(t).rings,!0);else{if(!_(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const s=this._ctx;s.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",s.fill("evenodd")}drawSolidStroke(t,e,s,r,i,n){if(!t||!e||0===s)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!1);else{if(!u(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(G(t).rings,!0)}const o=this._ctx;o.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",o.lineWidth=this.transformSize(s)+.5,this._setCapStyle(r),this._setJoinStyle(i),o.miterLimit=n,o.stroke()}pushClipPath(t){if(this._ctx.save(),m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else{if(!u(t))return;this._buildPath(G(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e,r){const i=this._resourceManager.getResource(t);if(s(i))return;let n=e*(i.width/i.height),o=e;e||(n=i.width,o=i.height);const a=this.transformPt([0,0]),[h,l]=this.getTransformAngle(),c=this.transformSize(1);this._ctx.save(),this._ctx.setTransform({m11:r*c*h,m12:r*c*l,m21:-c*l,m22:c*h,m41:a[0],m42:a[1]}),this._ctx.drawImage(i,0,0,i.width,i.height,-n/2,-o/2,n,o),this._ctx.restore()}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_buildPath(t,e){const s=this._ctx;if(s.beginPath(),t)for(const r of t){const t=r?r.length:0;if(t>1){let i=this.transformPt(r[0]);s.moveTo(i[0],i[1]);for(let e=1;e<t;++e)i=this.transformPt(r[e]),s.lineTo(i[0],i[1]);e&&s.closePath()}}}_setCapStyle(t){switch(t){case P.Butt:this._ctx.lineCap="butt";break;case P.Round:this._ctx.lineCap="round";break;case P.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case w.Bevel:this._ctx.lineJoin="bevel";break;case w.Round:this._ctx.lineJoin="round";break;case w.Miter:this._ctx.lineJoin="miter"}}}const G=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,E=t=>{switch(t){case"Left":return S.Left;case"Right":return S.Right;case"Center":return S.Center;case"Justify":return L.warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),S.Center}},H=t=>{switch(t){case"Top":return k.Top;case"Center":return k.Center;case"Bottom":return k.Bottom;case"Baseline":return k.Baseline}},B=(t,e,s)=>{switch(t){case"ExtraLeading":return 1+e/s;case"Multiple":return e;case"Exact":return e/s}};export{F as CIMSymbolDrawHelper,I as C_DEG_TO_RAD,A as CanvasDrawHelper,U as EnvDrawHelper,j as HittestDrawHelper,z as Transformation,E as horizontalAlignment2HAlign,B as lineGapType2LineHeight,H as verticalAlignment2VAlign};
5
+ import{bidiText as t}from"../../core/BidiText.js";import e from"../../core/Logger.js";import{isNone as s,isSome as i}from"../../core/maybe.js";import r from"../../core/ObjectPool.js";import{pt2px as n}from"../../core/screenUtils.js";import{create as o,fromValues as a}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as h}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as l}from"../../geometry/support/centroid.js";import{isPoint as c,isPolygon as m,isPolyline as f,isExtent as u,isMultipoint as _}from"../../geometry/support/jsonUtils.js";import{SimpleGeometryCursor as d}from"./CIMEffects.js";import{getEffectOperator as p,getPlacementOperator as y}from"./CIMOperators.js";import{Placement as g}from"./CIMPlacements.js";import x from"./CIMResourceManager.js";import{LineCapStyle as P,LineJoinStyle as w}from"./enums.js";import M from"./Rect.js";import b from"./TextRasterizer.js";import{HAlign as S,VAlign as k}from"../../views/2d/engine/webgl/alignmentUtils.js";import{GLYPH_SIZE as C,MAGIC_LABEL_LINE_HEIGHT as T}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as R}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";const I=Math.PI/180,v=10,L=e.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class z{constructor(t){this._t=t}static createIdentity(){return new z([1,0,0,0,1,0])}clone(){const t=this._t;return new z(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new z([t,0,0,0,e,0])}scale(t,e){const s=this._t;return s[0]*=t,s[1]*=t,s[2]*=t,s[3]*=e,s[4]*=e,s[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new z([0,0,t,0,0,e])}translate(t,e){const s=this._t;return s[2]+=t,s[5]+=e,this}static createRotate(t){const e=Math.cos(t),s=Math.sin(t);return new z([e,-s,0,s,e,0])}rotate(t){return z.multiply(this,z.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],s=Math.sqrt(t*t+e*e);return[t/s,e/s]}static multiply(t,e,s){const i=t._t,r=e._t,n=i[0]*r[0]+i[3]*r[1],o=i[1]*r[0]+i[4]*r[1],a=i[2]*r[0]+i[5]*r[1]+r[2],h=i[0]*r[3]+i[3]*r[4],l=i[1]*r[3]+i[4]*r[4],c=i[2]*r[3]+i[5]*r[4]+r[5],m=s._t;return m[0]=n,m[1]=o,m[2]=a,m[3]=h,m[4]=l,m[5]=c,s}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new z([0,0,0,0,0,0]);e=1/e;const s=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,r=t[4]*e,n=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new z([r,n,s,o,a,i])}}class F{constructor(t,e){this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new r(g,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._resourceManager=t||new x,this._transfos.push(e||z.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||z.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const s=e?t.scaleRatio():1;z.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*s)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e)}}drawMultiLayerSymbol(t,e){if(!t)return;const s=t.symbolLayers;if(!s)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(s,e),e=t.next()}}else this.drawSymbolLayers(s,e)}executeEffects(t,e){const s=this._resourceManager.geometryEngine;let i=new d(e);for(const r of t){const t=p(r);t&&(i=t.execute(i,r,this.geomUnitsPerPoint(),s))}return i}drawSymbolLayers(t,e){let s=t.length;for(;s--;){const i=t[s];if(!i||!1===i.enable)continue;const r=i.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const s=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());s&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,s),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const s=t.markerPlacement;if(s){const i=y(s);if(i){const r="CIMMarkerPlacementInsidePolygon"===s.type;r&&this.pushClipPath(e);const n=i.execute(e,s,this.geomUnitsPerPoint(),this._resourceManager.geometryEngine);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}r&&this.popClipPath()}}else{const s=this._placementPool.acquire();if(c(e))s.tx=e.x,s.ty=e.y,this.drawMarker(t,s);else if(m(e))[s.tx,s.ty]=l(e),this.drawMarker(t,s);else for(const i of e.points)if(s.tx=i[0],s.ty=i[1],this.drawMarker(t,s),this._earlyReturn)break;this._placementPool.release(s)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),r=t.size??10;if(s(i)||r<=0)return;const n=i.width,o=i.height;if(!n||!o)return;const a=n/o,h=t.scaleX??1,l=z.createIdentity(),c=t.anchorPoint;if(c){let e=c.x,s=c.y;"Absolute"!==t.anchorPointUnits&&(e*=r*a*h,s*=r),l.translate(-e,-s)}let m=t.rotation??0;t.rotateClockwise&&(m=-m),this._mapRotation&&(m+=this._mapRotation),m&&l.rotate(m*I);let f=t.offsetX??0,u=t.offsetY??0;if(f||u){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=f*s+u*e;f=f*e-u*s,u=i}l.translate(f,u)}const _=this.geomUnitsPerPoint();1!==_&&l.scale(_,_);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t.url,r,t.scaleX),this.pop()}drawVectorMarker(t,e){if(!t)return;const s=t.markerGraphics;if(!s)return;const i=t.size??10,r=t.frame,n=r?r.ymax-r.ymin:0,o=i&&n?i/n:1,a=z.createIdentity();r&&a.translate(.5*-(r.xmax+r.xmin),.5*-(r.ymax+r.ymin));const h=t.anchorPoint;if(h){let e=h.x,s=h.y;"Absolute"!==t.anchorPointUnits?r&&(e*=r.xmax-r.xmin,s*=r.ymax-r.ymin):(e/=o,s/=o),a.translate(-e,-s)}1!==o&&a.scale(o,o);let l=t.rotation??0;t.rotateClockwise&&(l=-l),this._mapRotation&&(l+=this._mapRotation),l&&a.rotate(l*I);let c=t.offsetX??0,m=t.offsetY??0;if(c||m){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=c*s+m*e;c=c*e-m*s,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const _ of s)if(_&&_.symbol&&_.geometry||L.error("Invalid marker graphic",_),this.drawSymbol(_.symbol,_.geometry),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e){if(!t)return;if(!c(e))return;if((t.height??10)<=0)return;const s=z.createIdentity();let i=t.angle??0;i=-i,i&&s.rotate(i*I);const r=t.offsetX??0,n=t.offsetY??0;(r||n)&&s.translate(r,n);const o=this.geomUnitsPerPoint();1!==o&&s.scale(o,o),s.translate(e.x,e.y),this.push(s,!1),this.drawText(t),this.pop()}_buildHatchPolyline(t,e,s){let i=(void 0!==t.separation?t.separation:4)*s,r=void 0!==t.rotation?t.rotation:0;if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const l=o();h(l,e),l[0]-=a,l[1]-=a,l[2]+=a,l[3]+=a;const c=[[l[0],l[1]],[l[0],l[3]],[l[2],l[3]],[l[2],l[1]]];for(;r>180;)r-=180;for(;r<0;)r+=180;const m=Math.cos(r*I),f=Math.sin(r*I),u=-i*f,_=i*m;let d,p,y,g;n=(void 0!==t.offsetX?t.offsetX*s:0)*f-(void 0!==t.offsetY?t.offsetY*s:0)*m,d=y=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const o of c){const t=o[0],e=o[1],s=m*t+f*e,i=-f*t+m*e;d=Math.min(d,s),y=Math.min(y,i),p=Math.max(p,s),g=Math.max(g,i)}y=Math.floor(y/i)*i;let x=m*d-f*y-u*n/i,P=f*d+m*y-_*n/i,w=m*p-f*y-u*n/i,M=f*p+m*y-_*n/i;const b=1+Math.round((g-y)/i),S=[];for(let o=0;o<b;o++)x+=u,P+=_,w+=u,M+=_,S.push([[x,P],[w,M]]);return{paths:S}}}class U extends F{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new M(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return a(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(m(t))this._processPath(t.rings,0);else if(f(t))this._processPath(t.paths,0);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,s){if(!t||this._clipCount>0)return;const i=.5*this.transformSize(s);if(m(t))this._processPath(t.rings,i);else if(f(t))this._processPath(t.paths,i);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}pushClipPath(t){this.drawSolidFill(t),++this._clipCount}popClipPath(){--this._clipCount}drawImage(t,e,s){let r=s*e,n=e;const o=this._resourceManager.getResource(t);!e&&i(o)&&(r=s*o.width,n=o.height),this._merge(this.transformPt([-r/2,-n/2]),0),this._merge(this.transformPt([-r/2,n/2]),0),this._merge(this.transformPt([r/2,-n/2]),0),this._merge(this.transformPt([r/2,n/2]),0)}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_processPath(t,e){if(t)for(const s of t){const t=s?s.length:0;if(t>1){this._merge(this.transformPt(s[0]),e);for(let i=1;i<t;++i)this._merge(this.transformPt(s[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class j extends F{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0}hitTest(t,e,s,i,r,o){const a=o*n(1);this.setTransform(),this.setGeomUnitsPerPoint(a),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/a,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);return this._mapRotation=h?r:0,this._earlyReturn=!1,this.drawSymbol(e,s),this._earlyReturn}drawSolidFill(t,e){this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,s,i,r,n){this._hitTestStroke(t,s)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r)||0===r.height||0===e)return;const n=e*this.geomUnitsPerPoint(),o=n*i*(r.width/r.height),a=this.reverseTransformPt(this._searchPoint),h=this._searchDistPoint;Math.abs(a[0])<o/2+h&&Math.abs(a[1])<n/2+h&&(this._earlyReturn=!0)}drawText(e){const s=this._textInfo;if(!s)return;const i=s.get(e);if(!i)return;const{text:r,mosaicItem:n}=i;if(!n||0===n.glyphMosaicItems.length)return;const o=e.height??v,a=B(e.lineGapType,e.lineGap??0,o),h=t(r)[1],l=n.glyphMosaicItems,c=R(l,h,{scale:o/C,angle:0,xOffset:0,yOffset:0,hAlign:E(e.horizontalAlignment),vAlign:H(e.verticalAlignment),maxLineWidth:512,lineHeight:T*Math.max(.25,Math.min(a||1,4)),decoration:e.font.decoration||"none",isCIM:!0}),m=this.reverseTransformPt(this._searchPoint),f=m[0],u=m[1];for(const t of c.glyphs)if(f>t.xTopLeft&&f<t.xBottomRight&&u>-t.yBottomRight&&u<-t.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(u(t)){const s=t;e=[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]]}else if(m(t))e=t.rings;else{if(!f(t))return;e=t.paths}const s=this.reverseTransformPt(this._searchPoint);if(this._pointInPolygon(s,e)&&(this._earlyReturn=!0),!this._earlyReturn){const t=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(s,e,t)&&(this._earlyReturn=!0)}}_hitTestStroke(t,e){let s=null;if(u(t)){const e=t;s=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(m(t))s=t.rings;else{if(!f(t))return;s=t.paths}const i=this.reverseTransformPt(this._searchPoint),r=e*this.geomUnitsPerPoint(),n=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(i,s,r/2+n)&&(this._earlyReturn=!0)}_pointInPolygon(t,e){let s=0;for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?s++:s--}}return 0!==s}_nearLine(t,e,s){for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];let o=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===o)continue;o=Math.sqrt(o);const a=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/o;if(Math.abs(a)<s){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/o;if(i>-s&&i<o+s)return!0}}}return!1}}class A extends F{constructor(t,e,s){super(e,s),this._ctx=t}drawSolidFill(t,e){if(!t)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else if(u(t))this._buildPath(G(t).rings,!0);else{if(!_(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const s=this._ctx;s.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",s.fill("evenodd")}drawSolidStroke(t,e,s,i,r,n){if(!t||!e||0===s)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!1);else{if(!u(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(G(t).rings,!0)}const o=this._ctx;o.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",o.lineWidth=this.transformSize(s)+.5,this._setCapStyle(i),this._setJoinStyle(r),o.miterLimit=n,o.stroke()}pushClipPath(t){if(this._ctx.save(),m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else{if(!u(t))return;this._buildPath(G(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r))return;let n=e*(r.width/r.height),o=e;e||(n=r.width,o=r.height);const a=this.transformPt([0,0]),[h,l]=this.getTransformAngle(),c=this.transformSize(1);this._ctx.save(),this._ctx.setTransform({m11:i*c*h,m12:i*c*l,m21:-c*l,m22:c*h,m41:a[0],m42:a[1]}),this._ctx.drawImage(r,0,0,r.width,r.height,-n/2,-o/2,n,o),this._ctx.restore()}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_buildPath(t,e){const s=this._ctx;if(s.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let r=this.transformPt(i[0]);s.moveTo(r[0],r[1]);for(let e=1;e<t;++e)r=this.transformPt(i[e]),s.lineTo(r[0],r[1]);e&&s.closePath()}}}_setCapStyle(t){switch(t){case P.Butt:this._ctx.lineCap="butt";break;case P.Round:this._ctx.lineCap="round";break;case P.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case w.Bevel:this._ctx.lineJoin="bevel";break;case w.Round:this._ctx.lineJoin="round";break;case w.Miter:this._ctx.lineJoin="miter"}}}const G=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,E=t=>{switch(t){case"Left":return S.Left;case"Right":return S.Right;case"Center":return S.Center;case"Justify":return L.warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),S.Center}},H=t=>{switch(t){case"Top":return k.Top;case"Center":return k.Center;case"Bottom":return k.Bottom;case"Baseline":return k.Baseline}},B=(t,e,s)=>{switch(t){case"ExtraLeading":return 1+e/s;case"Multiple":return e;case"Exact":return e/s}};export{F as CIMSymbolDrawHelper,I as C_DEG_TO_RAD,A as CanvasDrawHelper,U as EnvDrawHelper,j as HittestDrawHelper,z as Transformation,E as horizontalAlignment2HAlign,B as lineGapType2LineHeight,H as verticalAlignment2VAlign};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import t from"../../request.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{pt2px as a}from"../../core/screenUtils.js";import{numericHash as i}from"../../core/string.js";import{getJsonType as s,isPolygon as o,isPolyline as n}from"../../geometry/support/jsonUtils.js";import{analyzeCIMSymbol as c,analyzeCIMResource as l}from"./cimAnalyzer.js";import m from"./CIMResourceManager.js";import h from"./Rasterizer.js";import f from"./TextRasterizer.js";import{createLabelOverrideFunction as g,evaluateValueOrFunction as u,colorToArray as y}from"./utils.js";import{scaleCIMMarker as p}from"../support/cimSymbolUtils.js";import{Symbol3DAnchorPosition2D as d}from"../support/Symbol3DAnchorPosition2D.js";var M;!function(e){e.Legend="legend",e.Preview="preview"}(M||(M={}));const C=(e,t,r)=>{if(e&&e.targetSize){let i;if(r){const t=Math.max(r.frame.xmax-r.frame.xmin,r.frame.ymax-r.frame.ymin);i=e.targetSize/a(t)}else i=e.targetSize/t.referenceSize;return i}return e&&e.scaleFactor?e.scaleFactor:1},I={fill:{legend:{frame:{xmax:15,xmin:0,ymax:15,ymin:0},geometry:{rings:[[[0,15],[15,7.5],[15,0],[0,0],[0,15]]]},canvasPaths:{rings:[[[0,15],[0,0],[15,7.5],[15,15],[0,15]]]}},preview:{frame:{xmax:100,xmin:0,ymax:100,ymin:0},geometry:{rings:[[[0,100],[100,100],[100,0],[0,0],[0,100]]]},canvasPaths:{rings:[[[0,100],[0,0],[100,0],[100,100],[0,100]]]}}},stroke:{legend:{frame:{xmax:24,xmin:0,ymax:2,ymin:-2},geometry:{paths:[[[0,0],[12,0],[24,0]]]},canvasPaths:{paths:[[[0,2],[12,2],[24,2]]]}},preview:{frame:{xmax:100,xmin:0,ymax:2,ymin:-2},geometry:{paths:[[[0,0],[50,0],[100,0]]]},canvasPaths:{paths:[[[0,2],[50,2],[100,2]]]}}}};class z{constructor(e,t){this._spatialReference=e,this._avoidSDF=t,this._resourceCache=new Map,this._pictureMarkerCache=new Map,this._textRasterizer=new f,this._cimResourceManager=new m,this._rasterizer=new h(this._cimResourceManager)}async rasterizeCIMSymbolAsync(e,t,r,a,i,o,n,c){a=a||(t?null!=t.centroid?"esriGeometryPolygon":s(t.geometry):null)||x(e);const l=await this.analyzeCIMSymbol(e,t?P(t.attributes):null,r,a,c);return this.rasterizeCIMSymbol(l,t,a,i,o,n)}async analyzeCIMSymbol(e,t,a,i,s){const o=[],n=t?{geometryType:i,spatialReference:this._spatialReference,fields:t}:null;let l;await c(e.data,n,this._cimResourceManager,o,this._avoidSDF),r(s);for(const r of o)"CIMPictureMarker"!==r.cim.type&&"CIMPictureFill"!==r.cim.type&&"CIMPictureStroke"!==r.cim.type||(l||(l=[]),l.push(this._fetchPictureMarkerResource(r,s))),a&&"text"===r.type&&"string"==typeof r.text&&r.text.includes("[")&&(r.text=g(a,r.text,r.cim.textCase));return l&&await Promise.all(l),o}async _fetchPictureMarkerResource(e,r){const a=e.materialHash;if(!this._pictureMarkerCache.get(a)){const i=(await t(e.cim.url,{responseType:"image",signal:r&&r.signal})).data;this._pictureMarkerCache.set(a,i)}}rasterizeCIMSymbol(e,t,r,a,i,s){const o=[];for(const n of e){a&&"function"==typeof a.scaleFactor&&(a.scaleFactor=a.scaleFactor(t,i,s));const e=this._getRasterizedResource(n,t,r,a,i,s);if(!e)continue;let c=0,l=e.anchorX||0,m=e.anchorY||0,h=!1,f=0,g=0;if("esriGeometryPoint"===r){const e=C(a,n,null);if(f=u(n.offsetX,t,i,s)*e||0,g=u(n.offsetY,t,i,s)*e||0,"marker"===n.type)c=u(n.rotation,t,i,s)||0,h=!!n.rotateClockwise&&n.rotateClockwise;else if("text"===n.type){if(c=u(n.angle,t,i,s)||0,void 0!==n.horizontalAlignment)switch(n.horizontalAlignment){case"left":l=-.5;break;case"right":l=.5;break;default:l=0}if(void 0!==n.verticalAlignment)switch(n.verticalAlignment){case"top":m=.5;break;case"bottom":m=-.5;break;case"baseline":m=-.25;break;default:m=0}}}null!=e&&o.push({angle:c,rotateClockWise:h,anchorX:l,anchorY:m,offsetX:f,offsetY:g,rasterizedResource:e})}return this.getSymbolImage(o)}getSymbolImage(e){const t=document.createElement("canvas"),r=t.getContext("2d");let i=0,s=0,o=0,n=0;const c=[];for(let f=0;f<e.length;f++){const t=e[f],l=t.rasterizedResource;if(!l)continue;const m=l.size,h=t.offsetX,g=t.offsetY,u=t.anchorX,y=t.anchorY,p=t.rotateClockWise||!1;let d=t.angle,M=a(h)-m[0]*(.5+u),C=a(g)-m[1]*(.5+y),I=M+m[0],z=C+m[1];if(d){p&&(d=-d);const e=Math.sin(d*Math.PI/180),t=Math.cos(d*Math.PI/180),r=M*t-C*e,a=M*e+C*t,i=M*t-z*e,s=M*e+z*t,o=I*t-z*e,n=I*e+z*t,c=I*t-C*e,l=I*e+C*t;M=Math.min(r,i,o,c),C=Math.min(a,s,n,l),I=Math.max(r,i,o,c),z=Math.max(a,s,n,l)}i=M<i?M:i,s=C<s?C:s,o=I>o?I:o,n=z>n?z:n;const P=r.createImageData(l.size[0],l.size[1]);P.data.set(new Uint8ClampedArray(l.image.buffer));const x={offsetX:h,offsetY:g,rotateClockwise:p,angle:d,rasterizedImage:P,anchorX:u,anchorY:y};c.push(x)}t.width=o-i,t.height=n-s;const l=-i,m=n;for(let f=0;f<c.length;f++){const e=c[f],t=this._imageDataToCanvas(e.rasterizedImage),i=e.rasterizedImage.width,s=e.rasterizedImage.height,o=l-i*(.5+e.anchorX),n=m-s*(.5-e.anchorY);if(e.angle){const i=(360-e.angle)*Math.PI/180;r.save(),r.translate(a(e.offsetX),-a(e.offsetY)),r.translate(l,m),r.rotate(i),r.translate(-l,-m),r.drawImage(t,o,n),r.restore()}else r.drawImage(t,o+a(e.offsetX),n-a(e.offsetY))}const h=new d({x:l/t.width-.5,y:m/t.height-.5});return{imageData:0!==t.width&&0!==t.height?r.getImageData(0,0,t.width,t.height):r.createImageData(1,1),anchorPosition:h}}_imageDataToCanvas(e){this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas"));const t=this._imageDataCanvas,r=t.getContext("2d");return t.width=e.width,t.height=e.height,r.putImageData(e,0,0),t}_imageTo32Array(t,r,a,i){this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas"));const s=this._imageDataCanvas,o=s.getContext("2d");if(s.width=r,s.height=a,o.drawImage(t,0,0,r,a),i){o.save();const s=new e(i);o.fillStyle=s.toHex(),o.globalCompositeOperation="multiply",o.fillRect(0,0,r,a),o.globalCompositeOperation="destination-atop",o.drawImage(t,0,0,r,a),o.restore()}return new Uint32Array(o.getImageData(0,0,r,a).data.buffer)}_getRasterizedResource(e,t,r,a,s,o){let n,c,l,m,h=null,f=null;if("esriGeometryPolyline"===r||"esriGeometryPolygon"===r){const m=a&&a.style?a.style:M.Legend,g="esriGeometryPolyline"===r?I.stroke[m]:I.fill[m];if("line"===e.type){if("CIMSolidStroke"!==e.cim.type){if("CIMPictureStroke"===e.cim.type){const r=u(e.width,t,s,o),a=u(e.color,t,s,o),{image:i,width:n,height:c}=this._getPictureResource(e,r,a);return this._rasterizePictureResource(e,i,n,c,g,r)}return null}({analyzedCIM:n,hash:l}=w(e,t,s,o)),c=this._embedCIMLayerInVectorMarker(n,g)}else if("marker"===e.type){if("CIMPictureMarker"===e.cim.type){const r=u(e.size,t,s,o),a=u(e.color,t,s,o),{image:i,width:n,height:c}=this._getPictureResource(e,r,a);return this._rasterizePictureResource(e,i,n,c,g,r)}if("CIMVectorMarker"!==e.cim.type)return null;e.cim.offsetX=u(e.offsetX,t,s,o),e.cim.offsetY=u(e.offsetY,t,s,o),e.cim.rotation=u(e.rotation,t,s,o),e.cim.markerPlacement=e.markerPlacement,({analyzedCIM:n}=w(e,t,s,o)),l=i(JSON.stringify(n)).toString(),c=this._embedCIMLayerInVectorMarker(n,g),h=u(e.size,t,s,o),f=e.path}else{if("text"===e.type)return null;if("fill"===e.type){if("CIMHatchFill"===e.cim.type||"CIMVectorMarker"===e.cim.type||"CIMPictureMarker"===e.cim.type||"CIMPictureFill"===e.cim.type){const r=e.cim.size||e.cim.height;let a,i,c;if("CIMPictureMarker"===e.cim.type||"CIMPictureFill"===e.cim.type)({image:a,width:i,height:c}=this._getPictureResource(e,r,u(e.color,t,s,o)));else{({analyzedCIM:n,hash:l}=w(e,t,s,o));const m=this._rasterizer.rasterizeJSONResource({cim:n,type:e.type,url:e.url,mosaicHash:l,size:r,path:f},1,this._avoidSDF);a=m.image,i=m.size[0],c=m.size[1]}return this._rasterizePictureResource(e,a,i,c,g,null)}if("CIMSolidFill"!==e.cim.type)return null;({analyzedCIM:n,hash:l}=w(e,t,s,o)),c=this._embedCIMLayerInVectorMarker(n,g)}}}else{if("text"===e.type)return m=this._rasterizeTextResource(e,t,a,s,o),m;({analyzedCIM:n,hash:l}=w(e,t,s,o));const r=C(a,e,null);if("CIMPictureMarker"===e.cim.type){const a=u(e.size,t,s,o)*r,{image:i,width:n,height:c}=this._getPictureResource(e,a,u(e.color,t,s,o));return m={image:i,size:[n,c],sdf:!1,simplePattern:!1,anchorX:e.anchorPoint?e.anchorPoint.x:0,anchorY:e.anchorPoint?e.anchorPoint.y:0},m}p(n,r,{preserveOutlineWidth:!1}),c=n}l+=r,a&&(l+=JSON.stringify(a));const g=this._resourceCache;return g.has(l)?g.get(l):(m=this._rasterizer.rasterizeJSONResource({cim:c,type:e.type,url:e.url,mosaicHash:l,size:h,path:f},window.devicePixelRatio||1,this._avoidSDF),g.set(l,m),m)}_rasterizeTextResource(e,t,r,a,i){const s=C(r,e,null),o=u(e.text,t,a,i);if(!o||0===o.length)return null;const n=u(e.fontName,t,a,i),c=u(e.style,t,a,i),l=u(e.weight,t,a,i),m=u(e.decoration,t,a,i),h=u(e.size,t,a,i)*s,f=u(e.horizontalAlignment,t,a,i),g=u(e.verticalAlignment,t,a,i),p=y(u(e.color,t,a,i)),d=y(u(e.outlineColor,t,a,i)),M={color:p,size:h,horizontalAlignment:f,verticalAlignment:g,font:{family:n,style:c,weight:l,decoration:m},halo:{size:u(e.outlineSize,t,a,i)||0,color:d,style:c},pixelRatio:1,premultiplyColors:!this._avoidSDF};return this._textRasterizer.rasterizeText(o,M)}_rasterizePictureResource(e,t,r,i,s,c){const l=document.createElement("canvas"),m=l.getContext("2d");l.height=a(Math.max(s.frame.ymax-s.frame.ymin,c)),l.width=a(s.frame.xmax-s.frame.xmin);const h=m.createImageData(r,i);h.data.set(new Uint8ClampedArray(t.buffer));const f=this._imageDataToCanvas(h),g=m.createPattern(f,"repeat"),u=Math.cos((-e.cim.rotation||0)*Math.PI/180),y=Math.sin((-e.cim.rotation||0)*Math.PI/180);g.setTransform({m11:u,m12:y,m21:-y,m22:u,m41:a(e.cim.offsetX)||0,m42:a(e.cim.offsetY)||0});const p=s.canvasPaths;let d,M,C;o(p)?(d=p.rings,m.fillStyle=g,M=m.fill,C=["evenodd"]):n(p)&&(d=p.paths,m.strokeStyle=g,m.lineWidth=c,M=m.stroke,d[0][0][1]=l.height/2,d[0][1][1]=l.height/2),m.beginPath();for(const o of d){const e=o?o.length:0;if(e>1){let t=o[0];m.moveTo(a(t[0]),a(t[1]));for(let r=1;r<e;++r)t=o[r],m.lineTo(a(t[0]),a(t[1]));m.closePath()}}M.apply(m,C);const I=m.getImageData(0,0,l.width,l.height),z=new Uint8Array(I.data);return{size:[l.width,l.height],image:new Uint32Array(z.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0}}_getPictureResource(e,t,r){const i=this._pictureMarkerCache.get(e.materialHash);if(!i)return null;const s=i.height/i.width,o=t?s>1?a(t):a(t)/s:i.width,n=t?s>1?a(t)*s:a(t):i.height;return{image:this._imageTo32Array(i,o,n,r),width:o,height:n}}_embedCIMLayerInVectorMarker(e,t){const r=o(t.geometry)?"CIMPolygonSymbol":"CIMLineSymbol",a=t.frame;return{type:"CIMVectorMarker",frame:a,size:a.ymax-a.ymin,markerGraphics:[{type:"CIMMarkerGraphic",geometry:t.geometry,symbol:{type:r,symbolLayers:[e]}}]}}}function P(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}function x(e){if(!(e&&e.data&&e.data.symbol))return null;switch(e.data.symbol.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function w(e,t,r,a){let i,s;if("function"==typeof e.materialHash){i=(0,e.materialHash)(t,r,a),s=l(e.cim,e.materialOverrides)}else i=e.materialHash,s=e.cim;return{analyzedCIM:s,hash:i}}export{z as CIMSymbolRasterizer,M as GeometryStyle};
5
+ import e from"../../Color.js";import t from"../../request.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{pt2px as a}from"../../core/screenUtils.js";import{numericHash as i}from"../../core/string.js";import{getJsonType as s,isPolygon as o,isPolyline as n}from"../../geometry/support/jsonUtils.js";import{analyzeCIMSymbol as c,analyzeCIMResource as l}from"./cimAnalyzer.js";import m from"./CIMResourceManager.js";import h from"./Rasterizer.js";import f from"./TextRasterizer.js";import{createLabelOverrideFunction as g,evaluateValueOrFunction as u,colorToArray as y}from"./utils.js";import{scaleCIMMarker as p}from"../support/cimSymbolUtils.js";import{Symbol3DAnchorPosition2D as d}from"../support/Symbol3DAnchorPosition2D.js";var M;!function(e){e.Legend="legend",e.Preview="preview"}(M||(M={}));const C=(e,t,r)=>{if(e&&e.targetSize){let i;if(r){const t=Math.max(r.frame.xmax-r.frame.xmin,r.frame.ymax-r.frame.ymin);i=e.targetSize/a(t)}else i=e.targetSize/t.referenceSize;return i}return e&&e.scaleFactor?e.scaleFactor:1},I={fill:{legend:{frame:{xmax:15,xmin:0,ymax:15,ymin:0},geometry:{rings:[[[0,15],[15,7.5],[15,0],[0,0],[0,15]]]},canvasPaths:{rings:[[[0,15],[0,0],[15,7.5],[15,15],[0,15]]]}},preview:{frame:{xmax:100,xmin:0,ymax:100,ymin:0},geometry:{rings:[[[0,100],[100,100],[100,0],[0,0],[0,100]]]},canvasPaths:{rings:[[[0,100],[0,0],[100,0],[100,100],[0,100]]]}}},stroke:{legend:{frame:{xmax:24,xmin:0,ymax:2,ymin:-2},geometry:{paths:[[[0,0],[12,0],[24,0]]]},canvasPaths:{paths:[[[0,2],[12,2],[24,2]]]}},preview:{frame:{xmax:100,xmin:0,ymax:2,ymin:-2},geometry:{paths:[[[0,0],[50,0],[100,0]]]},canvasPaths:{paths:[[[0,2],[50,2],[100,2]]]}}}};class z{constructor(e,t){this._spatialReference=e,this._avoidSDF=t,this._resourceCache=new Map,this._pictureMarkerCache=new Map,this._textRasterizer=new f,this._cimResourceManager=new m,this._rasterizer=new h(this._cimResourceManager)}async rasterizeCIMSymbolAsync(e,t,r,a,i,o,n,c){a=a||(t?null!=t.centroid?"esriGeometryPolygon":s(t.geometry):null)||x(e);const l=await this.analyzeCIMSymbol(e,t?P(t.attributes):null,r,a,c);return this.rasterizeCIMSymbol(l,t,a,i,o,n)}async analyzeCIMSymbol(e,t,a,i,s){const o=[],n=t?{geometryType:i,spatialReference:this._spatialReference,fields:t}:null;let l;await c(e.data,n,this._cimResourceManager,o,this._avoidSDF),r(s);for(const r of o)"CIMPictureMarker"!==r.cim.type&&"CIMPictureFill"!==r.cim.type&&"CIMPictureStroke"!==r.cim.type||(l||(l=[]),l.push(this._fetchPictureMarkerResource(r,s))),a&&"text"===r.type&&"string"==typeof r.text&&r.text.includes("[")&&(r.text=g(a,r.text,r.cim.textCase));return l&&await Promise.all(l),o}async _fetchPictureMarkerResource(e,r){const a=e.materialHash;if(!this._pictureMarkerCache.get(a)){const i=(await t(e.cim.url,{responseType:"image",signal:r&&r.signal})).data;this._pictureMarkerCache.set(a,i)}}rasterizeCIMSymbol(e,t,r,a,i,s){const o=[];for(const n of e){a&&"function"==typeof a.scaleFactor&&(a.scaleFactor=a.scaleFactor(t,i,s));const e=this._getRasterizedResource(n,t,r,a,i,s);if(!e)continue;let c=0,l=e.anchorX||0,m=e.anchorY||0,h=!1,f=0,g=0;if("esriGeometryPoint"===r){const e=C(a,n,null);if(f=u(n.offsetX,t,i,s)*e||0,g=u(n.offsetY,t,i,s)*e||0,"marker"===n.type)c=u(n.rotation,t,i,s)||0,h=!!n.rotateClockwise&&n.rotateClockwise;else if("text"===n.type){if(c=u(n.angle,t,i,s)||0,void 0!==n.horizontalAlignment)switch(n.horizontalAlignment){case"left":l=-.5;break;case"right":l=.5;break;default:l=0}if(void 0!==n.verticalAlignment)switch(n.verticalAlignment){case"top":m=.5;break;case"bottom":m=-.5;break;case"baseline":m=-.25;break;default:m=0}}}null!=e&&o.push({angle:c,rotateClockWise:h,anchorX:l,anchorY:m,offsetX:f,offsetY:g,rasterizedResource:e})}return this.getSymbolImage(o)}getSymbolImage(e){const t=document.createElement("canvas"),r=t.getContext("2d");let i=0,s=0,o=0,n=0;const c=[];for(let f=0;f<e.length;f++){const t=e[f],l=t.rasterizedResource;if(!l)continue;const m=l.size,h=t.offsetX,g=t.offsetY,u=t.anchorX,y=t.anchorY,p=t.rotateClockWise||!1;let d=t.angle,M=a(h)-m[0]*(.5+u),C=a(g)-m[1]*(.5+y),I=M+m[0],z=C+m[1];if(d){p&&(d=-d);const e=Math.sin(d*Math.PI/180),t=Math.cos(d*Math.PI/180),r=M*t-C*e,a=M*e+C*t,i=M*t-z*e,s=M*e+z*t,o=I*t-z*e,n=I*e+z*t,c=I*t-C*e,l=I*e+C*t;M=Math.min(r,i,o,c),C=Math.min(a,s,n,l),I=Math.max(r,i,o,c),z=Math.max(a,s,n,l)}i=M<i?M:i,s=C<s?C:s,o=I>o?I:o,n=z>n?z:n;const P=r.createImageData(l.size[0],l.size[1]);P.data.set(new Uint8ClampedArray(l.image.buffer));const x={offsetX:h,offsetY:g,rotateClockwise:p,angle:d,rasterizedImage:P,anchorX:u,anchorY:y};c.push(x)}t.width=o-i,t.height=n-s;const l=-i,m=n;for(let f=0;f<c.length;f++){const e=c[f],t=this._imageDataToCanvas(e.rasterizedImage),i=e.rasterizedImage.width,s=e.rasterizedImage.height,o=l-i*(.5+e.anchorX),n=m-s*(.5-e.anchorY);if(e.angle){const i=(360-e.angle)*Math.PI/180;r.save(),r.translate(a(e.offsetX),-a(e.offsetY)),r.translate(l,m),r.rotate(i),r.translate(-l,-m),r.drawImage(t,o,n),r.restore()}else r.drawImage(t,o+a(e.offsetX),n-a(e.offsetY))}const h=new d({x:l/t.width-.5,y:m/t.height-.5});return{imageData:0!==t.width&&0!==t.height?r.getImageData(0,0,t.width,t.height):r.createImageData(1,1),anchorPosition:h}}_imageDataToCanvas(e){this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas"));const t=this._imageDataCanvas,r=t.getContext("2d");return t.width=e.width,t.height=e.height,r.putImageData(e,0,0),t}_imageTo32Array(t,r,a,i){this._imageDataCanvas||(this._imageDataCanvas=document.createElement("canvas"));const s=this._imageDataCanvas,o=s.getContext("2d");if(s.width=r,s.height=a,o.drawImage(t,0,0,r,a),i){o.save();const s=new e(i);o.fillStyle=s.toHex(),o.globalCompositeOperation="multiply",o.fillRect(0,0,r,a),o.globalCompositeOperation="destination-atop",o.drawImage(t,0,0,r,a),o.restore()}return new Uint32Array(o.getImageData(0,0,r,a).data.buffer)}_getRasterizedResource(e,t,r,a,s,o){let n,c,l,m,h=null,f=null;if("esriGeometryPolyline"===r||"esriGeometryPolygon"===r){const m=a&&a.style?a.style:M.Legend,g="esriGeometryPolyline"===r?I.stroke[m]:I.fill[m];if("line"===e.type){if("CIMSolidStroke"!==e.cim.type){if("CIMPictureStroke"===e.cim.type){const r=u(e.width,t,s,o),a=u(e.color,t,s,o),{image:i,width:n,height:c}=this._getPictureResource(e,r,a);return this._rasterizePictureResource(e,i,n,c,g,r)}return null}({analyzedCIM:n,hash:l}=w(e,t,s,o)),c=this._embedCIMLayerInVectorMarker(n,g)}else if("marker"===e.type){if("CIMPictureMarker"===e.cim.type){const r=u(e.size,t,s,o),a=u(e.color,t,s,o),{image:i,width:n,height:c}=this._getPictureResource(e,r,a);return this._rasterizePictureResource(e,i,n,c,g,r)}if("CIMVectorMarker"!==e.cim.type)return null;e.cim.offsetX=u(e.offsetX,t,s,o),e.cim.offsetY=u(e.offsetY,t,s,o),e.cim.rotation=u(e.rotation,t,s,o),e.cim.markerPlacement=e.markerPlacement,({analyzedCIM:n}=w(e,t,s,o)),l=i(JSON.stringify(n)).toString(),c=this._embedCIMLayerInVectorMarker(n,g),h=u(e.size,t,s,o),f=e.path}else{if("text"===e.type)return null;if("fill"===e.type){if("CIMHatchFill"===e.cim.type||"CIMVectorMarker"===e.cim.type||"CIMPictureMarker"===e.cim.type||"CIMPictureFill"===e.cim.type){const r=e.cim.size||e.cim.height;let a,i,c;if("CIMPictureMarker"===e.cim.type||"CIMPictureFill"===e.cim.type)({image:a,width:i,height:c}=this._getPictureResource(e,r,u(e.color,t,s,o)));else{({analyzedCIM:n,hash:l}=w(e,t,s,o));const m=this._rasterizer.rasterizeJSONResource({cim:n,type:e.type,url:e.url,mosaicHash:l,size:r,path:f},1,this._avoidSDF);a=m.image,i=m.size[0],c=m.size[1]}return this._rasterizePictureResource(e,a,i,c,g,null)}if("CIMSolidFill"!==e.cim.type)return null;({analyzedCIM:n,hash:l}=w(e,t,s,o)),c=this._embedCIMLayerInVectorMarker(n,g)}}}else{if("text"===e.type)return m=this._rasterizeTextResource(e,t,a,s,o),m;({analyzedCIM:n,hash:l}=w(e,t,s,o));const r=C(a,e,null);if("CIMPictureMarker"===e.cim.type){const a=u(e.size,t,s,o)*r,{image:i,width:n,height:c}=this._getPictureResource(e,a,u(e.color,t,s,o));return m={image:i,size:[n,c],sdf:!1,simplePattern:!1,anchorX:e.anchorPoint?e.anchorPoint.x:0,anchorY:e.anchorPoint?e.anchorPoint.y:0},m}p(n,r,{preserveOutlineWidth:!1}),c=n}l+=r,a&&(l+=JSON.stringify(a));const g=this._resourceCache;return g.has(l)?g.get(l):(m=this._rasterizer.rasterizeJSONResource({cim:c,type:e.type,url:e.url,mosaicHash:l,size:h,path:f},window.devicePixelRatio||1,this._avoidSDF),g.set(l,m),m)}_rasterizeTextResource(e,t,r,a,i){const s=C(r,e,null),o=u(e.text,t,a,i);if(!o||0===o.length)return null;const n=u(e.fontName,t,a,i),c=u(e.style,t,a,i),l=u(e.weight,t,a,i),m=u(e.decoration,t,a,i),h=u(e.size,t,a,i)*s,f=u(e.horizontalAlignment,t,a,i),g=u(e.verticalAlignment,t,a,i),p=y(u(e.color,t,a,i)),d=y(u(e.outlineColor,t,a,i)),M={color:p,size:h,horizontalAlignment:f,verticalAlignment:g,font:{family:n,style:c,weight:l,decoration:m},halo:{size:u(e.outlineSize,t,a,i)||0,color:d,style:c},pixelRatio:1,premultiplyColors:!this._avoidSDF};return this._textRasterizer.rasterizeText(o,M)}_rasterizePictureResource(e,t,r,i,s,c){const l=document.createElement("canvas"),m=l.getContext("2d");l.height=a(Math.max(s.frame.ymax-s.frame.ymin,c)),l.width=a(s.frame.xmax-s.frame.xmin);let h=-e.cim.rotation||0;"line"===e.type&&"CIMPictureStroke"===e.cim.type&&(h-=90);const f=m.createImageData(r,i);f.data.set(new Uint8ClampedArray(t.buffer));const g=this._imageDataToCanvas(f),u=m.createPattern(g,"repeat"),y=Math.cos(h*Math.PI/180),p=Math.sin(h*Math.PI/180);u.setTransform({m11:y,m12:p,m21:-p,m22:y,m41:a(e.cim.offsetX)||0,m42:a(e.cim.offsetY)||0});const d=s.canvasPaths;let M,C,I;o(d)?(M=d.rings,m.fillStyle=u,C=m.fill,I=["evenodd"]):n(d)&&(M=d.paths,m.strokeStyle=u,m.lineWidth=c,C=m.stroke,M[0][0][1]=l.height/2,M[0][1][1]=l.height/2),m.beginPath();for(const o of M){const e=o?o.length:0;if(e>1){let t=o[0];m.moveTo(a(t[0]),a(t[1]));for(let r=1;r<e;++r)t=o[r],m.lineTo(a(t[0]),a(t[1]));m.closePath()}}C.apply(m,I);const z=m.getImageData(0,0,l.width,l.height),P=new Uint8Array(z.data);return{size:[l.width,l.height],image:new Uint32Array(P.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0}}_getPictureResource(e,t,r){const i=this._pictureMarkerCache.get(e.materialHash);if(!i)return null;const s=i.height/i.width,o=t?s>1?a(t):a(t)/s:i.width,n=t?s>1?a(t)*s:a(t):i.height;return{image:this._imageTo32Array(i,o,n,r),width:o,height:n}}_embedCIMLayerInVectorMarker(e,t){const r=o(t.geometry)?"CIMPolygonSymbol":"CIMLineSymbol",a=t.frame;return{type:"CIMVectorMarker",frame:a,size:a.ymax-a.ymin,markerGraphics:[{type:"CIMMarkerGraphic",geometry:t.geometry,symbol:{type:r,symbolLayers:[e]}}]}}}function P(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}function x(e){if(!(e&&e.data&&e.data.symbol))return null;switch(e.data.symbol.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function w(e,t,r,a){let i,s;if("function"==typeof e.materialHash){i=(0,e.materialHash)(t,r,a),s=l(e.cim,e.materialOverrides)}else i=e.materialHash,s=e.cim;return{analyzedCIM:s,hash:i}}export{z as CIMSymbolRasterizer,M as GeometryStyle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as s}from"../../core/colorUtils.js";import"../../core/has.js";import r from"../../core/Error.js";import a from"../../core/Logger.js";import{isNone as o,isSome as n}from"../../core/maybe.js";import{eachAlways as l}from"../../core/promiseUtils.js";import{pt2px as i}from"../../core/screenUtils.js";import{defaultThematicColor as c,getPatternUrlWithColor as p,dekebabifyLineStyle as h}from"./gfxUtils.js";import{defaultPrimitive as u}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as m}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as f,adjustColorComponentBrightness as y,getPathSymbolShapes as d,shapes as b,getExtrudeSymbolShapes as v,getTetrahedronShapes as g,getDiamondShapes as k,getCylinderShapes as w,getCubeShapes as x,getInvertedConeShapes as M,getConeShapes as j,getWaterSymbolShapes as L}from"./previewUtils.js";import{renderSymbol as z,tintImageWithColor as S}from"./renderUtils.js";import{isVolumetricSymbol as P,getIconHref as U}from"./utils.js";import{resolveWebStyleSymbol as D}from"./webStyleSymbolUtils.js";const O=f.size,C=f.maxSize,I=f.maxOutlineSize,R=f.lineWidth,E=f.tallSymbolWidth;function Z(e){const t=e.outline,s=n(e.material)?e.material.color:null,r=n(s)?s.toHex():null;if(o(t)||"pattern"in t&&n(t.pattern)&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===r?{color:"#bdc3c7",width:.75}:null;const a=i(t.size)||0;return{color:"rgba("+(n(t.color)?t.color.toRgba():"255,255,255,1")+")",width:Math.min(a,I),style:"pattern"in t&&n(t.pattern)&&"style"===t.pattern.type?h(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}function q(t,s){const r=s&&s.resource,a=r&&r.href;if(t.thumbnail&&t.thumbnail.url)return Promise.resolve(t.thumbnail.url);if(a&&"object"!==s.type)return Promise.resolve(U(t,s));const o=e("esri/images/Legend/legend3dsymboldefault.png");return t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)?D(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((e=>e)).then((e=>e?.thumbnail?.url||o)):Promise.resolve(o)}function A(e,r=1){const a=e.a,o=t(e),n=o.h,l=o.s/r,i=100-(100-o.v)/r,{r:c,g:p,b:h}=s({h:n,s:l,v:i});return[c,p,h,a]}function H(e){return"water"===e.type?o(e.color)?null:e.color:o(e.material)||o(e.material.color)?null:e.material.color}function N(e,t=0){const s=H(e);if(!s){if("fill"===e.type)return null;const s=c.r,r=y(s,t);return[r,r,r,100]}const r=s.toRgba();for(let a=0;a<3;a++)r[a]=y(r[a],t);return r}async function T(t,s){const r=t.style;if("none"===r)return null;return{type:"pattern",x:0,y:0,src:await p(e(`esri/symbols/patterns/${r}.png`),s.toCss(!0)),width:5,height:5}}function W(e){return e.outline?Z(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function $(e,t){const s=H(e);if(!s)return null;let r="rgba(";return r+=y(s.r,t)+",",r+=y(s.g,t)+",",r+=y(s.b,t)+",",r+s.a+");"}function B(e,t){const s=$(e,t);if(!s)return{};if("pattern"in e&&n(e.pattern)&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:s,width:Math.min(e.size?i(e.size):.75,I),style:"pattern"in e&&n(e.pattern)&&"style"===e.pattern.type?h(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?i(2):e.join:null}}function F(e,t,s){const r=.75*s;return{type:"linear",x1:r?.25*r:0,y1:r?.5*r:0,x2:r||4,y2:r?.5*r:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function G(e){const t=e.depth,s=e.height,r=e.width;return r&&t&&s&&r===t&&r<s}function J(e,t,s){const r=[];if(!e)return r;switch(e.type){case"icon":{const s=0,a=0,o=t,n=t;switch(e.resource&&e.resource.primitive||u){case"circle":r.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:N(e,0),stroke:Z(e)});break;case"square":r.push({shape:{type:"path",path:[{command:"M",values:[s,n]},{command:"L",values:[s,a]},{command:"L",values:[o,a]},{command:"L",values:[o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)});break;case"triangle":r.push({shape:{type:"path",path:[{command:"M",values:[s,n]},{command:"L",values:[.5*o,a]},{command:"L",values:[o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)});break;case"cross":r.push({shape:{type:"path",path:[{command:"M",values:[.5*o,a]},{command:"L",values:[.5*o,n]},{command:"M",values:[s,.5*n]},{command:"L",values:[o,.5*n]}]},stroke:W(e)});break;case"x":r.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[o,n]},{command:"M",values:[o,a]},{command:"L",values:[s,n]}]},stroke:W(e)});break;case"kite":r.push({shape:{type:"path",path:[{command:"M",values:[s,.5*n]},{command:"L",values:[.5*o,a]},{command:"L",values:[o,.5*n]},{command:"L",values:[.5*o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)})}break}case"object":switch(e.resource&&e.resource.primitive||m){case"cone":{const a=F(N(e,0),N(e,-.6),s?E:t),o=j(t,s);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:a});break}case"inverted-cone":{const s=N(e,0),a=F(s,N(e,-.6),t),o=M(t);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:s});break}case"cube":{const a=x(t,s);r.push({shape:a[0],fill:N(e,0)}),r.push({shape:a[1],fill:N(e,-.3)}),r.push({shape:a[2],fill:N(e,-.5)});break}case"cylinder":{const a=F(N(e,0),N(e,-.6),s?E:t),o=w(t,s);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:a}),r.push({shape:o[2],fill:N(e,0)});break}case"diamond":{const s=k(t);r.push({shape:s[0],fill:N(e,-.3)}),r.push({shape:s[1],fill:N(e,0)}),r.push({shape:s[2],fill:N(e,-.3)}),r.push({shape:s[3],fill:N(e,-.7)});break}case"sphere":{const s=F(N(e,0),N(e,-.6));s.x1=0,s.y1=0,s.x2=.25*t,s.y2=.25*t,r.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:s});break}case"tetrahedron":{const s=g(t);r.push({shape:s[0],fill:N(e,-.3)}),r.push({shape:s[1],fill:N(e,0)}),r.push({shape:s[2],fill:N(e,-.6)});break}}break}return r}function K(e){const t="number"==typeof e?.size?e?.size:null;return t?i(t):null}function Q(e){return"icon"===e.type?"multiply":"tint"}function V(e,t){const s=K(t),r=t&&t.maxSize?i(t.maxSize):null,o=t&&t.disableUpsampling,n=e.symbolLayers,c=[];let p=0,h=0;const u=n.getItemAt(n.length-1);let m;return u&&"icon"===u.type&&(m=u.size&&i(u.size)),n.forEach((a=>{if("icon"!==a.type&&"object"!==a.type)return;const n="icon"===a.type?a.size&&i(a.size):0,l=s||n?Math.ceil(Math.min(s||n,r||C)):O;if(a&&a.resource&&a.resource.href){const t=q(e,a).then((e=>{const t=a.get("material.color"),s=Q(a);return S(e,l,t,s,o)})).then((e=>{const t=e.width,s=e.height;return p=Math.max(p,t),h=Math.max(h,s),[{shape:{type:"image",x:0,y:0,width:t,height:s,src:e.url},fill:null,stroke:null}]}));c.push(t)}else{let e=l;"icon"===a.type&&m&&s&&(e=l*(n/m));const r="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===a.type&&G(a);p=Math.max(p,r?E:e),h=Math.max(h,e),c.push(Promise.resolve(J(a,e,r)))}})),l(c).then((e=>{const s=[];return e.forEach((e=>{e.value?s.push(e.value):e.error&&a.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.error)})),z(s,[p,h],{node:t&&t.node,scale:!1,opacity:t&&t.opacity})}))}function X(e,t){const s=e.symbolLayers,r=[],a=P(e),n=K(t),l=(t&&t.maxSize?i(t.maxSize):null)||I;let c,p=0,h=0;return s.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const s=[];switch(e.type){case"line":{const r=B(e,0);if(o(r))break;const a=r&&r.width||0;0===t&&(c=a);const i=Math.min(n||a,l),u=0===t?i:n?i*(a/c):i,m=u>R/2?2*u:R;h=Math.max(h,u),p=Math.max(p,m),r.width=u,s.push({shape:{type:"path",path:[{command:"M",values:[0,.5*h]},{command:"L",values:[p,.5*h]}]},stroke:r});break}case"path":{const t=Math.min(n||O,l),r=N(e,0),a=N(e,-.2),o=$(e,-.4),i=o?{color:o,width:1}:{};if("quad"===e.profile){const t=e.width,o=e.height,n=d(t&&o?t/o:1,0===o,0===t),l={...i,join:"bevel"};s.push({shape:n[0],fill:a,stroke:l}),s.push({shape:n[1],fill:a,stroke:l}),s.push({shape:n[2],fill:r,stroke:l})}else s.push({shape:b.pathSymbol3DLayer[0],fill:a,stroke:i}),s.push({shape:b.pathSymbol3DLayer[1],fill:r,stroke:i});h=Math.max(h,t),p=h}}r.push(s)})),Promise.resolve(z(r,[p,h],{node:t&&t.node,scale:a,opacity:t&&t.opacity}))}async function Y(e,t){const s="mesh-3d"===e.type,r=e.symbolLayers,a=K(t),l=t&&t.maxSize?i(t.maxSize):null,c=a||O,p=[];let h=0,u=0,m=!1;for(let i=0;i<r.length;i++){const e=r.getItemAt(i),t=[];if(s&&"fill"!==e.type)continue;const a=b.fill[0];switch(e.type){case"fill":{const r=Z(e),o=Math.min(c,l||C);h=Math.max(h,o),u=Math.max(u,o),m=!0;let i=N(e,0);const p="pattern"in e&&e.pattern,f=H(e);!s&&n(p)&&"style"===p.type&&"solid"!==p.style&&f&&(i=await T(p,f)),t.push({shape:a,fill:i,stroke:r});break}case"line":{const s=B(e,0);if(o(s))break;const r={stroke:s,shape:a};h=Math.max(h,O),u=Math.max(u,O),t.push(r);break}case"extrude":{const s={join:"round",width:1,...B(e,-.4)},r=N(e,0),a=N(e,-.2),o=Math.min(c,l||C),n=v(o);s.width=1,t.push({shape:n[0],fill:a,stroke:s}),t.push({shape:n[1],fill:a,stroke:s}),t.push({shape:n[2],fill:r,stroke:s});const i=O,p=.7*O+.5*o;h=Math.max(h,i),u=Math.max(u,p);break}case"water":{const s=H(e),r=A(s),a=A(s,2),o=A(s,3),n=L();m=!0,t.push({shape:n[0],fill:r}),t.push({shape:n[1],fill:a}),t.push({shape:n[2],fill:o});const i=Math.min(c,l||C);h=Math.max(h,i),u=Math.max(u,i);break}}p.push(t)}return z(p,[h,u],{node:t&&t.node,scale:m,opacity:t&&t.opacity})}function _(e,t){if(0===e.symbolLayers.length)return Promise.reject(new r("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return V(e,t);case"line-3d":return X(e,t);case"polygon-3d":case"mesh-3d":return Y(e,t)}return Promise.reject(new r("symbolPreview: swatchInfo3D","symbol not supported."))}export{T as getPatternDescriptor,K as getSizeFromOptions,N as getSymbolLayerFill,_ as previewSymbol3D};
5
+ import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as s}from"../../core/colorUtils.js";import"../../core/has.js";import r from"../../core/Error.js";import a from"../../core/Logger.js";import{isNone as o,isSome as n}from"../../core/maybe.js";import{eachAlways as l}from"../../core/promiseUtils.js";import{pt2px as i}from"../../core/screenUtils.js";import{defaultThematicColor as c,getPatternUrlWithColor as p,dekebabifyLineStyle as h}from"./gfxUtils.js";import{defaultPrimitive as u}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as m}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as f,adjustColorComponentBrightness as y,getPathSymbolShapes as d,shapes as b,getExtrudeSymbolShapes as v,getTetrahedronShapes as g,getDiamondShapes as k,getCylinderShapes as w,getCubeShapes as x,getInvertedConeShapes as M,getConeShapes as j,getWaterSymbolShapes as L}from"./previewUtils.js";import{tintImageWithColor as z,renderSymbol as S}from"./renderUtils.js";import{isVolumetricSymbol as P,getIconHref as U}from"./utils.js";import{resolveWebStyleSymbol as D}from"./webStyleSymbolUtils.js";const O=f.size,C=f.maxSize,I=f.maxOutlineSize,R=f.lineWidth,E=f.tallSymbolWidth;function Z(e){const t=e.outline,s=n(e.material)?e.material.color:null,r=n(s)?s.toHex():null;if(o(t)||"pattern"in t&&n(t.pattern)&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===r?{color:"#bdc3c7",width:.75}:null;const a=i(t.size)||0;return{color:"rgba("+(n(t.color)?t.color.toRgba():"255,255,255,1")+")",width:Math.min(a,I),style:"pattern"in t&&n(t.pattern)&&"style"===t.pattern.type?h(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}function q(t,s){const r=s&&s.resource,a=r&&r.href;if(t.thumbnail&&t.thumbnail.url)return Promise.resolve(t.thumbnail.url);if(a&&"object"!==s.type)return Promise.resolve(U(t,s));const o=e("esri/images/Legend/legend3dsymboldefault.png");return t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)?D(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((e=>e)).then((e=>e?.thumbnail?.url||o)):Promise.resolve(o)}function A(e,r=1){const a=e.a,o=t(e),n=o.h,l=o.s/r,i=100-(100-o.v)/r,{r:c,g:p,b:h}=s({h:n,s:l,v:i});return[c,p,h,a]}function H(e){return"water"===e.type?o(e.color)?null:e.color:o(e.material)||o(e.material.color)?null:e.material.color}function N(e,t=0){const s=H(e);if(!s){if("fill"===e.type)return null;const s=c.r,r=y(s,t);return[r,r,r,100]}const r=s.toRgba();for(let a=0;a<3;a++)r[a]=y(r[a],t);return r}async function T(t,s){const r=t.style;if("none"===r)return null;return{type:"pattern",x:0,y:0,src:await p(e(`esri/symbols/patterns/${r}.png`),s.toCss(!0)),width:5,height:5}}function W(e){return e.outline?Z(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function $(e,t){const s=H(e);if(!s)return null;let r="rgba(";return r+=y(s.r,t)+",",r+=y(s.g,t)+",",r+=y(s.b,t)+",",r+s.a+");"}function B(e,t){const s=$(e,t);if(!s)return{};if("pattern"in e&&n(e.pattern)&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:s,width:Math.min(e.size?i(e.size):.75,I),style:"pattern"in e&&n(e.pattern)&&"style"===e.pattern.type?h(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?i(2):e.join:null}}function F(e,t,s){const r=.75*s;return{type:"linear",x1:r?.25*r:0,y1:r?.5*r:0,x2:r||4,y2:r?.5*r:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function G(e){const t=e.depth,s=e.height,r=e.width;return r&&t&&s&&r===t&&r<s}function J(e,t,s){const r=[];if(!e)return r;switch(e.type){case"icon":{const s=0,a=0,o=t,n=t;switch(e.resource&&e.resource.primitive||u){case"circle":r.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:N(e,0),stroke:Z(e)});break;case"square":r.push({shape:{type:"path",path:[{command:"M",values:[s,n]},{command:"L",values:[s,a]},{command:"L",values:[o,a]},{command:"L",values:[o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)});break;case"triangle":r.push({shape:{type:"path",path:[{command:"M",values:[s,n]},{command:"L",values:[.5*o,a]},{command:"L",values:[o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)});break;case"cross":r.push({shape:{type:"path",path:[{command:"M",values:[.5*o,a]},{command:"L",values:[.5*o,n]},{command:"M",values:[s,.5*n]},{command:"L",values:[o,.5*n]}]},stroke:W(e)});break;case"x":r.push({shape:{type:"path",path:[{command:"M",values:[s,a]},{command:"L",values:[o,n]},{command:"M",values:[o,a]},{command:"L",values:[s,n]}]},stroke:W(e)});break;case"kite":r.push({shape:{type:"path",path:[{command:"M",values:[s,.5*n]},{command:"L",values:[.5*o,a]},{command:"L",values:[o,.5*n]},{command:"L",values:[.5*o,n]},{command:"Z",values:[]}]},fill:N(e,0),stroke:Z(e)})}break}case"object":switch(e.resource&&e.resource.primitive||m){case"cone":{const a=F(N(e,0),N(e,-.6),s?E:t),o=j(t,s);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:a});break}case"inverted-cone":{const s=N(e,0),a=F(s,N(e,-.6),t),o=M(t);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:s});break}case"cube":{const a=x(t,s);r.push({shape:a[0],fill:N(e,0)}),r.push({shape:a[1],fill:N(e,-.3)}),r.push({shape:a[2],fill:N(e,-.5)});break}case"cylinder":{const a=F(N(e,0),N(e,-.6),s?E:t),o=w(t,s);r.push({shape:o[0],fill:a}),r.push({shape:o[1],fill:a}),r.push({shape:o[2],fill:N(e,0)});break}case"diamond":{const s=k(t);r.push({shape:s[0],fill:N(e,-.3)}),r.push({shape:s[1],fill:N(e,0)}),r.push({shape:s[2],fill:N(e,-.3)}),r.push({shape:s[3],fill:N(e,-.7)});break}case"sphere":{const s=F(N(e,0),N(e,-.6));s.x1=0,s.y1=0,s.x2=.25*t,s.y2=.25*t,r.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:s});break}case"tetrahedron":{const s=g(t);r.push({shape:s[0],fill:N(e,-.3)}),r.push({shape:s[1],fill:N(e,0)}),r.push({shape:s[2],fill:N(e,-.6)});break}}break}return r}function K(e){const t="number"==typeof e?.size?e?.size:null;return t?i(t):null}function Q(e){return"icon"===e.type?"multiply":"tint"}function V(e,t){const s=K(t),r=t&&t.maxSize?i(t.maxSize):null,o=t&&t.disableUpsampling,n=e.symbolLayers,c=[];let p=0,h=0;const u=n.getItemAt(n.length-1);let m;return u&&"icon"===u.type&&(m=u.size&&i(u.size)),n.forEach((a=>{if("icon"!==a.type&&"object"!==a.type)return;const n="icon"===a.type?a.size&&i(a.size):0,l=s||n?Math.ceil(Math.min(s||n,r||C)):O;if(a&&a.resource&&a.resource.href){const t=q(e,a).then((e=>{const t=a.get("material.color"),s=Q(a);return z(e,l,t,s,o)})).then((e=>{const t=e.width,s=e.height;return p=Math.max(p,t),h=Math.max(h,s),[{shape:{type:"image",x:0,y:0,width:t,height:s,src:e.url},fill:null,stroke:null}]}));c.push(t)}else{let e=l;"icon"===a.type&&m&&s&&(e=l*(n/m));const r="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===a.type&&G(a);p=Math.max(p,r?E:e),h=Math.max(h,e),c.push(Promise.resolve(J(a,e,r)))}})),l(c).then((e=>{const s=[];return e.forEach((e=>{e.value?s.push(e.value):e.error&&a.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.error)})),S(s,[p,h],{node:t&&t.node,scale:!1,opacity:t&&t.opacity})}))}function X(e,t){const s=e.symbolLayers,r=[],a=P(e),n=K(t),l=(t&&t.maxSize?i(t.maxSize):null)||I;let c,p=0,h=0;return s.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const s=[];switch(e.type){case"line":{const r=B(e,0);if(o(r))break;const a=r&&r.width||0;0===t&&(c=a);const i=Math.min(n||a,l),u=0===t?i:n?i*(a/c):i,m=u>R/2?2*u:R;h=Math.max(h,u),p=Math.max(p,m),r.width=u,s.push({shape:{type:"path",path:[{command:"M",values:[0,.5*h]},{command:"L",values:[p,.5*h]}]},stroke:r});break}case"path":{const t=Math.min(n||O,l),r=N(e,0),a=N(e,-.2),o=$(e,-.4),i=o?{color:o,width:1}:{};if("quad"===e.profile){const t=e.width,o=e.height,n=d(t&&o?t/o:1,0===o,0===t),l={...i,join:"bevel"};s.push({shape:n[0],fill:a,stroke:l}),s.push({shape:n[1],fill:a,stroke:l}),s.push({shape:n[2],fill:r,stroke:l})}else s.push({shape:b.pathSymbol3DLayer[0],fill:a,stroke:i}),s.push({shape:b.pathSymbol3DLayer[1],fill:r,stroke:i});h=Math.max(h,t),p=h}}r.push(s)})),Promise.resolve(S(r,[p,h],{node:t&&t.node,scale:a,opacity:t&&t.opacity}))}async function Y(e,t){const s="mesh-3d"===e.type,r=e.symbolLayers,a=K(t),l=t&&t.maxSize?i(t.maxSize):null,c=a||O,p=[];let h=0,u=0,m=!1;for(let i=0;i<r.length;i++){const e=r.getItemAt(i),t=[];if(s&&"fill"!==e.type)continue;const a=b.fill[0];switch(e.type){case"fill":{const r=Z(e),o=Math.min(c,l||C);h=Math.max(h,o),u=Math.max(u,o),m=!0;let i=N(e,0);const p="pattern"in e&&e.pattern,f=H(e);!s&&n(p)&&"style"===p.type&&"solid"!==p.style&&f&&(i=await T(p,f)),t.push({shape:a,fill:i,stroke:r});break}case"line":{const s=B(e,0);if(o(s))break;const r={stroke:s,shape:a};h=Math.max(h,O),u=Math.max(u,O),t.push(r);break}case"extrude":{const s={join:"round",width:1,...B(e,-.4)},r=N(e,0),a=N(e,-.2),o=Math.min(c,l||C),n=v(o);s.width=1,t.push({shape:n[0],fill:a,stroke:s}),t.push({shape:n[1],fill:a,stroke:s}),t.push({shape:n[2],fill:r,stroke:s});const i=O,p=.7*O+.5*o;h=Math.max(h,i),u=Math.max(u,p);break}case"water":{const s=H(e),r=A(s),a=A(s,2),o=A(s,3),n=L();m=!0,t.push({shape:n[0],fill:r}),t.push({shape:n[1],fill:a}),t.push({shape:n[2],fill:o});const i=Math.min(c,l||C);h=Math.max(h,i),u=Math.max(u,i);break}}p.push(t)}return S(p,[h,u],{node:t&&t.node,scale:m,opacity:t&&t.opacity})}function _(e,t){if(0===e.symbolLayers.length)return Promise.reject(new r("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return V(e,t);case"line-3d":return X(e,t);case"polygon-3d":case"mesh-3d":return Y(e,t)}return Promise.reject(new r("symbolPreview: swatchInfo3D","symbol not supported."))}export{T as getPatternDescriptor,K as getSizeFromOptions,N as getSymbolLayerFill,_ as previewSymbol3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSymbol3D as t}from"../../symbols.js";import{isDevEnvironment as e,adjustStaticAGOUrl as r}from"../../core/devEnvironmentUtils.js";import o from"../../core/Error.js";import{isSome as l}from"../../core/maybe.js";import{urlToObject as n,removeFile as m}from"../../core/urlUtils.js";import s from"../../portal/Portal.js";import{f as i}from"../../chunks/persistableUrlUtils.js";import{fromJSON as a}from"./jsonUtils.js";import p from"./StyleOrigin.js";import{requestJSON as u,makeCIMSymbolRef as y,fetchStyle as f,symbolUrlFromStyleItem as c,Style2DUrlTemplate as b}from"./styleUtils.js";import{Thumbnail as g}from"./Thumbnail.js";function j(t,e,r,l){return t.name?t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName?d(t,e,l):f(t,e,l).then((o=>h(o,t.name,e,r,l))):Promise.reject(new o("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference"))}function h(f,b,j,h,d){const U=f.data,N=j&&l(j.portal)?j.portal:s.getDefault(),w={portal:N,url:n(f.baseUrl),origin:"portal-item"},D=U.items.find((t=>t.name===b));if(!D){const t=`The symbol name '${b}' could not be found`;return Promise.reject(new o("symbolstyleutils:symbol-name-not-found",t,{symbolName:b}))}let P=i(c(D,h),w),S=D.thumbnail&&D.thumbnail.href;const E=D.thumbnail&&D.thumbnail.imageData;e()&&(P=r(P),S=r(S));const O={portal:N,url:n(m(P)),origin:"portal-item"};return u(P,d).then((e=>{const r="cimRef"===h?y(e.data):e.data,o=a(r,O);if(o&&t(o)){if(S){const t=i(S,w);o.thumbnail=new g({url:t})}else E&&(o.thumbnail=new g({url:`data:image/png;base64,${E}`}));f.styleUrl?o.styleOrigin=new p({portal:j.portal,styleUrl:f.styleUrl,name:b}):f.styleName&&(o.styleOrigin=new p({portal:j.portal,styleName:f.styleName,name:b}))}return o}))}function d(t,e,r){const o=b.replace(/\{SymbolName\}/gi,t.name),i=l(e.portal)?e.portal:s.getDefault();return u(o,r).then((t=>{const e=y(t.data);return a(e,{portal:i,url:n(m(o)),origin:"portal-item"})}))}export{h as fetchSymbolFromStyle,j as resolveWebStyleSymbol};
5
+ import{isSymbol3D as t}from"../../symbols.js";import{isDevEnvironment as e,adjustStaticAGOUrl as r}from"../../core/devEnvironmentUtils.js";import o from"../../core/Error.js";import{isSome as l}from"../../core/maybe.js";import{urlToObject as m,removeFile as n}from"../../core/urlUtils.js";import s from"../../portal/Portal.js";import{f as a}from"../../chunks/persistableUrlUtils.js";import{fromJSON as i}from"./jsonUtils.js";import p from"./StyleOrigin.js";import{fetchStyle as u,symbolUrlFromStyleItem as f,requestJSON as y,makeCIMSymbolRef as c,Style2DUrlTemplate as b}from"./styleUtils.js";import{Thumbnail as g}from"./Thumbnail.js";function j(t,e,r,l){return t.name?t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName?d(t,e,l):u(t,e,l).then((o=>h(o,t.name,e,r,l))):Promise.reject(new o("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference"))}function h(u,b,j,h,d){const U=u.data,N=j&&l(j.portal)?j.portal:s.getDefault(),w={portal:N,url:m(u.baseUrl),origin:"portal-item"},S=U.items.find((t=>t.name===b));if(!S){const t=`The symbol name '${b}' could not be found`;return Promise.reject(new o("symbolstyleutils:symbol-name-not-found",t,{symbolName:b}))}let D=a(f(S,h),w),O=S.thumbnail&&S.thumbnail.href;const P=S.thumbnail&&S.thumbnail.imageData;e()&&(D=r(D),O=r(O));const E={portal:N,url:m(n(D)),origin:"portal-item"};return y(D,d).then((e=>{const r="cimRef"===h?c(e.data):e.data,o=i(r,E);if(o&&t(o)){if(O){const t=a(O,w);o.thumbnail=new g({url:t})}else P&&(o.thumbnail=new g({url:`data:image/png;base64,${P}`}));u.styleUrl?o.styleOrigin=new p({portal:j.portal,styleUrl:u.styleUrl,name:b}):u.styleName&&(o.styleOrigin=new p({portal:j.portal,styleName:u.styleName,name:b}))}return o}))}function d(t,e,r){const o=b.replace(/\{SymbolName\}/gi,t.name),a=l(e.portal)?e.portal:s.getDefault();return y(o,r).then((t=>{const e=c(t.data);return i(e,{portal:a,url:m(n(o)),origin:"portal-item"})}))}export{h as fetchSymbolFromStyle,j as resolveWebStyleSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import s from"../../Viewpoint.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{t as r}from"../../chunks/common.js";import{a,r as n,t as p,b as h}from"../../chunks/mat2d.js";import{c}from"../../chunks/mat2df32.js";import{c as m}from"../../chunks/mat2df64.js";import{s as l,c as f,d as u,r as w,m as v}from"../../chunks/mat3.js";import{c as d}from"../../chunks/mat3f32.js";import{c as j,t as y}from"../../chunks/vec2.js";import{f as R}from"../../chunks/vec2f32.js";import{a as _}from"../../chunks/vec2f64.js";import{isVec2 as x}from"../../core/libs/gl-matrix-2/types/vec2.js";import{copy as z,getMatrix as g,getResolution as S,getExtent as k,getTransform as M,getTransformNoRotation as N,getWorldScreenWidth as T}from"./viewpointUtils.js";import b from"../../geometry/Extent.js";import D from"../../geometry/Point.js";var V;const G=[0,0];let O=V=class extends i{constructor(t){super(t),this._viewpoint2D={center:_(),rotation:0,scale:0,spatialReference:null},this.center=[0,0],this.extent=new b,this.id=0,this.inverseTransform=m(),this.resolution=0,this.rotation=0,this.scale=0,this.transform=m(),this.transformNoRotation=m(),this.displayMat3=d(),this.displayViewMat3=d(),this.viewMat3=d(),this.viewMat2d=c(),this.worldScreenWidth=0,this.size=[0,0]}set pixelRatio(t){this._set("pixelRatio",t),this._update()}set size(t){this._set("size",t),this._update()}set viewpoint(t){if(t){const s=this._viewpoint2D,i=t.targetGeometry;s.center[0]=i.x,s.center[1]=i.y,s.rotation=t.rotation,s.scale=t.scale,s.spatialReference=i.spatialReference}this._update()}copy(t){const s=this.size,i=this.viewpoint;return i&&s?(this.viewpoint=z(i,t.viewpoint),this._set("size",j(s,t.size))):(this.viewpoint=t.viewpoint.clone(),this._set("size",[t.size[0],t.size[1]])),this._set("pixelRatio",t.pixelRatio),this}clone(){return new V({size:this.size,viewpoint:this.viewpoint.clone(),pixelRatio:this.pixelRatio})}toMap(t,s,i){return x(s)?y(t,s,this.inverseTransform):(G[0]=s,G[1]=i,y(t,G,this.inverseTransform))}toScreen(t,s,i){return x(s)?y(t,s,this.transform):(G[0]=s,G[1]=i,y(t,G,this.transform))}toScreenNoRotation(t,s,i){return x(s)?y(t,s,this.transformNoRotation):(G[0]=s,G[1]=i,y(t,G,this.transformNoRotation))}getScreenTransform(t,s){const{center:i}=this._viewpoint2D,e=this._get("pixelRatio")||1,o=this._get("size");return g(t,i,o,s,0,e),t}_update(){const{center:t,spatialReference:i,scale:e,rotation:o}=this._viewpoint2D,c=this._get("pixelRatio")||1,m=this._get("size"),d=new s({targetGeometry:new D(t[0],t[1],i),scale:e,rotation:o});if(this._set("viewpoint",d),!m||!i||!e)return;this.resolution=S(d),this.rotation=o,this.scale=e,this.spatialReference=i,j(this.center,t);const y=0!==m[0]?2/m[0]:0,_=0!==m[1]?-2/m[1]:0;l(this.displayMat3,y,0,0,0,_,0,-1,1,1);const x=f(this.viewMat3),z=R(m[0]/2,m[1]/2),g=R(-m[0]/2,-m[1]/2),b=r(o);u(x,x,z),w(x,x,b),u(x,x,g),v(this.displayViewMat3,this.displayMat3,x);const V=a(this.viewMat2d,z);return n(V,V,b),p(V,V,g),k(this.extent,d,m),M(this.transform,d,m,c),h(this.inverseTransform,this.transform),N(this.transformNoRotation,d,m,c),this.worldScreenWidth=T(this.spatialReference,this.resolution),this._set("id",this.id+1),this}};t([e({readOnly:!0})],O.prototype,"id",void 0),t([e({value:1,json:{write:!0}})],O.prototype,"pixelRatio",null),t([e({json:{write:!0}})],O.prototype,"size",null),t([e()],O.prototype,"spatialReference",void 0),t([e({type:s,json:{write:!0}})],O.prototype,"viewpoint",null),O=V=t([o("esri.views.2d.ViewState")],O);const U=O;export{U as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import s from"../../Viewpoint.js";import{JSONSupport as i}from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{t as r}from"../../chunks/common.js";import{a,r as n,t as p,c as h}from"../../chunks/mat2d.js";import{c}from"../../chunks/mat2df32.js";import{c as m}from"../../chunks/mat2df64.js";import{s as l,c as f,d as u,r as w,m as v}from"../../chunks/mat3.js";import{c as d}from"../../chunks/mat3f32.js";import{c as j,t as y}from"../../chunks/vec2.js";import{f as R}from"../../chunks/vec2f32.js";import{a as _}from"../../chunks/vec2f64.js";import{isVec2 as x}from"../../core/libs/gl-matrix-2/types/vec2.js";import{copy as z,getMatrix as g,getResolution as S,getExtent as k,getTransform as M,getTransformNoRotation as N,getWorldScreenWidth as T}from"./viewpointUtils.js";import D from"../../geometry/Extent.js";import V from"../../geometry/Point.js";var b;const G=[0,0];let O=b=class extends i{constructor(t){super(t),this._viewpoint2D={center:_(),rotation:0,scale:0,spatialReference:null},this.center=[0,0],this.extent=new D,this.id=0,this.inverseTransform=m(),this.resolution=0,this.rotation=0,this.scale=0,this.transform=m(),this.transformNoRotation=m(),this.displayMat3=d(),this.displayViewMat3=d(),this.viewMat3=d(),this.viewMat2d=c(),this.worldScreenWidth=0,this.size=[0,0]}set pixelRatio(t){this._set("pixelRatio",t),this._update()}set size(t){this._set("size",t),this._update()}set viewpoint(t){if(t){const s=this._viewpoint2D,i=t.targetGeometry;s.center[0]=i.x,s.center[1]=i.y,s.rotation=t.rotation,s.scale=t.scale,s.spatialReference=i.spatialReference}this._update()}copy(t){const s=this.size,i=this.viewpoint;return i&&s?(this.viewpoint=z(i,t.viewpoint),this._set("size",j(s,t.size))):(this.viewpoint=t.viewpoint.clone(),this._set("size",[t.size[0],t.size[1]])),this._set("pixelRatio",t.pixelRatio),this}clone(){return new b({size:this.size,viewpoint:this.viewpoint.clone(),pixelRatio:this.pixelRatio})}toMap(t,s,i){return x(s)?y(t,s,this.inverseTransform):(G[0]=s,G[1]=i,y(t,G,this.inverseTransform))}toScreen(t,s,i){return x(s)?y(t,s,this.transform):(G[0]=s,G[1]=i,y(t,G,this.transform))}toScreenNoRotation(t,s,i){return x(s)?y(t,s,this.transformNoRotation):(G[0]=s,G[1]=i,y(t,G,this.transformNoRotation))}getScreenTransform(t,s){const{center:i}=this._viewpoint2D,e=this._get("pixelRatio")||1,o=this._get("size");return g(t,i,o,s,0,e),t}_update(){const{center:t,spatialReference:i,scale:e,rotation:o}=this._viewpoint2D,c=this._get("pixelRatio")||1,m=this._get("size"),d=new s({targetGeometry:new V(t[0],t[1],i),scale:e,rotation:o});if(this._set("viewpoint",d),!m||!i||!e)return;this.resolution=S(d),this.rotation=o,this.scale=e,this.spatialReference=i,j(this.center,t);const y=0!==m[0]?2/m[0]:0,_=0!==m[1]?-2/m[1]:0;l(this.displayMat3,y,0,0,0,_,0,-1,1,1);const x=f(this.viewMat3),z=R(m[0]/2,m[1]/2),g=R(-m[0]/2,-m[1]/2),D=r(o);u(x,x,z),w(x,x,D),u(x,x,g),v(this.displayViewMat3,this.displayMat3,x);const b=a(this.viewMat2d,z);return n(b,b,D),p(b,b,g),k(this.extent,d,m),M(this.transform,d,m,c),h(this.inverseTransform,this.transform),N(this.transformNoRotation,d,m,c),this.worldScreenWidth=T(this.spatialReference,this.resolution),this._set("id",this.id+1),this}};t([e({readOnly:!0})],O.prototype,"id",void 0),t([e({value:1,json:{write:!0}})],O.prototype,"pixelRatio",null),t([e({json:{write:!0}})],O.prototype,"size",null),t([e()],O.prototype,"spatialReference",void 0),t([e({type:s,json:{write:!0}})],O.prototype,"viewpoint",null),O=b=t([o("esri.views.2d.ViewState")],O);const U=O;export{U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{Point as e}from"../webgl/Geometry.js";var t;!function(e){e[e.moveTo=1]="moveTo",e[e.lineTo=2]="lineTo",e[e.close=7]="close"}(t||(t={}));class s{constructor(e,t){this.values={};const s=t.keys,o=t.values;for(;e.next();)switch(e.tag()){case 1:this.id=e.getUInt64();break;case 2:{const t=e.getMessage(),r=this.values;for(;!t.empty();){const e=t.getUInt32(),a=t.getUInt32();r[s[e]]=o[a]}t.release();break}case 3:this.type=e.getUInt32();break;case 4:this._pbfGeometry=e.getMessage();break;default:e.skip()}}getGeometry(s){if(void 0!==this._geometry)return this._geometry;if(!this._pbfGeometry)return null;const o=this._pbfGeometry;let r,a;this._pbfGeometry=null,s?s.reset(this.type):r=[];let n,l=t.moveTo,i=0,c=0,h=0;for(;!o.empty();){if(0===i){const e=o.getUInt32();l=7&e,i=e>>3}switch(i--,l){case t.moveTo:c+=o.getSInt32(),h+=o.getSInt32(),s?s.moveTo(c,h):(a&&r.push(a),a=[],a.push(new e(c,h)));break;case t.lineTo:c+=o.getSInt32(),h+=o.getSInt32(),s?s.lineTo(c,h):a.push(new e(c,h));break;case t.close:s?s.close():a&&!a[0].equals(c,h)&&a.push(a[0].clone());break;default:throw o.release(),new Error("Invalid path operation")}}return s?n=s.result():(a&&r.push(a),n=r),o.release(),this._geometry=n,n}}export{s as default};
5
+ import{Point as e}from"../webgl/Geometry.js";var t;!function(e){e[e.moveTo=1]="moveTo",e[e.lineTo=2]="lineTo",e[e.close=7]="close"}(t||(t={}));class s{constructor(e,t){this.values={},this._geometry=void 0,this._pbfGeometry=null;const s=t.keys,o=t.values;for(;e.next();)switch(e.tag()){case 1:this.id=e.getUInt64();break;case 2:{const t=e.getMessage(),r=this.values;for(;!t.empty();){const e=t.getUInt32(),n=t.getUInt32();r[s[e]]=o[n]}t.release();break}case 3:this.type=e.getUInt32();break;case 4:this._pbfGeometry=e.getMessage();break;default:e.skip()}}getGeometry(s){if(void 0!==this._geometry)return this._geometry;if(!this._pbfGeometry)return null;const o=this._pbfGeometry;let r,n;this._pbfGeometry=null,s?s.reset(this.type):r=[];let a,i=t.moveTo,l=0,c=0,h=0;for(;!o.empty();){if(0===l){const e=o.getUInt32();i=7&e,l=e>>3}switch(l--,i){case t.moveTo:c+=o.getSInt32(),h+=o.getSInt32(),s?s.moveTo(c,h):r&&(n&&r.push(n),n=[],n.push(new e(c,h)));break;case t.lineTo:c+=o.getSInt32(),h+=o.getSInt32(),s?s.lineTo(c,h):n&&n.push(new e(c,h));break;case t.close:s?s.close():n&&!n[0].equals(c,h)&&n.push(n[0].clone());break;default:throw o.release(),new Error("Invalid path operation")}}return s?a=s.result():r&&(n&&r.push(n),a=r),o.release(),this._geometry=a,a}}export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{StyleLayerType as e}from"./StyleDefinition.js";import{CircleStyleLayer as t,SymbolStyleLayer as r,LineStyleLayer as i,FillStyleLayer as s,BackgroundStyleLayer as a}from"./StyleLayer.js";class l{constructor(t){if(this._style=t,this.backgroundBucketIds=[],this._uidToLayer=new Map,this._layerByName={},this._runningId=0,t.layers||(t.layers=[]),this.version=parseFloat(t.version),this.layers=t.layers.map(((e,t,r)=>this._create(e,t,r))).filter((e=>!!e)),this.layers){let t;for(let r=0;r<this.layers.length;r++)t=this.layers[r],this._layerByName[t.id]=t,this._uidToLayer.set(t.uid,t),t.type===e.BACKGROUND&&this.backgroundBucketIds.push(t.id)}this._identifyRefLayers()}isPainterDataDriven(e){const t=this._layerByName[e];return!!t&&t.isPainterDataDriven()}getStyleLayerId(e){return e>=this.layers.length?null:this.layers[e].id}getStyleLayerByUID(e){return this._uidToLayer.get(e)??null}getStyleLayerIndex(e){const t=this._layerByName[e];return t?this.layers.indexOf(t):-1}setStyleLayer(e,t){if(!e||!e.id)return;const r=this._style;null!=t&&t>=this.layers.length&&(t=this.layers.length-1);let i,s=!0;const a=this._layerByName[e.id];if(a){const y=this.layers.indexOf(a);t||(t=y),t===y?(s=!1,i=l._recreateLayer(e,a),this.layers[t]=i,r.layers[t]=e):(this.layers.splice(y,1),r.layers.splice(y,1),i=this._create(e,t,this.layers),this.layers.splice(t,0,i),r.layers.splice(t,0,e))}else i=this._create(e,t,this.layers),!t||t>=this.layers.length?(this.layers.push(i),r.layers.push(e)):(this.layers.splice(t,0,i),r.layers.splice(t,0,e));this._layerByName[e.id]=i,this._uidToLayer.set(i.uid,i),s&&this._recomputeZValues(),this._identifyRefLayers()}getStyleLayer(e){const t=this._layerByName[e];return t?{type:t.typeName,id:t.id,source:t.source,"source-layer":t.sourceLayer,minzoom:t.minzoom,maxzoom:t.maxzoom,filter:t.filter,layout:t.layout,paint:t.paint}:null}deleteStyleLayer(e){const t=this._layerByName[e];if(t){delete this._layerByName[e],this._uidToLayer.delete(t.uid);const r=this.layers.indexOf(t);this.layers.splice(r,1),this._style.layers.splice(r,1),this._recomputeZValues(),this._identifyRefLayers()}}getLayerById(e){return this._layerByName[e]}getLayoutProperties(e){const t=this._layerByName[e];return t?t.layout:null}getPaintProperties(e){const t=this._layerByName[e];return t?t.paint:null}setPaintProperties(e,t){const r=this._layerByName[e];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:r.layout,paint:t},s=l._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=s,this._style.layers[a].paint=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setLayoutProperties(e,t){const r=this._layerByName[e];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:t,paint:r.paint},s=l._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=s,this._style.layers[a].layout=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setStyleLayerVisibility(e,t){const r=this._layerByName[e];if(!r)return;const i=r.layout||{};i.visibility=t;const s={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:i,paint:r.paint},a=l._recreateLayer(s,r),y=this.layers.indexOf(r);this.layers[y]=a,this._style.layers[y].layout=i,this._layerByName[r.id]=a,this._uidToLayer.set(r.uid,a)}getStyleLayerVisibility(e){const t=this._layerByName[e];if(!t)return"none";return t.layout?.visibility??"visible"}_recomputeZValues(){const e=this.layers,t=1/(e.length+1);for(let r=0;r<e.length;r++)e[r].z=1-(1+r)*t}_identifyRefLayers(){const t=[],r=[];let i=0;for(const s of this.layers){const a=s.layout;if(s.type===e.FILL){const e=s;let r=s.source+"|"+s.sourceLayer;r+="|"+a?.visibility??"",r+="|"+s.minzoom,r+="|"+s.maxzoom,r+="|"+JSON.stringify(s.filter),(e.hasDataDrivenFill||e.hasDataDrivenOutline)&&(r+="|"+i),t.push({key:r,layer:s})}else if(s.type===e.LINE){const e=s,t=s.paint,l=null!=t&&(null!=t["line-pattern"]||null!=t["line-dasharray"]);let y=s.source+"|"+s.sourceLayer;y+="|"+a?.visibility??"",y+="|"+s.minzoom,y+="|"+s.maxzoom,y+="|"+JSON.stringify(s.filter),y+="|"+(void 0!==a?a["line-cap"]:""),y+="|"+(void 0!==a?a["line-join"]:""),(e.hasDataDrivenLine||l)&&(y+="|"+i),r.push({key:y,layer:s})}++i}this._assignRefLayers(t),this._assignRefLayers(r)}_assignRefLayers(t){let r,i;t.sort(((e,t)=>e.key<t.key?-1:e.key>t.key?1:0));const s=t.length;for(let a=0;a<s;a++){const l=t[a];if(l.key===r)l.layer.refLayerId=i;else if(r=l.key,i=l.layer.id,l.layer.type===e.FILL){if(!l.layer.getPaintProperty("fill-outline-color"))for(let e=a+1;e<s;e++){const s=t[e];if(s.key!==r)break;if(s.layer.getPaintProperty("fill-outline-color")){t[a]=s,t[e]=l,i=s.layer.id;break}}}else if(l.layer.type===e.LINE){let e=l.layer;for(let y=a+1;y<s;y++){const s=t[y];if(s.key!==r)break;const n=s.layer;(e.canUseThinTessellation&&!n.canUseThinTessellation||!e.canUseThinTessellation&&(n.getPaintProperty("line-pattern")||n.getPaintProperty("line-dasharray")))&&(e=n,t[a]=s,t[y]=l,i=s.layer.id)}}}}_create(l,y,n){const o=1-(1+y)*(1/(n.length+1)),u=this._runningId++;switch(l.type){case"background":return new a(e.BACKGROUND,l,o,u);case"fill":return new s(e.FILL,l,o,u);case"line":return new i(e.LINE,l,o,u);case"symbol":return new r(e.SYMBOL,l,o,u);case"raster":console.warn(`Unsupported vector tile raster layer ${l.id}`);case"circle":return new t(e.CIRCLE,l,o,u)}}static _recreateLayer(l,y){switch(l.type){case"background":return new a(e.BACKGROUND,l,y.z,y.uid);case"fill":return new s(e.FILL,l,y.z,y.uid);case"line":return new i(e.LINE,l,y.z,y.uid);case"symbol":return new r(e.SYMBOL,l,y.z,y.uid);case"raster":console.warn(`Unsupported vector tile raster layer ${l.id}`);case"circle":return new t(e.CIRCLE,l,y.z,y.uid)}}}export{l as default};
5
+ import{StyleLayerType as e}from"./StyleDefinition.js";import{CircleStyleLayer as t,SymbolStyleLayer as r,LineStyleLayer as i,FillStyleLayer as s,BackgroundStyleLayer as a}from"./StyleLayer.js";class l{constructor(t){if(this._style=t,this.backgroundBucketIds=[],this._uidToLayer=new Map,this._layerByName={},this._runningId=0,t.layers||(t.layers=[]),this.version=parseFloat(t.version),this.layers=t.layers.map(((e,t,r)=>this._create(e,t,r))).filter((e=>!!e)),this.layers){let t;for(let r=0;r<this.layers.length;r++)t=this.layers[r],this._layerByName[t.id]=t,this._uidToLayer.set(t.uid,t),t.type===e.BACKGROUND&&this.backgroundBucketIds.push(t.id)}this._identifyRefLayers()}isPainterDataDriven(e){const t=this._layerByName[e];return!!t&&t.isPainterDataDriven()}getStyleLayerId(e){return e>=this.layers.length?null:this.layers[e].id}getStyleLayerByUID(e){return this._uidToLayer.get(e)??null}getStyleLayerIndex(e){const t=this._layerByName[e];return t?this.layers.indexOf(t):-1}setStyleLayer(e,t){if(!e||!e.id)return;const r=this._style;null!=t&&t>=this.layers.length&&(t=this.layers.length-1);let i,s=!0;const a=this._layerByName[e.id];if(a){const y=this.layers.indexOf(a);t||(t=y),t===y?(s=!1,i=l._recreateLayer(e,a),this.layers[t]=i,r.layers[t]=e):(this.layers.splice(y,1),r.layers.splice(y,1),i=this._create(e,t,this.layers),this.layers.splice(t,0,i),r.layers.splice(t,0,e))}else i=this._create(e,t,this.layers),!t||t>=this.layers.length?(this.layers.push(i),r.layers.push(e)):(this.layers.splice(t,0,i),r.layers.splice(t,0,e));this._layerByName[e.id]=i,this._uidToLayer.set(i.uid,i),s&&this._recomputeZValues(),this._identifyRefLayers()}getStyleLayer(e){const t=this._layerByName[e];return t?{type:t.typeName,id:t.id,source:t.source,"source-layer":t.sourceLayer,minzoom:t.minzoom,maxzoom:t.maxzoom,filter:t.filter,layout:t.layout,paint:t.paint}:null}deleteStyleLayer(e){const t=this._layerByName[e];if(t){delete this._layerByName[e],this._uidToLayer.delete(t.uid);const r=this.layers.indexOf(t);this.layers.splice(r,1),this._style.layers.splice(r,1),this._recomputeZValues(),this._identifyRefLayers()}}getLayerById(e){return this._layerByName[e]}getLayoutProperties(e){const t=this._layerByName[e];return t?t.layout:null}getPaintProperties(e){const t=this._layerByName[e];return t?t.paint:null}setPaintProperties(e,t){const r=this._layerByName[e];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:r.layout,paint:t},s=l._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=s,this._style.layers[a].paint=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setLayoutProperties(e,t){const r=this._layerByName[e];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:t,paint:r.paint},s=l._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=s,this._style.layers[a].layout=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setStyleLayerVisibility(e,t){const r=this._layerByName[e];if(!r)return;const i=r.layout||{};i.visibility=t;const s={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:i,paint:r.paint},a=l._recreateLayer(s,r),y=this.layers.indexOf(r);this.layers[y]=a,this._style.layers[y].layout=i,this._layerByName[r.id]=a,this._uidToLayer.set(r.uid,a)}getStyleLayerVisibility(e){const t=this._layerByName[e];if(!t)return"none";return t.layout?.visibility??"visible"}_recomputeZValues(){const e=this.layers,t=1/(e.length+1);for(let r=0;r<e.length;r++)e[r].z=1-(1+r)*t}_identifyRefLayers(){const t=[],r=[];let i=0;for(const s of this.layers){const a=s.layout;if(s.type===e.FILL){const e=s;let r=s.source+"|"+s.sourceLayer;r+="|"+(a?.visibility??""),r+="|"+s.minzoom,r+="|"+s.maxzoom,r+="|"+JSON.stringify(s.filter),(e.hasDataDrivenFill||e.hasDataDrivenOutline)&&(r+="|"+i),t.push({key:r,layer:s})}else if(s.type===e.LINE){const e=s,t=s.paint,l=null!=t&&(null!=t["line-pattern"]||null!=t["line-dasharray"]);let y=s.source+"|"+s.sourceLayer;y+="|"+(a?.visibility??""),y+="|"+s.minzoom,y+="|"+s.maxzoom,y+="|"+JSON.stringify(s.filter),y+="|"+(void 0!==a?a["line-cap"]:""),y+="|"+(void 0!==a?a["line-join"]:""),(e.hasDataDrivenLine||l)&&(y+="|"+i),r.push({key:y,layer:s})}++i}this._assignRefLayers(t),this._assignRefLayers(r)}_assignRefLayers(t){let r,i;t.sort(((e,t)=>e.key<t.key?-1:e.key>t.key?1:0));const s=t.length;for(let a=0;a<s;a++){const l=t[a];if(l.key===r)l.layer.refLayerId=i;else if(r=l.key,i=l.layer.id,l.layer.type===e.FILL){if(!l.layer.getPaintProperty("fill-outline-color"))for(let e=a+1;e<s;e++){const s=t[e];if(s.key!==r)break;if(s.layer.getPaintProperty("fill-outline-color")){t[a]=s,t[e]=l,i=s.layer.id;break}}}else if(l.layer.type===e.LINE){let e=l.layer;for(let y=a+1;y<s;y++){const s=t[y];if(s.key!==r)break;const n=s.layer;(e.canUseThinTessellation&&!n.canUseThinTessellation||!e.canUseThinTessellation&&(n.getPaintProperty("line-pattern")||n.getPaintProperty("line-dasharray")))&&(e=n,t[a]=s,t[y]=l,i=s.layer.id)}}}}_create(l,y,n){const o=1-(1+y)*(1/(n.length+1)),u=this._runningId++;switch(l.type){case"background":return new a(e.BACKGROUND,l,o,u);case"fill":return new s(e.FILL,l,o,u);case"line":return new i(e.LINE,l,o,u);case"symbol":return new r(e.SYMBOL,l,o,u);case"raster":console.warn(`Unsupported vector tile raster layer ${l.id}`);case"circle":return new t(e.CIRCLE,l,o,u)}}static _recreateLayer(l,y){switch(l.type){case"background":return new a(e.BACKGROUND,l,y.z,y.uid);case"fill":return new s(e.FILL,l,y.z,y.uid);case"line":return new i(e.LINE,l,y.z,y.uid);case"symbol":return new r(e.SYMBOL,l,y.z,y.uid);case"raster":console.warn(`Unsupported vector tile raster layer ${l.id}`);case"circle":return new t(e.CIRCLE,l,y.z,y.uid)}}}export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as s,createAbortError as e}from"../../../../core/promiseUtils.js";const i=1e20;class r{constructor(t){this.size=t;const s=document.createElement("canvas");s.width=s.height=t,this._context=s.getContext("2d"),this._gridOuter=new Float64Array(t*t),this._gridInner=new Float64Array(t*t),this._f=new Float64Array(t),this._d=new Float64Array(t),this._z=new Float64Array(t+1),this._v=new Int16Array(t)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg&&(document.body.removeChild(this._svg),this._svg=null)}draw(r,h,n=31){this._initSVG();const o=this.createSVGString(r);return new Promise(((r,a)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(o),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,this.size,this.size),this._context.drawImage(d,0,0,this.size,this.size);const s=this._context.getImageData(0,0,this.size,this.size),e=new Uint8Array(this.size*this.size*4);for(let t=0;t<this.size*this.size;t++){const e=s.data[4*t+3]/255;this._gridOuter[t]=1===e?0:0===e?i:Math.max(0,.5-e)**2,this._gridInner[t]=1===e?i:0===e?0:Math.max(0,e-.5)**2}this._edt(this._gridOuter,this.size,this.size),this._edt(this._gridInner,this.size,this.size);for(let i=0;i<this.size*this.size;i++){const s=this._gridOuter[i]-this._gridInner[i];t(.5-s/(2*n),e,4*i)}r(e)};const l=h&&h.signal;l&&s(l,(()=>a(e())))}))}_initSVG(){if(!this._svg){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("style","position: absolute;"),t.setAttribute("width","0"),t.setAttribute("height","0"),t.setAttribute("aria-hidden","true"),t.setAttribute("role","presentation"),document.body.appendChild(t),this._svg=t}}createSVGString(t){this._initSVG();const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",t),this._svg.appendChild(s);const e=s.getBBox(),i=e.width/e.height,r=this.size/2;let h,n,o,a;if(i>1){n=h=r/e.width;const t=r*(1/i);o=this.size/4,a=r-t/2}else{h=n=r/e.height;o=r-r*i/2,a=this.size/4}const d=-e.x*h+o,l=-e.y*n+a;s.setAttribute("style",`transform: matrix(${h}, 0, 0, ${n}, ${d}, ${l})`);const _=`<svg style="fill:red;" height="${this.size}" width="${this.size}" xmlns="http://www.w3.org/2000/svg">${this._svg.innerHTML}</svg>`;return this._svg.removeChild(s),_}_edt(t,s,e){const i=this._f,r=this._d,h=this._v,n=this._z;for(let o=0;o<s;o++){for(let r=0;r<e;r++)i[r]=t[r*s+o];this._edt1d(i,r,h,n,e);for(let i=0;i<e;i++)t[i*s+o]=r[i]}for(let o=0;o<e;o++){for(let e=0;e<s;e++)i[e]=t[o*s+e];this._edt1d(i,r,h,n,s);for(let e=0;e<s;e++)t[o*s+e]=Math.sqrt(r[e])}}_edt1d(t,s,e,r,h){e[0]=0,r[0]=-i,r[1]=+i;for(let n=1,o=0;n<h;n++){let s=(t[n]+n*n-(t[e[o]]+e[o]*e[o]))/(2*n-2*e[o]);for(;s<=r[o];)o--,s=(t[n]+n*n-(t[e[o]]+e[o]*e[o]))/(2*n-2*e[o]);o++,e[o]=n,r[o]=s,r[o+1]=+i}for(let i=0,n=0;i<h;i++){for(;r[n+1]<i;)n++;s[i]=(i-e[n])*(i-e[n])+t[e[n]]}}}export{r as default};
5
+ import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";const i=1e20;class r{constructor(t){this._svg=null,this.size=t;const e=document.createElement("canvas");e.width=e.height=t,this._context=e.getContext("2d"),this._gridOuter=new Float64Array(t*t),this._gridInner=new Float64Array(t*t),this._f=new Float64Array(t),this._d=new Float64Array(t),this._z=new Float64Array(t+1),this._v=new Int16Array(t)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg&&(document.body.removeChild(this._svg),this._svg=null)}draw(r,h,n=31){this._initSVG();const o=this.createSVGString(r);return new Promise(((r,a)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(o),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,this.size,this.size),this._context.drawImage(d,0,0,this.size,this.size);const e=this._context.getImageData(0,0,this.size,this.size),s=new Uint8Array(this.size*this.size*4);for(let t=0;t<this.size*this.size;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?i:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?i:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,this.size,this.size),this._edt(this._gridInner,this.size,this.size);for(let i=0;i<this.size*this.size;i++){const e=this._gridOuter[i]-this._gridInner[i];t(.5-e/(2*n),s,4*i)}r(s)};const l=h&&h.signal;l&&e(l,(()=>a(s())))}))}_initSVG(){if(!this._svg){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("style","position: absolute;"),t.setAttribute("width","0"),t.setAttribute("height","0"),t.setAttribute("aria-hidden","true"),t.setAttribute("role","presentation"),document.body.appendChild(t),this._svg=t}return this._svg}createSVGString(t){const e=this._initSVG(),s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",t),e.appendChild(s);const i=s.getBBox(),r=i.width/i.height,h=this.size/2;let n,o,a,d;if(r>1){o=n=h/i.width;const t=h*(1/r);a=this.size/4,d=h-t/2}else{n=o=h/i.height;a=h-h*r/2,d=this.size/4}const l=-i.x*n+a,_=-i.y*o+d;s.setAttribute("style",`transform: matrix(${n}, 0, 0, ${o}, ${l}, ${_})`);const g=`<svg style="fill:red;" height="${this.size}" width="${this.size}" xmlns="http://www.w3.org/2000/svg">${e.innerHTML}</svg>`;return e.removeChild(s),g}_edt(t,e,s){const i=this._f,r=this._d,h=this._v,n=this._z;for(let o=0;o<e;o++){for(let r=0;r<s;r++)i[r]=t[r*e+o];this._edt1d(i,r,h,n,s);for(let i=0;i<s;i++)t[i*e+o]=r[i]}for(let o=0;o<s;o++){for(let s=0;s<e;s++)i[s]=t[o*e+s];this._edt1d(i,r,h,n,e);for(let s=0;s<e;s++)t[o*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,r,h){s[0]=0,r[0]=-i,r[1]=+i;for(let n=1,o=0;n<h;n++){let e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);for(;e<=r[o];)o--,e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);o++,s[o]=n,r[o]=e,r[o+1]=+i}for(let i=0,n=0;i<h;i++){for(;r[n+1]<i;)n++;e[i]=(i-s[n])*(i-s[n])+t[s[n]]}}}export{r as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{CapType as t,JoinType as e}from"../../../../symbols/cim/enums.js";import{THIN_LINE_HALF_WIDTH_THRESHOLD as i}from"./definitions.js";function x(t,e){return t.x===e.x&&t.y===e.y}function r(t){if(!t)return;const e=t.length;if(e<=1)return;let i=0;for(let r=1;r<e;r++)x(t[r],t[i])||++i===r||(t[i]=t[r]);t.length=i+1}function n(t,e){return t.x=e.y,t.y=-e.x,t}function s(t,e){return t.x=-e.y,t.y=e.x,t}function y(t,e){return t.x=e.x,t.y=e.y,t}function o(t,e){return t.x=-e.x,t.y=-e.y,t}function h(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function l(t,e){return t.x*e.y-t.y*e.x}function _(t,e){return t.x*e.x+t.y*e.y}function a(t,e,i,x){return t.x=e.x*i+e.y*x,t.y=e.x*x-e.y*i,t}class c{constructor(t,e,i){this._writeVertex=t,this._writeTriangle=e,this._canUseThinTessellation=i,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(t,e){r(t),this._canUseThinTessellation&&e.halfWidth<i&&!e.offset?this._tessellateThin(t,e):this._tessellate(t,e)}_tessellateThin(t,e){if(t.length<2)return;const i=e.wrapDistance||65535;let x=e.initialDistance||0,r=!1,n=t[0].x,s=t[0].y;const y=t.length;for(let o=1;o<y;++o){r&&(r=!1,x=0);let e=t[o].x,y=t[o].y,h=e-n,l=y-s,_=Math.sqrt(h*h+l*l);if(h/=_,l/=_,x+_>i){r=!0;const t=(i-x)/_;_=i-x,e=(1-t)*n+t*e,y=(1-t)*s+t*y,--o}const a=this._writeVertex(n,s,0,0,h,l,l,-h,0,-1,x),c=this._writeVertex(n,s,0,0,h,l,-l,h,0,1,x);x+=_;const d=this._writeVertex(e,y,0,0,h,l,l,-h,0,-1,x),u=this._writeVertex(e,y,0,0,h,l,-l,h,0,1,x);this._writeTriangle(a,c,d),this._writeTriangle(c,d,u),n=e,s=y}}_tessellate(i,r){const c=i[0],d=i[i.length-1],u=x(c,d),v=u?3:2;if(i.length<v)return;const f=r.pixelCoordRatio,w=null!=r.capType?r.capType:t.BUTT,T=null!=r.joinType?r.joinType:e.MITER,g=null!=r.miterLimit?Math.min(r.miterLimit,4):2,m=null!=r.roundLimit?Math.min(r.roundLimit,1.05):1.05,V=null!=r.halfWidth?r.halfWidth:2,N=!!r.textured;let E,b,R=null,U=null;const k=this._prevNormal,p=this._nextNormal;let M=-1,B=-1;const L=this._joinNormal;let D,S;const j=this._textureNormalLeft,A=this._textureNormalRight,O=this._textureNormal;let I=-1,P=-1;const W=r.wrapDistance||65535;let q=r.initialDistance||0;const Q=this._writeVertex,X=this._writeTriangle,C=(t,e,i,x,r,n)=>{const s=Q(E,b,D,S,i,x,t,e,r,n,q);return I>=0&&P>=0&&s>=0&&X(I,P,s),I=P,P=s,s};u&&(R=i[i.length-2],p.x=d.x-R.x,p.y=d.y-R.y,B=h(p),p.x/=B,p.y/=B);let z=!1;for(let x=0;x<i.length;++x){if(z&&(z=!1,q=0),R&&(k.x=-p.x,k.y=-p.y,M=B,q+M>W&&(z=!0)),z){const t=(W-q)/M;M=W-q,R={x:(1-t)*R.x+t*i[x].x,y:(1-t)*R.y+t*i[x].y},--x}else R=i[x];E=R.x,b=R.y;const r=x<=0&&!z,c=x===i.length-1;if(r||(q+=M),U=c?u?i[1]:null:i[x+1],U?(p.x=U.x-E,p.y=U.y-b,B=h(p),p.x/=B,p.y/=B):(p.x=void 0,p.y=void 0),!u){if(r){s(L,p),D=L.x,S=L.y,w===t.SQUARE&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,0,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,0,1)),w===t.ROUND&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,-1,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,-1,1)),w!==t.ROUND&&w!==t.BUTT||(C(-p.y,p.x,p.x,p.y,0,-1),C(p.y,-p.x,p.x,p.y,0,1));continue}if(c){n(L,k),D=L.x,S=L.y,w!==t.ROUND&&w!==t.BUTT||(C(k.y,-k.x,-k.x,-k.y,0,-1),C(-k.y,k.x,-k.x,-k.y,0,1)),w===t.SQUARE&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,0,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,0,1)),w===t.ROUND&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,1,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,1,1));continue}}let d,v,Q=-l(k,p);if(Math.abs(Q)<.01)_(k,p)>0?(L.x=k.x,L.y=k.y,Q=1,d=Number.MAX_VALUE,v=!0):(s(L,p),Q=1,d=1,v=!1);else{L.x=(k.x+p.x)/Q,L.y=(k.y+p.y)/Q,d=h(L);const t=(d-1)*V*f;v=d>4||t>M&&t>B}D=L.x,S=L.y;let X=T;switch(T){case e.BEVEL:d<1.05&&(X=e.MITER);break;case e.ROUND:d<m&&(X=e.MITER);break;case e.MITER:d>g&&(X=e.BEVEL)}switch(X){case e.MITER:if(C(L.x,L.y,-k.x,-k.y,0,-1),C(-L.x,-L.y,-k.x,-k.y,0,1),c)break;if(N){const t=z?0:q;I=this._writeVertex(E,b,D,S,p.x,p.y,L.x,L.y,0,-1,t),P=this._writeVertex(E,b,D,S,p.x,p.y,-L.x,-L.y,0,1,t)}break;case e.BEVEL:{const t=Q<0;let e,i,x,r;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;if(v)x=t?s(this._innerPrev,k):n(this._innerPrev,k),r=t?n(this._innerNext,p):s(this._innerNext,p);else{const e=t?o(this._inner,L):y(this._inner,L);x=e,r=e}const h=t?n(this._bevelStart,k):s(this._bevelStart,k);C(x.x,x.y,-k.x,-k.y,e.x,e.y);const l=C(h.x,h.y,-k.x,-k.y,i.x,i.y);if(c)break;const _=t?s(this._bevelEnd,p):n(this._bevelEnd,p);if(v){const t=this._writeVertex(E,b,D,S,-k.x,-k.y,0,0,0,0,q);I=this._writeVertex(E,b,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q),P=this._writeVertex(E,b,D,S,p.x,p.y,_.x,_.y,i.x,i.y,q),this._writeTriangle(l,t,P)}else{if(N){const t=this._bevelMiddle;t.x=(h.x+_.x)/2,t.y=(h.y+_.y)/2,a(O,t,-k.x,-k.y),C(t.x,t.y,-k.x,-k.y,O.x,O.y),a(O,t,p.x,p.y),I=this._writeVertex(E,b,D,S,p.x,p.y,t.x,t.y,O.x,O.y,q),P=this._writeVertex(E,b,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q)}else{const t=I;I=P,P=t}C(_.x,_.y,p.x,p.y,i.x,i.y)}if(t){const t=I;I=P,P=t}break}case e.ROUND:{const t=Q<0;let e,i;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;const x=t?o(this._inner,L):y(this._inner,L);let r,h;v?(r=t?s(this._innerPrev,k):n(this._innerPrev,k),h=t?n(this._innerNext,p):s(this._innerNext,p)):(r=x,h=x);const l=t?n(this._roundStart,k):s(this._roundStart,k),u=t?s(this._roundEnd,p):n(this._roundEnd,p),f=C(r.x,r.y,-k.x,-k.y,e.x,e.y),w=C(l.x,l.y,-k.x,-k.y,i.x,i.y);if(c)break;const T=this._writeVertex(E,b,D,S,-k.x,-k.y,0,0,0,0,q);v||this._writeTriangle(I,P,T);const g=o(this._outer,x),m=this._writeVertex(E,b,D,S,p.x,p.y,u.x,u.y,i.x,i.y,q);let V,R;const U=d>2;if(U){let e;d!==Number.MAX_VALUE?(g.x/=d,g.y/=d,e=_(k,g),e=(d*(e*e-1)+1)/e):e=-1,V=t?n(this._startBreak,k):s(this._startBreak,k),V.x+=k.x*e,V.y+=k.y*e,R=t?s(this._endBreak,p):n(this._endBreak,p),R.x+=p.x*e,R.y+=p.y*e}a(O,g,-k.x,-k.y);const M=this._writeVertex(E,b,D,S,-k.x,-k.y,g.x,g.y,O.x,O.y,q);a(O,g,p.x,p.y);const B=N?this._writeVertex(E,b,D,S,p.x,p.y,g.x,g.y,O.x,O.y,q):M,W=T,X=N?this._writeVertex(E,b,D,S,p.x,p.y,0,0,0,0,q):T;let z=-1,F=-1;if(U&&(a(O,V,-k.x,-k.y),z=this._writeVertex(E,b,D,S,-k.x,-k.y,V.x,V.y,O.x,O.y,q),a(O,R,p.x,p.y),F=this._writeVertex(E,b,D,S,p.x,p.y,R.x,R.y,O.x,O.y,q)),N?U?(this._writeTriangle(W,w,z),this._writeTriangle(W,z,M),this._writeTriangle(X,B,F),this._writeTriangle(X,F,m)):(this._writeTriangle(W,w,M),this._writeTriangle(X,B,m)):U?(this._writeTriangle(T,w,z),this._writeTriangle(T,z,F),this._writeTriangle(T,F,m)):(this._writeTriangle(T,w,M),this._writeTriangle(T,B,m)),v?(I=this._writeVertex(E,b,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q),P=m):(I=N?this._writeVertex(E,b,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q):f,this._writeTriangle(I,X,m),P=m),t){const t=I;I=P,P=t}break}}}}}export{c as LineTessellation};
5
+ import{CapType as t,JoinType as e}from"../../../../symbols/cim/enums.js";import{THIN_LINE_HALF_WIDTH_THRESHOLD as i}from"./definitions.js";function x(t,e){return t.x===e.x&&t.y===e.y}function r(t){if(!t)return;const e=t.length;if(e<=1)return;let i=0;for(let r=1;r<e;r++)x(t[r],t[i])||++i===r||(t[i]=t[r]);t.length=i+1}function n(t,e){return t.x=e.y,t.y=-e.x,t}function s(t,e){return t.x=-e.y,t.y=e.x,t}function y(t,e){return t.x=e.x,t.y=e.y,t}function o(t,e){return t.x=-e.x,t.y=-e.y,t}function h(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function l(t,e){return t.x*e.y-t.y*e.x}function _(t,e){return t.x*e.x+t.y*e.y}function a(t,e,i,x){return t.x=e.x*i+e.y*x,t.y=e.x*x-e.y*i,t}class c{constructor(t,e,i){this._writeVertex=t,this._writeTriangle=e,this._canUseThinTessellation=i,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(t,e){r(t),this._canUseThinTessellation&&e.halfWidth<i&&!e.offset?this._tessellateThin(t,e):this._tessellate(t,e)}_tessellateThin(t,e){if(t.length<2)return;const i=e.wrapDistance||65535;let x=e.initialDistance||0,r=!1,n=t[0].x,s=t[0].y;const y=t.length;for(let o=1;o<y;++o){r&&(r=!1,x=0);let e=t[o].x,y=t[o].y,h=e-n,l=y-s,_=Math.sqrt(h*h+l*l);if(h/=_,l/=_,x+_>i){r=!0;const t=(i-x)/_;_=i-x,e=(1-t)*n+t*e,y=(1-t)*s+t*y,--o}const a=this._writeVertex(n,s,0,0,h,l,l,-h,0,-1,x),c=this._writeVertex(n,s,0,0,h,l,-l,h,0,1,x);x+=_;const d=this._writeVertex(e,y,0,0,h,l,l,-h,0,-1,x),u=this._writeVertex(e,y,0,0,h,l,-l,h,0,1,x);this._writeTriangle(a,c,d),this._writeTriangle(c,d,u),n=e,s=y}}_tessellate(i,r){const c=i[0],d=i[i.length-1],u=x(c,d),v=u?3:2;if(i.length<v)return;const f=r.pixelCoordRatio,w=null!=r.capType?r.capType:t.BUTT,T=null!=r.joinType?r.joinType:e.MITER,g=null!=r.miterLimit?Math.min(r.miterLimit,4):2,m=null!=r.roundLimit?Math.min(r.roundLimit,1.05):1.05,V=null!=r.halfWidth?r.halfWidth:2,N=!!r.textured;let E,b,R,U=null;const k=this._prevNormal,p=this._nextNormal;let M=-1,B=-1;const L=this._joinNormal;let D,S;const j=this._textureNormalLeft,A=this._textureNormalRight,O=this._textureNormal;let I=-1,P=-1;const W=r.wrapDistance||65535;let q=r.initialDistance||0;const Q=this._writeVertex,X=this._writeTriangle,C=(t,e,i,x,r,n)=>{const s=Q(b,R,D,S,i,x,t,e,r,n,q);return I>=0&&P>=0&&s>=0&&X(I,P,s),I=P,P=s,s};u&&(E=i[i.length-2],p.x=d.x-E.x,p.y=d.y-E.y,B=h(p),p.x/=B,p.y/=B);let z=!1;for(let x=0;x<i.length;++x){if(z&&(z=!1,q=0),E&&(k.x=-p.x,k.y=-p.y,M=B,q+M>W&&(z=!0)),z){const t=(W-q)/M;M=W-q,E={x:(1-t)*E.x+t*i[x].x,y:(1-t)*E.y+t*i[x].y},--x}else E=i[x];b=E.x,R=E.y;const r=x<=0&&!z,c=x===i.length-1;if(r||(q+=M),U=c?u?i[1]:null:i[x+1],U?(p.x=U.x-b,p.y=U.y-R,B=h(p),p.x/=B,p.y/=B):(p.x=void 0,p.y=void 0),!u){if(r){s(L,p),D=L.x,S=L.y,w===t.SQUARE&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,0,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,0,1)),w===t.ROUND&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,-1,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,-1,1)),w!==t.ROUND&&w!==t.BUTT||(C(-p.y,p.x,p.x,p.y,0,-1),C(p.y,-p.x,p.x,p.y,0,1));continue}if(c){n(L,k),D=L.x,S=L.y,w!==t.ROUND&&w!==t.BUTT||(C(k.y,-k.x,-k.x,-k.y,0,-1),C(-k.y,k.x,-k.x,-k.y,0,1)),w===t.SQUARE&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,0,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,0,1)),w===t.ROUND&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,1,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,1,1));continue}}let d,v,Q=-l(k,p);if(Math.abs(Q)<.01)_(k,p)>0?(L.x=k.x,L.y=k.y,Q=1,d=Number.MAX_VALUE,v=!0):(s(L,p),Q=1,d=1,v=!1);else{L.x=(k.x+p.x)/Q,L.y=(k.y+p.y)/Q,d=h(L);const t=(d-1)*V*f;v=d>4||t>M&&t>B}D=L.x,S=L.y;let X=T;switch(T){case e.BEVEL:d<1.05&&(X=e.MITER);break;case e.ROUND:d<m&&(X=e.MITER);break;case e.MITER:d>g&&(X=e.BEVEL)}switch(X){case e.MITER:if(C(L.x,L.y,-k.x,-k.y,0,-1),C(-L.x,-L.y,-k.x,-k.y,0,1),c)break;if(N){const t=z?0:q;I=this._writeVertex(b,R,D,S,p.x,p.y,L.x,L.y,0,-1,t),P=this._writeVertex(b,R,D,S,p.x,p.y,-L.x,-L.y,0,1,t)}break;case e.BEVEL:{const t=Q<0;let e,i,x,r;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;if(v)x=t?s(this._innerPrev,k):n(this._innerPrev,k),r=t?n(this._innerNext,p):s(this._innerNext,p);else{const e=t?o(this._inner,L):y(this._inner,L);x=e,r=e}const h=t?n(this._bevelStart,k):s(this._bevelStart,k);C(x.x,x.y,-k.x,-k.y,e.x,e.y);const l=C(h.x,h.y,-k.x,-k.y,i.x,i.y);if(c)break;const _=t?s(this._bevelEnd,p):n(this._bevelEnd,p);if(v){const t=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);I=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,_.x,_.y,i.x,i.y,q),this._writeTriangle(l,t,P)}else{if(N){const t=this._bevelMiddle;t.x=(h.x+_.x)/2,t.y=(h.y+_.y)/2,a(O,t,-k.x,-k.y),C(t.x,t.y,-k.x,-k.y,O.x,O.y),a(O,t,p.x,p.y),I=this._writeVertex(b,R,D,S,p.x,p.y,t.x,t.y,O.x,O.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q)}else{const t=I;I=P,P=t}C(_.x,_.y,p.x,p.y,i.x,i.y)}if(t){const t=I;I=P,P=t}break}case e.ROUND:{const t=Q<0;let e,i;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;const x=t?o(this._inner,L):y(this._inner,L);let r,h;v?(r=t?s(this._innerPrev,k):n(this._innerPrev,k),h=t?n(this._innerNext,p):s(this._innerNext,p)):(r=x,h=x);const l=t?n(this._roundStart,k):s(this._roundStart,k),u=t?s(this._roundEnd,p):n(this._roundEnd,p),f=C(r.x,r.y,-k.x,-k.y,e.x,e.y),w=C(l.x,l.y,-k.x,-k.y,i.x,i.y);if(c)break;const T=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);v||this._writeTriangle(I,P,T);const g=o(this._outer,x),m=this._writeVertex(b,R,D,S,p.x,p.y,u.x,u.y,i.x,i.y,q);let V,E;const U=d>2;if(U){let e;d!==Number.MAX_VALUE?(g.x/=d,g.y/=d,e=_(k,g),e=(d*(e*e-1)+1)/e):e=-1,V=t?n(this._startBreak,k):s(this._startBreak,k),V.x+=k.x*e,V.y+=k.y*e,E=t?s(this._endBreak,p):n(this._endBreak,p),E.x+=p.x*e,E.y+=p.y*e}a(O,g,-k.x,-k.y);const M=this._writeVertex(b,R,D,S,-k.x,-k.y,g.x,g.y,O.x,O.y,q);a(O,g,p.x,p.y);const B=N?this._writeVertex(b,R,D,S,p.x,p.y,g.x,g.y,O.x,O.y,q):M,W=T,X=N?this._writeVertex(b,R,D,S,p.x,p.y,0,0,0,0,q):T;let z=-1,F=-1;if(U&&(a(O,V,-k.x,-k.y),z=this._writeVertex(b,R,D,S,-k.x,-k.y,V.x,V.y,O.x,O.y,q),a(O,E,p.x,p.y),F=this._writeVertex(b,R,D,S,p.x,p.y,E.x,E.y,O.x,O.y,q)),N?U?(this._writeTriangle(W,w,z),this._writeTriangle(W,z,M),this._writeTriangle(X,B,F),this._writeTriangle(X,F,m)):(this._writeTriangle(W,w,M),this._writeTriangle(X,B,m)):U?(this._writeTriangle(T,w,z),this._writeTriangle(T,z,F),this._writeTriangle(T,F,m)):(this._writeTriangle(T,w,M),this._writeTriangle(T,B,m)),v?(I=this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q),P=m):(I=N?this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q):f,this._writeTriangle(I,X,m),P=m),t){const t=I;I=P,P=t}break}}}}}export{c as LineTessellation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as r,isSome as t}from"../../../../../core/maybe.js";import{f as e}from"../../../../../chunks/vec4f32.js";import{createProgramDescriptor as s}from"../Utils.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{StencilOperation as a,CompareFunction as m,DataType as n,PrimitiveType as p}from"../../../../webgl/enums.js";import{createProgram as l}from"../../../../webgl/ProgramTemplate.js";const c=()=>s("clip",{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT}]});class f extends o{constructor(){super(...arguments),this._color=e(0,1,0,1)}dispose(){this._program&&this._program.dispose()}prepareState({context:r}){r.setStencilTestEnabled(!0),r.setBlendingEnabled(!1),r.setFaceCullingEnabled(!1),r.setColorMask(!1,!1,!1,!1),r.setStencilOp(a.KEEP,a.KEEP,a.REPLACE),r.setStencilWriteMask(255),r.setStencilFunction(m.ALWAYS,0,255)}draw(e,s){const{context:o,state:a,requestRender:m}=e,f=c(),d=s.getVAO(o,a,f.attributes,f.bufferLayouts);r(d.indexBuffer)||(this._program||(this._program=l(o,i)),!t(m)||this._program.isCompiled?(o.useProgram(this._program),this._program.setUniform2fv("u_coord_range",[1,1]),this._program.setUniform4fv("u_color",this._color),this._program.setUniformMatrix3fv("u_dvsMat3",a.displayMat3),o.bindVAO(d),o.drawElements(p.TRIANGLES,d.indexBuffer.size,n.UNSIGNED_INT,0),o.bindVAO()):m())}}export{f as default};
5
+ import{isNone as r,isSome as t}from"../../../../../core/maybe.js";import{f as e}from"../../../../../chunks/vec4f32.js";import{createProgramDescriptor as s}from"../Utils.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{StencilOperation as a,CompareFunction as m,PrimitiveType as n,DataType as p}from"../../../../webgl/enums.js";import{createProgram as l}from"../../../../webgl/ProgramTemplate.js";const c=()=>s("clip",{geometry:[{location:0,name:"a_pos",count:2,type:p.SHORT}]});class f extends o{constructor(){super(...arguments),this._color=e(0,1,0,1)}dispose(){this._program&&this._program.dispose()}prepareState({context:r}){r.setStencilTestEnabled(!0),r.setBlendingEnabled(!1),r.setFaceCullingEnabled(!1),r.setColorMask(!1,!1,!1,!1),r.setStencilOp(a.KEEP,a.KEEP,a.REPLACE),r.setStencilWriteMask(255),r.setStencilFunction(m.ALWAYS,0,255)}draw(e,s){const{context:o,state:a,requestRender:m}=e,f=c(),d=s.getVAO(o,a,f.attributes,f.bufferLayouts);r(d.indexBuffer)||(this._program||(this._program=l(o,i)),!t(m)||this._program.isCompiled?(o.useProgram(this._program),this._program.setUniform2fv("u_coord_range",[1,1]),this._program.setUniform4fv("u_color",this._color),this._program.setUniformMatrix3fv("u_dvsMat3",a.displayMat3),o.bindVAO(d),o.drawElements(n.TRIANGLES,d.indexBuffer.size,p.UNSIGNED_INT,0),o.bindVAO()):m())}}export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../../core/maybe.js";import{TEXTURE_BINDING_BITMAP as t}from"../definitions.js";import{createProgramDescriptor as r}from"../Utils.js";import s from"./WGLBrush.js";import{BlendFactor as o,CompareFunction as i,DataType as n,PrimitiveType as a}from"../../../../webgl/enums.js";const m=()=>r("overlay",{geometry:[{location:0,name:"a_pos",count:2,type:n.FLOAT}],tex:[{location:1,name:"a_uv",count:2,type:n.UNSIGNED_SHORT}]});class u extends s{constructor(){super(...arguments),this._desc={vsPath:"overlay/overlay",fsPath:"overlay/overlay",attributes:new Map([["a_pos",0],["a_uv",1]])}}dispose(){}prepareState({context:e}){e.setBlendingEnabled(!0),e.setColorMask(!0,!0,!0,!0),e.setBlendFunctionSeparate(o.ONE,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(i.GREATER,255,255)}draw(r,s){const{context:o,painter:i,requestRender:n}=r;if(!s.isReady)return;const{computedOpacity:u,dvsMat3:c,isWrapAround:p,perspectiveTransform:d,texture:l}=s;r.timeline.begin(this.name);const f=i.materialManager.getProgram(this._desc);if(e(n)&&!f.isCompiled)return void n();const _=m(),v=s.getVAO(o,_.bufferLayouts,_.attributes);if(!v)return;o.bindVAO(v),o.useProgram(f),o.bindTexture(l,t),f.setUniformMatrix3fv("u_dvsMat3",c),f.setUniform1i("u_texture",t),f.setUniform1f("u_opacity",u),f.setUniform2fv("u_perspective",d);const y=p?10:4;o.drawArrays(a.TRIANGLE_STRIP,0,y),o.bindVAO(),r.timeline.end(this.name)}}export{u as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{TEXTURE_BINDING_BITMAP as t}from"../definitions.js";import{createProgramDescriptor as r}from"../Utils.js";import s from"./WGLBrush.js";import{BlendFactor as o,CompareFunction as i,PrimitiveType as n,DataType as a}from"../../../../webgl/enums.js";const m=()=>r("overlay",{geometry:[{location:0,name:"a_pos",count:2,type:a.FLOAT}],tex:[{location:1,name:"a_uv",count:2,type:a.UNSIGNED_SHORT}]});class u extends s{constructor(){super(...arguments),this._desc={vsPath:"overlay/overlay",fsPath:"overlay/overlay",attributes:new Map([["a_pos",0],["a_uv",1]])}}dispose(){}prepareState({context:e}){e.setBlendingEnabled(!0),e.setColorMask(!0,!0,!0,!0),e.setBlendFunctionSeparate(o.ONE,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(i.GREATER,255,255)}draw(r,s){const{context:o,painter:i,requestRender:a}=r;if(!s.isReady)return;const{computedOpacity:u,dvsMat3:c,isWrapAround:p,perspectiveTransform:d,texture:l}=s;r.timeline.begin(this.name);const f=i.materialManager.getProgram(this._desc);if(e(a)&&!f.isCompiled)return void a();const _=m(),v=s.getVAO(o,_.bufferLayouts,_.attributes);if(!v)return;o.bindVAO(v),o.useProgram(f),o.bindTexture(l,t),f.setUniformMatrix3fv("u_dvsMat3",c),f.setUniform1i("u_texture",t),f.setUniform1f("u_opacity",u),f.setUniform2fv("u_perspective",d);const y=p?10:4;o.drawArrays(n.TRIANGLE_STRIP,0,y),o.bindVAO(),r.timeline.end(this.name)}}export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LabelMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,CompareFunction as i,PrimitiveType as s}from"../../../../webgl/enums.js";const m=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:r.UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:r.UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:r.UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:r.SHORT},{location:8,name:"a_texCoords",count:2,type:r.UNSIGNED_SHORT}]});class l extends a{dispose(){}getGeometryType(){return t.LABEL}supportsSymbology(e){return!0}drawGeometry(t,o,a,l){const{context:u,painter:p,state:c,rendererInfo:d,passOptions:f,requestRender:y}=t,_=n.load(a.materialKey),E=e(f)&&"hittest"===f.type,N=_.mapAligned?1:0;if(!N&&Math.abs(o.key.level-Math.round(100*t.displayLevel)/100)>=1)return;const{bufferLayouts:S,attributes:U}=m(_),T=p.materialManager.getMaterialProgram(t,_,"materials/label",U,l);if(e(y)&&!E&&!T.isCompiled)return void y();t.context.setStencilFunction(i.EQUAL,0,255),u.useProgram(T),this._setSharedUniforms(T,t,o),p.textureManager.bindTextures(u,T,_);const g=1===N?c.displayViewMat3:c.displayMat3;this._setSizeVVUniforms(_,T,d,o),T.setUniform1f("u_mapRotation",Math.floor(c.rotation/360*254)),T.setUniform1f("u_mapAligned",N),T.setUniformMatrix3fv("u_displayMat3",g),T.setUniform1f("u_opacity",1),T.setUniform2fv("u_screenSize",t.state.size),T.setUniform1f("u_isHalo",1);const G=a.target.getVAO(u,S,U),I=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;u.bindVAO(G),u.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),T.setUniform1f("u_isHalo",0),u.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),u.setStencilTestEnabled(!0),u.setBlendingEnabled(!0)}}export{l as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LabelMaterialKey as n}from"../materialKey/MaterialKey.js";import{CompareFunction as r,PrimitiveType as i,DataType as s}from"../../../../webgl/enums.js";const m=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:s.SHORT},{location:1,name:"a_id",count:4,type:s.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:s.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:s.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:s.UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:s.UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:s.UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:s.SHORT},{location:8,name:"a_texCoords",count:2,type:s.UNSIGNED_SHORT}]});class l extends a{dispose(){}getGeometryType(){return t.LABEL}supportsSymbology(e){return!0}drawGeometry(t,o,a,l){const{context:u,painter:p,state:c,rendererInfo:d,passOptions:f,requestRender:y}=t,_=n.load(a.materialKey),E=e(f)&&"hittest"===f.type,N=_.mapAligned?1:0;if(!N&&Math.abs(o.key.level-Math.round(100*t.displayLevel)/100)>=1)return;const{bufferLayouts:S,attributes:U}=m(_),T=p.materialManager.getMaterialProgram(t,_,"materials/label",U,l);if(e(y)&&!E&&!T.isCompiled)return void y();t.context.setStencilFunction(r.EQUAL,0,255),u.useProgram(T),this._setSharedUniforms(T,t,o),p.textureManager.bindTextures(u,T,_);const g=1===N?c.displayViewMat3:c.displayMat3;this._setSizeVVUniforms(_,T,d,o),T.setUniform1f("u_mapRotation",Math.floor(c.rotation/360*254)),T.setUniform1f("u_mapAligned",N),T.setUniformMatrix3fv("u_displayMat3",g),T.setUniform1f("u_opacity",1),T.setUniform2fv("u_screenSize",t.state.size),T.setUniform1f("u_isHalo",1);const G=a.target.getVAO(u,S,U),I=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;u.bindVAO(G),u.drawElements(i.TRIANGLES,a.indexCount,s.UNSIGNED_INT,I),T.setUniform1f("u_isHalo",0),u.drawElements(i.TRIANGLES,a.indexCount,s.UNSIGNED_INT,I),u.setStencilTestEnabled(!0),u.setBlendingEnabled(!0)}}export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";const s=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:r.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:r.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:r.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:r.BYTE},{location:7,name:"a_aux",count:2,type:r.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:r.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return t.LINE}supportsSymbology(e){return!0}drawGeometry(t,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:y,requestRender:d}=t,_=n.load(a.materialKey),f=e(y)&&"hittest"===y.type;let E=s(_),N=i.TRIANGLES;f&&(E=this._getTriangleDesc(a.materialKey,E),N=i.POINTS);const{attributes:g,bufferLayouts:S}=E,T=c.materialManager.getMaterialProgram(t,_,"materials/line",g,m);if(e(d)&&!f&&!T.isCompiled)return void d();const U=1/t.pixelRatio,G=0;l.useProgram(T),this._setSharedUniforms(T,t,o),_.textureBinding&&c.textureManager.bindTextures(l,T,_);const I=2**(p-o.key.level);T.setUniform1f("u_zoomFactor",I),T.setUniform1f("u_blur",G+U),T.setUniform1f("u_antialiasing",U),this._setSizeVVUniforms(_,T,u,o),this._setColorAndOpacityVVUniforms(_,T,u),l.setFaceCullingEnabled(!1);const b=a.target.getVAO(l,S,g,f);let x=a.indexCount,D=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;f&&(x/=3,D/=3),l.bindVAO(b),l.drawElements(N,x,r.UNSIGNED_INT,D)}}export{m as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{PrimitiveType as r,DataType as i}from"../../../../webgl/enums.js";const s=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:i.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:i.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:i.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:i.BYTE},{location:7,name:"a_aux",count:2,type:i.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return t.LINE}supportsSymbology(e){return!0}drawGeometry(t,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:y,requestRender:d}=t,_=n.load(a.materialKey),f=e(y)&&"hittest"===y.type;let E=s(_),N=r.TRIANGLES;f&&(E=this._getTriangleDesc(a.materialKey,E),N=r.POINTS);const{attributes:g,bufferLayouts:S}=E,T=c.materialManager.getMaterialProgram(t,_,"materials/line",g,m);if(e(d)&&!f&&!T.isCompiled)return void d();const U=1/t.pixelRatio,G=0;l.useProgram(T),this._setSharedUniforms(T,t,o),_.textureBinding&&c.textureManager.bindTextures(l,T,_);const I=2**(p-o.key.level);T.setUniform1f("u_zoomFactor",I),T.setUniform1f("u_blur",G+U),T.setUniform1f("u_antialiasing",U),this._setSizeVVUniforms(_,T,u,o),this._setColorAndOpacityVVUniforms(_,T,u),l.setFaceCullingEnabled(!1);const b=a.target.getVAO(l,S,g,f);let x=a.indexCount,D=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;f&&(x/=3,D/=3),l.bindVAO(b),l.drawElements(N,x,i.UNSIGNED_INT,D)}}export{m as default};