@arcgis/core 4.34.0-next.81 → 4.34.0-next.83

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 (106) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{9789f178ece126c4006d.js → 25ea02dd7d45a90cbb3b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{6271a706ac3fcba91432.js → 609abf071c4ea24955c2.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{afb2770c4abbff9bab3d.js → 71c2a8e5a17803d3e949.js} +1 -1
  5. package/assets/esri/core/workers/chunks/77705d0c7c17bd46d81a.js +1 -0
  6. package/assets/esri/core/workers/chunks/{22f196d173711ebd64c7.js → 8513c9282c44bb0a736e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{db2396bf062468ee8b60.js → 8bdbd94a59269e216fba.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ecac5ca00c742bfb5898.js → 998d164b3e0b99a0ff1e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{96e483db7dd1f5dbb07a.js → 9a6fa91dd204f64d2590.js} +1 -1
  10. package/assets/esri/core/workers/chunks/a1196637268b89281780.js +1 -0
  11. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +1 -0
  12. package/assets/esri/core/workers/chunks/{b6c4712e00fce87bd0f4.js → aa1eb7b4d9ccda725da5.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{20ae2316d927415f3df9.js → b43473e84b3f7fa2634d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b168b6ffc16cd509d316.js → bd028badc07270eda3d0.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{6593b419339e7598b760.js → d5363e5637d37e89a25f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{81a8addcb858086ff9ee.js → e17df11c98dbd869302b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +1 -0
  18. package/assets/esri/core/workers/chunks/e4acc3c2b6d865ed1940.js +1 -0
  19. package/assets/esri/core/workers/chunks/{6e2a3abc3dbc342212c4.js → f35003a90163847fe1e2.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{a99752aec4602b5eeeaf.js → f8f85207b382c1ea038c.js} +11 -3
  21. package/assets/esri/core/workers/chunks/{9c5dcef2a75d4bb9b3d6.js → fcac475e4e82911b3126.js} +1 -1
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/chunks/CutFillComposition.glsl.js +8 -0
  25. package/chunks/CutFillMask.glsl.js +6 -0
  26. package/config.js +1 -1
  27. package/geometry/Extent.js +1 -1
  28. package/geometry/support/aaBoundingRect.js +1 -1
  29. package/interfaces.d.ts +53 -83
  30. package/kernel.js +1 -1
  31. package/layers/ImageryLayer.js +1 -1
  32. package/layers/ImageryTileLayer.js +1 -1
  33. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  34. package/layers/support/ElevationSampler.js +1 -1
  35. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  36. package/layers/support/rasterDatasets/datasetUtils.js +1 -1
  37. package/layers/support/tiles3DUtils.js +1 -1
  38. package/package.json +1 -1
  39. package/portal/schemas/definitions.js +1 -1
  40. package/smartMapping/renderers/color.js +1 -1
  41. package/smartMapping/renderers/location.js +1 -1
  42. package/smartMapping/renderers/predominance.js +1 -1
  43. package/smartMapping/renderers/relationship.js +1 -1
  44. package/smartMapping/renderers/size.js +1 -1
  45. package/smartMapping/renderers/type.js +1 -1
  46. package/smartMapping/statistics/summaryStatistics.js +1 -1
  47. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  48. package/smartMapping/support/adapters/support/utils.js +1 -1
  49. package/smartMapping/support/utils.js +1 -1
  50. package/support/elevationInfoUtils.js +1 -1
  51. package/support/revision.js +1 -1
  52. package/tables/elements.js +1 -1
  53. package/views/2d/engine/Stage.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  55. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
  56. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
  57. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
  58. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
  59. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  60. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  61. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  62. package/views/3d/layers/FlowSubView3D.js +1 -1
  63. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  64. package/views/3d/support/DisplayQualityProfile.js +1 -1
  65. package/views/3d/support/QualitySettings.js +1 -1
  66. package/views/3d/support/engineContent/line.js +1 -1
  67. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  68. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  69. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  70. package/views/3d/support/flow/geometryUtils.js +1 -1
  71. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  72. package/views/3d/terrain/OverlayManager.js +1 -1
  73. package/views/3d/terrain/Queue.js +5 -0
  74. package/views/3d/terrain/TerrainSurface.js +1 -1
  75. package/views/3d/terrain/Tile.js +1 -1
  76. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  77. package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +15 -7
  78. package/views/3d/webgl-engine/lib/CutFillColor.js +5 -0
  79. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  80. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  81. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  82. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +5 -0
  83. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +5 -0
  84. package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +5 -0
  85. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +5 -0
  86. package/views/3d/webgl.js +1 -1
  87. package/views/support/DefaultsFromMap.js +1 -1
  88. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  89. package/widgets/Editor/EditorViewModel.js +1 -1
  90. package/widgets/Editor/SplitFeatureWorkflow.js +5 -0
  91. package/widgets/Editor/SplitFeatureWorkflowData.js +5 -0
  92. package/widgets/Editor/UpdateWorkflow.js +1 -1
  93. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  94. package/widgets/Editor/workflowUtils.js +1 -1
  95. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  96. package/widgets/Search/SearchViewModel.js +1 -1
  97. package/widgets/Search.js +1 -1
  98. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  99. package/widgets/UtilityNetworkTrace.js +1 -1
  100. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  101. package/assets/esri/core/workers/chunks/07a355a9c95154971aab.js +0 -1
  102. package/assets/esri/core/workers/chunks/22a66db7d73e733917e3.js +0 -1
  103. package/assets/esri/core/workers/chunks/5f079be7f322768aef21.js +0 -1
  104. package/assets/esri/core/workers/chunks/cb3b88959b2f048e54a5.js +0 -1
  105. package/assets/esri/core/workers/chunks/da1a5537e2f2ca6cc247.js +0 -1
  106. package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +0 -5
package/interfaces.d.ts CHANGED
@@ -34392,7 +34392,7 @@ declare namespace __esri {
34392
34392
  type?: "range" | "coded-value" | "inherited" | nullish;
34393
34393
  }
34394
34394
 
34395
- export class ElevationSampler {
34395
+ export class ElevationSampler extends Evented {
34396
34396
  /**
34397
34397
  * The minimum and maximum resolution of the data in the sampler.
34398
34398
  *
@@ -34426,6 +34426,24 @@ declare namespace __esri {
34426
34426
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-ElevationSampler.html#elevationAt Read more...}
34427
34427
  */
34428
34428
  elevationAt(x: number, y: number): number;
34429
+ /**
34430
+ * Emits an event on the instance.
34431
+ *
34432
+ * @param type The name of the event.
34433
+ * @param event The event payload.
34434
+ *
34435
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-ElevationSampler.html#emit Read more...}
34436
+ */
34437
+ emit(type: string, event?: any): boolean;
34438
+ /**
34439
+ * Indicates whether there is an event listener on the instance that matches
34440
+ * the provided event name.
34441
+ *
34442
+ * @param type The name of the event.
34443
+ *
34444
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-ElevationSampler.html#hasEventListener Read more...}
34445
+ */
34446
+ hasEventListener(type: string): boolean;
34429
34447
  /**
34430
34448
  * Query elevation for a {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html Point}, {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html Polyline} or
34431
34449
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Multipoint.html Multipoint} geometry.
@@ -62584,6 +62602,7 @@ declare namespace __esri {
62584
62602
  gdbVersion?: string;
62585
62603
  globalIdUsed?: boolean;
62586
62604
  honorSequenceOfEdits?: boolean;
62605
+ trueCurveClient?: boolean;
62587
62606
  usePreviousEditMoment?: boolean;
62588
62607
  }
62589
62608
 
@@ -93262,6 +93281,8 @@ declare namespace __esri {
93262
93281
  /**
93263
93282
  * Attribute table element types.
93264
93283
  *
93284
+ * @deprecated since version 4.34. Import individual element modules directly instead.
93285
+ *
93265
93286
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableElement Read more...}
93266
93287
  */
93267
93288
  export type AttributeTableElement = | __esri.AttributeTableFieldElement
@@ -93271,6 +93292,8 @@ declare namespace __esri {
93271
93292
  /**
93272
93293
  * `AttributeTableFieldElement` defines how a feature layer's field participates in the attribute table.
93273
93294
  *
93295
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableFieldElement} directly instead.
93296
+ *
93274
93297
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableFieldElement Read more...}
93275
93298
  */
93276
93299
  export type AttributeTableFieldElement = __esri.AttributeTableFieldElement;
@@ -93279,6 +93302,8 @@ declare namespace __esri {
93279
93302
  * `AttributeTableGroupElement` defines a container that holds a set of attribute table elements
93280
93303
  * that can be displayed together.
93281
93304
  *
93305
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableGroupElement} directly instead.
93306
+ *
93282
93307
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableGroupElement Read more...}
93283
93308
  */
93284
93309
  export type AttributeTableGroupElement = __esri.AttributeTableGroupElement;
@@ -93286,6 +93311,8 @@ declare namespace __esri {
93286
93311
  /**
93287
93312
  * `AttributeTableRelationshipElement` defines how a relationship between {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html feature layers} and {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#tables tables} participates in the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html FeatureTable}.
93288
93313
  *
93314
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableRelationshipElement} directly instead.
93315
+ *
93289
93316
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableRelationshipElement Read more...}
93290
93317
  */
93291
93318
  export type AttributeTableRelationshipElement = __esri.AttributeTableRelationshipElement;
@@ -93293,6 +93320,8 @@ declare namespace __esri {
93293
93320
  /**
93294
93321
  * `AttributeTableAttachmentElement` defines how one or more attachments can participate in the attribute table.
93295
93322
  *
93323
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableAttachmentElement} directly instead.
93324
+ *
93296
93325
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableAttachmentElement Read more...}
93297
93326
  */
93298
93327
  export type AttributeTableAttachmentElement = __esri.AttributeTableAttachmentElement;
@@ -93527,12 +93556,16 @@ declare namespace __esri {
93527
93556
  /**
93528
93557
  * `AttributeTableAttachmentElement` defines how one or more attachments can participate in the attribute table.
93529
93558
  *
93559
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableAttachmentElement} directly instead.
93560
+ *
93530
93561
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableAttachmentElement Read more...}
93531
93562
  */
93532
93563
  export type elementsAttributeTableAttachmentElement = AttributeTableAttachmentElement;
93533
93564
  /**
93534
93565
  * Attribute table element types.
93535
93566
  *
93567
+ * @deprecated since version 4.34. Import individual element modules directly instead.
93568
+ *
93536
93569
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableElement Read more...}
93537
93570
  */
93538
93571
  export type elementsAttributeTableElement = | AttributeTableFieldElement
@@ -93542,6 +93575,8 @@ declare namespace __esri {
93542
93575
  /**
93543
93576
  * `AttributeTableFieldElement` defines how a feature layer's field participates in the attribute table.
93544
93577
  *
93578
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableFieldElement} directly instead.
93579
+ *
93545
93580
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableFieldElement Read more...}
93546
93581
  */
93547
93582
  export type elementsAttributeTableFieldElement = AttributeTableFieldElement;
@@ -93549,12 +93584,16 @@ declare namespace __esri {
93549
93584
  * `AttributeTableGroupElement` defines a container that holds a set of attribute table elements
93550
93585
  * that can be displayed together.
93551
93586
  *
93587
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableGroupElement} directly instead.
93588
+ *
93552
93589
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableGroupElement Read more...}
93553
93590
  */
93554
93591
  export type elementsAttributeTableGroupElement = AttributeTableGroupElement;
93555
93592
  /**
93556
93593
  * `AttributeTableRelationshipElement` defines how a relationship between {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html feature layers} and {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#tables tables} participates in the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html FeatureTable}.
93557
93594
  *
93595
+ * @deprecated since version 4.34. Import {@link module:esri/tables/elements/AttributeTableRelationshipElement} directly instead.
93596
+ *
93558
93597
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-elements.html#AttributeTableRelationshipElement Read more...}
93559
93598
  */
93560
93599
  export type elementsAttributeTableRelationshipElement = AttributeTableRelationshipElement;
@@ -116052,6 +116091,7 @@ declare namespace __esri {
116052
116091
  */
116053
116092
  readonly type: | "add-association"
116054
116093
  | "create-features"
116094
+ | "split-feature"
116055
116095
  | "update"
116056
116096
  | "update-feature"
116057
116097
  | "update-features"
@@ -132052,6 +132092,12 @@ declare namespace __esri {
132052
132092
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#maxSuggestions Read more...}
132053
132093
  */
132054
132094
  maxSuggestions: number;
132095
+ /**
132096
+ * The associated message bundle.
132097
+ *
132098
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#messages Read more...}
132099
+ */
132100
+ messages: any;
132055
132101
  /**
132056
132102
  * The minimum number of characters needed for the search if not specified by the source.
132057
132103
  *
@@ -132384,6 +132430,12 @@ declare namespace __esri {
132384
132430
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#maxSuggestions Read more...}
132385
132431
  */
132386
132432
  maxSuggestions?: number;
132433
+ /**
132434
+ * The associated message bundle.
132435
+ *
132436
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#messages Read more...}
132437
+ */
132438
+ messages?: any;
132387
132439
  /**
132388
132440
  * The minimum number of characters needed for the search if not specified by the source.
132389
132441
  *
@@ -140209,15 +140261,6 @@ declare namespace __esri {
140209
140261
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace.html#flags Read more...}
140210
140262
  */
140211
140263
  flags: FlagProperty[];
140212
- /**
140213
- * The Geodatabase version to pass into the trace.
140214
- *
140215
- * @default "sde.DEFAULT"
140216
- * @deprecated since version 4.31, gdbVersion will be removed and the gdbVersion of the {@link module:esri/networks/UtilityNetwork} will be consumed directly.
140217
- *
140218
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace.html#gdbVersion Read more...}
140219
- */
140220
- gdbVersion: string;
140221
140264
  /**
140222
140265
  * Icon displayed in the widget's button.
140223
140266
  *
@@ -140368,14 +140411,6 @@ declare namespace __esri {
140368
140411
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace.html#flags Read more...}
140369
140412
  */
140370
140413
  flags?: FlagProperty[];
140371
- /**
140372
- * The Geodatabase version to pass into the trace.
140373
- *
140374
- * @deprecated since version 4.31, gdbVersion will be removed and the gdbVersion of the {@link module:esri/networks/UtilityNetwork} will be consumed directly.
140375
- *
140376
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace.html#gdbVersion Read more...}
140377
- */
140378
- gdbVersion?: string;
140379
140414
  /**
140380
140415
  * Icon displayed in the widget's button.
140381
140416
  *
@@ -140477,15 +140512,6 @@ declare namespace __esri {
140477
140512
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace-UtilityNetworkTraceViewModel.html#flags Read more...}
140478
140513
  */
140479
140514
  flags: FlagProperty[];
140480
- /**
140481
- * The Geodatabase version to pass into the trace.
140482
- *
140483
- * @default "sde.DEFAULT"
140484
- * @deprecated since version 4.31, gdbVersion will be removed and the gdbVersion of the {@link module:esri/networks/UtilityNetwork} will be consumed directly.
140485
- *
140486
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace-UtilityNetworkTraceViewModel.html#gdbVersion Read more...}
140487
- */
140488
- gdbVersion: string;
140489
140515
  /**
140490
140516
  * This function provides the ability to override either the
140491
140517
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo MapView goTo()} or
@@ -140823,14 +140849,6 @@ declare namespace __esri {
140823
140849
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace-UtilityNetworkTraceViewModel.html#flags Read more...}
140824
140850
  */
140825
140851
  flags?: FlagProperty[];
140826
- /**
140827
- * The Geodatabase version to pass into the trace.
140828
- *
140829
- * @deprecated since version 4.31, gdbVersion will be removed and the gdbVersion of the {@link module:esri/networks/UtilityNetwork} will be consumed directly.
140830
- *
140831
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-UtilityNetworkTrace-UtilityNetworkTraceViewModel.html#gdbVersion Read more...}
140832
- */
140833
- gdbVersion?: string;
140834
140852
  /**
140835
140853
  * This function provides the ability to override either the
140836
140854
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo MapView goTo()} or
@@ -141774,22 +141792,6 @@ declare namespace __esri {
141774
141792
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionAdministratorLookup Read more...}
141775
141793
  */
141776
141794
  versionAdministratorLookup: globalThis.Map<string, boolean>;
141777
- /**
141778
- * A Map of current version identifiers keyed on the map service url.
141779
- *
141780
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141781
- *
141782
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionIdentifierLookup Read more...}
141783
- */
141784
- versionIdentifierLookup: globalThis.Map<string, VersionIdentifier>;
141785
- /**
141786
- * Contains information about versions contained in version management service such as name, guid, etc.
141787
- *
141788
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141789
- *
141790
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionInfoLookup Read more...}
141791
- */
141792
- versionInfoLookup: globalThis.Map<string, VersionManagementViewModelVersionInfo[]>;
141793
141795
  /**
141794
141796
  * This property contains metadata about the versioning state.
141795
141797
  *
@@ -141797,14 +141799,6 @@ declare namespace __esri {
141797
141799
  */
141798
141800
  versioningStateLookup: globalThis.Map<string, VersioningState>;
141799
141801
  versioningStates: Collection<VersioningState>;
141800
- /**
141801
- * This property contains metadata about the version management service.
141802
- *
141803
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141804
- *
141805
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionManagementServiceLookup Read more...}
141806
- */
141807
- versionManagementServiceLookup: globalThis.Map<string, VersionManagementService>;
141808
141802
  /**
141809
141803
  * The view from which the widget will operate.
141810
141804
  *
@@ -141894,22 +141888,6 @@ declare namespace __esri {
141894
141888
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionAdministratorLookup Read more...}
141895
141889
  */
141896
141890
  versionAdministratorLookup?: globalThis.Map<string, boolean>;
141897
- /**
141898
- * A Map of current version identifiers keyed on the map service url.
141899
- *
141900
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141901
- *
141902
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionIdentifierLookup Read more...}
141903
- */
141904
- versionIdentifierLookup?: globalThis.Map<string, VersionIdentifier>;
141905
- /**
141906
- * Contains information about versions contained in version management service such as name, guid, etc.
141907
- *
141908
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141909
- *
141910
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionInfoLookup Read more...}
141911
- */
141912
- versionInfoLookup?: globalThis.Map<string, VersionManagementViewModelVersionInfo[]>;
141913
141891
  /**
141914
141892
  * This property contains metadata about the versioning state.
141915
141893
  *
@@ -141917,14 +141895,6 @@ declare namespace __esri {
141917
141895
  */
141918
141896
  versioningStateLookup?: globalThis.Map<string, VersioningState>;
141919
141897
  versioningStates?: Collection<VersioningState>;
141920
- /**
141921
- * This property contains metadata about the version management service.
141922
- *
141923
- * @deprecated since version 4.30. Use {@link module:esri/versionManagement/VersioningState} instead.
141924
- *
141925
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-VersionManagement-VersionManagementViewModel.html#versionManagementServiceLookup Read more...}
141926
- */
141927
- versionManagementServiceLookup?: globalThis.Map<string, VersionManagementService>;
141928
141898
  /**
141929
141899
  * The view from which the widget will operate.
141930
141900
  *
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.81",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.83",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import{ClonableMixin as t}from"../core/Clonable.js";import o from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as p}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import c from"../graphic/ImageryGraphicOrigin.js";import y from"./Layer.js";import{ArcGISImageService as u}from"./mixins/ArcGISImageService.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as j}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as w}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{legendEnabled as b,popupEnabled as P,screenSizePerspectiveEnabled as x}from"./support/commonProperties.js";import{commonRasterFieldNames as O,rasterDimensionFieldPrefix as T,setDefaultRasterFieldFormats as _}from"./support/rasterFieldUtils.js";import{serviceSupportsSpatialReference as C}from"./support/versionUtils.js";import{logInvalidElevationInfoWarning as E,elevationModeUnsupportedMessage as R,featureExpressionUnsupportedMessage as A}from"../support/elevationInfoUtils.js";import{createPopupTemplate as G}from"../support/popupUtils.js";import M from"../symbols/support/ElevationInfo.js";let $=class extends(f(S(L(g(v(w(u(j(I(h(d(s(t(y)))))))))))))){constructor(...e){super(...e),this.graphicOrigin=new c(this),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.type="imagery",this._debouncedSaveOperations=a(async(e,r,t)=>{const{save:o,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return o(this,r);case 1:return i(this,t,r)}})}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(p).then(()=>this._fetchService(r))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}writeOperationalLayerType(e,r,t){const o="vector-field"===this.renderer?.type;r[t]=o?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set,o=O.itemPixelValue.toLowerCase(),i="raster-dataset"===this.sourceType,s=T.toLowerCase(),a=`${O.servicePixelValue.toLowerCase()}.`;for(const l of r){const e=l.name.toLowerCase();e===o||e.startsWith(a)||i&&e.startsWith(s)||t.add(l.name)}const p=G({fields:r,title:this.title},{...e,visibleFieldNames:t}),{rasterInfo:n}=this;return p?.fieldInfos&&n&&_(p.fieldInfos,n),p}queryFeatures(e,r){return this.queryRasters(e,r).then(e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this,r.origin=this.graphicOrigin;return e})}queryFeatureCount(e,r){return this.queryRasterCount(e,r)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,r){return this._debouncedSaveOperations(1,r,e)}serviceSupportsSpatialReference(e){return C(this,e)}write(e,r){if(!this._isPreviewLayer)return super.write(e,r);if(r?.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new o("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}_validateElevationInfo(e){E(i.getLogger(this),R("Imagery layers","relative-to-scene",e)),E(i.getLogger(this),A("Imagery layers",e))}};e([n({type:M,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],$.prototype,"elevationInfo",null),e([n({readOnly:!0,clonable:!1})],$.prototype,"graphicOrigin",void 0),e([n(b)],$.prototype,"legendEnabled",null),e([n({type:["show","hide"]})],$.prototype,"listMode",null),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],$.prototype,"isReference",void 0),e([n({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],$.prototype,"operationalLayerType",void 0),e([m("web-map","operationalLayerType")],$.prototype,"writeOperationalLayerType",null),e([n(P)],$.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],$.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],$.prototype,"defaultPopupTemplate",null),e([n({json:{read:!1,write:!1}}),n(x)],$.prototype,"screenSizePerspectiveEnabled",void 0),e([n({readOnly:!0,json:{read:!1}})],$.prototype,"type",void 0),e([n({readOnly:!0})],$.prototype,"_isPreviewLayer",null),$=e([l("esri.layers.ImageryLayer")],$);const F=$;export{F as default};
5
+ import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import{ClonableMixin as t}from"../core/Clonable.js";import o from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as p}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import c from"../graphic/ImageryGraphicOrigin.js";import y from"./Layer.js";import{ArcGISImageService as u}from"./mixins/ArcGISImageService.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as j}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as I}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as L}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{legendEnabled as b,popupEnabled as P,screenSizePerspectiveEnabled as x}from"./support/commonProperties.js";import{commonRasterFieldNames as O,rasterDimensionFieldPrefix as T,setDefaultRasterFieldFormats as _}from"./support/rasterFieldUtils.js";import{serviceSupportsSpatialReference as C}from"./support/versionUtils.js";import{logInvalidElevationInfoWarning as E,elevationModeUnsupportedMessage as R,featureExpressionUnsupportedMessage as A}from"../support/elevationInfoUtils.js";import{createPopupTemplate as G}from"../support/popupUtils.js";import M from"../symbols/support/ElevationInfo.js";let $=class extends(f(S(w(g(v(I(u(j(L(h(d(s(t(y)))))))))))))){constructor(...e){super(...e),this.graphicOrigin=new c(this),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.type="imagery",this._debouncedSaveOperations=a(async(e,r,t)=>{const{save:o,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return o(this,r);case 1:return i(this,t,r)}})}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(p).then(()=>this._fetchService(r))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}writeOperationalLayerType(e,r,t){const o="vector-field"===this.renderer?.type;r[t]=o?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set,o=O.itemPixelValue.toLowerCase(),i="raster-dataset"===this.sourceType,s=T.toLowerCase(),a=`${O.servicePixelValue.toLowerCase()}.`;for(const l of r){const e=l.name.toLowerCase();e===o||e.startsWith(a)||i&&e.startsWith(s)||t.add(l.name)}const p=G({fields:r,title:this.title},{...e,visibleFieldNames:t}),{rasterInfo:n}=this;return p?.fieldInfos&&n&&_(p.fieldInfos,n),p}queryFeatures(e,r){return this.queryRasters(e,r).then(e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this,r.origin=this.graphicOrigin;return e})}queryFeatureCount(e,r){return this.queryRasterCount(e,r)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,r){return this._debouncedSaveOperations(1,r,e)}serviceSupportsSpatialReference(e){return C(this,e)}write(e,r){if(!this._isPreviewLayer)return super.write(e,r);if(r?.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new o("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}_validateElevationInfo(e){E(i.getLogger(this),R("Imagery layers","relative-to-scene",e)),E(i.getLogger(this),A("Imagery layers",e))}};e([n({type:M,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],$.prototype,"elevationInfo",null),e([n({readOnly:!0,clonable:!1})],$.prototype,"graphicOrigin",void 0),e([n(b)],$.prototype,"legendEnabled",null),e([n({type:["show","hide"]})],$.prototype,"listMode",null),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],$.prototype,"isReference",void 0),e([n({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],$.prototype,"operationalLayerType",void 0),e([m("web-map","operationalLayerType")],$.prototype,"writeOperationalLayerType",null),e([n(P)],$.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],$.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],$.prototype,"defaultPopupTemplate",null),e([n(x)],$.prototype,"screenSizePerspectiveEnabled",void 0),e([n({readOnly:!0,json:{read:!1}})],$.prototype,"type",void 0),e([n({readOnly:!0})],$.prototype,"_isPreviewLayer",null),$=e([l("esri.layers.ImageryLayer")],$);const F=$;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as j}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import z from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as W,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as k}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(F(v(w(j(f(g(R(_(d(S(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(E,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await z.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){W(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),W(i.getLogger(this),k("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l({json:{read:!1,write:!1}}),l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([m("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q as default};
5
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as S}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import z from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as W,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as k}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(F(v(w(S(f(g(R(_(d(j(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(E,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await z.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){W(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),W(i.getLogger(this),k("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([m("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../request.js";import i from"../core/Accessor.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{isGeographic as d}from"../geometry/support/spatialReferenceUtils.js";import h from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,invalidLayerView as u}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as y}from"./Lyr3DWorkerHandle.js";import{loadLyr3DMainWASM as c}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as g}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as m}from"../views/3d/layers/support/makeScheduleFunction.js";let w=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=r?`[js] ${i}`:`${i}`;0===t||1===t?s.getLogger(this).error(e):2===t&&s.getLogger(this).warn(e),s.getLogger(this).info(e)}}initialize(){this._debugLevel>2&&(s.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([a(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera())]),this._pulseTaskHandle=n({preRender:()=>this._pulseTask()})}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null);const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0,i.needFrame=!0,i.layerView.updatingFlagChanged())}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t)}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const s=this._layers.get(e.wasmLayerId);if(s){const r=this._lyr3DMain._malloc(8*t.length),a=new Float64Array(this._lyr3DMain.HEAPF64.buffer,r,t.length);for(let e=0;e<t.length;++e)a[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,r,t.length,i),this._lyr3DMain._free(r),s.needFrame=!0,s.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&(t.outstandingJobCount>0||t.outstandingRenderableCount>0||t.needFrame)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=c().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const l="global"===this.view.viewingMode?5:3;5===l?this._viewSR.wkid=this._viewSR.latestWkid=4326:this.view.renderSpatialReference?.isWebMercator?this._viewSR.wkid=this._viewSR.latestWkid=3857:32662===this.view.renderSpatialReference?.wkid&&(this._viewSR.wkid=this._viewSR.latestWkid=4326);const d=this.view.heightModelInfo?.heightModel,h=!d||"gravity-related-height"===d;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=h?5773:115700;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0))?(this._workerHandle=new y(m(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}_pulseTask(){if(this._lyr3DMain){let e=0,t=0;this._layers.forEach(i=>{e+=i.layerView.usedMemory,t+=i.layerView.cachedMemory}),e/=1048576,t/=1048576;const i=this.view.resourceController.memoryController,s=i.usedMemory*i.maxMemory-e;this._lyr3DMain.frame_pulse(i.memoryFactor,e,t,s,i.maxMemory),this._layers.forEach(e=>{!0===e.needFrame&&(e.needFrame=!1,e.layerView.updatingFlagChanged())})}}_incrementJobCount(e){e.outstandingJobCount+=1,1===e.outstandingJobCount&&e.outstandingRenderableCount<1&&e.layerView.updatingFlagChanged()}_decrementJobCount(e){e.outstandingJobCount-=1,0===e.outstandingJobCount&&e.outstandingRenderableCount<1&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){e.outstandingRenderableCount+=1,e.outstandingJobCount<1&&1===e.outstandingRenderableCount&&e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){e.outstandingRenderableCount-=1,e.outstandingJobCount<1&&0===e.outstandingRenderableCount&&e.layerView.updatingFlagChanged()}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(i.jobId,i.desc),this._decrementJobCount(e)}_onJobSucceeded(e,t,i){if(this._lyr3DMain){const e=t.data.byteLength,s=this._lyr3DMain._malloc(e);new Uint8Array(this._lyr3DMain.HEAPU8.buffer,s,e).set(t.data),this._lyr3DMain.on_job_completed(i.jobId,t.jobDescJson,s,e),this._lyr3DMain._free(s)}this._decrementJobCount(e)}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.append("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,a,n,o){const l=this._getRequestPromises(e.urls,t,i,s);return Promise.all(l).then(e=>(a.inputs=e,this._workerHandle.invoke(a,n))).then(e=>e).catch(t=>{let i=1;return r(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t);const i=t.abortController.signal,s=t.layerView.layer,a="integrated-mesh-3dtiles"===s.type?s.key:null,n="integrated-mesh-3dtiles"===s.type?s.session:null,o={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:a}},l={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=a=>{if(1===a.status)this._onJobFailed(t,a,e);else if(0===a.status)this._onJobSucceeded(t,a,e);else if(2===a.status){const n=this._getRequestPromises(a.missingInputUrls,o,d,s);Promise.all(n).then(e=>{l.jobDescJson=a.jobDescJson,a.originalInputs?l.inputs=a.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(const t of e)l.inputs.push(t);return this._workerHandle.invoke(l,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{this._decrementJobCount(t),r(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error2 ${i}.`),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc)})}};try{const t=await this._getInitialPromise(e,o,d,s,l,i,n);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){n===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,o,d,s,l,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc),this._decrementJobCount(t)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),t=e.meshData;if(t.data&&t.data.byteLength>0){const e=t.data.slice();t.data=e}const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{this._lyr3DMain&&this._lyr3DMain.on_renderable_created(!0,e.layerId,e.handle,t.memUsageBytes),this._decrementRenderableCount(i)}).catch(t=>{r(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),this._lyr3DMain&&this._lyr3DMain.on_renderable_created(!1,e.layerId,e.handle,0),this._decrementRenderableCount(i)}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(1===d[h]);a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._layers.delete(e.wasmLayerId),!0)}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:u};const i="integrated-mesh-3dtiles"===t.type?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==r.errorCode)return{wasmLayerId:u,check:r};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!1});const o=g(t.elevationInfo),l=e=>s.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let _=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const e=d(i);let s=1,r=1;!e&&i.wkid&&-1!==i.wkid&&(s=h.values[h[i.wkid]],r=s),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),e,s,r).catch(l)}_=this._lyr3DMain.add_gaussian_splat_layer(t.url,a,o)}else _=this._lyr3DMain.add_3dtiles_layer(t.url,a,o);return _?(this._updateWasmCamera(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:u})}_updateWasmCamera(){const e=this.view.state?.contentCamera;if(!e||!this._lyr3DMain)return;const{eye:t,center:i,up:s,near:r,far:a,fovY:n}=e,o=[e.viewport[2],e.viewport[3]],l=e.width/e.height;this._lyr3DMain.set_camera_parameters({eye:t,center:i,up:s,near:r,far:a,fov:n,aspectRatio:l,viewport:o})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([o({constructOnly:!0})],w.prototype,"view",void 0),w=e([l("esri.layers.Lyr3DWasmPerSceneView")],w);const b=w;export{b as default};
5
+ import{__decorate as e}from"tslib";import t from"../request.js";import i from"../core/Accessor.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{isGeographic as d}from"../geometry/support/spatialReferenceUtils.js";import h from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,invalidLayerView as u}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as y}from"./Lyr3DWorkerHandle.js";import{loadLyr3DMainWASM as c}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as g}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as m}from"../views/3d/layers/support/makeScheduleFunction.js";const w=3857,b=32662,p=4326,f=5773,M=115700;let L=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=r?`[js] ${i}`:`${i}`;0===t||1===t?s.getLogger(this).error(e):2===t&&s.getLogger(this).warn(e),s.getLogger(this).info(e)}}initialize(){this._debugLevel>2&&(s.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([a(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera())]),this._pulseTaskHandle=n({preRender:()=>this._pulseTask()})}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._layers.forEach(e=>{e.abortController.abort()}),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null);const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0,i.needFrame=!0,i.layerView.updatingFlagChanged())}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t)}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const s=this._layers.get(e.wasmLayerId);if(s){const r=this._lyr3DMain._malloc(8*t.length),a=new Float64Array(this._lyr3DMain.HEAPF64.buffer,r,t.length);for(let e=0;e<t.length;++e)a[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,r,t.length,i),this._lyr3DMain._free(r),s.needFrame=!0,s.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&(t.outstandingJobCount>0||t.outstandingRenderableCount>0||t.needFrame)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=c().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();const l="global"===this.view.viewingMode?5:3;if(5===l)this._viewSR.wkid=this._viewSR.latestWkid=p,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(this.view.renderSpatialReference?.isWebMercator)this._viewSR.wkid=this._viewSR.latestWkid=w,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(this.view.renderSpatialReference?.wkid===b)this._viewSR.wkid=this._viewSR.latestWkid=p,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=f;else if(!this._viewSR.latestVcsWkid&&!this._viewSR.vcsWkid){const e=this.view.heightModelInfo?.heightModel,t=!e||"gravity-related-height"===e;this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=t?f:M}return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0))?(this._workerHandle=new y(m(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}_pulseTask(){if(this._lyr3DMain){let e=0,t=0;this._layers.forEach(i=>{e+=i.layerView.usedMemory,t+=i.layerView.cachedMemory}),e/=1048576,t/=1048576;const i=this.view.resourceController.memoryController,s=i.usedMemory*i.maxMemory-e;this._lyr3DMain.frame_pulse(i.memoryFactor,e,t,s,i.maxMemory),this._layers.forEach(e=>{!0===e.needFrame&&(e.needFrame=!1,e.layerView.updatingFlagChanged())})}}_incrementJobCount(e){e.outstandingJobCount+=1,1===e.outstandingJobCount&&e.outstandingRenderableCount<1&&e.layerView.updatingFlagChanged()}_decrementJobCount(e){e.outstandingJobCount-=1,0===e.outstandingJobCount&&e.outstandingRenderableCount<1&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){e.outstandingRenderableCount+=1,e.outstandingJobCount<1&&1===e.outstandingRenderableCount&&e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){e.outstandingRenderableCount-=1,e.outstandingJobCount<1&&0===e.outstandingRenderableCount&&e.layerView.updatingFlagChanged()}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(i.jobId,i.desc),this._decrementJobCount(e)}_onJobSucceeded(e,t,i){if(this._lyr3DMain){const e=t.data.byteLength,s=this._lyr3DMain._malloc(e);new Uint8Array(this._lyr3DMain.HEAPU8.buffer,s,e).set(t.data),this._lyr3DMain.on_job_completed(i.jobId,t.jobDescJson,s,e),this._lyr3DMain._free(s)}this._decrementJobCount(e)}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.append("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,a,n,o){const l=this._getRequestPromises(e.urls,t,i,s);return Promise.all(l).then(e=>(a.inputs=e,this._workerHandle.invoke(a,n))).then(e=>e).catch(t=>{let i=1;return r(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t);const i=t.abortController.signal,s=t.layerView.layer,a="integrated-mesh-3dtiles"===s.type?s.key:null,n="integrated-mesh-3dtiles"===s.type?s.session:null,o={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:a}},l={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=a=>{if(1===a.status)this._onJobFailed(t,a,e);else if(0===a.status)this._onJobSucceeded(t,a,e);else if(2===a.status){const n=this._getRequestPromises(a.missingInputUrls,o,d,s);Promise.all(n).then(e=>{l.jobDescJson=a.jobDescJson,a.originalInputs?l.inputs=a.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(const t of e)l.inputs.push(t);return this._workerHandle.invoke(l,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{this._decrementJobCount(t),r(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error2 ${i}.`),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc)})}};try{const t=await this._getInitialPromise(e,o,d,s,l,i,n);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){n===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,o,d,s,l,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain&&this._lyr3DMain.on_job_failed(e.jobId,e.desc),this._decrementJobCount(t)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),t=e.meshData;if(t.data&&t.data.byteLength>0){const e=t.data.slice();t.data=e}const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{this._lyr3DMain&&this._lyr3DMain.on_renderable_created(!0,e.layerId,e.handle,t.memUsageBytes),this._decrementRenderableCount(i)}).catch(t=>{r(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),this._lyr3DMain&&this._lyr3DMain.on_renderable_created(!1,e.layerId,e.handle,0),this._decrementRenderableCount(i)}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(1===d[h]);a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._layers.delete(e.wasmLayerId),!0)}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:u};const i="integrated-mesh-3dtiles"===t.type?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==r.errorCode)return{wasmLayerId:u,check:r};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!1});const o=g(t.elevationInfo),l=e=>s.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let _=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=d(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=h.values[h[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(l)}_=this._lyr3DMain.add_gaussian_splat_layer(t.url,a,o)}else _=this._lyr3DMain.add_3dtiles_layer(t.url,a,o);return _?(this._updateWasmCamera(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:u})}_updateWasmCamera(){const e=this.view.state?.contentCamera;if(!e||!this._lyr3DMain)return;const{eye:t,center:i,up:s,near:r,far:a,fovY:n}=e,o=[e.viewport[2],e.viewport[3]],l=e.width/e.height;this._lyr3DMain.set_camera_parameters({eye:t,center:i,up:s,near:r,far:a,fov:n,aspectRatio:l,viewport:o})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([o({constructOnly:!0})],L.prototype,"view",void 0),L=e([l("esri.layers.Lyr3DWasmPerSceneView")],L);const v=L;export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{makeHandle as e}from"../../core/handleUtils.js";import t from"../../core/Logger.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import s from"../../geometry/Point.js";import i from"../../geometry/SpatialReference.js";import{toExtent as o,create as a,containsXY as r}from"../../geometry/support/aaBoundingRect.js";import{project as l}from"../../geometry/support/webMercatorUtils.js";const m=()=>t.getLogger("esri.layers.support.ElevationSampler");class u{queryElevation(e){return h(e.clone(),this)}on(){return e()}}class c extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,s){super(),this.tile=e,this.noDataValue=s;const i=e.tile.extent;this.extent=o(i,t.spatialReference),this.extent.zmin=e.zmin,this.extent.zmax=e.zmax,this._aaExtent=i;const a=n(t.spatialReference),r=t.lodAt(e.tile.level).resolution*a;this.demResolution={min:r,max:r}}contains(e){const t=f(e,this.spatialReference);return null!=t&&this.containsAt(t.x,t.y)}containsAt(e,t){return r(this._aaExtent,e,t)}elevationAt(e,t){if(!this.containsAt(e,t)){const n=this.extent,s=`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`;return m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${s})`),this.noDataValue}return this.tile.sample(e,t)??this.noDataValue}}class p extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,n){let s;super(),"number"==typeof t?(this.noDataValue=t,this.samplers=e):(s=t,this.noDataValue=n,this.samplers=e.map(e=>new c(e,s,this.noDataValue)));const r=this.samplers[0];if(r){this.extent=r.extent.clone();const{min:e,max:t}=r.demResolution;this.demResolution={min:e,max:t};for(let n=1;n<this.samplers.length;n++){const e=this.samplers[n];this.extent.union(e.extent),this.demResolution.min=Math.min(this.demResolution.min,e.demResolution.min),this.demResolution.max=Math.max(this.demResolution.max,e.demResolution.max)}}else this.extent=o(a(),s?.spatialReference??i.WGS84),this.demResolution={min:0,max:0}}elevationAt(e,t){let n;for(const s of this.samplers)if(s.containsAt(e,t)&&(n=s.elevationAt(e,t),n!==s.noDataValue))return n;return null!=n?n:(m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler`),this.noDataValue)}}function h(e,t){const n=f(e,t.spatialReference);if(!n)return null;switch(e.type){case"point":return x(e,n,t);case"polyline":return R(e,n,t);case"multipoint":return d(e,n,t);default:return null}}function f(e,t){if(null==e)return null;const n=e.spatialReference;if(n.equals(t))return e;const s=l(e,t);return s||m().error(`Cannot project geometry spatial reference (wkid:${n.wkid}) to elevation sampler spatial reference (wkid:${t.wkid})`),s}function x(e,t,n){return e.hasZ=!0,e.z=n.elevationAt(t.x,t.y),e}function R(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.paths.length;i++){const o=e.paths[i],a=t.paths[i];for(let e=0;e<o.length;e++){const t=o[e],i=a[e];y.x=i[0],y.y=i[1],s&&(t[3]=t[2]),t[2]=n.elevationAt(y.x,y.y)}}return e.hasZ=!0,e}function d(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.points.length;i++){const o=e.points[i],a=t.points[i];y.x=a[0],y.y=a[1],s&&(o[3]=o[2]),o[2]=n.elevationAt(y.x,y.y)}return e.hasZ=!0,e}const y=new s;export{u as ElevationSamplerBase,p as MultiTileElevationSampler,c as TileElevationSampler,h as updateGeometryElevation};
5
+ import"../../core/has.js";import{Evented as e}from"../../core/Evented.js";import t from"../../core/Logger.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import s from"../../geometry/Point.js";import i from"../../geometry/SpatialReference.js";import{toExtent as o,create as a,containsXY as r}from"../../geometry/support/aaBoundingRect.js";import{project as l}from"../../geometry/support/webMercatorUtils.js";const m=()=>t.getLogger("esri.layers.support.ElevationSampler");class u extends e{queryElevation(e){return h(e.clone(),this)}}class c extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,s){super(),this.tile=e,this.noDataValue=s;const i=e.tile.extent;this.extent=o(i,t.spatialReference),this.extent.zmin=e.zmin,this.extent.zmax=e.zmax,this._aaExtent=i;const a=n(t.spatialReference),r=t.lodAt(e.tile.level).resolution*a;this.demResolution={min:r,max:r}}contains(e){const t=f(e,this.spatialReference);return null!=t&&this.containsAt(t.x,t.y)}containsAt(e,t){return r(this._aaExtent,e,t)}elevationAt(e,t){if(!this.containsAt(e,t)){const n=this.extent,s=`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`;return m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${s})`),this.noDataValue}return this.tile.sample(e,t)??this.noDataValue}}class p extends u{get spatialReference(){return this.extent.spatialReference}constructor(e,t,n){let s;super(),"number"==typeof t?(this.noDataValue=t,this.samplers=e):(s=t,this.noDataValue=n,this.samplers=e.map(e=>new c(e,s,this.noDataValue)));const r=this.samplers[0];if(r){this.extent=r.extent.clone();const{min:e,max:t}=r.demResolution;this.demResolution={min:e,max:t};for(let n=1;n<this.samplers.length;n++){const e=this.samplers[n];this.extent.union(e.extent),this.demResolution.min=Math.min(this.demResolution.min,e.demResolution.min),this.demResolution.max=Math.max(this.demResolution.max,e.demResolution.max)}}else this.extent=o(a(),s?.spatialReference??i.WGS84),this.demResolution={min:0,max:0}}elevationAt(e,t){let n;for(const s of this.samplers)if(s.containsAt(e,t)&&(n=s.elevationAt(e,t),n!==s.noDataValue))return n;return null!=n?n:(m().warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler`),this.noDataValue)}}function h(e,t){const n=f(e,t.spatialReference);if(!n)return null;switch(e.type){case"point":return x(e,n,t);case"polyline":return R(e,n,t);case"multipoint":return d(e,n,t);default:return null}}function f(e,t){if(null==e)return null;const n=e.spatialReference;if(n.equals(t))return e;const s=l(e,t);return s||m().error(`Cannot project geometry spatial reference (wkid:${n.wkid}) to elevation sampler spatial reference (wkid:${t.wkid})`),s}function x(e,t,n){return e.hasZ=!0,e.z=n.elevationAt(t.x,t.y),e}function R(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.paths.length;i++){const o=e.paths[i],a=t.paths[i];for(let e=0;e<o.length;e++){const t=o[e],i=a[e];y.x=i[0],y.y=i[1],s&&(t[3]=t[2]),t[2]=n.elevationAt(y.x,y.y)}}return e.hasZ=!0,e}function d(e,t,n){y.spatialReference=t.spatialReference;const s=e.hasM&&!e.hasZ;for(let i=0;i<e.points.length;i++){const o=e.points[i],a=t.points[i];y.x=a[0],y.y=a[1],s&&(o[3]=o[2]),o[2]=n.elevationAt(y.x,y.y)}return e.hasZ=!0,e}const y=new s;export{u as ElevationSamplerBase,p as MultiTileElevationSampler,c as TileElevationSampler,h as updateGeometryElevation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as R,getSliceIndex as w,createSlices as S,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as b,getBlock as v,putBlock as T,deleteBlock as P,decreaseRefCount as B}from"./RawBlockCache.js";import{convertNoDataToMask as _}from"../rasterFormats/pixelRangeUtils.js";import{decode as M}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as W,getLocalArithmeticNorthRotations as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as H,projectPoint as L,snapPyramid as E,shiftExtent as D,getWorldWrapCount as O,projectExtent as F,getProjectionOffsetGrid as A,getRasterDatasetAlignmentInfo as G,projectResolution as q}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as N,uvComponentToVector as J}from"../rasterFunctions/vectorFieldUtils.js";const V=8,U=256;let Q=0,$=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||"rasterId-"+Q++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=H().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||R(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=r,{datumTransformation:p}=t;let d=L(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map(e=>e[p]):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map(e=>e[p]):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=E(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:w,col:S,rowOffset:k,colOffset:b,blockWidth:v}=g,T=await this._tileFetchQueue.push({pyramidLevel:x,row:w,col:S,options:t},{signal:t.signal});if(!T?.pixels?.length)return{location:d,value:null};const P=k*v+b;return this._processIdentifyResult(T,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=D(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=O(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map(e=>e?.pixelBlock);let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:F(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?M(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:w(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,m=o&&null!=c?c.tileSize[1]:s.blockHeight,u=L(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=u.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach(e=>{e.x/=t.x,e.y/=t.y}),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254})}}}async _fetchPixels(e,t,i,o={}){let r=O(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=O(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,b=new m({x:w,y:S,spatialReference:k}),v=I===c&&R===f&&u.x%I===0&&u.y%R===0,T=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=o;if(!P&&v&&1===y.pixelBlocks.length&&I===t&&R===i&&X(l,T,B))return{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await H();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):A({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T,datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:L});let D;const F=!o.requestRawData,G={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:V,destDimension:F?{width:t,height:i}:null,coefs:F?E.coefficients:null,sampleSpacing:F?G:null,projectDirections:L,gcsGrid:L?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,V,{alignmentInfo:q});D=F?W(e,{width:t,height:i},E.coefficients,G,o.interpolation):e,L&&E.gcsGrid&&(Q=j({width:t,height:i},E.gcsGrid),D=N(D,this.rasterInfo.dataType,Q))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,u+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:b,maxCol:v,maxRow:T}=S;if(0===h&&(w<k||R<b||I>T||g>v))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=b&&T>=f&&v>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:o},{signal:o.signal});_?P.push(new Promise(e=>{t.then(t=>e(t)).catch(()=>{B=!0,e(null)})})):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:r.x+g*s*z,xmax:r.x+(R+1)*s*z,ymin:r.y-(w+1)*l*H,ymax:r.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?o.transposeVariableName:o.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?o.bandIds:null,c=b(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=v(c,o.registryId,f);if(null==m){const r=new AbortController;m=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),T(c,o.registryId,f,m,r),m.catch(()=>P(c,o.registryId,f))}return o.signal&&n(o,()=>{B(c,o.registryId,f)}),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map(e=>(e+360)%360);return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=J([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=G(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=q(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(u&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=E(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||F(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{x:m,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-m)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-m)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map(e=>e[o]),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map(e=>[e]));return s?.length&&(n.magdirValue=s.map(e=>e[0])),n}let a=e.pixels.map(e=>e.slice(o*s,o*s+s)),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=S(l,m.transposedVariableName);if(f){const e=k(u,m.multidimensionalDefinition,m.timeExtent);a=a.map(t=>e.map(e=>t[e])),c=c?.map(t=>e.map(e=>t[e])),u=e.map(e=>u[e])}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(_(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map((e,t)=>{const i={value:0===x?.[t]?null:a.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new d({...e,isSlice:!0}))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i}),pyramidLevel:r}}};function X(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],$.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],$.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],$.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],$.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],$.prototype,"_openPromise",void 0),e([l()],$.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],$.prototype,"rasterId",null),e([l(p)],$.prototype,"url",null),e([l({type:String,json:{write:!0}})],$.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"datasetFormat",void 0),e([l()],$.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],$.prototype,"rasterInfo",void 0),e([l()],$.prototype,"ioConfig",void 0),e([l()],$.prototype,"sourceJSON",void 0),$=e([c("esri.layers.support.rasterDatasets.BaseRaster")],$);export{$ as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import o from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I,getPixelSpaceCoverage as R}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as w,getSliceIndex as S,createSlices as k,getSliceIds as b}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as P,deleteBlock as B,decreaseRefCount as _}from"./RawBlockCache.js";import{convertNoDataToMask as M}from"../rasterFormats/pixelRangeUtils.js";import{decode as C}from"../rasterFormats/RasterCodec.js";import{mosaic as W,approximateTransform as j,getLocalArithmeticNorthRotations as z}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as H,load as L,projectPoint as E,snapPyramid as D,shiftExtent as O,getWorldWrapCount as F,projectExtent as A,getProjectionOffsetGrid as G,getRasterDatasetAlignmentInfo as q,projectResolution as N}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as J,uvComponentToVector as V}from"../rasterFunctions/vectorFieldUtils.js";const U=8,Q=256;let $=0,X=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=H(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||"rasterId-"+$++}set url(e){this._set("url",h(e,o.getLogger(this)))}async open(e){return this._openPromise??=L().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,i,r={}){const o=r.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,o);return r={noClip:!0,...r},this.fetchPixels(n,o.size[0],o.size[1],r)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:r}=t,{rasterInfo:o}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=o;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=r||w(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=o,{datumTransformation:p}=t;let d=E(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=o.transform){const e=o.transform.inverseTransform(d);if(!o.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&o.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:r}=o,n=3,s=r.x*n/2,l=r.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map(e=>e[p]):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map(e=>e[p]):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=D(t.srcResolution,o,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:R,col:S,rowOffset:k,colOffset:b,blockWidth:v}=g,T=await this._tileFetchQueue.push({pyramidLevel:x,row:R,col:S,options:t},{signal:t.signal});if(!T?.pixels?.length)return{location:d,value:null};const P=k*v+b;return this._processIdentifyResult(T,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,r={}){e=O(e),r=this._getRequestOptionsWithSliceId(r);const{_hasNoneOrGCSShiftTransform:o}=this;if(r.requestRawData&&o)return this._fetchPixels(e,t,i,r);const n=H(e.spatialReference),s=F(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&o)return this._fetchPixels(e,t,i,r);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const o=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=r.disableWrapAround&&g>0?null:this._fetchPixels(o,d,i,r);l.push(x)}const d=(await Promise.all(l)).map(e=>e?.pixelBlock);let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},r)).pixelBlock}else x=W(d,y,{blockWidths:p});return{extent:e,srcExtent:A(e,this.rasterInfo.spatialReference,r.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const o=await this._fetchRawTiles(e,t,i,r),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!o)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=o;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:o.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock}else g=W(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,r,o){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return A(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?C(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,r=0){const{customFetchParameters:o}=this.ioConfig,{range:n,query:s,headers:l}=i;r=r??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...o},headers:{...l,...a}})}catch(c){if(r>0)return r--,this.request(e,i,r);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:S(e,t)}getTileExtentFromTileInfo(e,t,i,r){const o=r.lodAt(e);return this.getTileExtent({x:o.resolution,y:o.resolution},t,i,r.origin,r.spatialReference,r.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:r}=this.rasterInfo,{pyramidResolutions:o}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(r.x+r.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(o){const t=(o[e].x+o[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,r){const{width:o,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==r&&(r=Math.max(0,Math.round(Math.log(Math.max(o,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],r);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,r,o,n=0,s=2){if(1===o.length&&n>0){o=[...o];let{x:e,y:t}=o[0];for(let i=0;i<n;i++)e*=s,t*=s,o.push({x:e,y:t})}const l=[],{x:a,y:c}=r;for(let f=0;f<o.length;f++){const{x:r,y:n}=o[f];l.push({minCol:Math.floor((e.xmin-a+.1*r)/t/r),maxCol:Math.floor((e.xmax-a-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const o=r**e;return{x:t.x*o,y:t.y*o}}identifyPixelLocation(e,t,i,r){const{spatialReference:o,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=r&&null!=c?c.tileSize[0]:s.blockWidth,m=r&&null!=c?c.tileSize[1]:s.blockHeight,u=E(e,o,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,r,o,n){const[s,l]=n,a=r.x+i*s*e.x,c=a+s*e.x,m=r.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:o})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<i||r.minRow>t||r.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:r}=e,o=u.WebMercator;e.spatialReference=o,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-r,spatialReference:o}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:o});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:o});const{pyramidResolutions:i,tileInfo:r}=s;if(i&&i.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254})}}}async _fetchPixels(e,t,i,r={}){let o=F(e);if(o>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,r),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=H(e.spatialReference);!d&&x||(o=F(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:o},r);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,b=new m({x:w,y:S,spatialReference:k}),v=I===c&&R===f&&u.x%I===0&&u.y%R===0,T=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=r;if(!P&&v&&1===y.pixelBlocks.length&&I===t&&R===i&&K(l,T,B))return{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=H(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,C=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");C&&!this.rasterJobHandler&&await L();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:o>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:C},r):G({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:T,datumTransformation:_,rasterTransform:p,hasWrapAround:o>0||M,isAdaptive:!1,includeGCSGrid:C});let D;const O=!r.requestRawData,A={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:N,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:N,srcMosaicSize:V,destDimension:O?{width:t,height:i}:null,coefs:O?E.coefficients:null,sampleSpacing:O?A:null,projectDirections:C,gcsGrid:C?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:r.interpolation,alignmentInfo:q,blockWidths:null},r);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=W(N,V,{alignmentInfo:q});D=O?j(e,{width:t,height:i},E.coefficients,A,r.interpolation):e,C&&E.gcsGrid&&(Q=z({width:t,height:i},E.gcsGrid),D=J(D,this.rasterInfo.dataType,Q))}return r.requestRawData||C?{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:b,pixelBlock:D}}async _fetchRawTiles(e,t,i,r){const{origin:o,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(a-=r.buffer.cols,c-=r.buffer.rows,m+=2*r.buffer.cols,u+=2*r.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:b,maxCol:v,maxRow:T}=S;if(0===h&&(w<k||R<b||I>T||g>v))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!r.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=b&&T>=f&&v>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:r},{signal:r.signal});_?P.push(new Promise(e=>{t.then(t=>e(t)).catch(()=>{B=!0,e(null)})})):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:o.x+g*s*z,xmax:o.x+(R+1)*s*z,ymin:o.y-(w+1)*l*H,ymax:o.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,r){const{storageInfo:o}=this.rasterInfo,s=null!=o.transposeInfo&&!!r.transposedVariableName;if(!s){const r=o.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=r;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?r.transposeVariableName:r.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?r.bandIds:null,c=v(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=T(c,r.registryId,f);if(null==m){const o=new AbortController;m=this.fetchRawTile(e,t,i,{...r,signal:o.signal}),P(c,r.registryId,f,m,o),m.catch(()=>B(c,r.registryId,f))}return r.signal&&n(r,()=>{_(c,r.registryId,f)}),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const r=e[0].length;if("vector-magdir"===i){const t=e[1].map(e=>(e+360)%360);return[e[0],t]}const[o,n]=e,s=[],l=[];for(let a=0;a<r;a++){const[e,t]=V([o[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=q(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,r={}){const o={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(o.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,o));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=o,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=N(s,this.rasterInfo.spatialReference,e,o.datumTransformation);const h=!l||r.srcResolution&&l.x+l.y<r.srcResolution.x+r.srcResolution.y;if(u&&r.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}l&&(o.srcResolution=l,this._updateSourceDataInfo(e,o))}return this._requireTooManySrcTiles(o.srcWidth,o.srcHeight,t,i)&&(o.srcWidth=0,o.srcHeight=0),o}_requireTooManySrcTiles(e,t,i,r){const{tileInfo:o}=this.rasterInfo.storageInfo,n=Math.ceil(e/o.size[0])*Math.ceil(t/o.size[1]),s=e/i,l=t/r,a=Math.max(1,(i+r)/1024);return n>=Q*a||s>U||l>U}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,r=i.spatialReference,{srcResolution:o,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=D(o,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||A(e,r,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{origin:m}=i.storageInfo,{width:u,height:h,ul:p}=R(c,m,l,s);t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=u,t.srcHeight=h,t.ul=p}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:r,pyramidLevel:o,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[r]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map(e=>e[r]),n={location:i,value:t,pyramidLevel:o},s=this._computeMagDirValues(t.map(e=>[e]));return s?.length&&(n.magdirValue=s.map(e=>e[0])),n}let a=e.pixels.map(e=>e.slice(r*s,r*s+s)),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=k(l,m.transposedVariableName);if(f){const e=b(u,m.multidimensionalDefinition,m.timeExtent);a=a.map(t=>e.map(e=>t[e])),c=c?.map(t=>e.map(e=>t[e])),u=e.map(e=>u[e])}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(M(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map((e,t)=>{const i={value:0===x?.[t]?null:a.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new d({...e,isSlice:!0}))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i}),pyramidLevel:o}}};function K(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],X.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],X.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],X.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],X.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],X.prototype,"_openPromise",void 0),e([l()],X.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],X.prototype,"rasterId",null),e([l(p)],X.prototype,"url",null),e([l({type:String,json:{write:!0}})],X.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],X.prototype,"datasetFormat",void 0),e([l()],X.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],X.prototype,"rasterInfo",void 0),e([l()],X.prototype,"ioConfig",void 0),e([l()],X.prototype,"sourceJSON",void 0),X=e([c("esri.layers.support.rasterDatasets.BaseRaster")],X);export{X as default};