@arcgis/core 6.0.0-next.53 → 6.0.0-next.55

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 (300) hide show
  1. package/WebScene.js +2 -2
  2. package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/featureset/support/sqlUtils.js +1 -1
  8. package/arcade/validation/arcadeValidator.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
  13. package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 14259910f44c08fd5bbd.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
  16. package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
  17. package/assets/esri/core/workers/chunks/{e507dfc4788295d9c244.js → 249a687ce1b6d0815242.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
  21. package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → 4401b3f8ebb658abe789.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
  25. package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
  26. package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e83806797979138fd22a.js → 844c593754b2692257f4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{2d3e977f3b75474d7ebc.js → 846248697c398468d8e6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{032733b863426c5bde00.js → 9e508f930086d2ef5f22.js} +3 -3
  31. package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{817bf487df056da1e6ec.js → a116dd204921e7464944.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
  38. package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → be0b8bb4f09aae6ff5de.js} +1 -1
  41. package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
  42. package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → e61082f56c08abe54b3a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
  47. package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
  48. package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
  50. package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
  51. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  52. package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
  53. package/chunks/CypherParser.js +1 -1
  54. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  55. package/chunks/MultiPathImpl.js +1 -1
  56. package/chunks/OperatorGeodesicBuffer.js +1 -1
  57. package/chunks/UnitFactory.js +1 -1
  58. package/chunks/blosc-wasm.js +2 -0
  59. package/chunks/cameraUtilsSpherical.js +1 -1
  60. package/chunks/parquet.js +1 -1
  61. package/chunks/text.js +1 -1
  62. package/config.js +1 -1
  63. package/core/sql/SqlInterval.js +1 -1
  64. package/core/urlUtils.js +1 -1
  65. package/geometry/geometryEngine.js +1 -1
  66. package/geometry/operators/gx/operatorOffset.js +1 -1
  67. package/geometry/support/Ellipsoid.js +1 -1
  68. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  69. package/geometry/support/geodesicConstants.js +1 -1
  70. package/geometry/support/meshUtils/primitives.js +1 -1
  71. package/kernel.js +1 -1
  72. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  73. package/layers/VoxelWasmPerSceneView.js +1 -1
  74. package/layers/effects/parser.js +1 -1
  75. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  76. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  77. package/layers/graphics/data/QueryEngineResult.js +1 -1
  78. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  79. package/layers/parquet.js +1 -1
  80. package/layers/raster/datasets/ZarrRaster.js +1 -1
  81. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  82. package/layers/raster/formats/RasterCodec.js +1 -1
  83. package/layers/raster/formats/blosc.js +2 -0
  84. package/layers/support/BuildingFilter.js +1 -1
  85. package/layers/support/IntegratedMeshSemantics.js +1 -1
  86. package/layers/support/fieldUtils.d.ts +23 -87
  87. package/layers/support/fieldUtils.js +1 -1
  88. package/layers/support/layersMapping.js +1 -1
  89. package/layers/video/VideoController.js +1 -1
  90. package/legend/ActiveLayerInfo.js +1 -1
  91. package/libs/ajv/ajv.bundle-wrapper.js +1 -1
  92. package/package.json +4 -4
  93. package/renderers/types.d.ts +1 -1
  94. package/rest/knowledgeGraphService.js +1 -1
  95. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  96. package/smartMapping/statistics/support/attributeDensity.js +1 -1
  97. package/smartMapping/support/adapters/support/utils.js +1 -1
  98. package/support/tests/serviceMockDependencies.js +1 -1
  99. package/symbols/cim/CIMEffects.js +1 -1
  100. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  101. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  102. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  103. package/symbols/cim/rasterizingUtils.js +1 -1
  104. package/views/2d/PaddedViewState.js +1 -1
  105. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  106. package/views/2d/engine/vectorTiles/constants.js +1 -1
  107. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
  108. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  109. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  110. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  113. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  114. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  115. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  116. package/views/2d/layers/ParquetLayerView2D.js +1 -1
  117. package/views/2d/layers/features/Processor.js +1 -1
  118. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  119. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  121. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  122. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  123. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  124. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  125. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  128. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  129. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  130. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  131. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
  132. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  133. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  134. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  135. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  136. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
  137. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  138. package/views/3d/camera/constraintUtils.js +1 -1
  139. package/views/3d/camera/intersectionUtils.js +1 -1
  140. package/views/3d/environment/EnvironmentView.js +1 -1
  141. package/views/3d/focusAreaUtils.js +1 -1
  142. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  143. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  144. package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
  145. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  146. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  147. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  148. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  149. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  150. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  151. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  152. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  153. package/views/3d/layers/I3SMeshView3D.js +1 -1
  154. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  155. package/views/3d/layers/TiledLayerView3D.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
  164. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  165. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  166. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  167. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  168. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  169. package/views/3d/layers/i3s/I3SNode.js +1 -1
  170. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  171. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  172. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  173. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  174. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  175. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  176. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  177. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  178. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
  179. package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
  180. package/views/3d/layers/support/uvUtils.js +1 -1
  181. package/views/3d/state/Constraints.js +1 -1
  182. package/views/3d/state/ConstraintsManager.js +1 -1
  183. package/views/3d/state/NearFarHeuristic.js +1 -1
  184. package/views/3d/state/ViewState.js +1 -1
  185. package/views/3d/state/ViewStateManager.js +1 -1
  186. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  187. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  188. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  189. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  190. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  191. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  192. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  193. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  194. package/views/3d/state/utils/navigationUtils.js +1 -1
  195. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  196. package/views/3d/support/RenderCoordsHelper.js +1 -1
  197. package/views/3d/support/SweptSphereVolume.js +1 -1
  198. package/views/3d/support/cameraUtils.js +1 -1
  199. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  200. package/views/3d/support/engineContent/line.js +1 -1
  201. package/views/3d/support/engineContent/marker.js +1 -1
  202. package/views/3d/support/hitTest.js +1 -1
  203. package/views/3d/support/orientedBoundingBox.js +1 -1
  204. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  205. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  206. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  207. package/views/3d/support/sunUtils.js +1 -1
  208. package/views/3d/terrain/ExtentHelper.js +1 -1
  209. package/views/3d/terrain/OverlayManager.js +1 -1
  210. package/views/3d/terrain/OverlayRenderer.js +1 -1
  211. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/Tile.js +1 -1
  215. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  216. package/views/3d/terrain/terrainUtils.js +1 -1
  217. package/views/3d/webgl/RenderCamera.js +1 -1
  218. package/views/3d/webgl-engine/Stage.js +1 -1
  219. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  220. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  222. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  223. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  225. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  228. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  229. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  230. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  231. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  232. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  233. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  234. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  235. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  236. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  237. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  238. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  239. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  240. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  241. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  242. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  243. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  244. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  245. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  246. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  247. package/views/MapView.d.ts +1 -0
  248. package/views/SceneView.js +1 -1
  249. package/views/View2D.js +1 -1
  250. package/views/ViewingMode.js +1 -1
  251. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  252. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  253. package/views/draw/DrawAction.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/DrawTool.js +1 -1
  256. package/views/draw/SegmentDrawAction.js +1 -1
  257. package/views/draw/support/Reshape.js +1 -1
  258. package/views/draw/support/helpMessageUtils.js +1 -1
  259. package/views/draw/support/managers/EditSessionManager.js +1 -1
  260. package/views/interactive/dragEventPipeline.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
  264. package/views/layers/support/editableLayerViews.js +1 -1
  265. package/views/overlay/TextOverlayItem.js +1 -1
  266. package/views/support/DefaultsFromMap.js +1 -1
  267. package/views/support/Scheduler.js +1 -1
  268. package/views/support/spatialReferenceSupport.js +1 -1
  269. package/views/webgl/ShaderTranspiler.js +2 -2
  270. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  271. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  272. package/widgets/BatchAttributeForm.js +1 -1
  273. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  274. package/widgets/Editor/workflowUtils.js +1 -1
  275. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  276. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  277. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  278. package/widgets/FeatureForm.js +1 -1
  279. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  280. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  281. package/widgets/Measurement.js +1 -1
  282. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  283. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  284. package/widgets/Search/support/layerSearchUtils.js +1 -1
  285. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  286. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  287. package/widgets/UtilityNetworkAssociations.js +1 -1
  288. package/widgets/Weather/WeatherViewModel.js +1 -1
  289. package/widgets/Weather/css.js +1 -1
  290. package/widgets/Weather.js +1 -1
  291. package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
  292. package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
  293. package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
  294. package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
  295. package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
  296. package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
  297. package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
  298. package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
  299. package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
  300. package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import{clone as r}from"../../../../core/lang.js";import{fromValues as i,fromArray as a,create as o,ONES as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as c,create as l,ZEROS as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d,ZEROS as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{abortMaybe as p,releaseMaybe as m}from"../../../../core/maybe.js";import{throwIfAbortError as h,throwIfAborted as g}from"../../../../core/promiseUtils.js";import{pt2px as _,onePixelInPoints as ee}from"../../../../core/screenUtils.js";import{numericHash as v}from"../../../../core/string.js";import{dataComponents as y}from"../../../../core/urlUtils.js";import{projectPointToVector as te}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as ne}from"../../../../geometry/support/aaBoundingBox.js";import b from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as x}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as S,CIMSymbolInflatedSizeHelper as re}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as w}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as ie}from"../../../../symbols/support/primitives.js";import ae from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as oe}from"../../../../symbols/support/utils.js";import{createTexture as se,requiresHalfTexelOffset as ce,defaultBoundingBox as le,defaultSymbolSizeRatio as T,defaultTexSize as E}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as D}from"../../terrain/DrapedZ.js";import{VerticalOffsetParameters as O}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointBufferGeometry as k}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as A}from"../../webgl-engine/lib/ManagedTexture.js";import{HUDMaterial as j}from"../../webgl-engine/materials/HUDMaterial.js";import{initFastSymbolUpdatesState as M,updateFastSymbolUpdatesState as N,evaluateModelTransformScale as P,ConvertOptions as F}from"../support/FastSymbolUpdates.js";import{transparentUnit as I}from"./constants.js";import{perBufferPointElevationAligner as L}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as R,needsElevationUpdates2D as z}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as B}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as V}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as ue}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as H}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as W,updateBufferStageObjectGeometry as de,extendPointGraphicElevationContext as G,createBufferStageObject as fe}from"./pointUtils.js";import{hasTransparencyModeSymbol as pe}from"./transparencyUtils.js";var K;const me=c(0,0,1),he=[E*T,E*T];class q extends ue{static{K=pe}static{this.PRIMITIVE_SIZE=he}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[K]=!0}async doLoad(e){this._validateOrThrow();let t=this._prepareMaterialParameters(),n=this._getPrimitive();if(n!=null)this._prepareResourcesPrimitive(t,n);else{let n=oe(this.symbolLayer),r=Y(n);r==null?await this._prepareResourcesHref(t,n,e):await this._prepareResourcesCIM(t,JSON.parse(r),e)}}_validateOrThrow(){if(this._drivenProperties.size)return;let e=H(this._getIconSize());if(e)throw new n(`graphics3diconsymbollayer:invalid-size`,e)}_getIconSize(){let e=this.symbolLayer,t=Math.round(e.size==null?16:_(e.size));return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){let n=this._overrideHelperClass,i=this._cimData;if(n&&i&&i.symbol||this.logger.error(`Can't create texture, CIM data is undefined`),i.primitiveOverrides){i=r(i);let a=i.primitiveOverrides;n.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),n.applyOverrides(i.symbol,a)}let a=v(JSON.stringify(i)),o=this._cimSymbolTextures.get(a);if(o)return o;let s=this._context.sharedResources.cimSymbolRasterizer,c=this._context.renderer&&this._context.renderer.type===`dictionary`?this._context.renderer.fieldMap:null;c&&n.applyDictionaryTextOverrides(i.symbol,e,c,null);let l=this._cimScaleFactorOrFunction==null?1:C(this._cimScaleFactorOrFunction,e);l!==1&&i.symbol&&w(i.symbol,l,!0);let u=S.getEnvelope(i,null,s.resourceManager);if(u?.width&&u.height){let e=u.x+u.width/2,t=u.y+u.height/2,n=i.symbol?.type===`CIMPointSymbol`?re.getPointSymbolHaloPadding(i.symbol,s.resourceManager):0,r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=n>0?Math.ceil((_(n)+1)*r):0,c=s.rasterize({type:`cim`,data:i},u.width,u.height,e,t,1,`esriGeometryPoint`,a,null,r),l=new ae({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=X(`relative`,l),o=new A(c,{width:c?.width??1,height:c?.height??1,reloadable:!0})}else o=new A(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){let{symbolLayer:e,symbol:t,_context:n,_drivenProperties:r,view:i}=this,a=this.symbolLayer.occludedVisibility?.mode??`hidden`;return{anchorPosition:X(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:e.angle!==0||r.rotation,hasVertexRotation:r.rotation,occludedFragmentOpacity:a===`hidden`?void 0:i.state.ensureOccludedFragmentOpacity(!1,a),hasSlicePlane:n.slicePlaneEnabled,verticalOffset:ge(t)?new O(t.verticalOffset):void 0,screenSizePerspective:n.screenSizePerspectiveEnabled?i.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){let n=this._getOutlineSize();if(J(t)&&n===0)throw Error(`Nothing to render`);if(this._outlineSize=n,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,this._context.sharedResources.textures!=null){let n=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>se(t));this._textureHandle=n,e.textureId=n.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=ce(t),e.distanceFieldBoundingBox=le;let r=this._getIconSize();this._size=[r,r],this._symbolTextureRatio=1/T,e.size=i(r*this._symbolTextureRatio,r*this._symbolTextureRatio),this._createMaterials(e)}async _prepareResourcesHref(t,r,i){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;let o=this._getIconSize(),s=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){let c=await e(this._context.sharedResources.textures.fromUrl(r,s,{signal:i}));if(c.ok===!1){h(c.error);let e=`Failed to load (Request for icon resource failed: ${r})`;throw new n(`graphics3diconsymbollayer:request-failed`,e)}this._textureHandle=c.value;let l=c.value.managedTexture;this._size=Z(l,o),t.size=a(this._size),t.textureId=l.id}this._createMaterials(t)}async _prepareResourcesCIM(e,t,n){let{OverrideHelper:r}=await import(`../../../../symbols/cim/OverrideHelper.js`);if(this._overrideHelperClass=r,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){let e=(await import(`../../../../symbols/cim/CIMSymbolRasterizer.js`)).CIMSymbolRasterizer;g(n),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}let i=this._context.sharedResources.cimSymbolRasterizer,a=t,o=a?.symbol,s=[S.normalizeSymbolAndFetchResources(o,i.resourceManager,n)],c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],l=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:l,fields:c,geometryType:`esriGeometryPoint`},a?.primitiveOverrides&&s.push(r.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),s.length>0&&(await Promise.all(s),g(n)),this._context.renderer&&this._context.renderer.type===`dictionary`&&this._context.renderer.scaleExpression){let e=this._context.renderer;if(e.scaleExpression){let t=e.scaleExpression,n=await x(t,this._context.layer.spatialReference),{default:r}=await import(`../../../2d/arcade/callExpressionWithFeature.js`),i=new b(c);this._cimScaleFactorOrFunction=(e,t,a)=>{let o=r(n,e,{$view:a},`esriGeometryPoint`,i,t);return o===null?1:o}}}g(n),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return Q(this.symbolLayer)}_getOutlineSize(){let e=0,t=this.symbolLayer;return t.outline?.size==null?(e=J(this._getPrimitive())?1.5:0,Math.max(e,0)):Math.max(_(t.outline.size),0)}_getOutlineColor(){let e=this._getLayerOpacity(),t=this.symbolLayer?.outline?.color;if(t!=null){let n=t.toUnitRGB(),r=t.a*e;return[n[0],n[1],n[2],r]}return[0,0,0,0]}_getFillColor(){if(J(this._getPrimitive()))return I;let e=this._getPrimitive()==null,t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){let e=this._materialColor;return e==null?this._getPrimitive()==null?d:f:e.toUnitRGBA()}_getFallbackSize(){let e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(t==null?16:Math.round(_(t)))/e}_createCimMaterials(e){let t=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;if(t)return t;let n=$([],e,this._context.focusAreaStyle,this._context.spherical);return this._cimSymbolMaterials.set(e.textureId??0,n),n}_createMaterials(e){this._fastUpdates=M(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,$(this._materials,e,this._context.focusAreaStyle,this._context.spherical)}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=p(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=m(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(e==null)return this._getFallbackSize();let[n,r,i]=e.output;return n===`symbol-value`?1:typeof n==`number`&&isFinite(n)?_(n)/t:typeof i==`number`&&isFinite(i)?_(i)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=W(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let r=this._materials,a=this.view.focusAreasView?.containsGeometry(n)??!0;if(this._cimData){if(!this._cimData.symbol)return null;let n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=this._generateTextureCIM(t,e),o=i(a.parameters.width/n,a.parameters.height/n);r=this._createCimMaterials({textureId:a.id,size:o,...this._cimMaterialParametersInfo})}let o=r[a?0:2];if(n==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;let s=this._getPrimitive()==null,c=e.renderingInfo,l=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(c,this._materialColor,s):null,u=this._getDrivenRotation(c),d=null;if(!this._fastUpdates?.visualVariables.size){let e=this._size,t=e[0]>e[1]?e[0]:e[1];d=this._getScaleFactor(c,t)}let f=d==null?null:i(d,d),p=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(p.mode===`on-the-ground`)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(c,n,o,l,u,f,t.uid):this._createAs3DShape(c,n,o,l,u,f,p,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){let e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(n=>{n.setParameters({color:e}),n.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){let e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){let n=e.stageObject.geometries[0]?.material,r=this._cimData?n?.parameters.textureId:null,i=r?this._cimSymbolMaterials.get(r):this._materials,a=(i?.indexOf(n)??-1)<2,o=i?.[t?a?1:3:a?0:2];o&&o!==n&&e.updateMaterial(o)}updateGeometry(e,t){let n=e.geometry;if(t.type!==`buffer`||this.draped||!n||!this._validateGeometry(n))return!1;let{elevationContext:r,stageObject:i}=t;if(r.mode!==this.getGeometryElevationMode(n))return!1;let a=W(n);if(!a)return!1;r.updateFeatureExpressionFeature(e,this._context.layer);let o=de(i,this._context,a,r);return o!=null&&(t.alignedSampledElevation=o,G(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=R(q.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=z(r)||r===`absolute-height`;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicallyBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(N(this._fastUpdates,t,this._fastVisualVariableConvertOptions())){let e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}else return 0;break;default:return 0}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(r,i){if(!i.resource||i.resource.type!==`partial`)return;let a=i.resource.diff;if(a?.href?.type!==`complete`)return;let o=a.href.newValue,{textures:s}=this._context.sharedResources;if(o==null||s==null||Y(o)!=null)return;let c=this._getIconSize(),l=c*this._context.graphicsCoreOwner.view.state.pixelRatio;r.symbolLayerStatePatches.push(()=>{this._patchTask=p(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,r)=>{let i=await e(s.fromUrl(o,l,{signal:r}));g(r);let a=!i.ok;if(a&&h(i.error),this._textureHandle=m(this._textureHandle),this._patchTask=null,a){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});let e=`Failed to load (Request for icon resource failed: ${o})`;this.logger.error(new n(`graphics3diconsymbollayer:request-failed`,e));return}this._textureHandle=i.value;let u=i.value.managedTexture;this._size=Z(u,c),this._forEachMaterial(e=>{e.setParameters({textureId:u.id}),e.visible=!0})},t))}),delete a.href}_preparePatchRotation(e,t){if(!t.angle||t.angle.type!==`complete`)return;let n=t.angle.newValue??0,r=n!==0||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:n,hasRotation:r}))}),delete t.angle}_defaultElevationInfoNoZ(){return ve}_createAs3DShape(e,t,n,r,i,a,o,s){let c=this.getFastUpdateAttrValues(e),l=this._context.layerViewUid,d=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerViewUid:l}),f=fe(this._context,t,n,{color:r,rotation:i,size:a,centerOffset:u,featureAttribute:c,olidColor:d},o,s);if(f==null)return null;let p=new B(this,f.object,null,L,o);return p.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),p.hiddenIfDeconflicted=!0,p.alignedSampledElevation=f.sampledElevation,p.needsElevationUpdates=z(o.mode)||o.mode===`absolute-height`,p.getScreenSize=this._createScreenSizeGetter(a,c),p.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(p.getScreenSize(),1,e),G(p,t,this._context.elevationProvider),p}_createAsOverlay(e,t,n,r,i,a,o){n.renderPriority=this._renderPriority;let s=l();te(t,s,this._context.overlaySR),s[2]=D;let c=this._context.clippingExtent;if(c!=null&&!ne(c,s))return null;let u=this.getFastUpdateAttrValues(e),d=this._context.layerViewUid,f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:d}),p=this._context.drapeSourceRenderer.rendererContext.localOriginFactory.getOrigin(s),m=k(n,p,{normal:me,position:s,groundDistance:0,color:r,rotation:i,size:a,featureAttribute:u,olidColor:f});m.layerViewUid=d,m.graphicUid=o;let h=new V(this,[m],null,this._context.drapeSourceRenderer);return h.getScreenSize=this._createScreenSizeGetter(a,u),h.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(h.getScreenSize(),1,e),h}_createScreenSizeGetter(e,t){e??=s;let n=this._outlineSize+2;if(this._fastUpdates&&t){let r=e[0]*this._size[0],i=e[1]*this._size[1];return(e=o())=>{let[a,s]=P(ye,this._fastUpdates.materialParameters,t);return e[0]=a*r+n,e[1]=s*i+n,e}}let r=e[0]*this._size[0]+n,i=e[1]*this._size[1]+n;return(e=o())=>(e[0]=r,e[1]=i,e)}_fastVisualVariableConvertOptions(){let e=Math.max(this._size[0],this._size[1]),t=c(e,e,e),n=ee,r=e*n,i=c(r,r,r),a=this._getFallbackSize();return new F({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:i,unitInMeters:n,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:c(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(t=>t.forEach(e))}test(){return{...super.test(),material:this._materials[0]}}}function ge(e){return e&&e.type===`point-3d`&&e.hasVisibleVerticalOffset()}function J(e){return e==null?!1:e===`cross`||e===`x`}function Y(e){let t=y(e);return t?.mediaType===`application/json`?t.data:void 0}function X(e,t){return e===`relative`?i((t.x||0)+.5,-(t.y||0)+.5):e in U?U[e]:U.center}function Z({parameters:e},t){let n=(e.width??1)/(e.height??1);return n>1?[t,Math.round(t/n)]:[Math.round(t*n),t]}function Q(e){return e.resource?.href?null:e.resource?.primitive??ie}function _e(e){return(e.material?.color?.a??1)===1&&Q(e)!=null}const ve={mode:`relative-to-ground`,offset:0},ye=l();function $(e,t,n,r){let i={...t,focusAreaStyle:n};return e[0]=new j(t,r),e[1]=new j(t,r,!0),e[2]=new j(i,r),e[3]=new j(i,r,!0),e}export{q as Graphics3DIconSymbolLayer};
2
+ import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import{clone as r}from"../../../../core/lang.js";import{fromValues as i,fromArray as a,create as o,ONES as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as c,create as l,ZEROS as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d,ZEROS as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{abortMaybe as p,releaseMaybe as m}from"../../../../core/maybe.js";import{throwIfAbortError as h,throwIfAborted as g}from"../../../../core/promiseUtils.js";import{pt2px as _,onePixelInPoints as ee}from"../../../../core/screenUtils.js";import{numericHash as v}from"../../../../core/string.js";import{dataComponents as y}from"../../../../core/urlUtils.js";import{projectPointToVector as te}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as ne}from"../../../../geometry/support/aaBoundingBox.js";import b from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as x}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as S,CIMSymbolInflatedSizeHelper as re}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as w}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as ie}from"../../../../symbols/support/primitives.js";import ae from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as oe}from"../../../../symbols/support/utils.js";import{createTexture as se,requiresHalfTexelOffset as ce,defaultBoundingBox as le,defaultSymbolSizeRatio as T,defaultTexSize as E}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as D}from"../../terrain/DrapedZ.js";import{VerticalOffsetParameters as O}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointBufferGeometry as k}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as A}from"../../webgl-engine/lib/ManagedTexture.js";import{HUDMaterial as j}from"../../webgl-engine/materials/HUDMaterial.js";import{initFastSymbolUpdatesState as M,updateFastSymbolUpdatesState as N,evaluateModelTransformScale as P,ConvertOptions as F}from"../support/FastSymbolUpdates.js";import{transparentUnit as I}from"./constants.js";import{perBufferPointElevationAligner as L}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as R,needsElevationUpdates2D as z}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as B}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as V}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as ue}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as H}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as W,updateBufferStageObjectGeometry as de,extendPointGraphicElevationContext as G,createBufferStageObject as fe}from"./pointUtils.js";import{hasTransparencyModeSymbol as pe}from"./transparencyUtils.js";var K;const me=c(0,0,1),he=[E*T,E*T];class q extends ue{static{K=pe}static{this.PRIMITIVE_SIZE=he}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[K]=!0}async doLoad(e){this._validateOrThrow();let t=this._prepareMaterialParameters(),n=this._getPrimitive();if(n!=null)this._prepareResourcesPrimitive(t,n);else{let n=oe(this.symbolLayer),r=Y(n);r==null?await this._prepareResourcesHref(t,n,e):await this._prepareResourcesCIM(t,JSON.parse(r),e)}}_validateOrThrow(){if(this._drivenProperties.size)return;let e=H(this._getIconSize());if(e)throw new n(`graphics3diconsymbollayer:invalid-size`,e)}_getIconSize(){let e=this.symbolLayer,t=Math.round(e.size==null?16:_(e.size));return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){let n=this._overrideHelperClass,i=this._cimData;if(n&&i&&i.symbol||this.logger.error(`Can't create texture, CIM data is undefined`),i.primitiveOverrides){i=r(i);let a=i.primitiveOverrides;n.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),n.applyOverrides(i.symbol,a)}let a=v(JSON.stringify(i)),o=this._cimSymbolTextures.get(a);if(o)return o;let s=this._context.sharedResources.cimSymbolRasterizer,c=this._context.renderer&&this._context.renderer.type===`dictionary`?this._context.renderer.fieldMap:null;c&&n.applyDictionaryTextOverrides(i.symbol,e,c,null);let l=this._cimScaleFactorOrFunction==null?1:C(this._cimScaleFactorOrFunction,e);l!==1&&i.symbol&&w(i.symbol,l,!0);let u=S.getEnvelope(i,null,s.resourceManager);if(u?.width&&u.height){let e=u.x+u.width/2,t=u.y+u.height/2,n=i.symbol?.type===`CIMPointSymbol`?re.getPointSymbolHaloPadding(i.symbol,s.resourceManager):0,r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=n>0?Math.ceil((_(n)+1)*r):0,c=s.rasterize({type:`cim`,data:i},u.width,u.height,e,t,1,`esriGeometryPoint`,a,null,r),l=new ae({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=X(`relative`,l),o=new A(c,{width:c?.width??1,height:c?.height??1,reloadable:!0})}else o=new A(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){let{symbolLayer:e,symbol:t,_context:n,_drivenProperties:r,view:i}=this,a=this.symbolLayer.occludedVisibility?.mode??`hidden`;return{anchorPosition:X(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:e.angle!==0||r.rotation,hasVertexRotation:r.rotation,occludedFragmentOpacity:a===`hidden`?void 0:i.state.ensureOccludedFragmentOpacity(!1,a),hasSlicePlane:n.slicePlaneEnabled,verticalOffset:ge(t)?new O(t.verticalOffset):void 0,screenSizePerspective:n.screenSizePerspectiveEnabled?i.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){let n=this._getOutlineSize();if(J(t)&&n===0)throw Error(`Nothing to render`);if(this._outlineSize=n,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,this._context.sharedResources.textures!=null){let n=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>se(t));this._textureHandle=n,e.textureId=n.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=ce(t),e.distanceFieldBoundingBox=le;let r=this._getIconSize();this._size=[r,r],this._symbolTextureRatio=1/T,e.size=i(r*this._symbolTextureRatio,r*this._symbolTextureRatio),this._createMaterials(e)}async _prepareResourcesHref(t,r,i){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;let o=this._getIconSize(),s=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){let c=await e(this._context.sharedResources.textures.fromUrl(r,s,{signal:i}));if(c.ok===!1){h(c.error);let e=`Failed to load (Request for icon resource failed: ${r})`;throw new n(`graphics3diconsymbollayer:request-failed`,e)}this._textureHandle=c.value;let l=c.value.managedTexture;this._size=Z(l,o),t.size=a(this._size),t.textureId=l.id}this._createMaterials(t)}async _prepareResourcesCIM(e,t,n){let{OverrideHelper:r}=await import(`../../../../symbols/cim/OverrideHelper.js`);if(this._overrideHelperClass=r,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){let e=(await import(`../../../../symbols/cim/CIMSymbolRasterizer.js`)).CIMSymbolRasterizer;g(n),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}let i=this._context.sharedResources.cimSymbolRasterizer,a=t,o=a?.symbol,s=[S.normalizeSymbolAndFetchResources(o,i.resourceManager,n)],c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],l=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:l,fields:c,geometryType:`esriGeometryPoint`},a?.primitiveOverrides&&s.push(r.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),s.length>0&&(await Promise.all(s),g(n)),this._context.renderer&&this._context.renderer.type===`dictionary`&&this._context.renderer.scaleExpression){let e=this._context.renderer;if(e.scaleExpression){let t=e.scaleExpression,n=await x(t,this._context.layer.spatialReference),{default:r}=await import(`../../../2d/arcade/callExpressionWithFeature.js`),i=new b(c);this._cimScaleFactorOrFunction=(e,t,a)=>{let o=r(n,e,{$view:a},`esriGeometryPoint`,i,t);return o===null?1:o}}}g(n),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return Q(this.symbolLayer)}_getOutlineSize(){let e=0,t=this.symbolLayer;return t.outline?.size==null?(e=J(this._getPrimitive())?1.5:0,Math.max(e,0)):Math.max(_(t.outline.size),0)}_getOutlineColor(){let e=this._getLayerOpacity(),t=this.symbolLayer?.outline?.color;if(t!=null){let n=t.toUnitRGB(),r=t.a*e;return[n[0],n[1],n[2],r]}return[0,0,0,0]}_getFillColor(){if(J(this._getPrimitive()))return I;let e=this._getPrimitive()==null,t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){let e=this._materialColor;return e==null?this._getPrimitive()==null?d:f:e.toUnitRGBA()}_getFallbackSize(){let e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(t==null?16:Math.round(_(t)))/e}_createCimMaterials(e){let t=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;if(t)return t;let n=$([],e,this._context.focusAreaStyle,this._context.spherical);return this._cimSymbolMaterials.set(e.textureId??0,n),n}_createMaterials(e){this._fastUpdates=M(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,$(this._materials,e,this._context.focusAreaStyle,this._context.spherical)}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=p(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=m(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(e==null)return this._getFallbackSize();let[n,r,i]=e.output;return n===`symbol-value`?1:typeof n==`number`&&isFinite(n)?_(n)/t:typeof i==`number`&&isFinite(i)?_(i)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=W(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let r=this._materials,a=this.view.focusAreasView?.containsGeometry(n)??!0;if(this._cimData){if(!this._cimData.symbol)return null;let n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=this._generateTextureCIM(t,e),o=i(a.parameters.width/n,a.parameters.height/n);r=this._createCimMaterials({textureId:a.id,size:o,...this._cimMaterialParametersInfo})}let o=r[a?0:2];if(n==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;let s=this._getPrimitive()==null,c=e.renderingInfo,l=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(c,this._materialColor,s):null,u=this._getDrivenRotation(c),d=null;if(!this._fastUpdates?.visualVariables.size){let e=this._size,t=e[0]>e[1]?e[0]:e[1];d=this._getScaleFactor(c,t)}let f=d==null?null:i(d,d),p=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(p.mode===`on-the-ground`)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(c,n,o,l,u,f,t.uid):this._createAs3DShape(c,n,o,l,u,f,p,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){let e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(n=>{n.setParameters({color:e}),n.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){let e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){let n=e.stageObject.geometries[0]?.material,r=this._cimData?n?.parameters.textureId:null,i=r?this._cimSymbolMaterials.get(r):this._materials,a=(i?.indexOf(n)??-1)<2,o=i?.[t?a?1:3:a?0:2];o&&o!==n&&e.updateMaterial(o)}updateGeometry(e,t){let n=e.geometry;if(t.type!==`buffer`||this.draped||!n||!this._validateGeometry(n))return!1;let{elevationContext:r,stageObject:i}=t;if(r.mode!==this.getGeometryElevationMode(n))return!1;let a=W(n);if(!a)return!1;r.updateFeatureExpressionFeature(e,this._context.layer);let o=de(i,this._context,a,r);return o!=null&&(t.alignedSampledElevation=o,G(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=R(q.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=z(r)||r===`absolute-height`;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicallyBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){if(N(this._fastUpdates,t,this._fastVisualVariableConvertOptions())){let e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}else return 0}else return 0;return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(r,i){if(!i.resource||i.resource.type!==`partial`)return;let a=i.resource.diff;if(a?.href?.type!==`complete`)return;let o=a.href.newValue,{textures:s}=this._context.sharedResources;if(o==null||s==null||Y(o)!=null)return;let c=this._getIconSize(),l=c*this._context.graphicsCoreOwner.view.state.pixelRatio;r.symbolLayerStatePatches.push(()=>{this._patchTask=p(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,r)=>{let i=await e(s.fromUrl(o,l,{signal:r}));g(r);let a=!i.ok;if(a&&h(i.error),this._textureHandle=m(this._textureHandle),this._patchTask=null,a){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});let e=`Failed to load (Request for icon resource failed: ${o})`;this.logger.error(new n(`graphics3diconsymbollayer:request-failed`,e));return}this._textureHandle=i.value;let u=i.value.managedTexture;this._size=Z(u,c),this._forEachMaterial(e=>{e.setParameters({textureId:u.id}),e.visible=!0})},t))}),delete a.href}_preparePatchRotation(e,t){if(!t.angle||t.angle.type!==`complete`)return;let n=t.angle.newValue??0,r=n!==0||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:n,hasRotation:r}))}),delete t.angle}_defaultElevationInfoNoZ(){return ve}_createAs3DShape(e,t,n,r,i,a,o,s){let c=this.getFastUpdateAttrValues(e),l=this._context.layerViewUid,d=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerViewUid:l}),f=fe(this._context,t,n,{color:r,rotation:i,size:a,centerOffset:u,featureAttribute:c,olidColor:d},o,s);if(f==null)return null;let p=new B(this,f.object,null,L,o);return p.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),p.hiddenIfDeconflicted=!0,p.alignedSampledElevation=f.sampledElevation,p.needsElevationUpdates=z(o.mode)||o.mode===`absolute-height`,p.getScreenSize=this._createScreenSizeGetter(a,c),p.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(p.getScreenSize(),1,e),G(p,t,this._context.elevationProvider),p}_createAsOverlay(e,t,n,r,i,a,o){n.renderPriority=this._renderPriority;let s=l();te(t,s,this._context.overlaySR),s[2]=D;let c=this._context.clippingExtent;if(c!=null&&!ne(c,s))return null;let u=this.getFastUpdateAttrValues(e),d=this._context.layerViewUid,f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:d}),p=this._context.drapeSourceRenderer.rendererContext.localOriginFactory.getOrigin(s),m=k(n,p,{normal:me,position:s,groundDistance:0,color:r,rotation:i,size:a,featureAttribute:u,olidColor:f});m.layerViewUid=d,m.graphicUid=o;let h=new V(this,[m],null,this._context.drapeSourceRenderer);return h.getScreenSize=this._createScreenSizeGetter(a,u),h.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(h.getScreenSize(),1,e),h}_createScreenSizeGetter(e,t){e??=s;let n=this._outlineSize+2;if(this._fastUpdates&&t){let r=e[0]*this._size[0],i=e[1]*this._size[1];return(e=o())=>{let[a,s]=P(ye,this._fastUpdates.materialParameters,t);return e[0]=a*r+n,e[1]=s*i+n,e}}let r=e[0]*this._size[0]+n,i=e[1]*this._size[1]+n;return(e=o())=>(e[0]=r,e[1]=i,e)}_fastVisualVariableConvertOptions(){let e=Math.max(this._size[0],this._size[1]),t=c(e,e,e),n=ee,r=e*n,i=c(r,r,r),a=this._getFallbackSize();return new F({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:i,unitInMeters:n,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:c(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(t=>t.forEach(e))}test(){return{...super.test(),material:this._materials[0]}}}function ge(e){return e&&e.type===`point-3d`&&e.hasVisibleVerticalOffset()}function J(e){return e==null?!1:e===`cross`||e===`x`}function Y(e){let t=y(e);return t?.mediaType===`application/json`?t.data:void 0}function X(e,t){return e===`relative`?i((t.x||0)+.5,-(t.y||0)+.5):e in U?U[e]:U.center}function Z({parameters:e},t){let n=(e.width??1)/(e.height??1);return n>1?[t,Math.round(t/n)]:[Math.round(t*n),t]}function Q(e){return e.resource?.href?null:e.resource?.primitive??ie}function _e(e){return(e.material?.color?.a??1)===1&&Q(e)!=null}const ve={mode:`relative-to-ground`,offset:0},ye=l();function $(e,t,n,r){let i={...t,focusAreaStyle:n};return e[0]=new j(t,r),e[1]=new j(t,r,!0),e[2]=new j(i,r),e[3]=new j(i,r,!0),e}export{q as Graphics3DIconSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as r,clone as i,ones as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{onePixelInPoints as o,pt2px as s,onePointInPixels as c}from"../../../../core/screenUtils.js";import{create as l,fromBuffer as u,intersectsClippingArea as d,empty as f,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{debugFlags as g}from"../../support/debugFlags.js";import{selectLocalOrigin as _,createBufferGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as y,geometryToRenderInfoDraped as b}from"../../support/renderInfoUtils/line.js";import{BufferObject3D as x}from"../../webgl-engine/lib/BufferObject3D.js";import{createLineMarkerBufferGeometry as S}from"../../webgl-engine/materials/internal/lineMarkerBufferUtils.js";import{LineMarkerMaterial as C}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as w,patternHidesLine as T}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as E}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as D,updateFastSymbolUpdatesState as O,getAttributeValue as k,getSizeAttributeValue as A,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{perBufferLineElevationAligner as M}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as N,needsElevationUpdates2D as P}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as F}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as I}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{parseCapType as z,computeSymbolLayerIndex as B,parseLineMarkerStyle as V}from"./lineUtils.js";const H=[`polyline`];class U extends L{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?o:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:B(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:z(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:w(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(o.hasVertexColor=this._hasDrivenColorOrOpacity,o.hasVertexSize=this._drivenProperties.size,o.hasLineDistance=o.stipplePattern!=null,this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new E(this._getMaterialParameters(!1,0),this.view),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new E({...this._getMaterialParameters(!1,1),wireframe:!0},this.view),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new C({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:V(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(i[3]=t?.output??this._getFallbackOpacity()),i}_getDrivenMarkerColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackMarkerOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(i[3]=t?.output??this._getFallbackMarkerOpacity()),i}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,H,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:{let e=this._fastUpdates;if(O(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof E&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(O(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof C&&e.setParameters(n.materialParameters);else return 0}break;default:return 0}return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=z(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=N(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=P(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicallyBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=W(e.graphic.geometry);if(r==null)return null;let i=[],a=[],o=l(),s=y(r,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,r.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,l=r.mapPositions;if(this._context.clippingExtent!=null&&(u(l,o),!d(o,this._context.clippingExtent)))continue;let f=this._createGeometryParts(e,c,l,1,n);a.push(f),i.push(f.line),f.wireframe!=null&&i.push(f.wireframe),f.marker!=null&&i.push(f.marker)}if(i.length===0)return null;let c=this._context.layerViewUid,f=new x({geometries:i,castShadow:!1,layerViewUid:c,graphicUid:n}),p=new F(this,f,null,(e,t,n,r,i)=>M(e,t,n,r,i,a),t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=P(t.mode),p}_createGeometryParts(e,t,n,r,i){let a=r===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o=this._fastUpdates?.visualVariables.color,s=this._fastUpdates?.visualVariables.size,c=this._fastUpdates?.visualVariables.opacity,l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:l}),{renderingInfo:d}=e,f={position:t,size:s?null:this._getDrivenSize(d),color:o?null:this._getDrivenColor(d),sizeFeature:s?A(s,d.size):null,colorFeature:o?k(o,d.color):null,opacityFeature:c?k(c,d.opacity):null},p=r===0?this._context.drapeSourceRenderer.rendererContext.localOriginFactory:this._context.localOriginFactory,m=_(t,p),h={overlayInfo:a,removeDuplicateStartEnd:!1,mapPositions:n,attributeData:f},y=v(this._lineMaterial,h,m,u),b=g.LINE_WIREFRAMES?v(this._wireframeLineMaterial,h,m,u):null,x=this._markerMaterial,C=null;x!=null&&(h.attributeData={...f,color:o?null:this._getDrivenMarkerColor(d)},C=S(x,h,m));for(let e of[y,C,b])e!=null&&(e.layerViewUid=l,e.graphicUid=i);return{line:y,marker:C,wireframe:b}}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=g.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=l(),s=f(),c=b(n,this._context.overlaySR);this._logGeometryCreationWarnings(c,n.paths,`paths`,`LineSymbol3DLayer`);for(let n of c.lines){if(u(n.position,o),!d(o,this._context.clippingExtent))continue;p(s,o);let r=this._createGeometryParts(e,n.position,void 0,0,t.uid);r.marker!=null&&a.push(r.marker),a.push(r.line),r.wireframe!=null&&a.push(r.wireframe)}return new I(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return T(this.symbolLayer.pattern)}_computeMaterialWidth(e,t){return t?this._drivenProperties.size?1:e??1:(e??=o,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?c:1:s(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let a=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(a);n.useMaterialColor&&G(i(o),this._materials[2],e),this._patternHidesLine&&(o[3]=0),G(o,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:V(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let n=this._getFallbackSize(),{size:r}=this.symbolLayer;return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:t(r,r,r),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(R):this._getFallbackOpacityAndColor(R),fallbackSize:t(n,n,n)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:s(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
2
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as r,clone as i,ones as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{onePixelInPoints as o,pt2px as s,onePointInPixels as c}from"../../../../core/screenUtils.js";import{create as l,fromBuffer as u,intersectsClippingArea as d,empty as f,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{debugFlags as g}from"../../support/debugFlags.js";import{selectLocalOrigin as _,createBufferGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as y,geometryToRenderInfoDraped as b}from"../../support/renderInfoUtils/line.js";import{BufferObject3D as x}from"../../webgl-engine/lib/BufferObject3D.js";import{createLineMarkerBufferGeometry as S}from"../../webgl-engine/materials/internal/lineMarkerBufferUtils.js";import{LineMarkerMaterial as C}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as w,patternHidesLine as T}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as E}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as D,updateFastSymbolUpdatesState as O,getAttributeValue as k,getSizeAttributeValue as A,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{perBufferLineElevationAligner as M}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as N,needsElevationUpdates2D as P}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as F}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as I}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{parseCapType as z,computeSymbolLayerIndex as B,parseLineMarkerStyle as V}from"./lineUtils.js";const H=[`polyline`];class U extends L{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?o:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:B(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:z(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:w(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(o.hasVertexColor=this._hasDrivenColorOrOpacity,o.hasVertexSize=this._drivenProperties.size,o.hasLineDistance=o.stipplePattern!=null,this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new E(this._getMaterialParameters(!1,0),this.view),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new E({...this._getMaterialParameters(!1,1),wireframe:!0},this.view),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new C({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:V(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(i[3]=t?.output??this._getFallbackOpacity()),i}_getDrivenMarkerColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackMarkerOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(i[3]=t?.output??this._getFallbackMarkerOpacity()),i}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,H,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){let e=this._fastUpdates;if(O(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof E&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(O(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof C&&e.setParameters(n.materialParameters);else return 0}else return 0;return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=z(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=N(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=P(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicallyBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=W(e.graphic.geometry);if(r==null)return null;let i=[],a=[],o=l(),s=y(r,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,r.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,l=r.mapPositions;if(this._context.clippingExtent!=null&&(u(l,o),!d(o,this._context.clippingExtent)))continue;let f=this._createGeometryParts(e,c,l,1,n);a.push(f),i.push(f.line),f.wireframe!=null&&i.push(f.wireframe),f.marker!=null&&i.push(f.marker)}if(i.length===0)return null;let c=this._context.layerViewUid,f=new x({geometries:i,castShadow:!1,layerViewUid:c,graphicUid:n}),p=new F(this,f,null,(e,t,n,r,i)=>M(e,t,n,r,i,a),t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=P(t.mode),p}_createGeometryParts(e,t,n,r,i){let a=r===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o=this._fastUpdates?.visualVariables.color,s=this._fastUpdates?.visualVariables.size,c=this._fastUpdates?.visualVariables.opacity,l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:l}),{renderingInfo:d}=e,f={position:t,size:s?null:this._getDrivenSize(d),color:o?null:this._getDrivenColor(d),sizeFeature:s?A(s,d.size):null,colorFeature:o?k(o,d.color):null,opacityFeature:c?k(c,d.opacity):null},p=r===0?this._context.drapeSourceRenderer.rendererContext.localOriginFactory:this._context.localOriginFactory,m=_(t,p),h={overlayInfo:a,removeDuplicateStartEnd:!1,mapPositions:n,attributeData:f},y=v(this._lineMaterial,h,m,u),b=g.LINE_WIREFRAMES?v(this._wireframeLineMaterial,h,m,u):null,x=this._markerMaterial,C=null;x!=null&&(h.attributeData={...f,color:o?null:this._getDrivenMarkerColor(d)},C=S(x,h,m));for(let e of[y,C,b])e!=null&&(e.layerViewUid=l,e.graphicUid=i);return{line:y,marker:C,wireframe:b}}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=g.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=l(),s=f(),c=b(n,this._context.overlaySR);this._logGeometryCreationWarnings(c,n.paths,`paths`,`LineSymbol3DLayer`);for(let n of c.lines){if(u(n.position,o),!d(o,this._context.clippingExtent))continue;p(s,o);let r=this._createGeometryParts(e,n.position,void 0,0,t.uid);r.marker!=null&&a.push(r.marker),a.push(r.line),r.wireframe!=null&&a.push(r.wireframe)}return new I(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return T(this.symbolLayer.pattern)}_computeMaterialWidth(e,t){return t?this._drivenProperties.size?1:e??1:(e??=o,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?c:1:s(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let a=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(a);n.useMaterialColor&&G(i(o),this._materials[2],e),this._patternHidesLine&&(o[3]=0),G(o,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:V(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let n=this._getFallbackSize(),{size:r}=this.symbolLayer;return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:t(r,r,r),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(R):this._getFallbackOpacityAndColor(R),fallbackSize:t(n,n,n)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:s(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{normalFromMat4 as n,fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as o,invert as s,getTranslation as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l,IDENTITY as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,add as m,scale as h,transformMat4 as g,transformMat3 as _,normalize as v,scaleAndAdd as y,subtract as b,cross as x,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as te,ZEROS as ne,ONES as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as ie}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{releaseMaybe as ae}from"../../../../core/maybe.js";import{isPromiseLike as oe}from"../../../../core/promiseUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as se}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as ce}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as le}from"../../../../geometry/projectionUtils.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{t as w}from"../../../../chunks/vec3.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{transformNormal as D,transformVectorENUPlateCarree as O,transformVectorWMPlateCarree as k,projectNormalToPCPF as _e,transformTangent as A,projectTangentToPCPF as ve}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as ye}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{projectLocalVertexSpaceToPCPF as be}from"../../../../geometry/support/meshUtils/vertexSpaceConversion.js";import{isRelativeVertexSpace as xe,isAbsoluteVertexSpace as Se}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as j,isPlateCarree as M}from"../../../../geometry/support/spatialReferenceUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as Ce}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as we}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as Te}from"../../glTF/internal/resourceUtils.js";import{convertMeshTextureTransformToGLTF as N,getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{debugFlags as F}from"../../support/debugFlags.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{Geometry as L}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Ee}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as De}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Oe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as R}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as ke,advancedMRRFactors as Ae,schematicMRRFactors as je}from"../../webgl-engine/materials/pbrUtils.js";import{hasEdges as Me,createMaterial as Ne}from"../support/edgeUtils.js";import{defaultSymbolLayerMemoryComplexity as Pe}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as Fe}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Re,nanFallbackColor as ze}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as Be,MeshFastUpdateProcessor as Ve}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as He}from"./olidUtils.js";import{SymbolComplexity as Ue}from"./SymbolComplexity.js";const We=[`mesh`];class Ge extends Re{constructor(e,t,n,r){super(e,t,n,r,Ce(t)),this._materialInfoCache=new Be,this._fastUpdateProcessor=new Ve,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){F.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new R({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new R({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new R({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,We,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicallyBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateMeshTransform(e,t,n,r,i){if(!e.fastTransformUpdatesAllowed)return!1;let a=e.fastTransformUpdatesEnabled;switch(i){case 0:if(a)return!0;break;case 1:if(!a)return!0}let o=this._context.renderCoordsHelper.spatialReference,s=it,{origin:c,transform:l}=n;if(!C(t.spatialReference,p(J,c.x,c.y,c.z??0),s,o))return!1;switch(i){case void 0:a||this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context,!0);break;case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:if(this._fastUpdateProcessor.disable(e,this._materialInfoCache),t.vertexSpace.type===`local`)return!1}e.updateFastLocalOrigin(s,l,this._context.localOriginFactory,!1);let{elevationContext:u}=e;u.centerInElevationSR=this._getCenterInElevationSR(s);let{elevationProvider:d,renderCoordsHelper:f}=this._context;return e.alignedSampledElevation=z(e,u,d.spatialReference,(e,t)=>V(e,d,u,f,t),f,s),e.updateTransform(s,l,this._context.isAsync,r),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Pe(this.symbol,this.symbolLayer),resourceBytes:e},n=Me(this.symbolLayer)?2:0;return new Ue({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=G(i),p=G(a),m=K(o),h=G(s),g=K(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=G(i),g=K(a),_=G(s),v=G(u),y=K(d),b=G(f),x=K(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${x}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=N(o),r.normalTextureTransform=N(c),r.emissiveTextureTransform=N(d),r.occlusionTextureTransform=N(p),r.metallicRoughnessTextureTransform=N(a)}return r}_getInternalTexture(e,t=!1,n=1){let r=tt(e);if(!r)return null;let i=`${e.contentHash}/${n}`,a=this._textures.get(i);if(a){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(a.id);return n!=null&&!oe(n)&&(a.events.on(`unloaded`,()=>t=ae(t)),t=n),a}let o=null,s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:Qe(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};return Te(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=n!==1,c.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),a=new Ee(o,c),this._textures.set(i,a),a.events.on(`loaded`,()=>this.updateComplexity()),a.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(a),a.events.on(`unloaded`,()=>{this._textures.delete(i)}),a}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=te(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&et(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?f:e.normalTextureTransform?.scale;t.normalScale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=ie;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=ze}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=we(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&($e(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=ke({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?ne:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:ne,diffuse:re,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?je:[s.metallic,s.roughness,Ae[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new Oe(d,this._context.spherical);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return Fe(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicallyBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let r=t.length,a=e.spatialReference.isGeographic?20015077/180:1,o=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),s=[],c=[],l=t[0].transformation,u=n(i(),l);for(let e=0;e<r;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,i=n.indices;for(let e=0;e<i.length;e+=3)U(r,i,e,Z),Ze(r,i,e,J,Y,X),m(J,J,Y),m(J,J,X),h(J,J,1/3),g(J,J,l),s.push(...J),_(Z,Z,u),v(Z,Z),y(J,J,Z,o),s.push(...J),c.push(c.length),c.push(c.length)}return s.length?new L(this._debugFaceNormalMaterial,[[`position`,new I(s,c,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,a,o,s){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=s*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=[],m=t[0].transformation,h=n(i(),m);a===`tangent`&&r(h,m);for(let e=0;e<c;e++){let n=t[e],r=n.attributes.get(`position`),i=n.attributes.get(a);if(!r||!i)continue;let o=r.data,s=r.indices,c=i.data,l=i.indices;for(let e=0;e<s.length;e++){let t=s[e]*3,n=l[e]*i.stride;p(J,o[t+0],o[t+1],o[t+2]),g(J,J,m),d.push(...J),p(Y,c[n+0],c[n+1],c[n+2]),_(Y,Y,h),v(Y,Y),y(J,J,Y,u),d.push(...J),f.push(f.length),f.push(f.length)}}return d.length?new L(o,[[`position`,new I(d,f,3,!0)]],null):null}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;if(F.DRAW_MESH_GEOMETRY_NORMALS){let e=this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),n=this._createFaceDebugNormals(i,o);e&&o.push(e),t&&o.push(t),n&&o.push(n)}let c=this._context.layerViewUid,l=new De({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Ne(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new Le(o[0].material,u,this._context.slicePlaneEnabled):null,f=new Ie(this,l,null,z,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=B(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=z(f,n,p.spatialReference,(e,t)=>V(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!xe(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{viewingMode:a}=i.state,o=i.spatialReference;return a===1&&r===`local`||a===2&&j(o,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=S(),n=p(ot,e[12],e[13],e[14]);return ce(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t,n){let r=n.position,i=r,a;if(t.reprojection===0)return{position:i,georeferencedPositionBuffer:a};let o=t.reprojection===1?t.transformBeforeProject:null;o&&(i=w(new Float64Array(i.length),i,o));let{normal:s,tangent:c}=n;!this._passthroughReprojectionInfo(t)&&(s||c)&&(a=i);let l=i===r||i===a?new Float64Array(i.length):i;return se(i,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:a}}_createNormalBuffer(e,t,n,r,i){let a=i.normal;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=D(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,0,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,0,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return _e(o,n,e.spatialReference,t,u,l)}_createTangentBuffer(e,t,n,r,i){let a=i.tangent;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=A(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,1,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,1,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return ve(o,n,e.spatialReference,t,u,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),s=o.reprojection===1&&o.convertLocalVertexSpace,c=s&&e.vertexSpace.type===`local`?be(e,e.vertexSpace,this._context.renderCoordsHelper.spatialReference):null;if(s&&!c)return this.logger.warn(`Local mesh vertex space could not be converted for rendering`),null;let{position:l,georeferencedPositionBuffer:u}=c?{position:c.position,georeferencedPositionBuffer:null}:this._createPositionBuffer(e,o,e.vertexAttributes),d=nt(e),f=this._createSymbolColorBuffer(t),p=c?c.normal:this._createNormalBuffer(e,l,u,o,e.vertexAttributes),m=c?c.tangent:this._createTangentBuffer(e,l,u,o,e.vertexAttributes),h=i,{geometryTransformation:g}=o,{transformation:_,position:v,normal:y,tangent:b}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:l,normal:p,tangent:m}:this._expressInOriginLocalSpace(e,l,p,m,g);return{positionBuffer:v,normalBuffer:y,tangentBuffer:b,uvBuffer:h,colorBuffer:d,symbolColorBuffer:f,objectTransformation:_,geometryTransformation:g}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`,r=t.type===`local`&&this._context.graphicsCoreOwner.view.state.isGlobal,i=n?+!j(this._context.renderCoordsHelper.spatialReference,e.spatialReference):+!!r;if(Se(t))return{reprojection:i,geometryTransformation:l()};let s=t.origin,c=e.transform?.localMatrix??u;if(i===0){let t=l();return C(e.spatialReference,s,t,this._context.renderCoordsHelper.spatialReference),{reprojection:i,objectTransformation:t,geometryTransformation:d(c)}}if(r)return{reprojection:i,convertLocalVertexSpace:!0,geometryTransformation:d(c)};let f=a(l(),s);return o(f,f,c),{reprojection:i,transformBeforeProject:f,geometryTransformation:l()}}_expressInOriginLocalSpace(e,t,n,r,i){let a=this._context.renderCoordsHelper.spatialReference,c=e.origin;q[0]=c.x,q[1]=c.y,q[2]=c.z??0;let u=l();C(e.spatialReference,q,u,a),o(Q,u,i),s(Q,Q);let{position:d,normal:f,tangent:p}=e.vertexAttributes,m=t===d?new Float64Array(t.length):t;w(m,t,Q);let h=n?n===f?new Float32Array(n.length):n:null,g=r?r===p?new Float32Array(r.length):r:null;return n&&h&&D(n,h,Q),r&&g&&A(r,g,Q),{transformation:u,position:m,normal:h,tangent:g}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=ye(e,t??e.spatialReference);return n?(ue(n,$),!de($,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!le(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:l,tangentBuffer:u,objectTransformation:d,geometryTransformation:f}=r,p=e.components??at,m=[],h=!1,g=c(J,d),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=Ke(e,t);if(r.length===0)continue;let c=qe(i,l,t,r);c.didFlipNormals&&(h=!0);let d=[[`position`,new I(i,r,3,!0)],[`normal`,new I(c.normals,c.indices,3,!0)]];o&&d.push([`color`,new I(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new I(s,p,4,!0)])),a&&d.push([`uv0`,new I(a,r,2,!0)]),u&&d.push([`tangent`,new I(u,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),He(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new L(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:d}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){let{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:n}=e;return t===2&&n.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class H{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function Ke(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function qe(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Ye(e,t,n,r);case`flat`:return Je(e,r);case`smooth`:return Xe(e,r)}}function Je(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=U(e,t,i,Z);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new H(n,r,!1)}function Ye(e,t,n,r){if(t==null)return Je(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){U(e,r,n,Z);for(let e=0;e<3;e++){let a=r[n+e]*3;J[0]=t[a],J[1]=t[a+1],J[2]=t[a+2],ee(Z,J)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new H(t,r,i)}function Xe(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=U(e,t,r,Z);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:S(),count:0},n[a]=o),m(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(v(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new H(r,i,!1)}function Ze(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function U(e,t,n,r){return Ze(e,t,n,J,Y,X),b(Y,Y,J),b(X,X,J),x(J,Y,X),v(r,J),r}function Qe(e=`repeat`){if(typeof e==`string`){let t=W(e);return{s:t,t}}return{s:W(e.horizontal),t:W(e.vertical)}}function W(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function $e(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function et(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function tt(e){return e.data??e.url}function G(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function K(e){let{offset:t,scale:n,rotation:r}=e??rt;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function nt(e){return e.vertexAttributes.color}const rt=new ge,q=S(),J=S(),Y=S(),X=S(),Z=S(),Q=l(),it=l(),$=fe(),at=[new me],ot=S();export{Ge as Graphics3DMeshFillSymbolLayer};
2
+ import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{normalFromMat4 as n,fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as o,invert as s,getTranslation as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l,IDENTITY as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,add as m,scale as h,transformMat4 as g,transformMat3 as _,normalize as v,scaleAndAdd as y,subtract as b,cross as x,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as te,ZEROS as ne,ONES as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as ie}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{releaseMaybe as ae}from"../../../../core/maybe.js";import{isPromiseLike as oe}from"../../../../core/promiseUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as se}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as ce}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as le}from"../../../../geometry/projectionUtils.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{t as w}from"../../../../chunks/vec3.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{transformNormal as D,transformVectorENUPlateCarree as O,transformVectorWMPlateCarree as k,projectNormalToPCPF as _e,transformTangent as A,projectTangentToPCPF as ve}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as ye}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{projectLocalVertexSpaceToPCPF as be}from"../../../../geometry/support/meshUtils/vertexSpaceConversion.js";import{isRelativeVertexSpace as xe,isAbsoluteVertexSpace as Se}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as j,isPlateCarree as M}from"../../../../geometry/support/spatialReferenceUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as Ce}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as we}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as Te}from"../../glTF/internal/resourceUtils.js";import{convertMeshTextureTransformToGLTF as N,getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{debugFlags as F}from"../../support/debugFlags.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{Geometry as L}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Ee}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as De}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Oe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as R}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as ke,advancedMRRFactors as Ae,schematicMRRFactors as je}from"../../webgl-engine/materials/pbrUtils.js";import{hasEdges as Me,createMaterial as Ne}from"../support/edgeUtils.js";import{defaultSymbolLayerMemoryComplexity as Pe}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as Fe}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Re,nanFallbackColor as ze}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as Be,MeshFastUpdateProcessor as Ve}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as He}from"./olidUtils.js";import{SymbolComplexity as Ue}from"./SymbolComplexity.js";const We=[`mesh`];class Ge extends Re{constructor(e,t,n,r){super(e,t,n,r,Ce(t)),this._materialInfoCache=new Be,this._fastUpdateProcessor=new Ve,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){F.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new R({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new R({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new R({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,We,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicallyBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateMeshTransform(e,t,n,r,i){if(!e.fastTransformUpdatesAllowed)return!1;let a=e.fastTransformUpdatesEnabled;switch(i){case 0:if(a)return!0;break;case 1:if(!a)return!0}let o=this._context.renderCoordsHelper.spatialReference,s=it,{origin:c,transform:l}=n;if(!C(t.spatialReference,p(J,c.x,c.y,c.z??0),s,o))return!1;switch(i){case void 0:a||this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context,!0);break;case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:if(this._fastUpdateProcessor.disable(e,this._materialInfoCache),t.vertexSpace.type===`local`)return!1}e.updateFastLocalOrigin(s,l,this._context.localOriginFactory,!1);let{elevationContext:u}=e;u.centerInElevationSR=this._getCenterInElevationSR(s);let{elevationProvider:d,renderCoordsHelper:f}=this._context;return e.alignedSampledElevation=z(e,u,d.spatialReference,(e,t)=>V(e,d,u,f,t),f,s),e.updateTransform(s,l,this._context.isAsync,r),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Pe(this.symbol,this.symbolLayer),resourceBytes:e},n=Me(this.symbolLayer)?2:0;return new Ue({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=G(i),p=G(a),m=K(o),h=G(s),g=K(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=G(i),g=K(a),_=G(s),v=G(u),y=K(d),b=G(f),x=K(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${x}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=N(o),r.normalTextureTransform=N(c),r.emissiveTextureTransform=N(d),r.occlusionTextureTransform=N(p),r.metallicRoughnessTextureTransform=N(a)}return r}_getInternalTexture(e,t=!1,n=1){let r=tt(e);if(!r)return null;let i=`${e.contentHash}/${n}`,a=this._textures.get(i);if(a){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(a.id);return n!=null&&!oe(n)&&(a.events.on(`unloaded`,()=>t=ae(t)),t=n),a}let o=null,s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:Qe(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};return Te(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=n!==1,c.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),a=new Ee(o,c),this._textures.set(i,a),a.events.on(`loaded`,()=>this.updateComplexity()),a.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(a),a.events.on(`unloaded`,()=>{this._textures.delete(i)}),a}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=te(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&et(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?f:e.normalTextureTransform?.scale;t.normalScale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=ie;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=ze}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=we(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&($e(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=ke({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?ne:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:ne,diffuse:re,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?je:[s.metallic,s.roughness,Ae[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new Oe(d,this._context.spherical);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return Fe(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicallyBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let r=t.length,a=e.spatialReference.isGeographic?20015077/180:1,o=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),s=[],c=[],l=t[0].transformation,u=n(i(),l);for(let e=0;e<r;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,i=n.indices;for(let e=0;e<i.length;e+=3)U(r,i,e,Z),Ze(r,i,e,J,Y,X),m(J,J,Y),m(J,J,X),h(J,J,1/3),g(J,J,l),s.push(...J),_(Z,Z,u),v(Z,Z),y(J,J,Z,o),s.push(...J),c.push(c.length),c.push(c.length)}return s.length?new L(this._debugFaceNormalMaterial,[[`position`,new I(s,c,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,a,o,s){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=s*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=[],m=t[0].transformation,h=n(i(),m);a===`tangent`&&r(h,m);for(let e=0;e<c;e++){let n=t[e],r=n.attributes.get(`position`),i=n.attributes.get(a);if(!r||!i)continue;let o=r.data,s=r.indices,c=i.data,l=i.indices;for(let e=0;e<s.length;e++){let t=s[e]*3,n=l[e]*i.stride;p(J,o[t+0],o[t+1],o[t+2]),g(J,J,m),d.push(...J),p(Y,c[n+0],c[n+1],c[n+2]),_(Y,Y,h),v(Y,Y),y(J,J,Y,u),d.push(...J),f.push(f.length),f.push(f.length)}}return d.length?new L(o,[[`position`,new I(d,f,3,!0)]],null):null}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;if(F.DRAW_MESH_GEOMETRY_NORMALS){let e=this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),n=this._createFaceDebugNormals(i,o);e&&o.push(e),t&&o.push(t),n&&o.push(n)}let c=this._context.layerViewUid,l=new De({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Ne(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new Le(o[0].material,u,this._context.slicePlaneEnabled):null,f=new Ie(this,l,null,z,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=B(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=z(f,n,p.spatialReference,(e,t)=>V(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!xe(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{isGlobal:a,isLocal:o}=i.state,s=i.spatialReference;return a&&r===`local`||o&&j(s,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=S(),n=p(ot,e[12],e[13],e[14]);return ce(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t,n){let r=n.position,i=r,a;if(t.reprojection===0)return{position:i,georeferencedPositionBuffer:a};let o=t.reprojection===1?t.transformBeforeProject:null;o&&(i=w(new Float64Array(i.length),i,o));let{normal:s,tangent:c}=n;!this._passthroughReprojectionInfo(t)&&(s||c)&&(a=i);let l=i===r||i===a?new Float64Array(i.length):i;return se(i,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:a}}_createNormalBuffer(e,t,n,r,i){let a=i.normal;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=D(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,0,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,0,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return _e(o,n,e.spatialReference,t,u,l)}_createTangentBuffer(e,t,n,r,i){let a=i.tangent;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=A(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,1,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,1,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return ve(o,n,e.spatialReference,t,u,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),s=o.reprojection===1&&o.convertLocalVertexSpace,c=s&&e.vertexSpace.type===`local`?be(e,e.vertexSpace,this._context.renderCoordsHelper.spatialReference):null;if(s&&!c)return this.logger.warn(`Local mesh vertex space could not be converted for rendering`),null;let{position:l,georeferencedPositionBuffer:u}=c?{position:c.position,georeferencedPositionBuffer:null}:this._createPositionBuffer(e,o,e.vertexAttributes),d=nt(e),f=this._createSymbolColorBuffer(t),p=c?c.normal:this._createNormalBuffer(e,l,u,o,e.vertexAttributes),m=c?c.tangent:this._createTangentBuffer(e,l,u,o,e.vertexAttributes),h=i,{geometryTransformation:g}=o,{transformation:_,position:v,normal:y,tangent:b}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:l,normal:p,tangent:m}:this._expressInOriginLocalSpace(e,l,p,m,g);return{positionBuffer:v,normalBuffer:y,tangentBuffer:b,uvBuffer:h,colorBuffer:d,symbolColorBuffer:f,objectTransformation:_,geometryTransformation:g}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`,r=t.type===`local`&&this._context.graphicsCoreOwner.view.state.isGlobal,i=n?+!j(this._context.renderCoordsHelper.spatialReference,e.spatialReference):+!!r;if(Se(t))return{reprojection:i,geometryTransformation:l()};let s=t.origin,c=e.transform?.localMatrix??u;if(i===0){let t=l();return C(e.spatialReference,s,t,this._context.renderCoordsHelper.spatialReference),{reprojection:i,objectTransformation:t,geometryTransformation:d(c)}}if(r)return{reprojection:i,convertLocalVertexSpace:!0,geometryTransformation:d(c)};let f=a(l(),s);return o(f,f,c),{reprojection:i,transformBeforeProject:f,geometryTransformation:l()}}_expressInOriginLocalSpace(e,t,n,r,i){let a=this._context.renderCoordsHelper.spatialReference,c=e.origin;q[0]=c.x,q[1]=c.y,q[2]=c.z??0;let u=l();C(e.spatialReference,q,u,a),o(Q,u,i),s(Q,Q);let{position:d,normal:f,tangent:p}=e.vertexAttributes,m=t===d?new Float64Array(t.length):t;w(m,t,Q);let h=n?n===f?new Float32Array(n.length):n:null,g=r?r===p?new Float32Array(r.length):r:null;return n&&h&&D(n,h,Q),r&&g&&A(r,g,Q),{transformation:u,position:m,normal:h,tangent:g}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=ye(e,t??e.spatialReference);return n?(ue(n,$),!de($,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!le(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:l,tangentBuffer:u,objectTransformation:d,geometryTransformation:f}=r,p=e.components??at,m=[],h=!1,g=c(J,d),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=Ke(e,t);if(r.length===0)continue;let c=qe(i,l,t,r);c.didFlipNormals&&(h=!0);let d=[[`position`,new I(i,r,3,!0)],[`normal`,new I(c.normals,c.indices,3,!0)]];o&&d.push([`color`,new I(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new I(s,p,4,!0)])),a&&d.push([`uv0`,new I(a,r,2,!0)]),u&&d.push([`tangent`,new I(u,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),He(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new L(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:d}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){return this._context.graphicsCoreOwner.view.state.isLocal&&e.vertexSpace.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class H{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function Ke(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function qe(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Ye(e,t,n,r);case`flat`:return Je(e,r);case`smooth`:return Xe(e,r)}}function Je(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=U(e,t,i,Z);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new H(n,r,!1)}function Ye(e,t,n,r){if(t==null)return Je(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){U(e,r,n,Z);for(let e=0;e<3;e++){let a=r[n+e]*3;J[0]=t[a],J[1]=t[a+1],J[2]=t[a+2],ee(Z,J)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new H(t,r,i)}function Xe(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=U(e,t,r,Z);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:S(),count:0},n[a]=o),m(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(v(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new H(r,i,!1)}function Ze(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function U(e,t,n,r){return Ze(e,t,n,J,Y,X),b(Y,Y,J),b(X,X,J),x(J,Y,X),v(r,J),r}function Qe(e=`repeat`){if(typeof e==`string`){let t=W(e);return{s:t,t}}return{s:W(e.horizontal),t:W(e.vertical)}}function W(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function $e(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function et(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function tt(e){return e.data??e.url}function G(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function K(e){let{offset:t,scale:n,rotation:r}=e??rt;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function nt(e){return e.vertexAttributes.color}const rt=new ge,q=S(),J=S(),Y=S(),X=S(),Z=S(),Q=l(),it=l(),$=fe(),at=[new me],ot=S();export{Ge as Graphics3DMeshFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{identity as e,scale as t,translate as n,copy as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as a,negate as o,copy as s,multiply as c,add as l,set as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,ONES as f,ZEROS as p,fromValues as m,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g,ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{throwIfAborted as y}from"../../../../core/promiseUtils.js";import{pt2px as b}from"../../../../core/screenUtils.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../../../geometry/projection/projectPointToVector.js";import{create as C,size as w,containsPoint as T,center as E}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as ee}from"../../../../symbols/support/materialUtils.js";import{defaultObjectPrimitive as D}from"../../../../symbols/support/primitives.js";import{objectSymbolLayerPrimitiveBoundingBox as te,objectSymbolLayerSizeWithResourceSize as O}from"../../../../symbols/support/symbolLayerUtils3D.js";import{VerticalOffsetParameters as ne}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as re}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as k}from"../../webgl-engine/materials/pbrUtils.js";import{initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as j,ConvertOptions as ae,evaluateModelTransformScale as M,evaluateModelTransform as N}from"../support/FastSymbolUpdates.js";import{estimateNumVerticesForLods as P,defaultSymbolLayerMemoryComplexity as oe}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as F,SampleElevationInfo as ce,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ue}from"./emissiveUtils.js";import{Graphics3DLodInstanceGraphicLayer as I}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,computeObjectScale as B,computeObjectRotation as V}from"./graphicUtils.js";import{makeLodResources as H}from"./lodResourceUtils.js";import{fetch as de}from"./objectResourceUtils.js";import{placePointOnGeometry as U,extendPointGraphicElevationContext as W}from"./pointUtils.js";import{isValidPrimitive as fe,primitiveLodResources as pe}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as me}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as he}from"./webStyleUtils.js";class G{constructor(e,t,n,r,i,a,o,s,c,l,u=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=n,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=s,this.extentPadding=c,this.physicallyBasedRenderingEnabled=l,this.pivotOffset=u}}class ge extends L{getCachedSize(){let[e,t,n]=this._resources==null?[1,1,1]:this._resources.symbolSize;return{width:e,depth:t,height:n}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=[],this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=n.physicallyBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){let e=z(this.symbolLayer);if(e)throw Error(e)}if(this._isPrimitive){let t=this.symbolLayer.resource,n=t&&fe(t?.primitive)?t.primitive:D;this._resources=await this._createResourcesForPrimitive(n,e)}else{let t=(await he(this.symbol.styleOrigin))?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(t,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicallyBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return this._resources==null?0:this._resources.extentPadding}get _isPrimitive(){return this._primitive!=null}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(e,t){let n=this.symbolLayer,r=C(te(e)),i=d(w(r)),o=d(O(i,n)),s=a(o),c=n.material?.emissive,l=(c?.source===`color`?c?.strength:void 0)??0,u={usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!0,mrrFactors:k,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:n.castShadows,emissiveStrengthFromSymbol:l,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass,normalType:1},p=!!u.usePBR,m=this.symbol;m.type===`point-3d`&&m.verticalOffset&&(u.verticalOffset=new ne(m.verticalOffset),u.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this.view.screenSizePerspective.parameters),u.externalColor=this._hasDrivenColorOrOpacity?R:this._materialColor?.toUnitRGBA()??g,this._fastUpdates=A(this._context.renderer,this._fastVisualVariableConvertOptions(r,o,i,null)),u.instanced=!0,this._fastUpdates?(Object.assign(u,this._fastUpdates.materialParameters),u.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(u.instancedColor=!0);let h=new ie(u,this._context.spherical);h.setParameters({cullFace:J(h.transparent)});let _=pe(e,h);if(!_)throw Error(`Unknown object symbol primitive: ${e}`);let v=await this._createStageResources(_,p,t);y(t);let b=await this._createLodRenderer(_,t);return new G(_,b,v,i,!1,!1,r,o,s,p)}async _createResourcesForUrl(e,t){let n={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},r={spherical:this._context.spherical,materialParameters:n,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=A(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),r.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(r.materialParameters.instancedColor=!0);let i=this.symbol;if(i.type===`point-3d`&&i.verticalOffset){let{screenLength:e,minWorldLength:t,maxWorldLength:n}=i.verticalOffset;r.materialParameters.verticalOffset={screenLength:b(e),minWorldLength:t||0,maxWorldLength:n??1/0},r.materialParameters.castShadows=!1}let o=this._context.physicallyBasedRenderingEnabled;r.signal=t,r.usePBR=o,r.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,r.skipHighLods=this._context.skipHighSymbolLods;let s=this.symbolLayer.material;r.materialParameters.emissiveStrengthFromSymbol=s?.emissive?.strength??1,r.materialParameters.emissiveSource=ee(s?.emissive?.source??`emissive`);let c=await de(e,r),l=c.isEsriSymbolResource,u=c.isWosr,f=H(c.lods),p=this._context,m=this._getExternalColorParameters(s),h=this.needsDrivenTransparentPass,g=f.getMaterials();g.forEach(e=>{e.setParameters({...m,drivenOpacity:h}),p.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});let _=c.referenceBoundingBox,v=d(w(_)),x=d(f.levels[0].pivotOffset),S=d(O(v,this.symbolLayer)),C=a(S),T=this._fastUpdates;j(T,this._context.renderer,this._fastVisualVariableConvertOptions(_,S,v,x))&&g.forEach(e=>e.setParameters(T.materialParameters));let E=await this._createStageResources(f,o,t);y(t);let D=await this._createLodRenderer(f,t);return new G(f,D,E,v,l,u,_,S,C,o,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,n){let r=this._context.stage,i=e.getMaterials();t!==this._context.physicallyBasedRenderingEnabled&&this.physicallyBasedRenderingChanged();let a=e.getTextures();return r.addTextures(a),this._addDisposeResource(()=>{a.forEach(e=>e.unload()),r.removeTextures(a)}),await Promise.all(a.map(e=>this._context.stage.schedule(()=>e.load(r.renderView.renderingContext),n))),y(n),{materials:i,textures:a,geometries:e.getEngineGeometries()}}async _createLodRenderer(e,t){let n=this._context.stage,i={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},a=this._fastUpdates,o=new re({symbol:e,metadata:i,shaderTransformation:a?{applyTransform:(e,t,n)=>{e.getFeatureAttribute(t,Q),r(n,N(a.materialParameters,Q,n))},scaleFactor:(e,t,n)=>{t.getFeatureAttribute(n,Q),M(e,a.materialParameters,Q)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{n.removeRenderPlugin(o),o.destroy()}),await n.addRenderPlugin(o,t),o}_getExternalColorParameters(e){let t={};if(t.externalColor=R,!this._drivenProperties.color&&e?.color!=null){let n=e.color.toUnitRGBA();this._drivenProperties.opacity&&(n[3]=NaN),t.externalColor=n}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=U(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;let r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(n,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(this._resources==null)return;let e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let n=0;n<t.length;n++){let r=t[n];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:J(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(this._resources==null)return;let e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(let t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,F)}slicePlaneEnabledChanged(){if(this._resources==null)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(let e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicallyBasedRenderingChanged(){if(this._resources==null)return!0;let{stageResources:e,isWosr:t}=this._resources;for(let n of e.materials)this._isPrimitive?n.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!0}):t||n.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!1});return this._hasLoadedPBRTextures===!1&&this._context.physicallyBasedRenderingEnabled===!0?(this._hasLoadedPBRTextures=!0,!1):!0}applyRendererDiff(e,t){if(this._resources==null)return 0;let{stageResources:{materials:n},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:s}=this._resources;for(let c in e.diff)switch(c){case`visualVariables`:if(j(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,s))){for(let e of n)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}else return 0;break;default:return 0}return 2}computeComplexity(){if(this._resources==null)return super.computeComplexity();let e=this._resources.lodResources,t=P(e.levels),n=e.computeUsedMemory(),r={...oe(this.symbol,this.symbolLayer),resourceBytes:n};return new me({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,t,n,r){if(!this._hasLodRenderer()||this._resources==null)return null;let i=this.getFastUpdateAttrValues(t),a=this._context.clippingExtent;if(S(e,Y,this._context.elevationProvider.spatialReference),a!=null&&!T(a,Y))return null;let o=q(n),s=this._computeGlobalTransform(e,n,Z,$),c=this._computeLocalTransform(this._resources,this.symbolLayer,t,X),l=this._resources.lodRenderer.instanceData,u=l.addInstance();this._instanceIndexToGraphicUid.set(u,r),l.setLocalTransform(u,c,!1),l.setGlobalTransform(u,s),i&&l.setFeatureAttribute(u,i),this._fastUpdates==null&&this._hasDrivenColorOrOpacity&&l.setColor(u,this._getDrivenUInt8ColorWithNaNSupport(t,this._materialColor,!this._isPrimitive));let d=this._context.stage.renderView.olidRenderHelper;if(d){let e=d.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});l.setObjectAndLayerIdColor(u,e)}let f=new I(this,u,se,n,this._context.stage.view.state.highlightOrderMap);return o&&(f.alignedSampledElevation=$.sampledElevation),f.needsElevationUpdates=F(n.mode),W(f,e,this._context.elevationProvider),f}_computeGlobalTransform(e,t,n,r){return le(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),Y[0]=e.x,Y[1]=e.y,Y[2]=r.z,x(e.spatialReference,Y,n,this._context.renderCoordsHelper.spatialReference),n}_computeLocalTransform(t,n,r,i){return e(i),this._applyObjectRotationVisualVariables(r,!1,i),this._applyObjectRotation(n,!0,i),this._applyObjectScale(t,r,i),this._applyAnchor(t,n,i),i}_applyObjectScale(e,n,r){if(this._fastUpdates?.requiresShaderTransformation)return;let i=this._drivenProperties.size&&n.size?n.size.output:e.symbolSize,a=B(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);if(a[0]!==1||a[1]!==1||a[2]!==1)t(r,r,a);else return}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}updateGeometry(e,t){if(this._resources==null)return!0;let n=e.geometry;if(!n)return!1;let r=U(n);if(r==null)return!1;let i=this.getGeometryElevationMode(n),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,Z,$),q(a)&&(t.alignedSampledElevation=$.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,Z,!0),W(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!t.heading&&!t.tilt&&!t.roll&&!t.width&&!t.height&&!t.depth&&!t.anchor&&!t.anchorPosition||this._resources==null)return;let n=(e,t,n)=>(e!=null&&e.type===`complete`?e.newValue:t)??n,r=n(t.heading,this.symbolLayer.heading,0),i=n(t.tilt,this.symbolLayer.tilt,0),a=n(t.roll,this.symbolLayer.roll,0),o=n(t.width,this.symbolLayer.width,void 0),s=n(t.height,this.symbolLayer.height,void 0),c=n(t.depth,this.symbolLayer.depth,void 0),l=n(t.anchor,this.symbolLayer.anchor,void 0),u=n(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;let f={heading:r,tilt:i,roll:a,anchor:l,anchorPosition:u},p=this._resources;this.loadStatus===1&&e.symbolLayerStatePatches.push(()=>{p.symbolSize=d(O(p.resourceSize,{width:o,height:s,depth:c,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{let n=this._computeLocalTransform(p,f,t,X);p.lodRenderer.instanceData.setLocalTransform(e,n,!0)})}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue,i=r==null?_:r.toUnitRGBA();delete n.color;let a=this._resources;if(a==null)return;let o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{let e={externalColor:i};for(let t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:J(t.transparent)})}})}_preparePatchEmissive(e,t){return ue(e,t,e=>{this._resources?.stageResources.materials.forEach(t=>{if(!this._isPrimitive){t.setParameters({emissiveStrengthFromSymbol:e??1});return}let n=this.symbolLayer.material?.emissive?.source===`color`;t.setParameters({emissiveStrengthFromSymbol:n?e??0:0})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_applyObjectRotationVisualVariables(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||V(e.heading?.output,e.tilt?.output,e.roll?.output,n)}_applyObjectRotation(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||V(e.heading,e.tilt,e.roll,n)}_applyAnchor(e,t,r){if(this._fastUpdates?.requiresShaderTransformation)return;let i=K(e.resourceBoundingBox,e.pivotOffset,t);i&&n(r,r,i)}_fastVisualVariableConvertOptions(e,t,n,r){let i=e==null?f:d(w(e)),a=e==null?p:K(e,r,this.symbolLayer),o=this._context.renderCoordsHelper.unitInMeters,s=B(t??void 0,t,n,o),c=m(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ae({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:o,anchor:a,scale:s,rotation:c,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:s})}get _primitive(){let{resource:e}=this.symbolLayer;return e?.href==null?e?.primitive??D:null}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?g:R)}get _materialColor(){return this.symbolLayer.material?.color}}function K(e,t,n){let r=h();switch(n.anchor){case`center`:s(r,E(e)),o(r,r);break;case`top`:{let t=E(e);u(r,-t[0],-t[1],-e[5]);break}case`bottom`:{let t=E(e);u(r,-t[0],-t[1],-e[2]);break}case`relative`:{let t=E(e),i=w(e),a=n.anchorPosition,s=a?m(a.x,a.y,a.z):p;c(r,i,s),l(r,r,t),o(r,r);break}default:t==null?s(r,p):o(r,t)}return r}function q(e){return e.mode!==`absolute-height`}function _e(e){return(e.material?.color?.a??1)===1&&e.resource?.href==null}function J(e){return e?0:2}const Y=h(),X=i(),Z=i(),Q=v(),$=new ce;export{ge as Graphics3DObjectSymbolLayer};
2
+ import{identity as e,scale as t,translate as n,copy as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as a,negate as o,copy as s,multiply as c,add as l,set as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,ONES as f,ZEROS as p,fromValues as m,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g,ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{throwIfAborted as y}from"../../../../core/promiseUtils.js";import{pt2px as b}from"../../../../core/screenUtils.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../../../geometry/projection/projectPointToVector.js";import{create as C,size as w,containsPoint as T,center as E}from"../../../../geometry/support/aaBoundingBox.js";import{getEmissiveMode as ee}from"../../../../symbols/support/materialUtils.js";import{defaultObjectPrimitive as D}from"../../../../symbols/support/primitives.js";import{objectSymbolLayerPrimitiveBoundingBox as te,objectSymbolLayerSizeWithResourceSize as O}from"../../../../symbols/support/symbolLayerUtils3D.js";import{VerticalOffsetParameters as ne}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{LodRenderer as re}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as k}from"../../webgl-engine/materials/pbrUtils.js";import{initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as j,ConvertOptions as ae,evaluateModelTransformScale as M,evaluateModelTransform as N}from"../support/FastSymbolUpdates.js";import{estimateNumVerticesForLods as P,defaultSymbolLayerMemoryComplexity as oe}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as F,SampleElevationInfo as ce,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as ue}from"./emissiveUtils.js";import{Graphics3DLodInstanceGraphicLayer as I}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,computeObjectScale as B,computeObjectRotation as V}from"./graphicUtils.js";import{makeLodResources as H}from"./lodResourceUtils.js";import{fetch as de}from"./objectResourceUtils.js";import{placePointOnGeometry as U,extendPointGraphicElevationContext as W}from"./pointUtils.js";import{isValidPrimitive as fe,primitiveLodResources as pe}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as me}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as he}from"./webStyleUtils.js";class G{constructor(e,t,n,r,i,a,o,s,c,l,u=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=n,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=a,this.resourceBoundingBox=o,this.symbolSize=s,this.extentPadding=c,this.physicallyBasedRenderingEnabled=l,this.pivotOffset=u}}class ge extends L{getCachedSize(){let[e,t,n]=this._resources==null?[1,1,1]:this._resources.symbolSize;return{width:e,depth:t,height:n}}constructor(e,t,n,r){super(e,t,n,r,_e(t)),this._resources=null,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=[],this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=n.physicallyBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){let e=z(this.symbolLayer);if(e)throw Error(e)}if(this._isPrimitive){let t=this.symbolLayer.resource,n=t&&fe(t?.primitive)?t.primitive:D;this._resources=await this._createResourcesForPrimitive(n,e)}else{let t=(await he(this.symbol.styleOrigin))?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(t,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicallyBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return this._resources==null?0:this._resources.extentPadding}get _isPrimitive(){return this._primitive!=null}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(e,t){let n=this.symbolLayer,r=C(te(e)),i=d(w(r)),o=d(O(i,n)),s=a(o),c=n.material?.emissive,l=(c?.source===`color`?c?.strength:void 0)??0,u={usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!0,mrrFactors:k,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:n.castShadows,emissiveStrengthFromSymbol:l,emissiveSource:1,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass,normalType:1},p=!!u.usePBR,m=this.symbol;m.type===`point-3d`&&m.verticalOffset&&(u.verticalOffset=new ne(m.verticalOffset),u.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(u.screenSizePerspective=this.view.screenSizePerspective.parameters),u.externalColor=this._hasDrivenColorOrOpacity?R:this._materialColor?.toUnitRGBA()??g,this._fastUpdates=A(this._context.renderer,this._fastVisualVariableConvertOptions(r,o,i,null)),u.instanced=!0,this._fastUpdates?(Object.assign(u,this._fastUpdates.materialParameters),u.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(u.instancedColor=!0);let h=new ie(u,this._context.spherical);h.setParameters({cullFace:J(h.transparent)});let _=pe(e,h);if(!_)throw Error(`Unknown object symbol primitive: ${e}`);let v=await this._createStageResources(_,p,t);y(t);let b=await this._createLodRenderer(_,t);return new G(_,b,v,i,!1,!1,r,o,s,p)}async _createResourcesForUrl(e,t){let n={instanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},r={spherical:this._context.spherical,materialParameters:n,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=A(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),r.materialParameters.instancedFeatureAttribute=!0):this._hasDrivenColorOrOpacity&&(r.materialParameters.instancedColor=!0);let i=this.symbol;if(i.type===`point-3d`&&i.verticalOffset){let{screenLength:e,minWorldLength:t,maxWorldLength:n}=i.verticalOffset;r.materialParameters.verticalOffset={screenLength:b(e),minWorldLength:t||0,maxWorldLength:n??1/0},r.materialParameters.castShadows=!1}let o=this._context.physicallyBasedRenderingEnabled;r.signal=t,r.usePBR=o,r.useEmissive=this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result,r.skipHighLods=this._context.skipHighSymbolLods;let s=this.symbolLayer.material;r.materialParameters.emissiveStrengthFromSymbol=s?.emissive?.strength??1,r.materialParameters.emissiveSource=ee(s?.emissive?.source??`emissive`);let c=await de(e,r),l=c.isEsriSymbolResource,u=c.isWosr,f=H(c.lods),p=this._context,m=this._getExternalColorParameters(s),h=this.needsDrivenTransparentPass,g=f.getMaterials();g.forEach(e=>{e.setParameters({...m,drivenOpacity:h}),p.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:this.view.screenSizePerspective.parameters})});let _=c.referenceBoundingBox,v=d(w(_)),x=d(f.levels[0].pivotOffset),S=d(O(v,this.symbolLayer)),C=a(S),T=this._fastUpdates;j(T,this._context.renderer,this._fastVisualVariableConvertOptions(_,S,v,x))&&g.forEach(e=>e.setParameters(T.materialParameters));let E=await this._createStageResources(f,o,t);y(t);let D=await this._createLodRenderer(f,t);return new G(f,D,E,v,l,u,_,S,C,o,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,n){let r=this._context.stage,i=e.getMaterials();t!==this._context.physicallyBasedRenderingEnabled&&this.physicallyBasedRenderingChanged();let a=e.getTextures();return r.addTextures(a),this._addDisposeResource(()=>{a.forEach(e=>e.unload()),r.removeTextures(a)}),await Promise.all(a.map(e=>this._context.stage.schedule(()=>e.load(r.renderView.renderingContext),n))),y(n),{materials:i,textures:a,geometries:e.getEngineGeometries()}}async _createLodRenderer(e,t){let n=this._context.stage,i={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},a=this._fastUpdates,o=new re({symbol:e,metadata:i,shaderTransformation:a?{applyTransform:(e,t,n)=>{e.getFeatureAttribute(t,Q),r(n,N(a.materialParameters,Q,n))},scaleFactor:(e,t,n)=>{t.getFeatureAttribute(n,Q),M(e,a.materialParameters,Q)}}:null},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{n.removeRenderPlugin(o),o.destroy()}),await n.addRenderPlugin(o,t),o}_getExternalColorParameters(e){let t={};if(t.externalColor=R,!this._drivenProperties.color&&e?.color!=null){let n=e.color.toUnitRGBA();this._drivenProperties.opacity&&(n[3]=NaN),t.externalColor=n}return t}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=U(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;let r=this.createElevationContextForGraphic(t),i=e.renderingInfo;return this._createAs3DShape(n,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(this._resources==null)return;let e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let n=0;n<t.length;n++){let r=t[n];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:J(r.transparent)})}}layerScreenSizePerspectiveChanged(){if(this._resources==null)return;let e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;for(let t of this._resources.stageResources.materials)t.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,F)}slicePlaneEnabledChanged(){if(this._resources==null)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(let e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicallyBasedRenderingChanged(){if(this._resources==null)return!0;let{stageResources:e,isWosr:t}=this._resources;for(let n of e.materials)this._isPrimitive?n.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!0}):t||n.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled,isSchematic:!1});return this._hasLoadedPBRTextures===!1&&this._context.physicallyBasedRenderingEnabled===!0?(this._hasLoadedPBRTextures=!0,!1):!0}applyRendererDiff(e,t){if(this._resources==null)return 0;let{stageResources:{materials:n},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:s}=this._resources;for(let c in e.diff)if(c===`visualVariables`){if(j(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,s))){for(let e of n)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}else return 0}else return 0;return 2}computeComplexity(){if(this._resources==null)return super.computeComplexity();let e=this._resources.lodResources,t=P(e.levels),n=e.computeUsedMemory(),r={...oe(this.symbol,this.symbolLayer),resourceBytes:n};return new me({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,t,n,r){if(!this._hasLodRenderer()||this._resources==null)return null;let i=this.getFastUpdateAttrValues(t),a=this._context.clippingExtent;if(S(e,Y,this._context.elevationProvider.spatialReference),a!=null&&!T(a,Y))return null;let o=q(n),s=this._computeGlobalTransform(e,n,Z,$),c=this._computeLocalTransform(this._resources,this.symbolLayer,t,X),l=this._resources.lodRenderer.instanceData,u=l.addInstance();this._instanceIndexToGraphicUid.set(u,r),l.setLocalTransform(u,c,!1),l.setGlobalTransform(u,s),i&&l.setFeatureAttribute(u,i),this._fastUpdates==null&&this._hasDrivenColorOrOpacity&&l.setColor(u,this._getDrivenUInt8ColorWithNaNSupport(t,this._materialColor,!this._isPrimitive));let d=this._context.stage.renderView.olidRenderHelper;if(d){let e=d.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid});l.setObjectAndLayerIdColor(u,e)}let f=new I(this,u,se,n,this._context.stage.view.state.highlightOrderMap);return o&&(f.alignedSampledElevation=$.sampledElevation),f.needsElevationUpdates=F(n.mode),W(f,e,this._context.elevationProvider),f}_computeGlobalTransform(e,t,n,r){return le(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),Y[0]=e.x,Y[1]=e.y,Y[2]=r.z,x(e.spatialReference,Y,n,this._context.renderCoordsHelper.spatialReference),n}_computeLocalTransform(t,n,r,i){return e(i),this._applyObjectRotationVisualVariables(r,!1,i),this._applyObjectRotation(n,!0,i),this._applyObjectScale(t,r,i),this._applyAnchor(t,n,i),i}_applyObjectScale(e,n,r){if(this._fastUpdates?.requiresShaderTransformation)return;let i=this._drivenProperties.size&&n.size?n.size.output:e.symbolSize,a=B(i,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);if(a[0]!==1||a[1]!==1||a[2]!==1)t(r,r,a);else return}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}updateGeometry(e,t){if(this._resources==null)return!0;let n=e.geometry;if(!n)return!1;let r=U(n);if(r==null)return!1;let i=this.getGeometryElevationMode(n),{elevationContext:a}=t;return a.mode===i&&(a.updateFeatureExpressionFeature(e,this._context.layer),this._computeGlobalTransform(r,a,Z,$),q(a)&&(t.alignedSampledElevation=$.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(t.instanceIndex,Z,!0),W(t,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!t.heading&&!t.tilt&&!t.roll&&!t.width&&!t.height&&!t.depth&&!t.anchor&&!t.anchorPosition||this._resources==null)return;let n=(e,t,n)=>(e!=null&&e.type===`complete`?e.newValue:t)??n,r=n(t.heading,this.symbolLayer.heading,0),i=n(t.tilt,this.symbolLayer.tilt,0),a=n(t.roll,this.symbolLayer.roll,0),o=n(t.width,this.symbolLayer.width,void 0),s=n(t.height,this.symbolLayer.height,void 0),c=n(t.depth,this.symbolLayer.depth,void 0),l=n(t.anchor,this.symbolLayer.anchor,void 0),u=n(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;let f={heading:r,tilt:i,roll:a,anchor:l,anchorPosition:u},p=this._resources;this.loadStatus===1&&e.symbolLayerStatePatches.push(()=>{p.symbolSize=d(O(p.resourceSize,{width:o,height:s,depth:c,isPrimitive:this._isPrimitive}))}),e.graphics3DGraphicPatches.push(({instanceIndex:e},t)=>{let n=this._computeLocalTransform(p,f,t,X);p.lodRenderer.instanceData.setLocalTransform(e,n,!0)})}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue,i=r==null?_:r.toUnitRGBA();delete n.color;let a=this._resources;if(a==null)return;let o=this._isPrimitive;e.graphics3DGraphicPatches.push(({instanceIndex:e})=>{if(this._hasDrivenColorOrOpacity)a.lodRenderer.instanceData.setColor(e,i);else{let e={externalColor:i};for(let t of a.stageResources.materials)t.setParameters(e),o&&t.setParameters({cullFace:J(t.transparent)})}})}_preparePatchEmissive(e,t){return ue(e,t,e=>{this._resources?.stageResources.materials.forEach(t=>{if(!this._isPrimitive){t.setParameters({emissiveStrengthFromSymbol:e??1});return}let n=this.symbolLayer.material?.emissive?.source===`color`;t.setParameters({emissiveStrengthFromSymbol:n?e??0:0})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_applyObjectRotationVisualVariables(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||V(e.heading?.output,e.tilt?.output,e.roll?.output,n)}_applyObjectRotation(e,t,n){this._fastUpdates?.requiresShaderTransformation&&t||V(e.heading,e.tilt,e.roll,n)}_applyAnchor(e,t,r){if(this._fastUpdates?.requiresShaderTransformation)return;let i=K(e.resourceBoundingBox,e.pivotOffset,t);i&&n(r,r,i)}_fastVisualVariableConvertOptions(e,t,n,r){let i=e==null?f:d(w(e)),a=e==null?p:K(e,r,this.symbolLayer),o=this._context.renderCoordsHelper.unitInMeters,s=B(t??void 0,t,n,o),c=m(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ae({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:o,anchor:a,scale:s,rotation:c,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:s})}get _primitive(){let{resource:e}=this.symbolLayer;return e?.href==null?e?.primitive??D:null}_getFallbackOpacityAndColor(){return this._materialColor?.toUnitRGBA()??(this._isPrimitive?g:R)}get _materialColor(){return this.symbolLayer.material?.color}}function K(e,t,n){let r=h();switch(n.anchor){case`center`:s(r,E(e)),o(r,r);break;case`top`:{let t=E(e);u(r,-t[0],-t[1],-e[5]);break}case`bottom`:{let t=E(e);u(r,-t[0],-t[1],-e[2]);break}case`relative`:{let t=E(e),i=w(e),a=n.anchorPosition,s=a?m(a.x,a.y,a.z):p;c(r,i,s),l(r,r,t),o(r,r);break}default:t==null?s(r,p):o(r,t)}return r}function q(e){return e.mode!==`absolute-height`}function _e(e){return(e.material?.color?.a??1)===1&&e.resource?.href==null}function J(e){return e?0:2}const Y=h(),X=i(),Z=i(),Q=v(),$=new ce;export{ge as Graphics3DObjectSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as C}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{SamplePosition as ee}from"../../support/ElevationProvider.js";import{Object3D as w}from"../../webgl-engine/lib/Object3D.js";import{Path as T}from"../../webgl-engine/lib/Path.js";import{PathBuilder as E}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as D,TriangulationCapBuilder as O,NoCapBuilder as k}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as A}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as te,isPathGeometry as ne}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as re}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as j,circleProfiles as M}from"../../webgl-engine/lib/PathProfile.js";import{PathMaterial as N}from"../../webgl-engine/materials/PathMaterial.js";import{ConvertOptions as P,initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as I,getSizeAttributeValue as L,getAttributeValue as R}from"../support/FastSymbolUpdates.js";import{needsElevationUpdates3D as z,evaluateElevationAlignmentAtPoint as B,SampleElevationInfo as V}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as H}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as U}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as W,nanFallbackColor as G}from"./Graphics3DSymbolLayer.js";import{isValidSize as K}from"./graphicUtils.js";const q=[`polyline`];class J extends W{constructor(e,t,n,r){super(e,t,n,r,C(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>U)||(this.logger.warn(`Geometry has a path longer than ${U} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new P({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(G),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?F(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=M[a];break;case`quad`:this._profile=j[a]}switch(e.join){case`round`:this._extruder=new A(2);break;default:case`bevel`:this._extruder=new A(1);break;case`miter`:this._extruder=new A(0)}switch(this._cap){case`none`:this._capBuilder=new k;break;case`butt`:default:this._capBuilder=new O(this._profile,1);break;case`square`:this._capBuilder=new O(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new D(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(K(this._intrinsicSize[0])&&K(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new N({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicallyBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,z)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicallyBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(I(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,oe,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(e=>e.length>0)||this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new ee(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=s+n*3;for(let e=s;e<g;e+=3){p.offset=e;let n=B(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2]}let y=new T(n,this._upVectorAlignment,c.vertexDataES,c.vertexDataRS,s,h);Y(y,this._upVectorAlignment,this._context.renderCoordsHelper);let b=new E(y,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),x=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),S=new te(this._materials[0],b,this._getVisualVariableData(r),x);S.transformation=i(o(),a,b.path.origin),l.push(S)}if(l.length===0)return null;let y=new w({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new H(this,y,null,(e,t,n,r,i)=>ae(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=z(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:L(t,e.size),colorAttributeValue:R(n,e.color),opacityAttributeValue:R(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t=0;t<e.numVertices;++t)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),e.setFrameFromUpVector(t,Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),re(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ie(e,t,n,r){let i=0,{origin:a,numVertices:o,positions:s,positionsES:c}=e,l=e.offset+o*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o}function ae(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!ne(e))continue;let o=e.builder.path;s+=ie(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new V,$=new Set,oe=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as C}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{SamplePosition as ee}from"../../support/ElevationProvider.js";import{Object3D as w}from"../../webgl-engine/lib/Object3D.js";import{Path as T}from"../../webgl-engine/lib/Path.js";import{PathBuilder as E}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as D,TriangulationCapBuilder as O,NoCapBuilder as k}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as A}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as te,isPathGeometry as ne}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as re}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as j,circleProfiles as M}from"../../webgl-engine/lib/PathProfile.js";import{PathMaterial as N}from"../../webgl-engine/materials/PathMaterial.js";import{ConvertOptions as P,initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as I,getSizeAttributeValue as L,getAttributeValue as R}from"../support/FastSymbolUpdates.js";import{needsElevationUpdates3D as z,evaluateElevationAlignmentAtPoint as B,SampleElevationInfo as V}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as H}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as U}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as W,nanFallbackColor as G}from"./Graphics3DSymbolLayer.js";import{isValidSize as K}from"./graphicUtils.js";const q=[`polyline`];class J extends W{constructor(e,t,n,r){super(e,t,n,r,C(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>U)||(this.logger.warn(`Geometry has a path longer than ${U} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new P({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(G),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?F(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=M[a];break;case`quad`:this._profile=j[a]}switch(e.join){case`round`:this._extruder=new A(2);break;default:case`bevel`:this._extruder=new A(1);break;case`miter`:this._extruder=new A(0)}switch(this._cap){case`none`:this._capBuilder=new k;break;case`butt`:default:this._capBuilder=new O(this._profile,1);break;case`square`:this._capBuilder=new O(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new D(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(K(this._intrinsicSize[0])&&K(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new N({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicallyBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,z)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicallyBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicallyBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){if(I(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0}else return 0;return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,oe,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(e=>e.length>0)||this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new ee(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=s+n*3;for(let e=s;e<g;e+=3){p.offset=e;let n=B(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2]}let y=new T(n,this._upVectorAlignment,c.vertexDataES,c.vertexDataRS,s,h);Y(y,this._upVectorAlignment,this._context.renderCoordsHelper);let b=new E(y,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),x=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),S=new te(this._materials[0],b,this._getVisualVariableData(r),x);S.transformation=i(o(),a,b.path.origin),l.push(S)}if(l.length===0)return null;let y=new w({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new H(this,y,null,(e,t,n,r,i)=>ae(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=z(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:L(t,e.size),colorAttributeValue:R(n,e.color),opacityAttributeValue:R(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t=0;t<e.numVertices;++t)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),e.setFrameFromUpVector(t,Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),re(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ie(e,t,n,r){let i=0,{origin:a,numVertices:o,positions:s,positionsES:c}=e,l=e.offset+o*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o}function ae(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!ne(e))continue;let o=e.builder.path;s+=ie(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new V,$=new Set,oe=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{has}from"../../../../applications/Components/baUtils.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{createGeometry as f}from"../../support/engineContent/line.js";import{loadTessellationUtils as p,preloadedPolygonToRenderInfoElevationAligned as m,preloadedPolygonToRenderInfoDraped as h}from"../../support/renderInfoUtils/polygon.js";import{Object3D as g}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as _}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as v}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as b}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as C,getAttributeValue as w,ConvertOptions as T}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as D}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as O,writeMapSpaceUVCoordsDraped as k}from"../support/uvUtils.js";import{elevationModeChangeUpdateType as A,needsElevationUpdates2D as j}from"./elevationAlignmentUtils.js";import{PlateLayoutInformation as M,updatePlateNormals as N}from"./extrudePolygon.js";import{Graphics3DDrapedGraphicLayer as P}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as F}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as I}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as L}from"./graphicUtils.js";import{parseCapType as R,computeSymbolLayerIndex as z}from"./lineUtils.js";import{geometryAsPolygon as B,createColorGeometry as V,PolygonCreationDataBase as H}from"./polygonUtils.js";const U=[`polyline`,`polygon`,`extent`];class W extends I{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await p()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _shadingEnabled(){return!this.draped&&!!has(`enable-feature:emissive-on-non-volumetric`)}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:e,draped:n,_shadingEnabled:r}=this,i=this._getCombinedOpacityAndColor(e);this._materials[0]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,shading:+!!r,castShadows:r&&this.symbolLayer.castShadows,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters},this._context),this._needsUV=this._materials[0]instanceof b;let a=this.symbolLayer.outline;if(J(a)){let e=y(a.pattern),n=R(a.pattern?a.patternCap||`butt`:`square`);this._materials[1]=new x({color:this._getOutlineColor(),width:t(a.size),polygonOffset:3,polygonOffsetIndex:z(this._renderPriority,this._renderPriorityStep),shadingEnabled:r,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&v(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(C(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=A(W.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=j(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicallyBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=B(t.geometry);if(!i)return null;let a=this._shadingEnabled,o=m(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,requireNormals:a,outlineOutput:`vertex-data`,owner:this._context.layer});if(o==null)return null;let d=new K(o,n,this._context.layerViewUid,t.uid),f=d.renderInfo.vertexCount;if(this._needsUV){d.uvMapSpace=l(f*4,!0),d.textureElementIndices=Array(f),d.boundingRect=s(9*(d.renderInfo.polygonIndices.length/3));let e=O(d.uvMapSpace,d.boundingRect,d.textureElementIndices,d.renderInfo.positions,d.renderInfo.polygonIndices,this._context.renderCoordsHelper);d.boundingRect=c(d.boundingRect,0,9*e),d.boundingRectIndices=u(e)}if(d.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(d),this._createAs3DShapeFill(e,d),this._materials[1]&&this._createAs3DShapeOutline(d),this._logGeometryCreationWarnings(d.renderInfo,i.rings,`rings`,`FillSymbol3DLayer`),d.outGeometries.length===0)return null;let p=new g({geometries:d.outGeometries,castShadow:this._shadingEnabled,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=d.plateLayout,_=new F(this,p,null,(e,t,n,r,i)=>D(e,t,n,r,i,h),r);return _.alignedSampledElevation=d.renderInfo.sampledElevation,_.needsElevationUpdates=j(r.mode),_}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s,vertexCount:c,compressedNormals:l}=t.renderInfo;if(s===0||this._context.clippingExtent!=null&&(n(i,G),!r(G,this._context.clippingExtent)))return;let u=this._fastUpdates?.visualVariables.color,d=V({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:u?null:t.color,compressedNormals:l,colorFeature:u?w(u,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.plateLayout=new M(c,0,null,0,s/3),N(d,t.plateLayout),t.outGeometries.push(d)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,G),!r(G,this._context.clippingExtent)))continue;let i=f(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=B(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=h(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new q(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderInfo.vertexCount*4,!0),k(o.uvMapSpace,o.renderInfo.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderInfo,r.rings,`rings`,`FillSymbol3DLayer`),new P(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0)return;let c=n(i,G);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=V({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?w(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new _(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,G),!r(G,this._context.clippingExtent))continue;a(e.outBoundingBox,G);let i=f(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new _(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return L(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new T({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??e})}}const G=o();class K extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}class q extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}function J(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{W as Graphics3DPolygonFillSymbolLayer};
2
+ import{has}from"../../../../applications/Components/baUtils.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{createGeometry as f}from"../../support/engineContent/line.js";import{loadTessellationUtils as p,preloadedPolygonToRenderInfoElevationAligned as m,preloadedPolygonToRenderInfoDraped as h}from"../../support/renderInfoUtils/polygon.js";import{Object3D as g}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as _}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as v}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as b}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as C,getAttributeValue as w,ConvertOptions as T}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as D}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as O,writeMapSpaceUVCoordsDraped as k}from"../support/uvUtils.js";import{elevationModeChangeUpdateType as A,needsElevationUpdates2D as j}from"./elevationAlignmentUtils.js";import{PlateLayoutInformation as M,updatePlateNormals as N}from"./extrudePolygon.js";import{Graphics3DDrapedGraphicLayer as P}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as F}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as I}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as L}from"./graphicUtils.js";import{parseCapType as R,computeSymbolLayerIndex as z}from"./lineUtils.js";import{geometryAsPolygon as B,createColorGeometry as V,PolygonCreationDataBase as H}from"./polygonUtils.js";const U=[`polyline`,`polygon`,`extent`];class W extends I{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await p()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _shadingEnabled(){return!this.draped&&!!has(`enable-feature:emissive-on-non-volumetric`)}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:e,draped:n,_shadingEnabled:r}=this,i=this._getCombinedOpacityAndColor(e);this._materials[0]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,shading:+!!r,castShadows:r&&this.symbolLayer.castShadows,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters},this._context),this._needsUV=this._materials[0]instanceof b;let a=this.symbolLayer.outline;if(J(a)){let e=y(a.pattern),n=R(a.pattern?a.patternCap||`butt`:`square`);this._materials[1]=new x({color:this._getOutlineColor(),width:t(a.size),polygonOffset:3,polygonOffsetIndex:z(this._renderPriority,this._renderPriorityStep),shadingEnabled:r,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&v(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){if(C(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0}else return 0;return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=A(W.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=j(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicallyBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=B(t.geometry);if(!i)return null;let a=this._shadingEnabled,o=m(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,requireNormals:a,outlineOutput:`vertex-data`,owner:this._context.layer});if(o==null)return null;let d=new K(o,n,this._context.layerViewUid,t.uid),f=d.renderInfo.vertexCount;if(this._needsUV){d.uvMapSpace=l(f*4,!0),d.textureElementIndices=Array(f),d.boundingRect=s(9*(d.renderInfo.polygonIndices.length/3));let e=O(d.uvMapSpace,d.boundingRect,d.textureElementIndices,d.renderInfo.positions,d.renderInfo.polygonIndices,this._context.renderCoordsHelper);d.boundingRect=c(d.boundingRect,0,9*e),d.boundingRectIndices=u(e)}if(d.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(d),this._createAs3DShapeFill(e,d),this._materials[1]&&this._createAs3DShapeOutline(d),this._logGeometryCreationWarnings(d.renderInfo,i.rings,`rings`,`FillSymbol3DLayer`),d.outGeometries.length===0)return null;let p=new g({geometries:d.outGeometries,castShadow:this._shadingEnabled,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=d.plateLayout,_=new F(this,p,null,(e,t,n,r,i)=>D(e,t,n,r,i,h),r);return _.alignedSampledElevation=d.renderInfo.sampledElevation,_.needsElevationUpdates=j(r.mode),_}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s,vertexCount:c,compressedNormals:l}=t.renderInfo;if(s===0||this._context.clippingExtent!=null&&(n(i,G),!r(G,this._context.clippingExtent)))return;let u=this._fastUpdates?.visualVariables.color,d=V({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:u?null:t.color,compressedNormals:l,colorFeature:u?w(u,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.plateLayout=new M(c,0,null,0,s/3),N(d,t.plateLayout),t.outGeometries.push(d)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,G),!r(G,this._context.clippingExtent)))continue;let i=f(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=B(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=h(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new q(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderInfo.vertexCount*4,!0),k(o.uvMapSpace,o.renderInfo.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.isGlobal)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderInfo,r.rings,`rings`,`FillSymbol3DLayer`),new P(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0)return;let c=n(i,G);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=V({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?w(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new _(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,G),!r(G,this._context.clippingExtent))continue;a(e.outBoundingBox,G);let i=f(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new _(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return L(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new T({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??e})}}const G=o();class K extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}class q extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}function J(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{W as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Graphics3DPointSymbol as e}from"./Graphics3DPointSymbol.js";import{Graphics3DSymbol as t}from"./Graphics3DSymbol.js";function n(n,r,i){switch(n.type){case`point-3d`:return new e(n,r,i);default:return new t(n,r,i)}}export{n as make};
2
+ import{Graphics3DPointSymbol as e}from"./Graphics3DPointSymbol.js";import{Graphics3DSymbol as t}from"./Graphics3DSymbol.js";function n(n,r,i){return n.type===`point-3d`?new e(n,r,i):new t(n,r,i)}export{n as make};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{copy as e,set as t,length as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as r,fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../../core/Logger.js";import{create as o,center as s,height as c}from"../../../../geometry/support/aaBoundingBox.js";import{textVerticalPaddingPx as l}from"../../webgl-engine/lib/TextRenderer.js";import{HUDMaterial as u}from"../../webgl-engine/materials/HUDMaterial.js";import{labelMarginPx as d}from"./constants.js";import{getGraphics3DSymbol as f}from"./graphicSymbolUtils.js";import{LabelPlacement as p}from"./LabelParameters.js";const m=()=>a.getLogger(`esri.views.3d.layers.graphics.labelPlacement`);class h{constructor(e,t,n,r=null){this._graphic=e,this._symbol=t,this._class=n,this._disablePlacement=r}get placement(){let e=this._verticalOffsetPlacement;if(e==null)return null;let t=this._getPlacementInfo(e);if(t==null)return null;let n=t.anchor,r=!!e.hasLabelVerticalOffset,i=e.verticalOffset,a=new p(i,n,r);return this._calculatePlacementOffsets(a,t)}get _verticalOffsetPlacement(){let e=this._class.labelPlacement,{_symbol:t,_graphic:n}=this,r=f(n.graphics3DSymbol),i=r?.symbol.type===`point-3d`?r.symbol:null,a=y[e]||this._defaultPlacementInfo;return i?.supportsCallout()&&i.hasVisibleVerticalOffset()&&!n.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:i.verticalOffset.clone(),anchor:null,normalizedOffset:null}:t?.hasVisibleVerticalOffset()&&(i==null||!i.supportsCallout()||!i.verticalOffset||n.isDraped)?!a||!v(a.placement)?(m().errorOncePerTick(`Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with `+e+` placement)`),null):{placement:`above-center`,verticalOffset:t.verticalOffset.clone(),anchor:`bottom`,normalizedOffset:[0,a.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}}_getPlacementInfo(e){if(e.anchor)return e;let t=this._class.labelPlacement,n=y[t],r=n||this._defaultPlacementInfo;return t&&!n&&m().warnOnce(`the requested label placement '${t}' is currently unsupported in SceneView.`),this._validatePlacementInfo(r)}_calculatePlacementOffsets(e,t){let n=this._graphic.graphic.geometry;if(n==null)return null;switch(n.type){case`point`:this._setPointSpecificPlacement(e,t);break;case`mesh`:this._setMeshSpecificPlacement(e,t);break;case`polygon`:this._setPolygonSpecificPlacement(e,t)}let r=d-l;return e.screenOffset[0]+=r*t.normalizedOffset[0],e.screenOffset[1]+=r*t.normalizedOffset[1],e}get _defaultPlacementInfo(){let e=this._graphic.graphic.geometry;if(e==null)return null;switch(e.type){case`polyline`:case`extent`:case`multipoint`:return{placement:`center-center`,normalizedOffset:r,anchor:`center`};case`polygon`:return this._firstSymbolLayer?.type===`extrude`?y[`above-center`]:{placement:`center-center`,normalizedOffset:r,anchor:`center`};case`point`:case`mesh`:return y[`above-center`];default:return}}_validatePlacementInfo(e){let t=this._graphic.graphic.geometry;if(t==null)return null;if(this._disablePlacement!=null){let t=this._class.labelPlacement;return t?(m().warnOncePerTick(g(t,this._disablePlacement.logEntityDescription)),this._defaultPlacementInfo):e}let n=t.type;switch(n){case`polyline`:case`polygon`:case`extent`:case`multipoint`:{let e=this._class.labelPlacement;if(e)return y[e]&&m().warnOnce(g(e,`'${n}' geometries`)),this._defaultPlacementInfo;break}case`point`:case`mesh`:return e}return e}_setPointSpecificPlacement(n,r){let i=this._firstSymbolLayer;if(i==null)return;let a=this._graphic.layers[0],o=a?.type===`buffer`&&(i.type===`icon`||i.type===`text`);switch(a!=null&&!o?e(n.translation,a.getCenterObjectSpace()):t(n.translation,0,0,0),i.type){case`icon`:case`text`:this._setHUDSpecificPlacement(n,r,a);break;case`object`:_(n,r,a)}}_setMeshSpecificPlacement(e,t){let n=this._firstSymbolLayer;n!=null&&n.type===`fill`&&_(e,t,this._graphic.layers[0])}_setPolygonSpecificPlacement(e,n){let r=this._firstSymbolLayer;if(r!=null)switch(r.type){case`extrude`:{let r=this._graphic.layers[0];r==null?t(e.translation,0,0,0):(r.getBoundingBoxObjectSpace(S),s(S,e.translation),e.translation[2]=c(S)/2),_(e,n,r);break}}}_setHUDSpecificPlacement(e,t,n){let r=n==null?null:n.getScreenSize();if(!this._graphic.isDraped&&r!=null){let n=this._normalizedSymbolAnchorPos;e.screenOffset[0]=r[0]/2*(t.normalizedOffset[0]-n[0]);let i=r[1]/2*(t.normalizedOffset[1]-n[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=i,e.centerOffsetUnits=`screen`):e.screenOffset[1]=i}else!e.hasLabelVerticalOffset&&e.anchor!==`center`&&(y[this._class.labelPlacement]&&m().warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor=`center`)}get _firstSymbolLayer(){let e=this._graphic.graphics3DSymbol,t=f(e);return t==null?null:t.symbol.symbolLayers.at(0)}get _normalizedSymbolAnchorPos(){let e=this._graphic.layers[0],t=e?.type===`object3d`||e?.type===`buffer`?e.stageObject.geometries[0].material:null;if(t&&t instanceof u){let e=t.parameters.anchorPosition;x[0]=(e[0]-.5)*2,x[1]=(e[1]-.5)*2}else x[0]=0,x[1]=0;return x}}function g(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function _(e,t,r){let a=r==null?S:r.getBoundingBoxObjectSpace(S),o=i(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(o[0]*o[0]+o[1]*o[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];let c=e.translation[2],l=o[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=c+l;let u=n(o);e.centerOffset[2]=u/2*t.normalizedOffset[2]}function v(e){switch(e){case`above-center`:return!0;default:return!1}}const y={"above-center":{placement:`above-center`,normalizedOffset:[0,1,0],anchor:`bottom`},"above-left":{placement:`above-left`,normalizedOffset:[-1,1,0],anchor:`bottom-right`},"above-right":{placement:`above-right`,normalizedOffset:[1,1,0],anchor:`bottom-left`},"below-center":{placement:`below-center`,normalizedOffset:[0,-1,2],anchor:`top`},"below-left":{placement:`below-left`,normalizedOffset:[-1,-1,0],anchor:`top-right`},"below-right":{placement:`below-right`,normalizedOffset:[1,-1,0],anchor:`top-left`},"center-center":{placement:`center-center`,normalizedOffset:[0,0,1],anchor:`center`},"center-left":{placement:`center-left`,normalizedOffset:[-1,0,0],anchor:`right`},"center-right":{placement:`center-right`,normalizedOffset:[1,0,0],anchor:`left`}},b={"above-center":[`default`,`esriServerPointLabelPlacementAboveCenter`],"above-left":[`esriServerPointLabelPlacementAboveLeft`],"above-right":[`esriServerPointLabelPlacementAboveRight`],"below-center":[`esriServerPointLabelPlacementBelowCenter`],"below-left":[`esriServerPointLabelPlacementBelowLeft`],"below-right":[`esriServerPointLabelPlacementBelowRight`],"center-center":[`esriServerPointLabelPlacementCenterCenter`],"center-left":[`esriServerPointLabelPlacementCenterLeft`],"center-right":[`esriServerPointLabelPlacementCenterRight`]};for(let e in b){let t=b[e],n=y[e];t.forEach(e=>{y[e]=n})}Object.freeze&&(Object.freeze(y),Object.keys(y).forEach(e=>{Object.freeze(y[e]),Object.freeze(y[e]?.normalizedOffset)}));const x=[0,0],S=o();export{h as LabelInfo};
2
+ import{copy as e,set as t,length as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as r,fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../../core/Logger.js";import{create as o,center as s,height as c}from"../../../../geometry/support/aaBoundingBox.js";import{textVerticalPaddingPx as l}from"../../webgl-engine/lib/TextRenderer.js";import{HUDMaterial as u}from"../../webgl-engine/materials/HUDMaterial.js";import{labelMarginPx as d}from"./constants.js";import{getGraphics3DSymbol as f}from"./graphicSymbolUtils.js";import{LabelPlacement as p}from"./LabelParameters.js";const m=()=>a.getLogger(`esri.views.3d.layers.graphics.labelPlacement`);class h{constructor(e,t,n,r=null){this._graphic=e,this._symbol=t,this._class=n,this._disablePlacement=r}get placement(){let e=this._verticalOffsetPlacement;if(e==null)return null;let t=this._getPlacementInfo(e);if(t==null)return null;let n=t.anchor,r=!!e.hasLabelVerticalOffset,i=e.verticalOffset,a=new p(i,n,r);return this._calculatePlacementOffsets(a,t)}get _verticalOffsetPlacement(){let e=this._class.labelPlacement,{_symbol:t,_graphic:n}=this,r=f(n.graphics3DSymbol),i=r?.symbol.type===`point-3d`?r.symbol:null,a=y[e]||this._defaultPlacementInfo;return i?.supportsCallout()&&i.hasVisibleVerticalOffset()&&!n.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:i.verticalOffset.clone(),anchor:null,normalizedOffset:null}:t?.hasVisibleVerticalOffset()&&(i==null||!i.supportsCallout()||!i.verticalOffset||n.isDraped)?!a||!v(a.placement)?(m().errorOncePerTick(`Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with `+e+` placement)`),null):{placement:`above-center`,verticalOffset:t.verticalOffset.clone(),anchor:`bottom`,normalizedOffset:[0,a.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}}_getPlacementInfo(e){if(e.anchor)return e;let t=this._class.labelPlacement,n=y[t],r=n||this._defaultPlacementInfo;return t&&!n&&m().warnOnce(`the requested label placement '${t}' is currently unsupported in SceneView.`),this._validatePlacementInfo(r)}_calculatePlacementOffsets(e,t){let n=this._graphic.graphic.geometry;if(n==null)return null;switch(n.type){case`point`:this._setPointSpecificPlacement(e,t);break;case`mesh`:this._setMeshSpecificPlacement(e,t);break;case`polygon`:this._setPolygonSpecificPlacement(e,t)}let r=d-l;return e.screenOffset[0]+=r*t.normalizedOffset[0],e.screenOffset[1]+=r*t.normalizedOffset[1],e}get _defaultPlacementInfo(){let e=this._graphic.graphic.geometry;if(e==null)return null;switch(e.type){case`polyline`:case`extent`:case`multipoint`:return{placement:`center-center`,normalizedOffset:r,anchor:`center`};case`polygon`:return this._firstSymbolLayer?.type===`extrude`?y[`above-center`]:{placement:`center-center`,normalizedOffset:r,anchor:`center`};case`point`:case`mesh`:return y[`above-center`];default:return}}_validatePlacementInfo(e){let t=this._graphic.graphic.geometry;if(t==null)return null;if(this._disablePlacement!=null){let t=this._class.labelPlacement;return t?(m().warnOncePerTick(g(t,this._disablePlacement.logEntityDescription)),this._defaultPlacementInfo):e}let n=t.type;switch(n){case`polyline`:case`polygon`:case`extent`:case`multipoint`:{let e=this._class.labelPlacement;if(e)return y[e]&&m().warnOnce(g(e,`'${n}' geometries`)),this._defaultPlacementInfo;break}case`point`:case`mesh`:return e}return e}_setPointSpecificPlacement(n,r){let i=this._firstSymbolLayer;if(i==null)return;let a=this._graphic.layers[0],o=a?.type===`buffer`&&(i.type===`icon`||i.type===`text`);switch(a!=null&&!o?e(n.translation,a.getCenterObjectSpace()):t(n.translation,0,0,0),i.type){case`icon`:case`text`:this._setHUDSpecificPlacement(n,r,a);break;case`object`:_(n,r,a)}}_setMeshSpecificPlacement(e,t){let n=this._firstSymbolLayer;n!=null&&n.type===`fill`&&_(e,t,this._graphic.layers[0])}_setPolygonSpecificPlacement(e,n){let r=this._firstSymbolLayer;if(r!=null)switch(r.type){case`extrude`:{let r=this._graphic.layers[0];r==null?t(e.translation,0,0,0):(r.getBoundingBoxObjectSpace(S),s(S,e.translation),e.translation[2]=c(S)/2),_(e,n,r);break}}}_setHUDSpecificPlacement(e,t,n){let r=n==null?null:n.getScreenSize();if(!this._graphic.isDraped&&r!=null){let n=this._normalizedSymbolAnchorPos;e.screenOffset[0]=r[0]/2*(t.normalizedOffset[0]-n[0]);let i=r[1]/2*(t.normalizedOffset[1]-n[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=i,e.centerOffsetUnits=`screen`):e.screenOffset[1]=i}else!e.hasLabelVerticalOffset&&e.anchor!==`center`&&(y[this._class.labelPlacement]&&m().warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor=`center`)}get _firstSymbolLayer(){let e=this._graphic.graphics3DSymbol,t=f(e);return t==null?null:t.symbol.symbolLayers.at(0)}get _normalizedSymbolAnchorPos(){let e=this._graphic.layers[0],t=e?.type===`object3d`||e?.type===`buffer`?e.stageObject.geometries[0].material:null;if(t&&t instanceof u){let e=t.parameters.anchorPosition;x[0]=(e[0]-.5)*2,x[1]=(e[1]-.5)*2}else x[0]=0,x[1]=0;return x}}function g(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function _(e,t,r){let a=r==null?S:r.getBoundingBoxObjectSpace(S),o=i(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(o[0]*o[0]+o[1]*o[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];let c=e.translation[2],l=o[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=c+l;let u=n(o);e.centerOffset[2]=u/2*t.normalizedOffset[2]}function v(e){return e===`above-center`}const y={"above-center":{placement:`above-center`,normalizedOffset:[0,1,0],anchor:`bottom`},"above-left":{placement:`above-left`,normalizedOffset:[-1,1,0],anchor:`bottom-right`},"above-right":{placement:`above-right`,normalizedOffset:[1,1,0],anchor:`bottom-left`},"below-center":{placement:`below-center`,normalizedOffset:[0,-1,2],anchor:`top`},"below-left":{placement:`below-left`,normalizedOffset:[-1,-1,0],anchor:`top-right`},"below-right":{placement:`below-right`,normalizedOffset:[1,-1,0],anchor:`top-left`},"center-center":{placement:`center-center`,normalizedOffset:[0,0,1],anchor:`center`},"center-left":{placement:`center-left`,normalizedOffset:[-1,0,0],anchor:`right`},"center-right":{placement:`center-right`,normalizedOffset:[1,0,0],anchor:`left`}},b={"above-center":[`default`,`esriServerPointLabelPlacementAboveCenter`],"above-left":[`esriServerPointLabelPlacementAboveLeft`],"above-right":[`esriServerPointLabelPlacementAboveRight`],"below-center":[`esriServerPointLabelPlacementBelowCenter`],"below-left":[`esriServerPointLabelPlacementBelowLeft`],"below-right":[`esriServerPointLabelPlacementBelowRight`],"center-center":[`esriServerPointLabelPlacementCenterCenter`],"center-left":[`esriServerPointLabelPlacementCenterLeft`],"center-right":[`esriServerPointLabelPlacementCenterRight`]};for(let e in b){let t=b[e],n=y[e];t.forEach(e=>{y[e]=n})}Object.freeze&&(Object.freeze(y),Object.keys(y).forEach(e=>{Object.freeze(y[e]),Object.freeze(y[e]?.normalizedOffset)}));const x=[0,0],S=o();export{h as LabelInfo};