@arcgis/core 6.0.0-next.48 → 6.0.0-next.49
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.
- package/Ground.js +1 -1
- package/analysis/AreaMeasurementAnalysis.d.ts +12 -10
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/applications/Components/formatUtils.d.ts +3 -2
- package/applications/MapViewer/templateUtils.d.ts +4 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +12 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/arcgisGlobal.d.ts +4 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/063cc462524646cd45e8.js +1 -0
- package/assets/esri/core/workers/chunks/119c62e9c9c7440a6129.js +1 -0
- package/assets/esri/core/workers/chunks/14c04fde8d33b739b415.js +1 -0
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +1 -0
- package/assets/esri/core/workers/chunks/31eb09e96f31bced71ad.js +1 -0
- package/assets/esri/core/workers/chunks/{056a815273653271bf75.js → 3236e18921955450fc0d.js} +5 -5
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +1 -0
- package/assets/esri/core/workers/chunks/435dacf493aec07ff6e3.js +1 -0
- package/assets/esri/core/workers/chunks/4c26d6408ee7a3b9d163.js +1 -0
- package/assets/esri/core/workers/chunks/{73bf76a3a0418edb26a5.js → 506954fb374ea528d020.js} +1 -1
- package/assets/esri/core/workers/chunks/55db28616f810ca063b7.js +1 -0
- package/assets/esri/core/workers/chunks/59ae5bd0ee1bae7a9fb3.js +1 -0
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +1 -0
- package/assets/esri/core/workers/chunks/6779afc2d6ee46c301b5.js +1 -0
- package/assets/esri/core/workers/chunks/6a509ffb4852d694a097.js +1 -0
- package/assets/esri/core/workers/chunks/6d25a7071fceb707858a.js +1 -0
- package/assets/esri/core/workers/chunks/7a97eec9823941fd210f.js +29 -0
- package/assets/esri/core/workers/chunks/82bbf0c5e18fc1c795f4.js +1 -0
- package/assets/esri/core/workers/chunks/91019e9dff63107f8cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{1345413ec0b4128849b1.js → 954f9854a9bf4a852b81.js} +1 -1
- package/assets/esri/core/workers/chunks/9846abf2d3991a15b2b5.js +1 -0
- package/assets/esri/core/workers/chunks/9f74b3f0f453bc957e3a.js +1 -0
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +1 -0
- package/assets/esri/core/workers/chunks/a1c45e8f5bba471b3905.js +1 -0
- package/assets/esri/core/workers/chunks/a2825285d46f8cd5d814.js +1 -0
- package/assets/esri/core/workers/chunks/{d4f6be8290ad0243e1b8.js → b511b5c68defefccde0b.js} +1 -1
- package/assets/esri/core/workers/chunks/bf81b3670b5323621e2d.js +1 -0
- package/assets/esri/core/workers/chunks/c4794d692934098988e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0900a901197948bd7df.js +1 -0
- package/assets/esri/core/workers/chunks/d2ed93bbfa98395bbed7.js +1 -0
- package/assets/esri/core/workers/chunks/d486a8a61ff993f8202a.js +1 -0
- package/assets/esri/core/workers/chunks/e06036392a982dbf3ae3.js +1 -0
- package/assets/esri/core/workers/chunks/{773ba0909ccd3a034c31.js → ed1db6571b0c61fe4f91.js} +1 -1
- package/chunks/BlendWeights.glsl.js +4 -5
- package/chunks/Blur.glsl.js +10 -7
- package/chunks/BlurEmission.glsl.js +27 -7
- package/chunks/Clouds.glsl.js +2 -2
- package/chunks/Component.glsl.js +1 -1
- package/chunks/EdgeDetect.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +1 -1
- package/chunks/EmissionComposite.glsl.js +2 -2
- package/chunks/Fog.glsl.js +4 -4
- package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
- package/chunks/HighlightSharpApply.glsl.js +4 -1
- package/chunks/LineMarker.glsl.js +4 -4
- package/chunks/Magnifier.glsl.js +1 -1
- package/chunks/NoiseTextureAtlas.glsl.js +3 -3
- package/chunks/Pattern.glsl.js +35 -32
- package/chunks/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +18 -9
- package/chunks/RealisticAtmosphereCompositing.glsl.js +35 -0
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/ObservableBase.js +1 -1
- package/core/accessorSupport/tracking/ObservationHandle.js +1 -1
- package/core/accessorSupport/tracking/SimpleObservable.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/accessorSupport/tracking/TrackingTarget.js +1 -1
- package/core/quantity.js +1 -1
- package/core/timeUtils.js +1 -1
- package/geometry/coordinateConversion/CoordinateConversionModel.d.ts +258 -0
- package/geometry/coordinateConversion/CoordinateConversionModel.js +2 -0
- package/geometry/coordinateConversion/support/Conversion.d.ts +73 -0
- package/geometry/coordinateConversion/support/Conversion.js +2 -0
- package/geometry/coordinateConversion/support/Format.d.ts +131 -0
- package/geometry/coordinateConversion/support/Format.js +2 -0
- package/geometry/coordinateConversion/support/coordinateConversionUtils.js +2 -0
- package/geometry/coordinateConversion/support/formatUtils.js +2 -0
- package/geometry/coordinateConversion/types.d.ts +116 -0
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +2 -2
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/mixins/FeatureLayerBase.d.ts +2 -2
- package/layers/raster/formats/Lzw.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/layers/raster/formats/tiffTag.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +2 -0
- package/layers/support/VideoElement.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/package.json +2 -2
- package/symbols/FillSymbol3DLayer.d.ts +1 -4
- package/time/daylightUtils.d.ts +29 -0
- package/time/daylightUtils.js +2 -0
- package/time/timeZoneUtils.js +1 -1
- package/time/types.d.ts +57 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +2 -0
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/SymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +6 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -9
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/atmosphere/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphere.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositing.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositingTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +87 -41
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternLayouts.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +3 -0
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/022565ef98a702ab952f.js +0 -1
- package/assets/esri/core/workers/chunks/163e97987e1f75610009.js +0 -1
- package/assets/esri/core/workers/chunks/1d57b1445afec89a7941.js +0 -1
- package/assets/esri/core/workers/chunks/3654672d772d11484883.js +0 -1
- package/assets/esri/core/workers/chunks/3af0ff5a0b82872aac38.js +0 -1
- package/assets/esri/core/workers/chunks/3b9415dfd7546aeec261.js +0 -1
- package/assets/esri/core/workers/chunks/5109b48666138df14038.js +0 -1
- package/assets/esri/core/workers/chunks/6b73dfc9252b32f1eae2.js +0 -1
- package/assets/esri/core/workers/chunks/6e4698879e7d8fbc4d12.js +0 -1
- package/assets/esri/core/workers/chunks/71295afd21fc5bc5ddbc.js +0 -1
- package/assets/esri/core/workers/chunks/794a9f116c4700bb1210.js +0 -1
- package/assets/esri/core/workers/chunks/8e0ecc7f55dd8bf2cf16.js +0 -1
- package/assets/esri/core/workers/chunks/9dece842ada6278c33ef.js +0 -1
- package/assets/esri/core/workers/chunks/a12e29f2cb78fdaa0753.js +0 -1
- package/assets/esri/core/workers/chunks/b70af9fb974ef9836efd.js +0 -1
- package/assets/esri/core/workers/chunks/c0f2b6a10bcc766318f5.js +0 -1
- package/assets/esri/core/workers/chunks/c248db5e4d92cfb3c4d1.js +0 -1
- package/assets/esri/core/workers/chunks/ce02adb527389b90223d.js +0 -1
- package/assets/esri/core/workers/chunks/d8eea5ffe05c620fac9e.js +0 -1
- package/assets/esri/core/workers/chunks/d997d81d0965c05447d4.js +0 -1
- package/assets/esri/core/workers/chunks/e1645882f54818c4036a.js +0 -1
- package/assets/esri/core/workers/chunks/e44679a0d271c1efb60d.js +0 -1
- package/assets/esri/core/workers/chunks/f11f40017ec97a2a6b5f.js +0 -29
- package/assets/esri/core/workers/chunks/f7f5d8256e63d303cbcb.js +0 -1
- package/assets/esri/core/workers/chunks/f87d5450190896e61ff8.js +0 -1
- package/assets/esri/core/workers/chunks/fdee2255f49b43056e9d.js +0 -1
- package/assets/esri/core/workers/chunks/ff1e614fde01781360fa.js +0 -1
- package/chunks/AtmosphereCompositing.glsl.js +0 -25
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +0 -2
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type Point from "../Point.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Localized strings supplied to a [CoordinateConversionModel](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/CoordinateConversionModel/).
|
|
5
|
+
*
|
|
6
|
+
* @since 5.2
|
|
7
|
+
*/
|
|
8
|
+
export interface CoordinateConversionMessages {
|
|
9
|
+
/**
|
|
10
|
+
* Localized abbreviations for north, south, east, and west.
|
|
11
|
+
*
|
|
12
|
+
* @since 5.2
|
|
13
|
+
*/
|
|
14
|
+
abbreviatedDirections: Record<"north" | "south" | "east" | "west", string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Describes a point in terms of a location, a [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/), and a coordinate, a string.
|
|
19
|
+
*
|
|
20
|
+
* @since 5.2
|
|
21
|
+
*/
|
|
22
|
+
export interface Position {
|
|
23
|
+
/**
|
|
24
|
+
* A point geometry representing the location described by the conversion.
|
|
25
|
+
*
|
|
26
|
+
* @since 5.2
|
|
27
|
+
*/
|
|
28
|
+
location?: Point | null;
|
|
29
|
+
/**
|
|
30
|
+
* A string representing the location.
|
|
31
|
+
*
|
|
32
|
+
* @since 5.2
|
|
33
|
+
*/
|
|
34
|
+
coordinate?: string | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @since 5.2 */
|
|
38
|
+
export type Mode = "live" | "capture" | "idle";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This object describes how a Format should be projected and formatted for display. Used to define
|
|
42
|
+
* custom Formats that require custom conversion and/or projection logic.
|
|
43
|
+
*
|
|
44
|
+
* @since 5.2
|
|
45
|
+
*/
|
|
46
|
+
export interface ConversionInfo {
|
|
47
|
+
/**
|
|
48
|
+
* A function that takes a point and returns a [Position](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/types/#Position).
|
|
49
|
+
*
|
|
50
|
+
* @since 5.2
|
|
51
|
+
*/
|
|
52
|
+
convert?: ConvertFunction;
|
|
53
|
+
/**
|
|
54
|
+
* A function that takes a string and returns a Point.
|
|
55
|
+
*
|
|
56
|
+
* @since 5.2
|
|
57
|
+
*/
|
|
58
|
+
reverseConvert?: ReverseConvertFunction;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A user-provided function that converts a [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) into a
|
|
63
|
+
* [Position](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/types/#Position). This function may
|
|
64
|
+
* be necessary to provide as part of [ConversionInfo](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/types/#ConversionInfo)
|
|
65
|
+
* when creating a custom [Format](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/support/Format/).
|
|
66
|
+
*
|
|
67
|
+
* @param point - A point to be converted.
|
|
68
|
+
* @returns The returned position.
|
|
69
|
+
* @since 5.2
|
|
70
|
+
*/
|
|
71
|
+
export type ConvertFunction = (point: Point) => Position;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A user-provided function that converts a coordinate string into a [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/).
|
|
75
|
+
* This function may be necessary to provide as part of [ConversionInfo](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/types/#ConversionInfo)
|
|
76
|
+
* when creating a custom [Format](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/support/Format/).
|
|
77
|
+
*
|
|
78
|
+
* @param coordinate - The string to be reversed.
|
|
79
|
+
* @returns The returned point
|
|
80
|
+
* @since 5.2
|
|
81
|
+
*/
|
|
82
|
+
export type ReverseConvertFunction = (coordinate: string) => Point;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A coordinate segment represents one piece of a coordinate string.
|
|
86
|
+
*
|
|
87
|
+
* > [!WARNING]
|
|
88
|
+
* >
|
|
89
|
+
* > A MGRS coordinate, for example `30UVG898998`, is described by four segments:
|
|
90
|
+
* > 1. Alias `Z`, the gridzone: `30U`
|
|
91
|
+
* > 2. Alias `S`, the 100,000 meter square designator: `VG`
|
|
92
|
+
* > 3. Alias `X`, the easting (x coordinate with respect to the 10,000 meter square): `898`
|
|
93
|
+
* > 4. Alias `Y`, the northing (y coordinate with respect to the 10,000 meter square): `998`
|
|
94
|
+
*
|
|
95
|
+
* @since 5.2
|
|
96
|
+
*/
|
|
97
|
+
export interface CoordinateSegment {
|
|
98
|
+
/**
|
|
99
|
+
* A string that provides the name for this segment of a coordinate string.
|
|
100
|
+
*
|
|
101
|
+
* @since 5.2
|
|
102
|
+
*/
|
|
103
|
+
alias: string;
|
|
104
|
+
/**
|
|
105
|
+
* A string that describes the role of this segment.
|
|
106
|
+
*
|
|
107
|
+
* @since 5.2
|
|
108
|
+
*/
|
|
109
|
+
description: string;
|
|
110
|
+
/**
|
|
111
|
+
* A regular expression that should extract this segment from the complete coordinate.
|
|
112
|
+
*
|
|
113
|
+
* @since 5.2
|
|
114
|
+
*/
|
|
115
|
+
searchPattern: RegExp;
|
|
116
|
+
}
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.
|
|
2
|
+
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.49`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import"../core/has.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{on as s,sync as c,watch as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{persistable as f}from"../core/accessorSupport/decorators/persistable.js";import p from"../geometry/SpatialReference.js";import m from"./Layer.js";import{APIKeyMixin as h}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as _}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as b}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as x,url as S}from"./support/commonProperties.js";import{GeometryDescriptor as C}from"./support/GeometryDescriptor.js";import{IntegratedMeshSemantics as w}from"./support/IntegratedMeshSemantics.js";import T from"./support/SceneModifications.js";import{default3DTilesFullExtent as E,spatialReferenceProperty as D,fullExtentProperty as O,supportedSpatialReferencesProperty as k,fullExtentsProperty as A,esriCrsSpatialReferenceProperty as j,esriCrsFullExtentProperty as M}from"./support/tiles3DUtils.js";import N from"../portal/Portal.js";import{getElevationOffsetInMeters as P,logInvalidElevationInfoWarning as F,elevationModeRequiredMessage as I,featureExpressionUnsupportedMessage as L}from"../support/elevationInfoUtils.js";import{f as R}from"../chunks/persistableUrlUtils.js";import{initialize as z,switchMeshModificationPolygonVCSSync as B}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as V,fromWasmModification as H}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as U}from"../core/accessorSupport/decorators/reader.js";let W=class extends g(v(y(b(a(_(h(n(m)))))))){readModifications(e,t,n){this._modificationsSource={url:R(e,n),context:n}}initialize(){this.addHandles([s(()=>this.modifications,`after-changes`,()=>{this.modifications=this.modifications,this._modificationsGeneration++},c),l(()=>this.modifications,()=>this._modificationsGeneration++)])}constructor(e){super(e),this.operationalLayerType=`IntegratedMesh3DTilesLayer`,this.modifications=null,this._modificationsSource=null,this.fullExtent=E,this.esriCrsFullExtent=null,this.url=null,this.type=`integrated-mesh-3dtiles`,this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._modificationsGeneration=0,this._simulateGoogleUrl=!1}set elevationInfo(e){(e==null||e.mode===`absolute-height`)&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){let t=[e];for(;t?.length>0;){let e=t.pop();if(!e)return;for(let[n,r]of Object.entries(e)){if(n===`uri`)try{let e=new URL(`https://tmp`+r).searchParams.get(`session`);if(e)return e}catch{}typeof r==`object`&&r&&t.push(r)}}return null}async requestRootAndSession(e){let n=(e,t)=>new r(`3dtiles-init:`+e,t);return this._rootRequestPromise||=new Promise((r,a)=>{this.url||a(n(`url-missing`,`Layer url missing`)),this._key=this.customParameters?this.customParameters.key:null,new Promise((e,r)=>{if(this.replacesTerrain&&!this._key){let i=this.portalItem?.portal||this.parent?.portalItem?.portal||N.getDefault();i.signIn().then(()=>{i.g3dTilesEnabled?t(i.restUrl+`/portals/self/modules/g3dtiles`,{responseType:`json`,query:{f:`json`}}).then(t=>{this._key=t.data.keyString,e()},()=>r(n(`g3dtiles-key-error`,`Error fetching Google 3D Tiles key from portal`))):r(n(`g3dTilesEnabled-false`,`Google 3D Tiles are not enabled on Portal `+i.url))},()=>r(n(`sign-in-failed`,`Error signing in to Portal`)))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:`array-buffer`,signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse(new TextDecoder().decode(e.data))}catch(e){a(n(`root-parse-failed`,`Error parsing root tile, details: `+e));return}this._rootTilesetJSON?(this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.read(this._rootTilesetJSON,{origin:`service`}),r(),this._rootRequestPromise=null):a(n(`root-is-null`,`Root tile is null.`))},e=>{o(e),a(n(`root-load-failed`,`Error loading root tile`)),this._rootRequestPromise=null,i.getLogger(`IntegratedMesh3DTilesLayer`).error(`Layer loading failed`,e)})},e=>a(e))}),this._rootRequestPromise}_haveWGS84ZModifications(e){for(let t of e)if(!t.geometry?.spatialReference||t.geometry?.spatialReference.vcsWkid===115700&&t.geometry?.spatialReference.wkid===4326)return!0;return!1}async _doLoad(e){let t=e==null?null:e.signal;try{await this.loadFromPortal({supportedTypes:[`3DTiles Service`],validateItem:e=>{if(e.typeKeywords?.includes(`IntegratedMesh`))return!0;throw new r(`portal:invalid-layer-item-type`,"Invalid layer item, expected '${expectedType}' ",{expectedType:`3DTiles Service containing IntegratedMesh`})}},e)}catch(e){o(e)}if(this._modificationsSource!=null){let t=await T.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await z();try{let e=V(null,t.toArray(),p.WGS84),n=B({modifications:e,inVCS:115700});n.success&&n.modifications&&H(n.modifications,t)}catch(e){i.getLogger(this).error(`convert-mesh-modification-z-error`,`Error when converting:`,e)}}this.setAtOrigin(`modifications`,t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(this._modificationsSource==null){let{modifications:e}=this;e&&e.length>0&&await z()}else await this.load().then(()=>{},()=>{})}async queryElevationForGround(e,t){let n=C.fromGeometry(e),r=t.signal;if(this.queryElevationCallback&&w.contributesToGroundElevation(this,this.replacesTerrain)){let i=12.9*(t.minDemResolution||0)+.71,a=await(await this.queryElevationCallback(n,{signal:r,maxGeometricError:i})).project(e.spatialReference,r);if(a){if(t.noDataValue!==void 0&&t.noDataValue!==Number.MAX_VALUE)for(let e of a.coordinates)e.z===Number.MAX_VALUE&&(e.z=t.noDataValue);let e=t.noDataValue??Number.MAX_VALUE,n=a.coordinates.map(t=>({demResolution:t.z===e?-1:1,source:this}));return{geometry:a.export(),noDataValue:e,sampleInfo:n}}}return{geometry:n.export(),noDataValue:Number.MAX_VALUE,sampleInfo:n.coordinates.map(()=>({demResolution:-1,source:this}))}}get memoizedElevationQueryDependencies(){return[this.loadStatus,this.queryElevationCallback!=null,P(this.elevationInfo),this._modificationsGeneration]}get hasAttributionData(){return!1}_validateElevationInfo(e){let t=`Integrated mesh 3d tiles layers`;F(i.getLogger(this),I(t,`absolute-height`,e)),F(i.getLogger(this),L(t,e))}get replacesTerrain(){return this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return w.isUsedAsGroundLayer(this)}get hasGoogleUrl(){return this._simulateGoogleUrl||!!(this.url?.match(/.+\.googleapis.com/)??!1)}get test(){}};e([u({type:[`IntegratedMesh3DTilesLayer`]})],W.prototype,`operationalLayerType`,void 0),e([u({type:T,clonable:e=>e?.clone()??null}),f({origins:[`web-scene`,`portal-item`],type:`resource`,prefix:`modifications`})],W.prototype,`modifications`,void 0),e([u({clonable:e=>e?{...e}:null})],W.prototype,`_modificationsSource`,void 0),e([U([`web-scene`,`portal-item`],`modifications`)],W.prototype,`readModifications`,null),e([u(D)],W.prototype,`spatialReference`,void 0),e([u(O)],W.prototype,`fullExtent`,void 0),e([u(k)],W.prototype,`supportedSpatialReferences`,void 0),e([u(A)],W.prototype,`fullExtents`,void 0),e([u(j)],W.prototype,`esriCrsSpatialReference`,void 0),e([u(M)],W.prototype,`esriCrsFullExtent`,void 0),e([u(x)],W.prototype,`elevationInfo`,null),e([u({type:[`show`,`hide`]})],W.prototype,`listMode`,void 0),e([u(S)],W.prototype,`url`,void 0),e([u({readOnly:!0})],W.prototype,`type`,void 0),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],W.prototype,`path`,void 0),e([u({type:Number,json:{name:`layerDefinition.minScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],W.prototype,`minScale`,void 0),e([u({type:Number,json:{name:`layerDefinition.maxScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],W.prototype,`maxScale`,void 0),e([u()],W.prototype,`queryElevationCallback`,void 0),e([u()],W.prototype,`_modificationsGeneration`,void 0),e([u()],W.prototype,`memoizedElevationQueryDependencies`,null),e([u({readOnly:!0})],W.prototype,`hasAttributionData`,null),e([u()],W.prototype,`replacesTerrain`,null),e([u()],W.prototype,`isUsedAsGroundLayer`,null),e([u()],W.prototype,`hasGoogleUrl`,null),e([u()],W.prototype,`_simulateGoogleUrl`,void 0),W=e([d(`esri.layers.IntegratedMesh3DTilesLayer`)],W);const G=W;export{G as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{isSome as r}from"../core/arrayUtils.js";import{result as i,assertResult as a}from"../core/asyncUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import s from"../core/Error.js";import{abortHandle as c,disposable as l,makeHandle as u}from"../core/handleUtils.js";import
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{isSome as r}from"../core/arrayUtils.js";import{result as i,assertResult as a}from"../core/asyncUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import s from"../core/Error.js";import{abortHandle as c,disposable as l,makeHandle as u}from"../core/handleUtils.js";import d from"../core/Logger.js";import{MultiOriginJSONSupportMixin as f}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as p,throwIfAbortError as m}from"../core/promiseUtils.js";import{on as h,sync as g,watch as _}from"../core/reactiveUtils.js";import{property as v,subclass as y}from"../core/accessorSupport/decorators.js";import{persistable as b}from"../core/accessorSupport/decorators/persistable.js";import x from"./Layer.js";import{APIKeyMixin as S}from"./mixins/APIKeyMixin.js";import{ArcGISService as C}from"./mixins/ArcGISService.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as T}from"./mixins/OperationalLayer.js";import{PortalLayer as E}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as D}from"./mixins/ScaleRangeLayer.js";import{SceneService as O}from"./mixins/SceneService.js";import{elevationInfo as k}from"./support/commonProperties.js";import{GeometryDescriptor as A}from"./support/GeometryDescriptor.js";import{queryIntegratedMeshElevation as j,defaultNoDataValue as M}from"./support/I3SIntegratedMeshElevationQuery.js";import{I3SNodePageDefinition as N,I3SMaterialDefinition as P,I3STextureSetDefinition as F,I3SGeometryDefinition as I}from"./support/I3SLayerDefinitions.js";import{IntegratedMeshSemantics as L}from"./support/IntegratedMeshSemantics.js";import R from"./support/SceneModifications.js";import{logInvalidElevationInfoWarning as z,elevationModeRequiredMessage as B,featureExpressionUnsupportedMessage as V}from"../support/elevationInfoUtils.js";import{f as H}from"../chunks/persistableUrlUtils.js";import{SceneLayerWorkerHandle as U}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{I3SDataRequester as W}from"../views/3d/layers/i3s/I3SDataRequester.js";import G from"../views/3d/layers/i3s/I3SNodeLoader.js";import{ImmediateTask as K}from"../views/support/Scheduler.js";import{reader as q}from"../core/accessorSupport/decorators/reader.js";let J=class extends O(C(T(E(D(f(w(S(o(x))))))))){constructor(e){super(e),this.geometryType=`mesh`,this.operationalLayerType=`IntegratedMeshLayer`,this.type=`integrated-mesh`,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile=`mesh-pyramids`,this.modifications=null,this._modificationsSource=null,this.path=null,this.definitionExpression=null,this._elevationQueryAbortController=new AbortController,this._elevationQueryWorkerContext=`i3s-elevation-query-${this.uid}`,this._elevationQueryWorkerHandle=null,this._elevationQueryWorkerSetup=null,this._modificationsGeneration=0}destroy(){this._elevationQueryAbortController.abort();let e=this._elevationQueryWorkerHandle;this._elevationQueryWorkerHandle=null,this._elevationQueryWorkerSetup=null,e?.destroyContextAndSelf(this._elevationQueryWorkerContext),super.destroy()}initialize(){this.addHandles([h(()=>this.modifications,`after-changes`,()=>{this.modifications=this.modifications,this._modificationsGeneration++},g),_(()=>this.modifications,()=>this._modificationsGeneration++,g),_(()=>this.memoizedElevationQueryDependencies,()=>this._abortElevationQueriesAfterDependencyChange(),g),_(()=>this.elevationQueryDataRequester,()=>this._abortElevationQueriesAfterDependencyChange(),g)])}readModifications(e,t,n){this._modificationsSource={url:H(e,n),context:n}}set elevationInfo(e){(e==null||e.mode===`absolute-height`)&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get _elevationQueryWorker(){return this._elevationQueryWorkerHandle??=new U((e,t)=>K.schedule(e,t))}get memoizedElevationQueryDependencies(){return[this.elevationInfo?.offset,this._modificationsGeneration]}async queryElevation(n,a,o){let s={stack:[],error:void 0,hasError:!1};try{let t=o?.noDataValue??Number.MAX_VALUE,d=this._elevationQueryWorker,f=new AbortController;n.addHandles(c(f),f),e(s,l(u(()=>n.removeHandles(f))),!1);let m=AbortSignal.any([o?.signal,this._elevationQueryAbortController.signal,f.signal].filter(r));await this.load({signal:m}),p(m);let h=A.fromGeometry(a),g={signal:m,elevationOffset:this.elevationInfo?.offset??0,scheduler:n.resourceController.scheduler};if(this._elevationQueryWorkerSetup==null){let e=this.store?.defaultGeometrySchema;e!=null&&(this._elevationQueryWorkerSetup=i(d.setLegacySchema(this._elevationQueryWorkerContext,e)))}let _=await j(this,h,g);p(m);let v=_.coordinates,y=Array(v.length);for(let e=0;e<v.length;++e){let n=v[e],r=n.z===M;y[e]=r,r&&(n.z=t)}let b=await _.project(a.spatialReference,m);p(m);let x=b??h.clone(),S={geometry:x.export(),noDataValue:t};return o?.returnSampleInfo&&(S.sampleInfo=x.coordinates.map((e,t)=>({demResolution:y[t]?-1:1}))),S}catch(e){s.error=e,s.hasError=!0}finally{t(s)}}async queryElevationForGround(e,t){let n=A.fromGeometry(e),r=X(e),{view:i,...a}=t;if(r!=null&&i?.type===`3d`){let e=await this.queryElevation(i,r,a),t=A.fromGeometry(e.geometry),o=t.coordinates.map((t,n)=>({demResolution:e.sampleInfo?.[n]?.demResolution??(t.z===e.noDataValue?-1:1),source:this}));return{geometry:n.clone(t.coordinates).export(),noDataValue:e.noDataValue,sampleInfo:o}}return{geometry:n.export(),noDataValue:Number.MAX_VALUE,sampleInfo:n.coordinates.map(()=>({demResolution:-1,source:this}))}}_abortElevationQueriesAfterDependencyChange(){let e=this._elevationQueryAbortController;this._elevationQueryAbortController=new AbortController,e.abort()}async processElevationQueryGeometry(e,t){let n=await this._elevationQueryWorkerSetup;return n!=null&&a(n),p(t),this._elevationQueryWorker.invoke(e,t)}async _doLoad(e){let t=e?.signal;try{await this.loadFromPortal({supportedTypes:[`Scene Service`]},e)}catch(e){m(e)}if(p(t),await this._fetchService(t),p(t),this._modificationsSource!=null){let n=await R.fromUrl(this._modificationsSource.url,this.spatialReference,e);p(t),this.setAtOrigin(`modifications`,n,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t),p(t)}beforeSave(){if(this._modificationsSource!=null)return this.load().then(()=>{},()=>{})}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`integrated-mesh`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`integrated-mesh`})}get isUsedAsGroundLayer(){return L.isUsedAsGroundLayer(this)}get replacesTerrain(){return!1}validateLayer(e){if(e.layerType&&e.layerType!==`IntegratedMesh`)throw new s(`integrated-mesh-layer:layer-type-not-supported`,`IntegratedMeshLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new s(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x`});if(this.version.major>1)throw new s(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x`})}_getTypeKeywords(){return[`IntegratedMeshLayer`]}get elevationQueryDataRequester(){return new W(this.customParameters,this.apiKey)}get elevationQueryNodeLoader(){return new G(this,this.elevationQueryDataRequester,d.getLogger(`esri.layers.IntegratedMeshLayer`),this.store?.defaultGeometrySchema,[],{loadFeatureData:!1,textureUsageMask:0})}_validateElevationInfo(e){let t=`Integrated mesh layers`;z(d.getLogger(this),B(t,`absolute-height`,e)),z(d.getLogger(this),V(t,e))}};n([v({type:String,readOnly:!0})],J.prototype,`geometryType`,void 0),n([v({type:[`show`,`hide`]})],J.prototype,`listMode`,void 0),n([v({type:[`IntegratedMeshLayer`]})],J.prototype,`operationalLayerType`,void 0),n([v({json:{read:!1},readOnly:!0})],J.prototype,`type`,void 0),n([v({type:N,readOnly:!0,clonable:!1})],J.prototype,`nodePages`,void 0),n([v({type:[P],readOnly:!0,clonable:!1})],J.prototype,`materialDefinitions`,void 0),n([v({type:[F],readOnly:!0,clonable:!1})],J.prototype,`textureSetDefinitions`,void 0),n([v({type:[I],readOnly:!0,clonable:!1})],J.prototype,`geometryDefinitions`,void 0),n([v({readOnly:!0})],J.prototype,`serviceUpdateTimeStamp`,void 0),n([v({type:R,clonable:e=>e?.clone()??e}),b({origins:[`web-scene`,`portal-item`],type:`resource`,prefix:`modifications`})],J.prototype,`modifications`,void 0),n([v({clonable:e=>e?{...e}:null})],J.prototype,`_modificationsSource`,void 0),n([q([`web-scene`,`portal-item`],`modifications`)],J.prototype,`readModifications`,null),n([v(k)],J.prototype,`elevationInfo`,null),n([v({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],J.prototype,`path`,void 0),n([v({clonable:!1})],J.prototype,`_elevationQueryWorker`,null),n([v()],J.prototype,`_modificationsGeneration`,void 0),n([v()],J.prototype,`memoizedElevationQueryDependencies`,null),n([v()],J.prototype,`isUsedAsGroundLayer`,null),n([v()],J.prototype,`replacesTerrain`,null),n([v({clonable:!1})],J.prototype,`elevationQueryDataRequester`,null),n([v({clonable:!1})],J.prototype,`elevationQueryNodeLoader`,null),J=n([y(`esri.layers.IntegratedMeshLayer`)],J);const Y=J;function X(e){return e instanceof A?X(e.export()):e.type===`point`||e.type===`multipoint`||e.type===`polyline`?e:null}export{Y as default};
|
|
@@ -558,7 +558,7 @@ export default class CatalogFootprintLayer extends CatalogFootprintLayerSupercla
|
|
|
558
558
|
* - When `undefined` (default): Fetches m-values if they are needed for rendering or labeling, or layer property interacts with the geometry.
|
|
559
559
|
* Otherwise, m-values are excluded from feature queries.
|
|
560
560
|
* - When `true`: Fetches m-values with the geometry, ensuring they are available on the client.
|
|
561
|
-
* - When `false`:
|
|
561
|
+
* - When `false`: m-values are fetched if needed for rendering or labeling. Otherwise, they are not fetched.
|
|
562
562
|
*
|
|
563
563
|
* > [!WARNING]
|
|
564
564
|
* >
|
|
@@ -573,7 +573,7 @@ export default class CatalogFootprintLayer extends CatalogFootprintLayerSupercla
|
|
|
573
573
|
* - When `undefined` (default): Fetches z-values if they are needed for rendering or labeling, or layer property interacts with the geometry.
|
|
574
574
|
* Otherwise, z-values are excluded from feature queries.
|
|
575
575
|
* - When `true`: Fetches z-values with the geometry, ensuring they are available on the client.
|
|
576
|
-
* - When `false`:
|
|
576
|
+
* - When `false`: z-values are fetched if needed for rendering or labeling. Otherwise, they are not fetched.
|
|
577
577
|
*
|
|
578
578
|
* @see [FeatureLayerBase.hasZ](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#hasZ)
|
|
579
579
|
* @see [Geometry.hasZ](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/#hasZ)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{createAbortError as a}from"../../core/promiseUtils.js";import{parseWhereClause as o}from"../../core/sql.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../geometry/Extent.js";import u from"../../geometry/Polygon.js";import{initializeProjection as d,project as f}from"../../geometry/projectionUtils.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import{systemOidFieldName as m,systemOriginIdFieldName as h,systemDestinationIdFieldName as g,systemIsSpatialFieldName as _,systemLayoutGeometryFieldName as v}from"./constants.js";import{recursiveParseSqlToCypher as y,addAdditionalClausesToCypher as b}from"./cypherUtils.js";import x from"./SessionMemoryStorage.js";import{utilsExtentToInBoundsRings as S}from"./supportUtils.js";import{executeQueryStreaming as C}from"../../rest/knowledgeGraphService.js";import w from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import T from"../../rest/support/Query.js";let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;let t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach(n=>{n.name&&(t.set(n.name,`entity`),this._processingCacheUpdatesLookup.set(n.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.entityTypeNames.add(n.name),n.properties?.forEach(e=>{e.geometryType&&e.geometryType!==`esriGeometryNull`&&this.geographicLookup.set(n.name,{name:e.name??``,geometryType:e.geometryType})}))}),e.knowledgeGraph.dataModel.relationshipTypes?.forEach(n=>{n.name&&(t.set(n.name,`relationship`),this._processingCacheUpdatesLookup.set(n.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.relationshipTypeNames.add(n.name),n.properties?.forEach(e=>{e.geometryType&&e.geometryType!==`esriGeometryNull`&&this.geographicLookup.set(n.name,{name:e.name??``,geometryType:e.geometryType})}))}),e.inclusionModeDefinition?.namedTypeDefinitions.forEach((n,a)=>{if(t.get(a)===`entity`)this.entityTypeNames.add(a);else if(t.get(a)===`relationship`)this.relationshipTypeNames.add(a);else{r.getLogger(this).warn(`A named type, ${a}, was in the inclusion list that wasn't in the data model and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(a);return}let o=new Map;n.members?.forEach(e=>{i(this.memberIdTypeLookup,e.id,()=>new Set).add(a)}),this.sublayerCaches.set(a,o)})}addToLayer(e){e.forEach(({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new n(`knowledge-graph:layer-data-manager`,`You cannot add to a layer's exclusion list if it was not created with an exclusion list originally`);if(!this.inclusionModeDefinition.namedTypeDefinitions.has(e)){let n=new Map;n.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:n}),i(this.memberIdTypeLookup,t,()=>new Set).add(e)}else if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){let n=this.inclusionModeDefinition.namedTypeDefinitions.get(e);n.members||=new Map,n.members.set(t,{id:t}),i(this.memberIdTypeLookup,t,()=>new Set).add(e)}})}getById(e){return x.getInstance().readFromStoreById(e)}async getData(e,t,n,r){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return{features:[],cypherTranslationApplied:!1};let i;if(i=e||new T({where:`1=1`,outFields:[`*`]}),n.type===`link-chart`){let e=n,r=this._processingCacheUpdatesLookup.get(t.objectType.name??``),a=i.outFields;a&&a.length===1&&a[0]===m&&i.where===`1=1`||await Promise.all(r??[]);let o=this.sublayerCaches.has(t.objectType.name??``)?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],s=[];return o.forEach(n=>{if(this.relationshipTypeNames.has(t.objectType.name)){n.geometry=e.relationshipLinkChartDiagramLookup.get(n.attributes[t.objectIdField]);let r=this.memberIdTypeLookup.get(n.attributes[h]),i=this.memberIdTypeLookup.get(n.attributes[g]),a=this._isEndEntitySpatial(r,n,h),o=this._isEndEntitySpatial(i,n,g);n.attributes[_]=Number(a&&o)}else{n.geometry=e.entityLinkChartDiagramLookup.get(n.attributes[t.objectIdField]);let r=this.geographicLookup.get(t.objectType.name);r&&n.attributes[r.name]?n.attributes[_]=1:n.attributes[_]=0}n.attributes[v]=n.geometry,s.push(n)}),{features:s,cypherTranslationApplied:!1}}return this.retrieveDataFromService(i,t,n,r)}async getConnectedRecordIds(e,t,n){let r=[],i=``,a=this._getNamedTypeIdMapFromNodeIds(e);if(t&&t?.length!==0){for(let e of t)i=i+e+`|`;i=i.slice(0,-1)}let o={},s=[];for(let[e,n]of a){let r=`${e}_ids`;o[r]=n,t&&t?.length!==0?s.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r:${i}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`):s.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`)}if(!s.length)return r;let c=s.join(` UNION `),l=(await C(this.knowledgeGraph,new w({openCypherQuery:c,bindParameters:o}),{signal:n?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e];r.push({id:n[0],typeName:n[1]}),r.push({id:n[2],typeName:n[3]})}}return r}async getRelationshipsBetweenNodes(e,t,n){let r=this._getNamedTypeIdMapFromNodeIds(e);if(r.size===0)return[];let i={relationshipExclusionIds:t,possibleConnectionEntityIds:e},a=[];for(let[e,t]of r.entries()){let n=`${e}_ids`;i[n]=t,a.push(`MATCH (n:${e}) WHERE id(n) IN $${n} WITH n MATCH (n)-[r]->(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let o=a.join(` UNION `),s=[],c=(await C(this.knowledgeGraph,new w({openCypherQuery:o,bindParameters:i}),{signal:n?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await c.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e];s.push({id:n[0],typeName:n[1]})}}return s}async getRelationshipsFromNodes(e,t,n,r){let i=this._getNamedTypeIdMapFromNodeIds(e);if(i.size===0||t.length===0)return[];let a={relationshipExclusionIds:n,possibleConnectionEntityIds:t},o=[];for(let[e,t]of i.entries()){let n=`${e}_ids`;a[n]=t,o.push(`MATCH (n:${e}) WHERE id(n) IN $${n} WITH n MATCH (n)-[r]-(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let s=o.join(` UNION `),c=new Map,l=(await C(this.knowledgeGraph,new w({openCypherQuery:s,bindParameters:a}),{signal:r?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e],r=c.get(n[1]);r||(r=new Set,c.set(n[1],r)),r.add(n[0])}}let u=[];for(let[e,t]of c)for(let n of t)u.push({id:n,typeName:e});return u}async refreshCacheContent(e,t,r,o=!0,s){let c=x.getInstance(),l=[],u=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),this.knowledgeGraph.dataModel.relationshipTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),!e&&!this.inclusionModeDefinition?(this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)}),this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)})):e?e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let t of this.memberIdTypeLookup.get(e))u.has(t)?u.get(t)?.push(e):u.set(t,[e])}):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{e.useAllData?u.set(t,null):e.members&&e.members.forEach(e=>{u.has(t)&&u.get(t)!==null?u.get(t)?.push(e.id):u.set(t,[e.id])})});for(let[e,a]of u){let u=new Set(a),f=new Promise((l,f)=>{(async()=>{let l=new Set,f=[],p=``,h=!1;if(t||d.get(e)?.properties?.forEach(e=>{e.name&&l.add(e.name)}),r&&this.geographicLookup.has(e)){let t=this.geographicLookup.get(e)?.name;t&&l.add(t)}if(this.entityTypeNames.has(e))p=`MATCH (n:${e}) ${a?`WHERE id(n) IN $ids `:``}return ID(n)`,l.forEach(e=>{p+=`, n.${e}`,f.push(e)});else if(this.relationshipTypeNames.has(e))h=!0,p=`MATCH ()-[n:${e}]->() ${a?`WHERE id(n) IN $ids `:``}return ID(n), id(startNode(n)), id(endNode(n))`,l.forEach(e=>{p+=`, n.${e}`,f.push(e)});else throw new n(`knowledge-graph:layer-data-manager`,`The graph type of ${e} could not be determined. Was this type set in the KG data model and inclusion definition?`);let g;g=a?new w({openCypherQuery:p,bindParameters:{ids:a}}):new w({openCypherQuery:p});let _=(await C(this.knowledgeGraph,g,{signal:s?.signal})).resultRowsStream.getReader();for(;;){let{done:t,value:n}=await _.read();if(t)break;let r=[];for(let e=0;e<n.length;e++){let t=n[e],a=0,o=0,s={properties:{}};for(s.id=t[a],a++,o++,h&&(s.originId=t[a],a++,o++,s.destinationId=t[a],a++,o++,i(this.nodeConnectionsLookup,s.originId,()=>new Set).add(s.id),i(this.nodeConnectionsLookup,s.destinationId,()=>new Set).add(s.id),i(this.relationshipConnectionsLookup,s.id,()=>[s.originId,s.destinationId]));a<t.length;a++)s.properties[f[a-o]]=t[a];u.delete(s.id),r.push(s)}let a=c.writeToStore(r,m,this.geographicLookup.get(e)?.name);this.sublayerCaches.has(e)||this.sublayerCaches.set(e,new Map),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(e)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(e).members=new Map);let s=this.sublayerCaches.get(e);a.forEach(t=>{s?.set(t.attributes[m],t),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.has(t.attributes[m])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.set(t.attributes[m],{id:t.attributes[m]}),i(this.memberIdTypeLookup,t.attributes[m],()=>new Set).add(e))})}let v=this.inclusionModeDefinition?.namedTypeDefinitions.get(e);if(v)for(let e of u)v.members?.delete(e)})().then(()=>{l(null)}).catch(e=>{e.name===`AbortError`?l(null):f(e)})});l.push(f),this._processingCacheUpdatesLookup.get(e)?.push(f)}if(await Promise.all(l),s?.signal?.aborted)throw a()}removeFromLayer(e){let t=new Set,n=new Set(e.map(e=>e.id));for(let n of e)t.add(n.typeName),this.memberIdTypeLookup.get(n.id)?.size===1?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)});t.forEach(e=>{this.sublayerCaches.get(e)?.forEach((t,r)=>{n.has(r)&&this.sublayerCaches.get(e)?.delete(r)})})}async retrieveDataFromService(e,t,r,i){let a=x.getInstance(),s=new Set,c=[],h=``,g=[],_=!1,v,T=t.graphType===`relationship`,E=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,D=r.sublayerIdsCache.get(t.objectType.name),O=!E&&D?Array.from(D).sort():null,k={systemOidFieldName:m,supportedSqlTypes:new Set([`column-reference`,`string`,`number`,`binary-expression`]),supportedSqlOperators:new Set([`=`,`<`,`<=`,`<>`,`>`,`>=`,`AND`,`OR`,`LIKE`]),unsupportedOperationFound:!1};if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&e.objectIds!=null&&(O=e.objectIds);else{if(!O?.length)return{features:[],cypherTranslationApplied:_};if(e.objectIds!=null){let t=e.objectIds,n=O.filter(e=>t.includes(e));if(t.length>0&&n.length===0)return{features:[],cypherTranslationApplied:_};e.objectIds=n,n.length>0&&(O=n)}else e.objectIds=O}if(e.outFields!=null){let n=e.outFields;n.includes(`*`)?t.fields.forEach(e=>{s.add(e.name)}):n.forEach(e=>{e!==m&&e!==t.geometryFieldName&&s.add(e)})}if(e.geometry!=null){let i=e.geometry,a,m=r.dataManager.knowledgeGraph.serviceDefinition,g=m?.spatialReference,_=m?.serviceCapabilities?.geometryCapabilities,y=_?.geometryMaxBoundingRectangleSizeX,b=_?.geometryMaxBoundingRectangleSizeY;if(i.type===`point`){let e=i;e.spatialReference?.isWGS84||(await d(e.spatialReference,p),e=f(e,p)),a=new l({spatialReference:p,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else i?.extent?.spatialReference&&!i.spatialReference?.isWGS84?(await d(i.extent.spatialReference,p),a=f(i.extent,p)):a=i.extent;if(y&&b&&g){if(g.wkid!==4326){let e=new l({spatialReference:g,xmax:y,ymax:b}),t=f(e,p);y=t.xmax,b=t.ymax}if(a.xmax-a.xmin>y)throw new n(`knowledge-graph:layer-data-manager`,`Extent x bounds should be within ${y}° latitude, limit exceeded`);if(a.ymax-a.ymin>b)throw new n(`knowledge-graph:layer-data-manager`,`Extent y bounds should be within ${b}° longitude, limit exceeded`)}if(e.where!=null&&e.where!==`1=1`){let n=await o(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach(e=>{n.fieldNames.includes(e.name)&&s.add(e.name)})}h=T?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach(e=>{h+=`, n.${e}`,c.push(e)}),v=new w({openCypherQuery:h,bindParameters:{param_filter_geom:new u({rings:S(a)})}})}else{let n=``;if(e.where!=null&&e.where!==`1=1`){let r=await o(e.where,t.fieldsIndex);t.fields.forEach(e=>{r.fieldNames.includes(e.name)&&s.add(e.name)}),n=y(r.parseTree,k),k.unsupportedOperationFound&&(n=``)}let r=``;r=T?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let i=!1;O&&(i=!0,r+=` WHERE ID(n) IN $ids`),n&&(r+=i?` AND`:` WHERE`,r+=` ${n}`),r+=` return ID(n)`,T&&(r+=`, id(startNode(n)), id(endNode(n))`),e.returnGeometry&&t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach(e=>{r+=`, n.${e}`,c.push(e)}),k.unsupportedOperationFound||(r=b(r,e),_=!0),v=O?new w({openCypherQuery:r,bindParameters:{ids:O}}):new w({openCypherQuery:r})}let A=(await C(r.dataManager.knowledgeGraph,v,i)).resultRowsStream.getReader();for(;;){let{done:e,value:n}=await A.read();if(e)break;let i=[];for(let e=0;e<n.length;e++){let t=n[e],r=0,a=0,o={properties:{}};for(o.id=t[r],r++,a++,T&&(o.originId=t[r],r++,a++,o.destinationId=t[r],r++,a++);r<t.length;r++)o.properties[c[r-a]]=t[r];i.push(o)}g=g.concat(a.writeToStore(i,m,r.dataManager.geographicLookup.get(t.objectType.name)?.name))}return{features:g,cypherTranslationApplied:_}}_isEndEntitySpatial(e,t,n){for(let r of e??[])if(this.entityTypeNames.has(r)){let e=this.geographicLookup.get(r),i=e&&this.sublayerCaches.get(r)?.get(t.attributes[n]);if(e&&i?.attributes[e.name])return!0}return!1}_getNamedTypeIdMapFromNodeIds(e){let t=new Map;return e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let n of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(n))return;t.has(n)?t.get(n)?.push(e):t.set(n,[e])}}),t}};e([s()],E.prototype,`knowledgeGraph`,void 0),e([s()],E.prototype,`inclusionModeDefinition`,void 0),e([s()],E.prototype,`entityTypeNames`,void 0),e([s()],E.prototype,`relationshipTypeNames`,void 0),e([s()],E.prototype,`geographicLookup`,void 0),e([s()],E.prototype,`sublayerCaches`,void 0),e([s()],E.prototype,`nodeConnectionsLookup`,void 0),e([s()],E.prototype,`relationshipConnectionsLookup`,void 0),e([s()],E.prototype,`memberIdTypeLookup`,void 0),E=e([c(`esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager`)],E);export{E as KnowledgeGraphLayerDataManager};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{createAbortError as a}from"../../core/promiseUtils.js";import{parseWhereClause as o}from"../../core/sql.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../geometry/Extent.js";import u from"../../geometry/Polygon.js";import{initializeProjection as d,project as f}from"../../geometry/projectionUtils.js";import{wgs84 as p}from"../../geometry/support/spatialReferenceUtils.js";import{systemOidFieldName as m,systemOriginIdFieldName as h,systemDestinationIdFieldName as g,systemIsSpatialFieldName as _,systemLayoutGeometryFieldName as v}from"./constants.js";import{recursiveParseSqlToCypher as y,addAdditionalClausesToCypher as b}from"./cypherUtils.js";import x from"./SessionMemoryStorage.js";import{utilsExtentToInBoundsRings as S}from"./supportUtils.js";import{executeQueryStreaming as C}from"../../rest/knowledgeGraphService.js";import w from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import T from"../../rest/support/Query.js";let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;let t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach(n=>{n.name&&(t.set(n.name,`entity`),this._processingCacheUpdatesLookup.set(n.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.entityTypeNames.add(n.name),n.properties?.forEach(e=>{e.geometryType&&e.geometryType!==`esriGeometryNull`&&this.geographicLookup.set(n.name,{name:e.name??``,geometryType:e.geometryType})}))}),e.knowledgeGraph.dataModel.relationshipTypes?.forEach(n=>{n.name&&(t.set(n.name,`relationship`),this._processingCacheUpdatesLookup.set(n.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.relationshipTypeNames.add(n.name),n.properties?.forEach(e=>{e.geometryType&&e.geometryType!==`esriGeometryNull`&&this.geographicLookup.set(n.name,{name:e.name??``,geometryType:e.geometryType})}))}),e.inclusionModeDefinition?.namedTypeDefinitions.forEach((n,a)=>{if(t.get(a)===`entity`)this.entityTypeNames.add(a);else if(t.get(a)===`relationship`)this.relationshipTypeNames.add(a);else{r.getLogger(this).warn(`A named type, ${a}, was in the inclusion list that wasn't in the data model and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(a);return}let o=new Map;n.members?.forEach(e=>{i(this.memberIdTypeLookup,e.id,()=>new Set).add(a)}),this.sublayerCaches.set(a,o)})}addToLayer(e){e.forEach(({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new n(`knowledge-graph:layer-data-manager`,`You cannot add to a layer's exclusion list if it was not created with an exclusion list originally`);if(!this.inclusionModeDefinition.namedTypeDefinitions.has(e)){let n=new Map;n.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:n}),i(this.memberIdTypeLookup,t,()=>new Set).add(e)}else if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){let n=this.inclusionModeDefinition.namedTypeDefinitions.get(e);n.members||=new Map,n.members.set(t,{id:t}),i(this.memberIdTypeLookup,t,()=>new Set).add(e)}})}getById(e){return x.getInstance().readFromStoreById(e)}async getData(e,t,n,r){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return{features:[],cypherTranslationApplied:!1};let i;if(i=e||new T({where:`1=1`,outFields:[`*`]}),n.type===`link-chart`){let e=n,r=this._processingCacheUpdatesLookup.get(t.objectType.name??``),a=i.outFields;a&&a.length===1&&a[0]===m&&i.where===`1=1`||await Promise.all(r??[]);let o=this.sublayerCaches.has(t.objectType.name??``)?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],s=[];return o.forEach(n=>{if(this.relationshipTypeNames.has(t.objectType.name)){n.geometry=e.relationshipLinkChartDiagramLookup.get(n.attributes[t.objectIdField]);let r=this.memberIdTypeLookup.get(n.attributes[h]),i=this.memberIdTypeLookup.get(n.attributes[g]),a=this._isEndEntitySpatial(r,n,h),o=this._isEndEntitySpatial(i,n,g);n.attributes[_]=Number(a&&o)}else{n.geometry=e.entityLinkChartDiagramLookup.get(n.attributes[t.objectIdField]);let r=this.geographicLookup.get(t.objectType.name);r&&n.attributes[r.name]?n.attributes[_]=1:n.attributes[_]=0}n.attributes[v]=n.geometry,s.push(n)}),{features:s,cypherTranslationApplied:!1}}return this.retrieveDataFromService(i,t,n,r)}async getConnectedRecordIds(e,t,n){let r=[],i=``,a=this._getNamedTypeIdMapFromNodeIds(e);if(t&&t?.length!==0){for(let e of t)i=i+e+`|`;i=i.slice(0,-1)}let o={},s=[];for(let[e,n]of a){let r=`${e}_ids`;o[r]=n,t&&t?.length!==0?s.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r:${i}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`):s.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`)}if(!s.length)return r;let c=s.join(` UNION `),l=(await C(this.knowledgeGraph,new w({openCypherQuery:c,bindParameters:o}),{signal:n?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e];r.push({id:n[0],typeName:n[1]}),r.push({id:n[2],typeName:n[3]})}}return r}async getRelationshipsBetweenNodes(e,t,n){let r=this._getNamedTypeIdMapFromNodeIds(e);if(r.size===0)return[];let i={relationshipExclusionIds:t,possibleConnectionEntityIds:e},a=[];for(let[e,t]of r.entries()){let n=`${e}_ids`;i[n]=t,a.push(`MATCH (n:${e}) WHERE id(n) IN $${n} WITH n MATCH (n)-[r]->(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let o=a.join(` UNION `),s=[],c=(await C(this.knowledgeGraph,new w({openCypherQuery:o,bindParameters:i}),{signal:n?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await c.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e];s.push({id:n[0],typeName:n[1]})}}return s}async getRelationshipsFromNodes(e,t,n,r){let i=this._getNamedTypeIdMapFromNodeIds(e);if(i.size===0||t.length===0)return[];let a={relationshipExclusionIds:n,possibleConnectionEntityIds:t},o=[];for(let[e,t]of i.entries()){let n=`${e}_ids`;a[n]=t,o.push(`MATCH (n:${e}) WHERE id(n) IN $${n} WITH n MATCH (n)-[r]-(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let s=o.join(` UNION `),c=new Map,l=(await C(this.knowledgeGraph,new w({openCypherQuery:s,bindParameters:a}),{signal:r?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;for(let e=0;e<t.length;e++){let n=t[e],r=c.get(n[1]);r||(r=new Set,c.set(n[1],r)),r.add(n[0])}}let u=[];for(let[e,t]of c)for(let n of t)u.push({id:n,typeName:e});return u}async refreshCacheContent(e,t,r,o=!0,s){let c=x.getInstance(),l=[],u=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),this.knowledgeGraph.dataModel.relationshipTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),!e&&!this.inclusionModeDefinition?(this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)}),this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)})):e?e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let t of this.memberIdTypeLookup.get(e))u.has(t)?u.get(t)?.push(e):u.set(t,[e])}):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{e.useAllData?u.set(t,null):e.members&&e.members.forEach(e=>{u.has(t)&&u.get(t)!==null?u.get(t)?.push(e.id):u.set(t,[e.id])})});for(let[e,a]of u){let u=new Set(a),f=new Promise((l,f)=>{(async()=>{let l=new Set,f=[],p=``,h=!1;if(t||d.get(e)?.properties?.forEach(e=>{e.name&&l.add(e.name)}),r&&this.geographicLookup.has(e)){let t=this.geographicLookup.get(e)?.name;t&&l.add(t)}if(this.entityTypeNames.has(e))p=`MATCH (n:${e}) ${a?`WHERE id(n) IN $ids `:``}return ID(n)`,l.forEach(e=>{p+=`, n.${e}`,f.push(e)});else if(this.relationshipTypeNames.has(e))h=!0,p=`MATCH ()-[n:${e}]->() ${a?`WHERE id(n) IN $ids `:``}return ID(n), id(startNode(n)), id(endNode(n))`,l.forEach(e=>{p+=`, n.${e}`,f.push(e)});else throw new n(`knowledge-graph:layer-data-manager`,`The graph type of ${e} could not be determined. Was this type set in the KG data model and inclusion definition?`);let g;g=a?new w({openCypherQuery:p,bindParameters:{ids:a}}):new w({openCypherQuery:p});let _=(await C(this.knowledgeGraph,g,{signal:s?.signal})).resultRowsStream.getReader();for(;;){let{done:t,value:n}=await _.read();if(t)break;let r=[];for(let e=0;e<n.length;e++){let t=n[e],a=0,o=0,s={properties:{}};for(s.id=t[a],a++,o++,h&&(s.originId=t[a],a++,o++,s.destinationId=t[a],a++,o++,i(this.nodeConnectionsLookup,s.originId,()=>new Set).add(s.id),i(this.nodeConnectionsLookup,s.destinationId,()=>new Set).add(s.id),i(this.relationshipConnectionsLookup,s.id,()=>[s.originId,s.destinationId]));a<t.length;a++)s.properties[f[a-o]]=t[a];u.delete(s.id),r.push(s)}let a=c.writeToStore(r,m,this.geographicLookup.get(e)?.name);this.sublayerCaches.has(e)||this.sublayerCaches.set(e,new Map),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(e)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(e).members=new Map);let s=this.sublayerCaches.get(e);a.forEach(t=>{s?.set(t.attributes[m],t),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.has(t.attributes[m])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.set(t.attributes[m],{id:t.attributes[m]}),i(this.memberIdTypeLookup,t.attributes[m],()=>new Set).add(e))})}let v=this.inclusionModeDefinition?.namedTypeDefinitions.get(e);if(v)for(let e of u)v.members?.delete(e)})().then(()=>{l(null)}).catch(e=>{e.name===`AbortError`?l(null):f(e)})});l.push(f),this._processingCacheUpdatesLookup.get(e)?.push(f)}if(await Promise.all(l),s?.signal?.aborted)throw a()}removeFromLayer(e){let t=new Set,n=new Set(e.map(e=>e.id));for(let n of e)t.add(n.typeName),this.memberIdTypeLookup.get(n.id)?.size===1?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)});t.forEach(e=>{this.sublayerCaches.get(e)?.forEach((t,r)=>{n.has(r)&&this.sublayerCaches.get(e)?.delete(r)})})}async retrieveDataFromService(e,t,r,i){let a=x.getInstance(),s=new Set,c=[],h=``,g=[],_=!1,v,T=t.graphType===`relationship`,E=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,D=r.sublayerIdsCache.get(t.objectType.name),O=!E&&D?Array.from(D).sort():null,k={systemOidFieldName:m,supportedSqlTypes:new Set([`column-reference`,`string`,`number`,`binary-expression`]),supportedSqlOperators:new Set([`=`,`<`,`<=`,`<>`,`>`,`>=`,`AND`,`OR`,`LIKE`]),unsupportedOperationFound:!1,requiresClientSidePagination:!1};if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&e.objectIds!=null&&(O=e.objectIds);else{if(!O?.length)return{features:[],cypherTranslationApplied:_};if(e.objectIds!=null){let t=e.objectIds,n=O.filter(e=>t.includes(e));if(t.length>0&&n.length===0)return{features:[],cypherTranslationApplied:_};e.objectIds=n,n.length>0&&(O=n)}else e.objectIds=O}if(e.outFields!=null){let n=e.outFields;n.includes(`*`)?t.fields.forEach(e=>{s.add(e.name)}):n.forEach(e=>{e!==m&&e!==t.geometryFieldName&&s.add(e)})}if(e.orderByFields!=null&&!e.outFields?.includes(`*`))for(let n of e.orderByFields){let[e]=n.trim().split(/\s+/),r=t.fieldsIndex.get(e);r&&r.name!==m&&(s.has(r.name)||s.add(r.name))}if(e.geometry!=null){let i=e.geometry,a,m=r.dataManager.knowledgeGraph.serviceDefinition,g=m?.spatialReference,_=m?.serviceCapabilities?.geometryCapabilities,y=_?.geometryMaxBoundingRectangleSizeX,b=_?.geometryMaxBoundingRectangleSizeY;if(i.type===`point`){let e=i;e.spatialReference?.isWGS84||(await d(e.spatialReference,p),e=f(e,p)),a=new l({spatialReference:p,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else i?.extent?.spatialReference&&!i.spatialReference?.isWGS84?(await d(i.extent.spatialReference,p),a=f(i.extent,p)):a=i.extent;if(y&&b&&g){if(g.wkid!==4326){let e=new l({spatialReference:g,xmax:y,ymax:b}),t=f(e,p);y=t.xmax,b=t.ymax}if(a.xmax-a.xmin>y)throw new n(`knowledge-graph:layer-data-manager`,`Extent x bounds should be within ${y}° latitude, limit exceeded`);if(a.ymax-a.ymin>b)throw new n(`knowledge-graph:layer-data-manager`,`Extent y bounds should be within ${b}° longitude, limit exceeded`)}if(e.where!=null&&e.where!==`1=1`){let n=await o(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach(e=>{n.fieldNames.includes(e.name)&&s.add(e.name)})}h=T?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach(e=>{h+=`, n.${e}`,c.push(e)}),v=new w({openCypherQuery:h,bindParameters:{param_filter_geom:new u({rings:S(a)})}})}else{let n=``;if(e.where!=null&&e.where!==`1=1`){let r=await o(e.where,t.fieldsIndex);t.fields.forEach(e=>{r.fieldNames.includes(e.name)&&s.add(e.name)}),n=y(r.parseTree,k),k.unsupportedOperationFound&&(n=``)}let r=``;r=T?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let i=!1;O&&(i=!0,r+=` WHERE ID(n) IN $ids`),n&&(r+=i?` AND`:` WHERE`,r+=` ${n}`),r+=` return ID(n)`,T&&(r+=`, id(startNode(n)), id(endNode(n))`),e.returnGeometry&&t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach(e=>{r+=`, n.${e}`,c.push(e)}),!k.unsupportedOperationFound&&!k.requiresClientSidePagination&&(r=b(r,e),_=!0),v=O?new w({openCypherQuery:r,bindParameters:{ids:O}}):new w({openCypherQuery:r})}let A=(await C(r.dataManager.knowledgeGraph,v,i)).resultRowsStream.getReader();for(;;){let{done:e,value:n}=await A.read();if(e)break;let i=[];for(let e=0;e<n.length;e++){let t=n[e],r=0,a=0,o={properties:{}};for(o.id=t[r],r++,a++,T&&(o.originId=t[r],r++,a++,o.destinationId=t[r],r++,a++);r<t.length;r++)o.properties[c[r-a]]=t[r];i.push(o)}g=g.concat(a.writeToStore(i,m,r.dataManager.geographicLookup.get(t.objectType.name)?.name))}return{features:g,cypherTranslationApplied:_}}_isEndEntitySpatial(e,t,n){for(let r of e??[])if(this.entityTypeNames.has(r)){let e=this.geographicLookup.get(r),i=e&&this.sublayerCaches.get(r)?.get(t.attributes[n]);if(e&&i?.attributes[e.name])return!0}return!1}_getNamedTypeIdMapFromNodeIds(e){let t=new Map;return e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let n of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(n))return;t.has(n)?t.get(n)?.push(e):t.set(n,[e])}}),t}};e([s()],E.prototype,`knowledgeGraph`,void 0),e([s()],E.prototype,`inclusionModeDefinition`,void 0),e([s()],E.prototype,`entityTypeNames`,void 0),e([s()],E.prototype,`relationshipTypeNames`,void 0),e([s()],E.prototype,`geographicLookup`,void 0),e([s()],E.prototype,`sublayerCaches`,void 0),e([s()],E.prototype,`nodeConnectionsLookup`,void 0),e([s()],E.prototype,`relationshipConnectionsLookup`,void 0),e([s()],E.prototype,`memberIdTypeLookup`,void 0),E=e([c(`esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager`)],E);export{E as KnowledgeGraphLayerDataManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Logger.js";import{systemOidFieldName as t}from"./constants.js";async function n(e){let{CharStream:t,CommonTokenStream:n,ParseTreeWalker:r}=await import(`../../chunks/antlr4.web.js`),{default:i}=await import(`./antlr/BindParamsListener.js`),{default:a}=await import(`../../chunks/CypherLexer.js`),{default:o}=await import(`../../chunks/CypherParser.js`),{default:s}=await import(`./antlr/SimpleErrorListener.js`),c=new s,l=new a(new t(e));l.removeErrorListeners(),l.addErrorListener(c);let u=new o(new n(l));u.removeErrorListeners(),u.addErrorListener(c);let d=u.oC_Cypher(),f=new i;return new r().walk(f,d),{bindParameters:Array.from(new Set(f.bindParams)).map(e=>e.slice(1)),parseErrors:c.errors}}const r=(e,t)=>{let n=e;return t.orderByFields?.length&&(n=
|
|
2
|
+
import e from"../../core/Logger.js";import{systemOidFieldName as t}from"./constants.js";async function n(e){let{CharStream:t,CommonTokenStream:n,ParseTreeWalker:r}=await import(`../../chunks/antlr4.web.js`),{default:i}=await import(`./antlr/BindParamsListener.js`),{default:a}=await import(`../../chunks/CypherLexer.js`),{default:o}=await import(`../../chunks/CypherParser.js`),{default:s}=await import(`./antlr/SimpleErrorListener.js`),c=new s,l=new a(new t(e));l.removeErrorListeners(),l.addErrorListener(c);let u=new o(new n(l));u.removeErrorListeners(),u.addErrorListener(c);let d=u.oC_Cypher(),f=new i;return new r().walk(f,d),{bindParameters:Array.from(new Set(f.bindParams)).map(e=>e.slice(1)),parseErrors:c.errors}}const r=(e,t)=>{let n=e;return t.orderByFields?.length&&(n=c(n,t.orderByFields)),t.start!=null&&(n=s(n,t.start)),t.num!=null&&(n=o(n,t.num)),n},i=(e,t)=>e.type===`column-reference`?e.column===t.systemOidFieldName?`ID(n)`:`n.${e.column}`:e.type===`string`?`'${e.value}'`:e.type===`number`?`${e.value}`:e.type===`binary-expression`&&e.operator!==`LIKE`&&t.supportedSqlTypes.has(e.left.type)&&t.supportedSqlTypes.has(e.right.type)&&t.supportedSqlOperators.has(e.operator)?`${i(e.left,t)} ${e.operator} ${i(e.right,t)}`:e.type===`binary-expression`&&e.operator===`LIKE`?a(e,t):(t.unsupportedOperationFound=!0,``);function a(e,t){if(e.left.type!==`column-reference`||e.right.type!==`string`||e.escape)return t.unsupportedOperationFound=!0,``;let n=e.right.value.replaceAll(/%+/g,`%`),r=n.startsWith(`%`),a=n.endsWith(`%`),o=n.slice(+!!r,a?-1:void 0),s=o.match(/[%_]/g)?.length??0;if(o.length===s)return t.unsupportedOperationFound=!0,``;s>0&&(t.requiresClientSidePagination=!0);let c=o.split(/[%_]/),l=i(e.left,t),u=[];for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let n;n=c.length===1&&!r&&!a?`=`:e===0&&!r?`STARTS WITH`:e===c.length-1&&!a?`ENDS WITH`:`CONTAINS`;let i=t.replaceAll(`\\`,`\\\\`).replaceAll(`'`,`\\'`);u.push(`${l} ${n} '${i}'`)}return u.length===1?u[0]:`(${u.join(` AND `)})`}function o(t,n){let r=t.trimEnd();return/\blimit\s+(\$\w+|\d+)\b/i.test(r)?(e.getLogger(`cypherUtils`).warn(`Query already contains a LIMIT clause. Skipping addition of new LIMIT.`),t):`${r} LIMIT ${n}`}function s(t,n){let r=t.trimEnd();return/\bskip\s+(\$\w+|\d+)\b/i.test(r)?(e.getLogger(`cypherUtils`).warn(`Query already contains a SKIP clause. Skipping addition of new SKIP.`),t):`${r} SKIP ${n}`}function c(n,r){let i=n.trimEnd();if(/\border\s+by\b/i.test(i))return e.getLogger(`cypherUtils`).warn(`Query already contains an ORDER BY clause. Skipping addition of new ORDER BY.`),n;let a=r.map(e=>e.trim()).filter(e=>!!e).map(e=>{let[n,r]=e.split(/\s+/,2);return n?`${n===t?`ID(n)`:`n.${n}`} ${r?.toUpperCase()===`DESC`?`DESC`:`ASC`}`:null}).filter(e=>!!e);return a.length?`${i} ORDER BY ${a.join(`, `)}`:n}export{r as addAdditionalClausesToCypher,o as addNumArgumentToCypherQuery,c as addOrderByFieldsToCypherQuery,s as addStartArgumentToCypherQuery,n as getBindParametersFromCypherQuery,i as recursiveParseSqlToCypher};
|
|
@@ -467,7 +467,7 @@ export abstract class FeatureLayerBase {
|
|
|
467
467
|
* - When `undefined` (default): Fetches m-values if they are needed for rendering or labeling, or layer property interacts with the geometry.
|
|
468
468
|
* Otherwise, m-values are excluded from feature queries.
|
|
469
469
|
* - When `true`: Fetches m-values with the geometry, ensuring they are available on the client.
|
|
470
|
-
* - When `false`:
|
|
470
|
+
* - When `false`: m-values are fetched if needed for rendering or labeling. Otherwise, they are not fetched.
|
|
471
471
|
*
|
|
472
472
|
* > [!WARNING]
|
|
473
473
|
* >
|
|
@@ -482,7 +482,7 @@ export abstract class FeatureLayerBase {
|
|
|
482
482
|
* - When `undefined` (default): Fetches z-values if they are needed for rendering or labeling, or layer property interacts with the geometry.
|
|
483
483
|
* Otherwise, z-values are excluded from feature queries.
|
|
484
484
|
* - When `true`: Fetches z-values with the geometry, ensuring they are available on the client.
|
|
485
|
-
* - When `false`:
|
|
485
|
+
* - When `false`: z-values are fetched if needed for rendering or labeling. Otherwise, they are not fetched.
|
|
486
486
|
*
|
|
487
487
|
* @see [FeatureLayerBase.hasZ](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/FeatureLayerBase/#hasZ)
|
|
488
488
|
* @see [Geometry.hasZ](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/#hasZ)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
function e(e,t,n,r=!0){if(t%4!=0||n%4!=0){let i=new ArrayBuffer(Math.ceil(n/4)*4),a=new Uint8Array(i),o=new Uint8Array(e,t,n);if(!r)a.set(o);else for(let e=0;e<a.length;e+=4)a[e]=o[e+3],a[e+1]=o[e+2],a[e+2]=o[e+1],a[e+3]=o[e];return new Uint32Array(a.buffer)}if(r){let r=new Uint8Array(e,t,n),i=new Uint8Array(r.length);for(let e=0;e<i.length;e+=4)i[e]=r[e+3],i[e+1]=r[e+2],i[e+2]=r[e+1],i[e+3]=r[e];return new Uint32Array(i.buffer)}return new Uint32Array(e,t,n/4)}function t(){let e=[];for(let t=0;t<=257;t++)e[t]=[t];return e}function n(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const r=new Set
|
|
2
|
+
function e(e,t,n,r=!0){if(t%4!=0||n%4!=0){let i=new ArrayBuffer(Math.ceil(n/4)*4),a=new Uint8Array(i),o=new Uint8Array(e,t,n);if(!r)a.set(o);else for(let e=0;e<a.length;e+=4)a[e]=o[e+3],a[e+1]=o[e+2],a[e+2]=o[e+1],a[e+3]=o[e];return new Uint32Array(a.buffer)}if(r){let r=new Uint8Array(e,t,n),i=new Uint8Array(r.length);for(let e=0;e<i.length;e+=4)i[e]=r[e+3],i[e+1]=r[e+2],i[e+2]=r[e+1],i[e+3]=r[e];return new Uint32Array(i.buffer)}return new Uint32Array(e,t,n/4)}function t(){let e=[];for(let t=0;t<=257;t++)e[t]=[t];return e}function n(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const r=new Set([511,1023,2047]);function i(i,a,o,s=!0){let c=e(i,a,o,s),l=9,u=t(),d=32,f=u.length,p=[],m=1,h=c[0],g=0,_=c.length,v=(_*4-o)*8,y=[];for(;h!=null;){if(d>=l)d-=l,g=h>>>32-l,h<<=l;else{g=h>>>32-d,h=c[m++];let e=l-d;d=32-e,g=(g<<e)+(h>>>d),h<<=e}if(g===257)break;if(g===256){l=9,u=t(),f=u.length,p=[];continue}let e=u[g];if(e==null){if(g>u.length)throw Error(`data integrity issue: code does not exist on code page`);p.push(p[0]),u[f++]=p.slice(),n(y,p)}else n(y,e),p.push(e[0]),p.length>1&&f<4096&&(u[f++]=p.slice()),p=e.slice();if(r.has(f)&&l++,d===0&&(h=c[m++],d=32),m>_||m===_&&d<=v)break}return new Uint8Array(y)}export{i as decode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import"../../../core/has.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as a}from"./pixelRangeUtils.js";import{isBSQConfig as o,getTagFirstNumericValue as s,getCompressionType as c,parseHeader as l,checkRequiredArraySize as u,getTagNumericValues as d,getImageInfo as f}from"./tiffParser.js";import{isPlatformLittleEndian as p}from"./utils.js";import{inflate as m}from"./Zlib.js";function h(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function g(e){let t=e?e.toLowerCase():`f32`,n=null;switch(t){case`u1`:case`u2`:case`u4`:case`u8`:n=Uint8Array;break;case`u16`:n=Uint16Array;break;case`u32`:n=Uint32Array;break;case`s8`:n=Int8Array;break;case`s16`:n=Int16Array;break;case`s32`:n=Int32Array;break;case`f64`:n=Float64Array;break;default:n=Float32Array}return n}async function _(e,t){return await n(),r(e,{inputOffset:t}).pixels[0]}function v(e,t){if(t%8==0)return e;let n=t>16?32:t>8?16:8;n>8&&(e=b(e,n===32?4:2));let r=n===32?Uint32Array:n===16?Uint16Array:Uint8Array,i=new r(e),a=Math.floor(e.byteLength*8/t+1e-6),o=new r(a),s=(1<<t)-1,c=0,l=0,u=0;for(let e=0;e<a;e++)if(l===0&&(u=i[c++],l=n),l>=t)o[e]=u>>>l-t&s,l-=t;else{let r=t-l,a=(u&s)<<r&s;u=i[c++],l=n-r,a+=u>>>l,o[e]=a}return o.buffer}function y(e,n,r){let i=new t;i.parse(e),i.colorTransform=r===6?-1:0;let a=i.getData(i.width,i.height,n!==1&&n!==4);return new Uint8Array(a.buffer)}function b(e,t){let n=new Uint8Array(e),r=new Uint8Array(n.length);if(t===2)for(let e=0;e<n.length;e+=2)r[e]=n[e+1],r[e+1]=n[e];else if(t===4)for(let e=0;e<n.length;e+=4)r[e]=n[e+3],r[e+1]=n[e+2],r[e+2]=n[e+1],r[e+3]=n[e];else for(let e=0;e<n.length;e+=8)r[e]=n[e+7],r[e+1]=n[e+6],r[e+2]=n[e+5],r[e+3]=n[e+4],r[e+4]=n[e+3],r[e+5]=n[e+2],r[e+6]=n[e+1],r[e+7]=n[e];return r.buffer}async function x(t,n){let{input:r,isTiffLittleEndian:a,ifd:l,offset:u,size:d}=t,f=p===a,x=s(l,`BITSPERSAMPLE`),S=s(l,`SAMPLESPERPIXEL`)??1,C=s(l,`PHOTOMETRICINTERPRETATION`),w=s(l,`SAMPLEFORMAT`)??1,E=h(w,x),D=c(l);if(D===34887)return await _(r,u);let O=g(E),k,A;switch(D){case 1:k=r.slice(u,u+d),A=new Uint8Array(k);break;case 8:case 32946:A=await m(new Uint8Array(r,u,d),void 0,n),k=A.buffer;break;case 6:A=y(new Uint8Array(r,u,d),S,C),k=A.buffer;break;case 7:{let e=l.get(`JPEGTABLES`).values,t
|
|
2
|
+
import e from"../../../core/Error.js";import"../../../core/has.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as a}from"./pixelRangeUtils.js";import{isBSQConfig as o,getTagFirstNumericValue as s,getCompressionType as c,parseHeader as l,checkRequiredArraySize as u,getTagNumericValues as d,getImageInfo as f}from"./tiffParser.js";import{isPlatformLittleEndian as p}from"./utils.js";import{inflate as m}from"./Zlib.js";function h(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function g(e){let t=e?e.toLowerCase():`f32`,n=null;switch(t){case`u1`:case`u2`:case`u4`:case`u8`:n=Uint8Array;break;case`u16`:n=Uint16Array;break;case`u32`:n=Uint32Array;break;case`s8`:n=Int8Array;break;case`s16`:n=Int16Array;break;case`s32`:n=Int32Array;break;case`f64`:n=Float64Array;break;default:n=Float32Array}return n}async function _(e,t){return await n(),r(e,{inputOffset:t}).pixels[0]}function v(e,t){if(t%8==0)return e;let n=t>16?32:t>8?16:8;n>8&&(e=b(e,n===32?4:2));let r=n===32?Uint32Array:n===16?Uint16Array:Uint8Array,i=new r(e),a=Math.floor(e.byteLength*8/t+1e-6),o=new r(a),s=(1<<t)-1,c=0,l=0,u=0;for(let e=0;e<a;e++)if(l===0&&(u=i[c++],l=n),l>=t)o[e]=u>>>l-t&s,l-=t;else{let r=t-l,a=(u&s)<<r&s;u=i[c++],l=n-r,a+=u>>>l,o[e]=a}return o.buffer}function y(e,n,r){let i=new t;i.parse(e),i.colorTransform=r===6?-1:0;let a=i.getData(i.width,i.height,n!==1&&n!==4);return new Uint8Array(a.buffer)}function b(e,t){let n=new Uint8Array(e),r=new Uint8Array(n.length);if(t===2)for(let e=0;e<n.length;e+=2)r[e]=n[e+1],r[e+1]=n[e];else if(t===4)for(let e=0;e<n.length;e+=4)r[e]=n[e+3],r[e+1]=n[e+2],r[e+2]=n[e+1],r[e+3]=n[e];else for(let e=0;e<n.length;e+=8)r[e]=n[e+7],r[e+1]=n[e+6],r[e+2]=n[e+5],r[e+3]=n[e+4],r[e+4]=n[e+3],r[e+5]=n[e+2],r[e+6]=n[e+1],r[e+7]=n[e];return r.buffer}async function x(t,n){let{input:r,isTiffLittleEndian:a,ifd:l,offset:u,size:d}=t,f=p===a,x=s(l,`BITSPERSAMPLE`),S=s(l,`SAMPLESPERPIXEL`)??1,C=s(l,`PHOTOMETRICINTERPRETATION`),w=s(l,`SAMPLEFORMAT`)??1,E=h(w,x),D=c(l);if(D===34887)return await _(r,u);let O=g(E),k,A;switch(D){case 1:k=r.slice(u,u+d),A=new Uint8Array(k);break;case 8:case 32946:A=await m(new Uint8Array(r,u,d),void 0,n),k=A.buffer;break;case 6:A=y(new Uint8Array(r,u,d),S,C),k=A.buffer;break;case 7:{let e=l.get(`JPEGTABLES`);if(e){let t=e.values,n=t.length-2,i=new Uint8Array(n+d-2);for(let e=0;e<n;e++)i[e]=t[e];let a=new Uint8Array(r,u+2,d-2);for(let e=0;e<a.length;e++)i[n+e]=a[e];A=y(i,S,C)}else A=y(new Uint8Array(r,u,d),S,C);k=A.buffer}break;case 5:A=i(r,u,d,p),k=A.buffer;break;default:throw new e(`tiff-reader:decode-data`,`unsupported compression `+D)}let j=s(l,`PREDICTOR`)??1,M=s(l,`TILEWIDTH`),N=s(l,`TILELENGTH`),P=D===5||D===8||D===32946,F=w===3&&j===3&&P&&!!M&&!!N;k=v(k,x);let I;if(I=f||x<=8||x%8!=0||F?new O(k):new O(b(k,x>32?8:x>16?4:2)),j>1&&P&&M&&N){let e=o(l),t=new O(I.length);t.set(I),I=T(t,N,M,F,e?1:S)}return I}async function S(e,t,n,r){let i=d(n,`TILEOFFSETS`),a=d(n,`TILEBYTECOUNTS`);if(i==null||a==null)return null;let{width:l,height:u,pixelType:p,tileWidth:m,tileHeight:h}=f([n]),_=o(n,t),v=s(n,`SAMPLESPERPIXEL`)||t.planes,y=l*u,b=s(n,`BITSPERSAMPLE`),S=c(n)===34887,C=g(p),w=[];for(let e=0;e<v;e++)w.push(new C(y));let T=Math.ceil(l/m),E=new Uint8Array(y).fill(255),D=null,O=!1;if(b%8==0){if(S&&_&&v>1){let o=Math.round(i.length/v);for(let s=0;s<o;s++){let o=Math.floor(s/T)*h,c=s%T*m,d=o*l+c;for(let f=0;f<v;f++){let p=s*v+f;a[p]===0?(D=null,O=!0):D=await x({input:e,isTiffLittleEndian:t.littleEndian,ifd:n,offset:i[p],size:a[p]},r);let g=Math.min(m,l-c),_=Math.min(h,u-o),y=w[f];for(let e=0;e<_;e++){let t=d+e*l,n=e*m;for(let e=0;e<g;e++,t++,n++)D?y[t]=D[n]:E[t]=0}}}}else for(let o=0;o<i.length;o++){let s=Math.floor(o/T)*h,c=o%T*m,d=s*l+c;a[o]===0?(D=null,O=!0):D=await x({input:e,isTiffLittleEndian:t.littleEndian,ifd:n,offset:i[o],size:a[o]},r);let f=Math.min(m,l-c),p=Math.min(h,u-s);for(let e=0;e<v;e++){let t=w[e];if(_||S)for(let n=0;n<p;n++){let r=d+n*l,i=m*h*e+n*m;for(let e=0;e<f;e++,r++,i++)D?t[r]=D[i]:E[r]=0}else for(let n=0;n<p;n++){let r=d+n*l,i=n*m*v+e;for(let e=0;e<f;e++,r++,i+=v)D?t[r]=D[i]:E[r]=0}}}}return{width:l,height:u,pixelType:p,pixels:w,mask:O?E:void 0}}async function C(e,t,n,r){let a=p===t.littleEndian,o=d(n,`STRIPOFFSETS`),l=d(n,`STRIPBYTECOUNTS`);if(o==null||l==null)return null;let{width:u,height:h,pixelType:_}=f([n]),b=s(n,`SAMPLESPERPIXEL`)||t.planes,x=s(n,`PHOTOMETRICINTERPRETATION`),S=u*h,C=s(n,`BITSPERSAMPLE`),w=g(_),T=new w(S*b),E=s(n,`ROWSPERSTRIP`),D=c(n),O,k,A,j;if(C%8==0)for(let t=0;t<o.length;t++){let n=E*u*t*b;if(_===`u8`||_===`s8`||a)D===8||D===32946?(A=new Uint8Array(e,o[t],l[t]),A=await m(A,void 0,r),k=A.buffer):D===6?(A=new Uint8Array(e,o[t],l[t]),A=y(A,b,x),k=A.buffer):D===5?(A=i(e,o[t],l[t],p),k=A.buffer):k=e.slice(o[t],o[t]+l[t]),k=v(k,C),O=new w(k);else{switch(D===6||D===8||D===32946?(A=new Uint8Array(e,o[t],l[t]),j=await m(A,void 0,r),k=j.buffer):(k=new ArrayBuffer(l[t]),A=new Uint8Array(e,o[t],l[t]),j=new Uint8Array(k)),_){case`u16`:case`s16`:for(let e=0;e<A.length;e+=2)j[e]=A[e+1],j[e+1]=A[e];break;case`u32`:case`s32`:case`f32`:for(let e=0;e<A.length;e+=4)j[e]=A[e+3],j[e+1]=A[e+2],j[e+2]=A[e+1],j[e+3]=A[e]}k=v(k,C),O=new w(k)}T.set(O,n)}let M=[];if(b===1)M.push(T);else for(let e=0;e<b;e++){let t=new w(S);for(let n=0;n<S;n++)t[n]=T[n*b+e];M.push(t)}return{width:u,height:h,pixelType:_,pixels:M}}function w(e,t,n){if(!(e&&e.length>0&&t&&n))return null;let r,i,a,o=e[0].length,s=e.length,c=new Uint8Array(o);for(let l=0;l<s;l++)if(r=e[l],i=t[l],a=n[l],l===0)for(let e=0;e<o;e++)c[e]=r[e]<i||r[e]>a?0:1;else for(let e=0;e<o;e++)c[e]&&(c[e]=r[e]<i||r[e]>a?0:1);return c}function T(e,t,n,r,i){let a=r?4:1,o=n*a*i;r&&(e=new Uint8Array(e.buffer));for(let n=0;n<t;n++){let t=n*o;for(let n=i;n<o;n++)e[t+n]+=e[t+n-i]}if(!r)return e;let s=new Uint8Array(e.length),c=n*i;for(let n=0;n<t;n++){let t=n*o;for(let n=0;n<c;n++)for(let r=0;r<a;r++)s[t+n*a+r]=e[t+n+(a-r-1)*c]}return new Float32Array(s.buffer)}async function E(e,t,n){let{headerInfo:r,ifd:i,offsets:l,sizes:u}=t,d=[];for(let t=0;t<l.length;t++){+(u[t]===0);let a=await x({input:e,isTiffLittleEndian:r.littleEndian,ifd:i,offset:l[t],size:u[t]||e.byteLength},n);d.push(a)}let f=o(i,r),p=s(i,`BITSPERSAMPLE`),m=h(s(i,`SAMPLEFORMAT`)??1,p),_=s(i,`SAMPLESPERPIXEL`)||r.planes,v=g(m),y=s(i,`TILEWIDTH`),b=s(i,`TILELENGTH`),S=c(i)===34887,C=y*b,T,E=[],D=d[0];for(let e=0;e<_;e++){if(T=new v(C),d.length===_)D=d[e],D.length===C&&(T=D);else if(D.length){if(f||S)T=D.length===C?D:D.slice(C*e,C*(e+1));else for(let t=0;t<C;t++)T[t]=D[t*_+e]}E.push(T)}let O=r.noData?r.noData[0]:t.noDataValue,k=r.metadata?r.metadata.statistics:null,A=k?k.map(e=>e.min):null,j=k?k.map(e=>e.max):null,M={pixelType:m,width:y,height:b,pixels:E,noDataValue:O};return O==null?A&&j&&t.applyMinMaxConstraint&&(M.mask=w(E,A,j)):a(M,O,{matchAllNoData:t?.matchAllNoData}),M}async function D(t,n={},r){let i=n.pyramidLevel||0,o=n.headerInfo||l(t),{ifds:s,noData:c}=o;if(s.length===0)throw new e(`tiff-reader:decode`,`no valid image file directory`);let d=u(o);if(d)throw new e(`tiff-reader:decode`,d);let f=i===-1?s[s.length-1]:s[i],p=c??n.noDataValue,m=o.tileWidth?await S(t,o,f,r):await C(t,o,f,r);if(!m)return m;if(p!=null){let e=c==null&&n?.matchAllNoData;a(m,p,{matchAllNoData:e})}return m}export{D as decode,E as decodeTileOrStrip};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{bytesToUTF8 as t}from"../datasets/byteStreamUtils.js";import{tiffTags as n,ifdTags as r,getTagName as i,geoKeys as a}from"./tiffTag.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],s=4294967296,c=new Map([[1,(e,t)=>e.getUint8(t)],[2,(e,t)=>e.getUint8(t)],[3,(e,t,n)=>e.getUint16(t,n)],[4,(e,t,n)=>e.getUint32(t,n)],[5,(e,t,n)=>e.getUint32(t,n)/e.getUint32(t+4,n)],[6,(e,t)=>e.getInt8(t)],[7,(e,t)=>e.getUint8(t)],[8,(e,t,n)=>e.getInt16(t,n)],[9,(e,t,n)=>e.getInt32(t,n)],[10,(e,t,n)=>e.getInt32(t,n)/e.getInt32(t+4,n)],[11,(e,t,n)=>e.getFloat32(t,n)],[12,(e,t,n)=>e.getFloat64(t,n)],[13,(e,t,n)=>e.getUint32(t,n)],[16,(e,t,n)=>l(e,t,n)],[17,(e,t,n)=>u(e,t,n)],[18,(e,t,n)=>l(e,t,n)]]);function l(e,t,n){let r=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*s+r:r*s+i}function u(e,t,n){let r=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n),a=(n?r:i)>=0?1:-1;return n?r*=a:i*=a,a*(n?i*s+r:r*s+i)}function d(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function f(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function h(e,t){return e.get(t)?.values?.[0]}function g(e){let n=e.get(`GEOKEYDIRECTORY`),r=n?.values;if(!r||typeof r[0]!=`number`||r.length<4)return;let o=r,s=o.slice(0,3).join(`.`),c=o[3];if(o.length<4+c*4)return;let l=new Map;l.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[s]});for(let n=0;n<c;n++){let r=4+n*4,s=o[r],c=o[r+1],u=o[r+2],d=o[r+3],f={id:s,type:c,valueCount:u,valueOffset:d,values:null};if(c===0)f.values=[d];else{let n=e.get(i(c)),r=n?.values;if(r==null&&n?.offlineOffsetSize!=null)return;if(r!=null){let e=d+u;n?.asciiBytes?e<=n.asciiBytes.length&&(f.values=[t(n.asciiBytes.subarray(d,e)).replace(/\|$/,``)]):typeof r[0]==`string`?e<=r[0].length&&(f.values=[r[0].slice(d,e).replace(/\|$/,``)]):e<=r.length&&(f.values=r.slice(d,e))}}let p=i(s,a);l.set(p,f)}n.data=l}function _(e,t,n,r){return r?l(e,t,n):e.getUint32(t,n)}function v(e,t,r,a=0,o=n,s=4){let c=s===8,u=c?8:2;if(r<0||r+u>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:u};let d=c?l(new DataView(e,r,8),0,t):new DataView(e,r,2).getUint16(0,t),f=4+s*2,p=s,m=u+d*f+p;if(r+m>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:m};let h=_(new DataView(e,r+m-p,p),0,t,c),g=r+u,v=new Map;for(let n=0;n<d;n++){let r=new DataView(e,g+f*n,f),c=r.getUint16(0,t),l=r.getUint16(2,t),u=i(c,o),d=[],p=0,m=0;s===4?(p=r.getUint32(4,t),m=r.getUint32(8,t)):s===8&&(p=_(r,4,t,!0),m=_(r,12,t,!0),d.push(r.getUint32(12,t)),d.push(r.getUint32(16,t)));let h={id:c,type:l,valueCount:p,valueOffset:m,valueOffsets:d,values:null};S(e,t,h,a,!1,s),v.set(u,h)}return{success:!0,ifd:v,nextIFD:h,requiredBufferSize:m}}function y(e){if(!e)return null;let t=e.match(/<Item(.*?)Item>/gi);if(!t||t.length===0)return null;let n=new Map;for(let e=0;e<t.length;e++){let r=t[e],i=r.indexOf(`sample=`),a=i>-1?r.slice(i+8,r.indexOf(`"`,i+8)):null;i=r.indexOf(`name=`);let o=i>-1?r.slice(i+6,r.indexOf(`"`,i+6)):r.slice(6,r.indexOf(`>`));if(o){let e=r.slice(r.indexOf(`>`)+1,r.indexOf(`</Item>`)).trim();a==null?n.set(o,e):n.has(o)?n.get(o)[a]=e:n.set(o,[e])}}let r=n.get(`STATISTICS_MINIMUM`),i=n.get(`STATISTICS_MAXIMUM`),a=n.get(`STATISTICS_MEAN`),o=n.get(`STATISTICS_STDDEV`),s=n.get(`STATISTICS_COUNT`),c=n.get(`STATISTICS_MEDIAN`),l=n.get(`STATISTICS_COVARIANCES`),u=null;if(r&&i){u=[];for(let e=0;e<r.length;e++){let t={min:parseFloat(r[e]),max:parseFloat(i[e]),avg:a&&parseFloat(a[e]),stddev:o&&parseFloat(o[e])};s&&(t.count=parseFloat(s[e])),c&&(t.median=parseFloat(c[e])),l&&(t.covariances=l[e].split(`,`).map(e=>parseFloat(e))),u.push(t)}}let d=n.get(`BandName`),f=n.get(`WavelengthMin`),p=n.get(`WavelengthMax`),m=null;if(d){m=[];for(let e=0;e<d.length;e++)m.push({BandName:d[e],WavelengthMin:f&&parseFloat(f[e]),WavelengthMax:p&&parseFloat(p[e])})}let h=n.get(`DataType`);return{statistics:u,bandProperties:m,dataType:h,rawMetadata:n}}function b(e,t,n,r){let{type:i,valueCount:a}=t,s=o[i];if(s==null||s<=0)return[];let l=a*s,u=l/s,d=new DataView(e,n,l),f=[],p=c.get(i);if(!p)return[];for(let e=0,t=0;e<u;e++,t+=s)f.push(p(d,t,r));return f}function x(e,t,n=4){let{type:r,valueCount:i,valueOffsets:a}=e,c=o[r];if(c==null||c<=0)return[];let l=c*8,u=i*l,{valueOffset:d}=e,f=n===8?64:32;if(!t){if(f<=32)d>>>=32-u;else{let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s);u<=32?(d=e>>>32-u,a[0]=d):(d=e*2**(32-u)+(t>>>32-u),a[0]=e,a[1]=t>>>32-u)}}if(i===1&&l===f)return[d];let p=[];if(f===64){let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s),n=e,r=32;for(let e=1;e<=i;e++){let i=32-l*e%32;if(r<l){let e=n<<i>>>32-r,a=t<<32-r>>>32-r;n=t,p.push(e+a*2**(l-r)),r-=32-(l-r)}else p.push(n<<i>>>32-l),r-=l;r===0&&(r=32,n=t)}return p}for(let e=1;e<=i;e++){let t=32-l*e;p.push(d<<t>>>32-l)}return p}function S(e,n,r,i=0,a=!1,s=4){if(r.values)return!0;let{type:c,valueCount:l}=r,u=r.valueOffset,d=o[c];if(d==null||d<=0)return r.values=[],!0;let f=l*d,p=l*o[c]*8,m=s===8?64:32,h;if(p<=m)h=x(r,n,s);else{let t=a?e.byteLength:e.byteLength-u+i;if(u-=i,a&&(u=0),u<0||f>t)return r.offlineOffsetSize=[r.valueOffset,f],r.values=null,!1;h=b(e,r,u,n)}if(c===2){let e=h instanceof Uint8Array?h:new Uint8Array(h);r.id===34737&&(r.asciiBytes=e),r.values=[e.length?t(e):``]}else r.values=h;return!0}function C(e){if(!e.has(`XMP`))return;let n=e.get(`XMP`),r=n.values;r&&typeof r[0]==`number`&&n.type===7&&(n.values=[t(new Uint8Array(r))])}function w(e){let t=h(e,`PHOTOMETRICINTERPRETATION`),n=p(e,`COLORMAP`);if(t!=null&&t<=3&&n?.length&&n.length%3==0){let e=[],t=n.length/3;for(let r=0;r<t;r++)e.push([r,n[r]>>>8,n[r+t]>>>8,n[r+t*2]>>>8]);return e}}function T(e){let t=p(e,`GEOTIEPOINTS`),n=p(e,`GEOPIXELSCALE`),r=p(e,`GEOTRANSMATRIX`),i=e.get(`GEOKEYDIRECTORY`)?.data,a=i?h(i,`GTRasterTypeGeoKey`)===2:!1,{spatialReference:o,isPseudoGeographic:s}=E(e),c;n&&t&&t.length>=6?(c=[n[0],0,t[3]-t[0]*n[0],0,-Math.abs(n[1]),t[4]-t[1]*n[1]],a&&(c[2]-=c[0]*.5+c[1]*.5,c[5]-=c[3]*.5+c[4]*.5)):r?.length===16&&(c=a?[r[0],r[1],r[3]-r[0]*.5,r[4],r[5],r[7]-r[5]*.5]:[r[0],r[1],r[3],r[4],r[5],r[7]]);let l,u=h(e,`IMAGEWIDTH`),f=h(e,`IMAGELENGTH`);if(c){let e=[{x:0,y:f},{x:0,y:0},{x:u,y:f},{x:u,y:0}],t,n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=0;o<e.length;o++)t=d(e[o],c),n=t.x>n?n:t.x,i=t.x<i?i:t.x,r=t.y>r?r:t.y,a=t.y<a?a:t.y;l={xmin:n,xmax:i,ymin:r,ymax:a,spatialReference:o}}else l={xmin:-.5,ymin:.5-f,xmax:u-.5,ymax:.5,spatialReference:o};return s&&(l.xmax-l.xmin>400||Math.max(Math.abs(l.xmin),Math.abs(l.xmax))>361)&&(l.spatialReference=null),{extent:l,isPseudoGeographic:s,affine:n?void 0:c}}function E(e){let t=m(e,`GEOASCIIPARAMS`),n=null;if(t){let e=t.split(`|`).find(e=>e.includes(`ESRI PE String = `)),r=e?e.replace(`ESRI PE String = `,``):``;n=r.startsWith(`COMPD_CS`)||r.startsWith(`PROJCS`)||r.startsWith(`GEOGCS`)?{wkid:null,wkt:r}:null}let r=!1,i=e.get(`GEOKEYDIRECTORY`)?.data;if(i){let e=h(i,`GTModelTypeGeoKey`);if(e===2){let e=h(i,`GeographicTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e}),!n&&e===32767&&(r=!0,n={wkid:4326})}else if(e===1){let e=h(i,`ProjectedCSTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e})}}return{spatialReference:n,isPseudoGeographic:r}}function D(e){let{width:t,height:n,tileHeight:r,tileWidth:i}=e,a=e.planes,o=i?i*r:t*n,s=h(e.ifds[0],`BITSPERSAMPLE`),c=o*a,l=``;return c>2**30/(s>8?s/8:1)&&(l=i?`tiled tiff exceeding 1 gigabits per tile is not supported`:`scanline tiff exceeding 1 gigabits is not supported`),l}function O(e,t){let n=h(e,`PLANARCONFIGURATION`);return n==null?t?t.isBSQ:!1:n===2}function k(e){return h(e,`COMPRESSION`)??1}function A(e){let t=k(e),n,r=!1;switch(t){case 1:n=`NONE`,r=!0;break;case 2:case 3:case 4:case 32771:n=`CCITT`;break;case 5:n=`LZW`,r=!0;break;case 6:case 7:n=`JPEG`,r=!0;break;case 32773:n=`PACKBITS`;break;case 8:case 32946:n=`DEFLATE`,r=!0;break;case 34712:n=`JPEG2000`;break;case 34887:n=`LERC`,r=!0;break;default:n=String(t)}return{compression:n,supported:r}}function j(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function M(e){let t=e[0],n=h(t,`TILEWIDTH`),r=h(t,`TILELENGTH`),i=h(t,`IMAGEWIDTH`),a=h(t,`IMAGELENGTH`),o=h(t,`BITSPERSAMPLE`),s=h(t,`SAMPLESPERPIXEL`),c=h(t,`SAMPLEFORMAT`)??1,l=j(c,o),u=O(t),d=f(t,`GDAL_NODATA`),p=null;d?.length&&(p=d.map(e=>parseFloat(e)),p.some(e=>isNaN(e))&&(p=null));let g=!0,_=``,{compression:v,supported:b}=A(t);b||(g=!1,_+=`unsupported tag compression `+v),c>3&&(g=!1,_+=`unsupported tag sampleFormat `+c),o>32&&o!==64&&(g=!1,_+=`unsupported tag bitsPerSample `+o);let{extent:x,isPseudoGeographic:S,affine:C}=T(t),E=N(e),k,M,F,I;if(E.length>0){F=Math.round(Math.log(i/h(E[0],`IMAGEWIDTH`))/Math.LN2);let e=E[E.length-1];I=E.length,k=h(e,`TILEWIDTH`),M=h(e,`TILELENGTH`)}k=I!=null&&I>0?k||n:null,M=I!=null&&I>0?M||r:null;let L;n&&(L=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(a/r)-1,minRow:0,minCol:0}],E.forEach(e=>{L.push({maxCol:Math.ceil(h(e,`IMAGEWIDTH`)/h(e,`TILEWIDTH`))-1,maxRow:Math.ceil(h(e,`IMAGELENGTH`)/h(e,`TILELENGTH`))-1,minRow:0,minCol:0})}));let R=y(m(e[0],`GDAL_METADATA`));_+=` `+D({width:i,height:a,tileWidth:n,tileHeight:r,planes:s,ifds:e});let z=P(e).length===E.length+1,B=E?.length?E.map(e=>({x:i/h(e,`IMAGEWIDTH`),y:a/h(e,`IMAGELENGTH`)})):void 0,V=w(t);return{width:i,height:a,tileWidth:n,tileHeight:r,planes:s,isBSQ:u,pixelType:l,compression:v,noData:p,hasMaskBand:z,isSupported:g,pyramidResolutions:B,message:_,extent:x,isPseudoGeographic:S,affine:C,firstPyramidLevel:F,maximumPyramidLevel:I,pyramidBlockWidth:k,pyramidBlockHeight:M,tileBoundary:L,metadata:R,colormap:V}}function N(e){return e.filter(e=>h(e,`NEWSUBFILETYPE`)===1)}function P(e){return e.filter(e=>{let t=((h(e,`NEWSUBFILETYPE`)??0)&4)==4,n=h(e,`PHOTOMETRICINTERPRETATION`)===4;return t&&n})}function F(e,t,i,a=0,o=n,s=4){let c=v(e,t,i,a,o,s),l,u=c.ifd;return u&&(r.forEach((n,r)=>{u.has(r)&&(l=u.get(r),l.data=v(e,t,l.valueOffset-a,a,n).ifd)}),g(u),C(u)),c}function I(t){let n=new DataView(t,0,16),r=n.getUint16(0,!1),i=null;if(r===18761)i=!0;else if(r===19789)i=!1;else throw new e(`tiff-reader:parse-signature`,`unexpected endianness byte`);let a=n.getUint16(2,i);if(a!==42&&a!==43)throw new e(`tiff-reader:parse-signature`,`unexpected tiff identifier`);let o=4,s=a===43;if(s){let t=n.getUint16(o,i);if(o+=2,t!==8||n.getUint16(o,i)!==0)throw new e(`tiff-reader:parse-signature`,`unsupported bigtiff version`);o+=2}let c=_(n,o,i,s);return{littleEndian:i,isBigTiff:s,firstIFDPos:c}}function L(e){let{littleEndian:t,isBigTiff:r,firstIFDPos:i}=I(e),a=i,o=[];do{let i=F(e,t,a,0,n,r?8:4);if(i.success)o.push(i.ifd),a=i.nextIFD;else break}while(a>0);let s=M(o),c=N(o),l=P(o);return{...s,littleEndian:t,isBigTiff:r,ifds:o,pyramidIFDs:c,maskIFDs:l}}export{D as checkRequiredArraySize,k as getCompressionType,M as getImageInfo,P as getMaskIFDs,N as getPyramidIFDs,h as getTagFirstNumericValue,p as getTagNumericValues,O as isBSQConfig,S as parseFieldValues,g as parseGeoKeyDirectory,L as parseHeader,F as parseIFD,y as parseMetadata,I as parseSignature,C as parseXMP};
|
|
2
|
+
import e from"../../../core/Error.js";import{bytesToUTF8 as t}from"../datasets/byteStreamUtils.js";import{tiffTags as n,ifdTags as r,getTagName as i,geoKeys as a}from"./tiffTag.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],s=4294967296,c=new Map([[1,(e,t)=>e.getUint8(t)],[2,(e,t)=>e.getUint8(t)],[3,(e,t,n)=>e.getUint16(t,n)],[4,(e,t,n)=>e.getUint32(t,n)],[5,(e,t,n)=>e.getUint32(t,n)/e.getUint32(t+4,n)],[6,(e,t)=>e.getInt8(t)],[7,(e,t)=>e.getUint8(t)],[8,(e,t,n)=>e.getInt16(t,n)],[9,(e,t,n)=>e.getInt32(t,n)],[10,(e,t,n)=>e.getInt32(t,n)/e.getInt32(t+4,n)],[11,(e,t,n)=>e.getFloat32(t,n)],[12,(e,t,n)=>e.getFloat64(t,n)],[13,(e,t,n)=>e.getUint32(t,n)],[16,(e,t,n)=>l(e,t,n)],[17,(e,t,n)=>u(e,t,n)],[18,(e,t,n)=>l(e,t,n)]]);function l(e,t,n){return Number(e.getBigUint64(t,n))}function u(e,t,n){return Number(e.getBigInt64(t,n))}function d(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function f(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function h(e,t){return e.get(t)?.values?.[0]}function g(e){let n=e.get(`GEOKEYDIRECTORY`),r=n?.values;if(!r||typeof r[0]!=`number`||r.length<4)return;let o=r,s=o.slice(0,3).join(`.`),c=o[3];if(o.length<4+c*4)return;let l=new Map;l.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[s]});for(let n=0;n<c;n++){let r=4+n*4,s=o[r],c=o[r+1],u=o[r+2],d=o[r+3],f={id:s,type:c,valueCount:u,valueOffset:d,values:null};if(c===0)f.values=[d];else{let n=e.get(i(c)),r=n?.values;if(r==null&&n?.offlineOffsetSize!=null)return;if(r!=null){let e=d+u;n?.asciiBytes?e<=n.asciiBytes.length&&(f.values=[t(n.asciiBytes.subarray(d,e)).replace(/\|$/,``)]):typeof r[0]==`string`?e<=r[0].length&&(f.values=[r[0].slice(d,e).replace(/\|$/,``)]):e<=r.length&&(f.values=r.slice(d,e))}}let p=i(s,a);l.set(p,f)}n.data=l}function _(e,t,n,r){return r?l(e,t,n):e.getUint32(t,n)}function v(e,t,r,a=0,o=n,s=4){let c=s===8,u=c?8:2;if(r<0||r+u>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:u};let d=c?l(new DataView(e,r,8),0,t):new DataView(e,r,2).getUint16(0,t),f=4+s*2,p=s,m=u+d*f+p;if(r+m>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:m};let h=_(new DataView(e,r+m-p,p),0,t,c),g=r+u,v=new Map;for(let n=0;n<d;n++){let r=new DataView(e,g+f*n,f),c=r.getUint16(0,t),l=r.getUint16(2,t),u=i(c,o),d=[],p=0,m=0;s===4?(p=r.getUint32(4,t),m=r.getUint32(8,t)):s===8&&(p=_(r,4,t,!0),m=_(r,12,t,!0),d.push(r.getUint32(12,t)),d.push(r.getUint32(16,t)));let h={id:c,type:l,valueCount:p,valueOffset:m,valueOffsets:d,values:null};S(e,t,h,a,!1,s),v.set(u,h)}return{success:!0,ifd:v,nextIFD:h,requiredBufferSize:m}}function y(e){if(!e)return null;let t=e.match(/<Item(.*?)Item>/gi);if(!t||t.length===0)return null;let n=new Map;for(let e=0;e<t.length;e++){let r=t[e],i=r.indexOf(`sample=`),a=i>-1?r.slice(i+8,r.indexOf(`"`,i+8)):null;i=r.indexOf(`name=`);let o=i>-1?r.slice(i+6,r.indexOf(`"`,i+6)):r.slice(6,r.indexOf(`>`));if(o){let e=r.slice(r.indexOf(`>`)+1,r.indexOf(`</Item>`)).trim();a==null?n.set(o,e):(n.has(o)||n.set(o,[]),n.get(o)[a]=e)}}let r=n.get(`STATISTICS_MINIMUM`),i=n.get(`STATISTICS_MAXIMUM`),a=n.get(`STATISTICS_MEAN`),o=n.get(`STATISTICS_STDDEV`),s=n.get(`STATISTICS_COUNT`),c=n.get(`STATISTICS_MEDIAN`),l=n.get(`STATISTICS_COVARIANCES`),u=null;if(r&&i){u=[];for(let e=0;e<r.length;e++){let t={min:parseFloat(r[e]),max:parseFloat(i[e]),avg:a&&parseFloat(a[e]),stddev:o&&parseFloat(o[e])};s&&(t.count=parseFloat(s[e])),c&&(t.median=parseFloat(c[e])),l&&(t.covariances=l[e].split(`,`).map(e=>parseFloat(e))),u.push(t)}}let d=n.get(`BandName`),f=n.get(`WavelengthMin`),p=n.get(`WavelengthMax`),m=null;if(d){m=[];for(let e=0;e<d.length;e++)m.push({BandName:d[e],WavelengthMin:f&&parseFloat(f[e]),WavelengthMax:p&&parseFloat(p[e])})}let h=n.get(`DataType`);return{statistics:u,bandProperties:m,dataType:h,rawMetadata:n}}function b(e,t,n,r){let{type:i,valueCount:a}=t,s=o[i];if(s==null||s<=0)return[];let l=a*s,u=l/s,d=new DataView(e,n,l),f=[],p=c.get(i);if(!p)return[];for(let e=0,t=0;e<u;e++,t+=s)f.push(p(d,t,r));return f}function x(e,t,n=4){let{type:r,valueCount:i,valueOffsets:a}=e,c=o[r];if(c==null||c<=0)return[];let l=c*8,u=i*l,{valueOffset:d}=e,f=n===8?64:32;if(!t){if(f<=32)d>>>=32-u;else{let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s);u<=32?(d=e>>>32-u,a[0]=d):(d=e*2**(32-u)+(t>>>32-u),a[0]=e,a[1]=t>>>32-u)}}if(i===1&&l===f)return[d];let p=[];if(f===64){let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s),n=e,r=32;for(let e=1;e<=i;e++){let i=32-l*e%32;if(r<l){let e=n<<i>>>32-r,a=t<<32-r>>>32-r;n=t,p.push(e+a*2**(l-r)),r-=32-(l-r)}else p.push(n<<i>>>32-l),r-=l;r===0&&(r=32,n=t)}return p}for(let e=1;e<=i;e++){let t=32-l*e;p.push(d<<t>>>32-l)}return p}function S(e,n,r,i=0,a=!1,s=4){if(r.values)return!0;let{type:c,valueCount:l}=r,u=r.valueOffset,d=o[c];if(d==null||d<=0)return r.values=[],!0;let f=l*d,p=l*o[c]*8,m=s===8?64:32,h;if(p<=m)h=x(r,n,s);else{let t=a?e.byteLength:e.byteLength-u+i;if(u-=i,a&&(u=0),u<0||f>t)return r.offlineOffsetSize=[r.valueOffset,f],r.values=null,!1;h=b(e,r,u,n)}if(c===2){let e=h instanceof Uint8Array?h:new Uint8Array(h);r.id===34737&&(r.asciiBytes=e),r.values=[e.length?t(e):``]}else r.values=h;return!0}function C(e){if(!e.has(`XMP`))return;let n=e.get(`XMP`),r=n.values;r&&typeof r[0]==`number`&&n.type===7&&(n.values=[t(new Uint8Array(r))])}function w(e){let t=h(e,`PHOTOMETRICINTERPRETATION`),n=p(e,`COLORMAP`);if(t!=null&&t<=3&&n?.length&&n.length%3==0){let e=[],t=n.length/3;for(let r=0;r<t;r++)e.push([r,n[r]>>>8,n[r+t]>>>8,n[r+t*2]>>>8]);return e}}function T(e){let t=p(e,`GEOTIEPOINTS`),n=p(e,`GEOPIXELSCALE`),r=p(e,`GEOTRANSMATRIX`),i=e.get(`GEOKEYDIRECTORY`)?.data,a=i?h(i,`GTRasterTypeGeoKey`)===2:!1,{spatialReference:o,isPseudoGeographic:s}=E(e),c;n&&t&&t.length>=6?(c=[n[0],0,t[3]-t[0]*n[0],0,-Math.abs(n[1]),t[4]-t[1]*n[1]],a&&(c[2]-=c[0]*.5+c[1]*.5,c[5]-=c[3]*.5+c[4]*.5)):r?.length===16&&(c=a?[r[0],r[1],r[3]-r[0]*.5,r[4],r[5],r[7]-r[5]*.5]:[r[0],r[1],r[3],r[4],r[5],r[7]]);let l,u=h(e,`IMAGEWIDTH`),f=h(e,`IMAGELENGTH`);if(c){let e=[{x:0,y:f},{x:0,y:0},{x:u,y:f},{x:u,y:0}],t,n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=0;o<e.length;o++)t=d(e[o],c),n=t.x>n?n:t.x,i=t.x<i?i:t.x,r=t.y>r?r:t.y,a=t.y<a?a:t.y;l={xmin:n,xmax:i,ymin:r,ymax:a,spatialReference:o}}else l={xmin:-.5,ymin:.5-f,xmax:u-.5,ymax:.5,spatialReference:o};return s&&(l.xmax-l.xmin>400||Math.max(Math.abs(l.xmin),Math.abs(l.xmax))>361)&&(l.spatialReference=null),{extent:l,isPseudoGeographic:s,affine:n?void 0:c}}function E(e){let t=m(e,`GEOASCIIPARAMS`),n=null;if(t){let e=t.split(`|`).find(e=>e.includes(`ESRI PE String = `)),r=e?e.replace(`ESRI PE String = `,``):``;n=r.startsWith(`COMPD_CS`)||r.startsWith(`PROJCS`)||r.startsWith(`GEOGCS`)?{wkid:null,wkt:r}:null}let r=!1,i=e.get(`GEOKEYDIRECTORY`)?.data;if(i){let e=h(i,`GTModelTypeGeoKey`);if(e===2){let e=h(i,`GeographicTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e}),!n&&e===32767&&(r=!0,n={wkid:4326})}else if(e===1){let e=h(i,`ProjectedCSTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e})}}return{spatialReference:n,isPseudoGeographic:r}}function D(e){let{width:t,height:n,tileHeight:r,tileWidth:i}=e,a=e.planes,o=i?i*r:t*n,s=h(e.ifds[0],`BITSPERSAMPLE`),c=o*a,l=``;return c>2**30/(s>8?s/8:1)&&(l=i?`tiled tiff exceeding 1 gigabits per tile is not supported`:`scanline tiff exceeding 1 gigabits is not supported`),l}function O(e,t){let n=h(e,`PLANARCONFIGURATION`);return n==null?t?t.isBSQ:!1:n===2}function k(e){return h(e,`COMPRESSION`)??1}function A(e){let t=k(e),n,r=!1;switch(t){case 1:n=`NONE`,r=!0;break;case 2:case 3:case 4:case 32771:n=`CCITT`;break;case 5:n=`LZW`,r=!0;break;case 6:case 7:n=`JPEG`,r=!0;break;case 32773:n=`PACKBITS`;break;case 8:case 32946:n=`DEFLATE`,r=!0;break;case 34712:n=`JPEG2000`;break;case 34887:n=`LERC`,r=!0;break;default:n=String(t)}return{compression:n,supported:r}}function j(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function M(e){let t=e[0],n=h(t,`TILEWIDTH`),r=h(t,`TILELENGTH`),i=h(t,`IMAGEWIDTH`),a=h(t,`IMAGELENGTH`),o=h(t,`BITSPERSAMPLE`),s=h(t,`SAMPLESPERPIXEL`),c=h(t,`SAMPLEFORMAT`)??1,l=j(c,o),u=O(t),d=f(t,`GDAL_NODATA`),p=null;d?.length&&(p=d.map(e=>parseFloat(e)),p.some(e=>isNaN(e))&&(p=null));let g=!0,_=``,{compression:v,supported:b}=A(t);b||(g=!1,_+=`unsupported tag compression `+v),c>3&&(g=!1,_+=`unsupported tag sampleFormat `+c),o>32&&o!==64&&(g=!1,_+=`unsupported tag bitsPerSample `+o);let{extent:x,isPseudoGeographic:S,affine:C}=T(t),E=N(e),k,M,F,I;if(E.length>0){F=Math.round(Math.log(i/h(E[0],`IMAGEWIDTH`))/Math.LN2);let e=E[E.length-1];I=E.length,k=h(e,`TILEWIDTH`),M=h(e,`TILELENGTH`)}k=I!=null&&I>0?k||n:null,M=I!=null&&I>0?M||r:null;let L;n&&(L=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(a/r)-1,minRow:0,minCol:0}],E.forEach(e=>{L.push({maxCol:Math.ceil(h(e,`IMAGEWIDTH`)/h(e,`TILEWIDTH`))-1,maxRow:Math.ceil(h(e,`IMAGELENGTH`)/h(e,`TILELENGTH`))-1,minRow:0,minCol:0})}));let R=y(m(e[0],`GDAL_METADATA`));_+=` `+D({width:i,height:a,tileWidth:n,tileHeight:r,planes:s,ifds:e});let z=P(e).length===E.length+1,B=E?.length?E.map(e=>({x:i/h(e,`IMAGEWIDTH`),y:a/h(e,`IMAGELENGTH`)})):void 0,V=w(t);return{width:i,height:a,tileWidth:n,tileHeight:r,planes:s,isBSQ:u,pixelType:l,compression:v,noData:p,hasMaskBand:z,isSupported:g,pyramidResolutions:B,message:_,extent:x,isPseudoGeographic:S,affine:C,firstPyramidLevel:F,maximumPyramidLevel:I,pyramidBlockWidth:k,pyramidBlockHeight:M,tileBoundary:L,metadata:R,colormap:V}}function N(e){return e.filter(e=>h(e,`NEWSUBFILETYPE`)===1)}function P(e){return e.filter(e=>{let t=((h(e,`NEWSUBFILETYPE`)??0)&4)==4,n=h(e,`PHOTOMETRICINTERPRETATION`)===4;return t&&n})}function F(e,t,i,a=0,o=n,s=4){let c=v(e,t,i,a,o,s),l,u=c.ifd;if(u){for(let[n,i]of r)u.has(n)&&(l=u.get(n),l.data=v(e,t,l.valueOffset-a,a,i).ifd);g(u),C(u)}return c}function I(t){let n=new DataView(t,0,16),r=n.getUint16(0,!1),i=null;if(r===18761)i=!0;else if(r===19789)i=!1;else throw new e(`tiff-reader:parse-signature`,`unexpected endianness byte`);let a=n.getUint16(2,i);if(a!==42&&a!==43)throw new e(`tiff-reader:parse-signature`,`unexpected tiff identifier`);let o=4,s=a===43;if(s){let t=n.getUint16(o,i);if(o+=2,t!==8||n.getUint16(o,i)!==0)throw new e(`tiff-reader:parse-signature`,`unsupported bigtiff version`);o+=2}let c=_(n,o,i,s);return{littleEndian:i,isBigTiff:s,firstIFDPos:c}}function L(e){let{littleEndian:t,isBigTiff:r,firstIFDPos:i}=I(e),a=i,o=[];do{let i=F(e,t,a,0,n,r?8:4);if(i.success)o.push(i.ifd),a=i.nextIFD;else break}while(a>0);let s=M(o),c=N(o),l=P(o);return{...s,littleEndian:t,isBigTiff:r,ifds:o,pyramidIFDs:c,maskIFDs:l}}export{D as checkRequiredArraySize,k as getCompressionType,M as getImageInfo,P as getMaskIFDs,N as getPyramidIFDs,h as getTagFirstNumericValue,p as getTagNumericValues,O as isBSQConfig,S as parseFieldValues,g as parseGeoKeyDirectory,L as parseHeader,F as parseIFD,y as parseMetadata,I as parseSignature,C as parseXMP};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
const e=(
|
|
2
|
+
const e=new Map([[254,`NEWSUBFILETYPE`],[255,`SUBFILETYPE`],[256,`IMAGEWIDTH`],[257,`IMAGELENGTH`],[258,`BITSPERSAMPLE`],[259,`COMPRESSION`],[262,`PHOTOMETRICINTERPRETATION`],[263,`THRESHHOLDING`],[264,`CELLWIDTH`],[265,`CELLLENGTH`],[266,`FILLORDER`],[269,`DOCUMENTNAME`],[270,`IMAGEDESCRIPTION`],[271,`MAKE`],[272,`MODEL`],[273,`STRIPOFFSETS`],[274,`ORIENTATION`],[277,`SAMPLESPERPIXEL`],[278,`ROWSPERSTRIP`],[279,`STRIPBYTECOUNTS`],[280,`MINSAMPLEVALUE`],[281,`MAXSAMPLEVALUE`],[282,`XRESOLUTION`],[283,`YRESOLUTION`],[284,`PLANARCONFIGURATION`],[285,`PAGENAME`],[286,`XPOSITION`],[287,`YPOSITION`],[288,`FREEOFFSETS`],[289,`FREEBYTECOUNTS`],[290,`GRAYRESPONSEUNIT`],[291,`GRAYRESPONSECURVE`],[292,`T4OPTIONS`],[293,`T6OPTIONS`],[296,`RESOLUTIONUNIT`],[297,`PAGENUMBER`],[300,`COLORRESPONSEUNIT`],[301,`TRANSFERFUNCTION`],[305,`SOFTWARE`],[306,`DATETIME`],[315,`ARTIST`],[316,`HOSTCOMPUTER`],[317,`PREDICTOR`],[318,`WHITEPOINT`],[319,`PRIMARYCHROMATICITIES`],[320,`COLORMAP`],[321,`HALFTONEHINTS`],[322,`TILEWIDTH`],[323,`TILELENGTH`],[324,`TILEOFFSETS`],[325,`TILEBYTECOUNTS`],[326,`BADFAXLINES`],[327,`CLEANFAXDATA`],[328,`CONSECUTIVEBADFAXLINES`],[330,`SUBIFD`],[332,`INKSET`],[333,`INKNAMES`],[334,`NUMBEROFINKS`],[336,`DOTRANGE`],[337,`TARGETPRINTER`],[338,`EXTRASAMPLES`],[339,`SAMPLEFORMAT`],[340,`SMINSAMPLEVALUE`],[341,`SMAXSAMPLEVALUE`],[342,`TRANSFERRANGE`],[347,`JPEGTABLES`],[512,`JPEGPROC`],[513,`JPEGIFOFFSET`],[514,`JPEGIFBYTECOUNT`],[515,`JPEGRESTARTINTERVAL`],[517,`JPEGLOSSLESSPREDICTORS`],[518,`JPEGPOINTTRANSFORM`],[519,`JPEGQTABLES`],[520,`JPEGDCTABLES`],[521,`JPEGACTABLES`],[529,`YCBCRCOEFFICIENTS`],[530,`YCBCRSUBSAMPLING`],[531,`YCBCRPOSITIONING`],[532,`REFERENCEBLACKWHITE`],[700,`XMP`],[33550,`GEOPIXELSCALE`],[33922,`GEOTIEPOINTS`],[33432,`COPYRIGHT`],[42112,`GDAL_METADATA`],[42113,`GDAL_NODATA`],[50844,`RPCCOEFFICIENT`],[34264,`GEOTRANSMATRIX`],[34735,`GEOKEYDIRECTORY`],[34736,`GEODOUBLEPARAMS`],[34737,`GEOASCIIPARAMS`],[34665,`EXIFIFD`],[34853,`GPSIFD`],[40965,`INTEROPERABILITYIFD`]]),t=new Map([...e,[36864,`ExifVersion`],[40960,`FlashpixVersion`],[40961,`ColorSpace`],[42240,`Gamma`],[37121,`ComponentsConfiguration`],[37122,`CompressedBitsPerPixel`],[40962,`PixelXDimension`],[40963,`PixelYDimension`],[37500,`MakerNote`],[37510,`UserComment`],[40964,`RelatedSoundFile`],[36867,`DateTimeOriginal`],[36868,`DateTimeDigitized`],[36880,`OffsetTime`],[36881,`OffsetTimeOriginal`],[36882,`OffsetTimeDigitized`],[37520,`SubSecTime`],[37521,`SubSecTimeOriginal`],[37522,`SubSecTimeDigitized`],[37888,`Temperature`],[37889,`Humidity`],[37890,`Pressure`],[37891,`WaterDepth`],[37892,`Acceleration`],[37893,`CameraElevationAngle`],[42016,`ImageUniqueID`],[42032,`CameraOwnerName`],[42033,`BodySerialNumber`],[42034,`LensSpecification`],[42035,`LensMake`],[42036,`LensModel`],[42037,`LensSerialNumber`],[33434,`ExposureTime`],[33437,`FNumber`],[34850,`ExposureProgram`],[34852,`SpectralSensitivity`],[34855,`PhotographicSensitivity`],[34856,`OECF`],[34864,`SensitivityType`],[34865,`StandardOutputSensitivity`],[34866,`RecommendedExposureIndex`],[34867,`ISOSpeed`],[34868,`ISOSpeedLatitudeyyy`],[34869,`ISOSpeedLatitudezzz`],[37377,`ShutterSpeedValue`],[37378,`ApertureValue`],[37379,`BrightnessValue`],[37380,`ExposureBiasValue`],[37381,`MaxApertureValue`],[37382,`SubjectDistance`],[37383,`MeteringMode`],[37384,`LightSource`],[37385,`Flash`],[37386,`FocalLength`],[37396,`SubjectArea`],[41483,`FlashEnergy`],[41484,`SpatialFrequencyResponse`],[41486,`FocalPlaneXResolution`],[41487,`FocalPlaneYResolution`],[41488,`FocalPlaneResolutionUnit`],[41492,`SubjectLocation`],[41493,`ExposureIndex`],[41495,`SensingMethod`],[41728,`FileSource`],[41729,`SceneType`],[41730,`CFAPattern`],[41985,`CustomRendered`],[41986,`ExposureMode`],[41987,`WhiteBalance`],[41988,`DigitalZoomRatio`],[41989,`FocalLengthIn35mmFilm`],[41990,`SceneCaptureType`],[41991,`GainControl`],[41992,`Contrast`],[41993,`Saturation`],[41994,`Sharpness`],[41995,`DeviceSettingDescription`],[41996,`SubjectDistanceRange`]]),n=new Map([[0,`GPSVersionID`],[1,`GPSLatitudeRef`],[2,`GPSLatitude`],[3,`GPSLongitudeRef`],[4,`GPSLongitude`],[5,`GPSAltitudeRef`],[6,`GPSAltitude`],[7,`GPSTimeStamp`],[8,`GPSSatellites`],[9,`GPSStatus`],[10,`GPSMeasureMode`],[11,`GPSDOP`],[12,`GPSSpeedRef`],[13,`GPSSpeed`],[14,`GPSTrackRef`],[15,`GPSTrack`],[16,`GPSImgDirectionRef`],[17,`GPSImgDirection`],[18,`GPSMapDatum`],[19,`GPSDestLatitudeRef`],[20,`GPSDestLatitude`],[21,`GPSDestLongitudeRef`],[22,`GPSDestLongitude`],[23,`GPSDestBearingRef`],[24,`GPSDestBearing`],[25,`GPSDestDistanceRef`],[26,`GPSDestDistance`],[27,`GPSProcessingMethod`],[28,`GPSAreaInformation`],[29,`GPSDateStamp`],[30,`GPSDifferential`],[31,`GPSHPositioningError`]]),r=new Map([[1024,`GTModelTypeGeoKey`],[1025,`GTRasterTypeGeoKey`],[1026,`GTCitationGeoKey`],[2048,`GeographicTypeGeoKey`],[2049,`GeogCitationGeoKey`],[2050,`GeogGeodeticDatumGeoKey`],[2051,`GeogPrimeMeridianGeoKey`],[2052,`GeogLinearUnitsGeoKey`],[2053,`GeogLinearUnitSizeGeoKey`],[2054,`GeogAngularUnitsGeoKey`],[2055,`GeogAngularUnitSizeGeoKey`],[2056,`GeogEllipsoidGeoKey`],[2057,`GeogSemiMajorAxisGeoKey`],[2058,`GeogSemiMinorAxisGeoKey`],[2059,`GeogInvFlatteningGeoKey`],[2061,`GeogPrimeMeridianLongGeoKey`],[2060,`GeogAzimuthUnitsGeoKey`],[3072,`ProjectedCSTypeGeoKey`],[3073,`PCSCitationGeoKey`],[3074,`ProjectionGeoKey`],[3075,`ProjCoordTransGeoKey`],[3076,`ProjLinearUnitsGeoKey`],[3077,`ProjLinearUnitSizeGeoKey`],[3078,`ProjStdParallel1GeoKey`],[3079,`ProjStdParallel2GeoKey`],[3080,`ProjNatOriginLongGeoKey`],[3081,`ProjNatOriginLatGeoKey`],[3082,`ProjFalseEastingGeoKey`],[3083,`ProjFalseNorthingGeoKey`],[3084,`ProjFalseOriginLongGeoKey`],[3085,`ProjFalseOriginLatGeoKey`],[3086,`ProjFalseOriginEastingGeoKey`],[3087,`ProjFalseOriginNorthingGeoKey`],[3088,`ProjCenterLongGeoKey`],[3090,`ProjCenterEastingGeoKey`],[3091,`ProjCenterNorthingGeoKey`],[3092,`ProjScaleAtNatOriginGeoKey`],[3093,`ProjScaleAtCenterGeoKey`],[3094,`ProjAzimuthAngleGeoKey`],[3095,`ProjStraightVertPoleLongGeoKey`],[4096,`VerticalCSTypeGeoKey`],[4097,`VerticalCitationGeoKey`],[4098,`VerticalDatumGeoKey`],[4099,`VerticalUnitsGeoKey`]]),i=new Map([[`EXIFIFD`,t],[`GPSIFD`,n]]);function a(t,n=e){return n.get(t)??`unknown${t}`}export{r as geoKeys,a as getTagName,i as ifdTags,e as tiffTags};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import has from"../../core/has.js";import{isGround as e}from"../../support/groundInstanceUtils.js";import{isBasemap as t}from"../../support/userTypeGuards/isBasemap.js";class n{static allowIMInGround(){return!!has(`enable-feature:im-as-ground`)}static isUsedAsGroundLayer(r){return n.allowIMInGround()?t(r.parent)||e(r.parent):r.type===`integrated-mesh`||t(r.parent)}static shouldObserveSceneElevationForVolume(){return!!has(`enable-feature:im-as-ground`)}static shouldStencilTerrain(e){return!n.allowIMInGround()||e.isUsedAsGroundLayer}static shouldIntersectAsGround(e){return!n.allowIMInGround()||e.isUsedAsGroundLayer}static shouldDrapeRaster(e,t=!1){return n.allowIMInGround()?e.isUsedAsGroundLayer:t}static shouldUseSceneElevationContext(e){return n.allowIMInGround()&&!e.isUsedAsGroundLayer}static opacitySource(e,t=!1){return n.allowIMInGround()?e.isUsedAsGroundLayer?`ground`:`layer`:t?`ground`:`opaque`}static contributesToGroundElevation(e,t=!1){return n.allowIMInGround()?e.isUsedAsGroundLayer:t}static shouldRegisterGroundElevationProvider(e,t){return n.allowIMInGround()||!e&&t}static hitTestResultMode(e){return n.allowIMInGround()?e.isUsedAsGroundLayer?`ground`:`layer`:`legacy`}static shouldGenerateVertexNormals(e){return!e.isUsedAsGroundLayer}static shouldApplyModification(e,t){return!e.isUsedAsGroundLayer||t===`replace`}constructor(e,t=!1){let r=n.allowIMInGround(),i=e.isUsedAsGroundLayer;this.shouldDrapeRaster=r?i:e.type===`integrated-mesh-3dtiles`&&t,this.shouldIntersectAsGround=(e.type===`integrated-mesh`||e.type===`integrated-mesh-3dtiles`)&&n.shouldIntersectAsGround(e),this.shouldDrapeFeatures=!r||i,this.shouldRenderSliceAsTransparent=!r||i,this.shouldFadeSlicedSurface=this.shouldDrapeRaster}}export{n as IntegratedMeshSemantics};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../request.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{renderingSanitizer as a}from"../../core/sanitizerUtils.js";import{makeAbsolute as o,isAbsolute as s,getProxyRule as c,addProxy as l,isBlobProtocol as u,isDataProtocol as d}from"../../core/urlUtils.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import m from"./MediaElementBase.js";import{mediaElementUrlProperty as h,mediaTypeProperty as g}from"./mediaUtils.js";import{whenVideoPlayable as _}from"./videoUtils.js";import{VideoElementSymbol as v}from"../../support/mediaLayerUtils.js";import{i as y}from"../../chunks/persistableUrlUtils.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";var x;const S=Symbol(`canplay`);let C=class extends m{static{x=v}constructor(e){super(e),this.autoplay=!0,this.content=null,this.type=`video`,this[x]=!0}load(){let e=this.video;return typeof e==`string`?this.addResolvingPromise(this._preProcessVideoUrl(e).then(async e=>{let t=document.createElement(`video`);return t.src=a.sanitizeUrl(o(e)),t.crossOrigin=`anonymous`,t.autoplay=this.autoplay,t.muted=!0,t.loop=!0,t.playsInline=!0,this._loadVideo(t).then(()=>{this._set(`content`,t)})})):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then(()=>{this._set(`content`,e)})):this.addResolvingPromise(Promise.reject(new n(`video-element:invalid-video-type`,`Invalid video type`,{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.content?.currentTime}set currentTime(e){if(!this.content)return;let t=i(e,0,this.content.duration);`fastSeek`in this.content?this.content.fastSeek(t):this.content.currentTime=t,this.content.play().then(()=>{this.content?.pause()}).catch(()=>{})}get duration(){return this.content?.duration}set video(e){this.loadStatus===`not-loaded`?this._set(`video`,e):r.getLogger(this).error(`#video`,`video cannot be changed after the element is loaded.`)}writeVideo(e,t,r,i){if(!e){i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source is missing`));return}let a=T(e)?e:null;if(!a){i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source must be an absolute url`));return}!s(a)&&i?.blockedRelativeUrls&&i.blockedRelativeUrls.push(a);let c=o(a);y(c)?i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source cannot be an item resource`)):t[r]=c}async _preProcessVideoUrl(e){if(c(e))return l(e);try{return await t(e,{method:`head`}),e}catch{try{return l(e,!0)}catch{return e}}}async _loadVideo(e){e.crossOrigin!==`anonymous`&&(e.crossOrigin=`anonymous`,u(e.src)||(e.src=e.src));try{await _(e,e=>this.addHandles(e,S)),this.autoplay&&await e.play().catch(e=>{throw console.error(e),e})}finally{this.removeHandles(S)}}};e([f()],C.prototype,`autoplay`,void 0),e([f({readOnly:!0})],C.prototype,`content`,void 0),e([f({readOnly:!0})],C.prototype,`contentWidth`,null),e([f({readOnly:!0})],C.prototype,`contentHeight`,null),e([f({type:Number})],C.prototype,`currentTime`,null),e([f({type:Number})],C.prototype,`duration`,null),e([f(h)],C.prototype,`video`,null),e([b(`video`)],C.prototype,`writeVideo`,null),e([f(g)],C.prototype,`type`,void 0),C=e([p(`esri.layers.support.VideoElement`)],C);const w=C;function T(e){return typeof e==`string`&&!d(e)&&!u(e)}export{w as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{renderingSanitizer as a}from"../../core/sanitizerUtils.js";import{makeAbsolute as o,isAbsolute as s,getProxyRule as c,addProxy as l,isBlobProtocol as u,isDataProtocol as d}from"../../core/urlUtils.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import m from"./MediaElementBase.js";import{mediaElementUrlProperty as h,mediaTypeProperty as g}from"./mediaUtils.js";import{whenVideoPlayable as _}from"./videoUtils.js";import{VideoElementSymbol as v}from"../../support/mediaLayerUtils.js";import{i as y}from"../../chunks/persistableUrlUtils.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";var x;const S=Symbol(`canplay`);let C=class extends m{static{x=v}constructor(e){super(e),this.autoplay=!0,this.content=null,this.type=`video`,this[x]=!0}load(){let e=this.video;return typeof e==`string`?this.addResolvingPromise(this._preProcessVideoUrl(e).then(async e=>{let t=document.createElement(`video`);return t.src=a.sanitizeUrl(o(e)),t.crossOrigin=`anonymous`,t.autoplay=this.autoplay,t.muted=!0,t.loop=!0,t.playsInline=!0,this._loadVideo(t).then(()=>{this._set(`content`,t)})})):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then(()=>{this._set(`content`,e)})):this.addResolvingPromise(Promise.reject(new n(`video-element:invalid-video-type`,`Invalid video type`,{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.content?.currentTime}set currentTime(e){if(!this.content)return;let t=i(e,0,this.content.duration);`fastSeek`in this.content?this.content.fastSeek(t):this.content.currentTime=t,this.content.play().then(()=>{this.content?.pause()}).catch(()=>{})}get duration(){return this.content?.duration}set video(e){this.loadStatus===`not-loaded`?this._set(`video`,e):r.getLogger(this).error(`#video`,`video cannot be changed after the element is loaded.`)}writeVideo(e,t,r,i){if(!e){i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source is missing`));return}let a=T(e)?e:null;if(!a){i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source must be an absolute url`));return}!s(a)&&i?.blockedRelativeUrls&&i.blockedRelativeUrls.push(a);let c=o(a);y(c)?i?.messages&&i.messages.push(new n(`video-element:unsupported-video`,`video source cannot be an item resource`)):t[r]=c}async _preProcessVideoUrl(e){if(c(e))return l(e);try{return await t(e,{method:`head`}),e}catch{try{return l(e,!0)}catch{return e}}}async _loadVideo(e){e.srcObject==null&&e.crossOrigin!==`anonymous`&&(e.crossOrigin=`anonymous`,u(e.src)||(e.src=e.src));try{await _(e,e=>this.addHandles(e,S)),this.autoplay&&await e.play().catch(e=>{throw console.error(e),e})}finally{this.removeHandles(S)}}};e([f()],C.prototype,`autoplay`,void 0),e([f({readOnly:!0})],C.prototype,`content`,void 0),e([f({readOnly:!0})],C.prototype,`contentWidth`,null),e([f({readOnly:!0})],C.prototype,`contentHeight`,null),e([f({type:Number})],C.prototype,`currentTime`,null),e([f({type:Number})],C.prototype,`duration`,null),e([f(h)],C.prototype,`video`,null),e([b(`video`)],C.prototype,`writeVideo`,null),e([f(g)],C.prototype,`type`,void 0),C=e([p(`esri.layers.support.VideoElement`)],C);const w=C;function T(e){return typeof e==`string`&&!d(e)&&!u(e)}export{w as default};
|