@arcgis/core 4.33.0-next.20250422 → 4.33.0-next.20250424
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/Graphic.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/Analysis.d.ts +4 -0
- package/analysis/Analysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/analysis/SlicePlane.js +1 -1
- package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
- package/analysis/support/AnalysisOriginWebScene.js +5 -0
- package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
- package/arcade/geometry/constructors.js +1 -1
- package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b2f9f0767dadf185120c.js → 00612d6e05b1c8647668.js} +1 -1
- package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
- package/assets/esri/core/workers/chunks/{f54546c155fba2fd3a7e.js → 05d7d8ff3e4cbad32580.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 079434fe765c53d304f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed612e82a279ac8d1e.js → 11b55e7e76e50fe11bbe.js} +1 -1
- package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
- package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
- package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
- package/assets/esri/core/workers/chunks/235efd948ae470a6f238.js +1 -0
- package/assets/esri/core/workers/chunks/{60d3b329e69f3cddb7f4.js → 265f69d153b7b6f07e42.js} +1 -1
- package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
- package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
- package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js → 30551c1d3e4fa7be86c1.js} +2 -2
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js.LICENSE.txt → 30551c1d3e4fa7be86c1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
- package/assets/esri/core/workers/chunks/{78242f2bf742b33d99fa.js → 3795793643f4db64af0e.js} +1 -1
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js → 3cf001abca8ad933bccf.js} +2 -2
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js.LICENSE.txt → 3cf001abca8ad933bccf.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js → 543eb46b55cacd6e1dbc.js} +2 -2
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js.LICENSE.txt → 543eb46b55cacd6e1dbc.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js → 577f24923fa4d08360e4.js} +2 -2
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js.LICENSE.txt → 577f24923fa4d08360e4.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
- package/assets/esri/core/workers/chunks/{f46c4a69ef2f763e905b.js → 5d63dfa5a60c88e03b28.js} +1 -1
- package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
- package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +1 -0
- package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
- package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
- package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +319 -0
- package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
- package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
- package/assets/esri/core/workers/chunks/{c2f38c66fae2cdb57445.js → 96e5d192c8d23c1e324f.js} +1 -1
- package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
- package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
- package/assets/esri/core/workers/chunks/{796cf1c2ca9955595836.js → 9b2ab27159500315fbc1.js} +1 -1
- package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
- package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +1 -0
- package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js → ac9c6779771ec855da79.js} +2 -2
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js.LICENSE.txt → ac9c6779771ec855da79.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{ef6e805c49e1afdf966b.js → c054198c6438cb57f188.js} +1 -1
- package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
- package/assets/esri/core/workers/chunks/{601fc99426f0213b0769.js → cbec01223d51cdb9ee79.js} +1 -1
- package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
- package/assets/esri/core/workers/chunks/{90c893959145827961ac.js → cd9343c78a7c3acdbbcd.js} +1 -1
- package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
- package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js → d8dc922f7466300b668f.js} +2 -2
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js.LICENSE.txt → d8dc922f7466300b668f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{96cddbbeef61a4f33f29.js → db5913824d5e5a2a8365.js} +1 -1
- package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
- package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +2 -0
- package/assets/esri/core/workers/chunks/{02176f84d6d57f1bc1c8.js.LICENSE.txt → e524462c63834fae7e01.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e7e987558cf017c62458.js → ebfa4a0334401f5e004a.js} +1 -1
- package/assets/esri/core/workers/chunks/{736a11e64e5f03e3936b.js → f2cef954b58c6604642c.js} +64 -64
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/BloomBlur.glsl.js +7 -7
- package/chunks/BloomComposition.glsl.js +24 -25
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +5 -0
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/Collection.js +1 -1
- package/core/JSONSupport.js +1 -1
- package/core/SetUtils.js +1 -1
- package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorSimplifyOGC.js +5 -0
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOGCOperator.d.ts +6 -0
- package/geometry/operators/simplifyOGCOperator.js +5 -0
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +442 -113
- package/layers/DimensionLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/videoUtils.js +5 -0
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/colorRampUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/versionManagement/utils.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/atmosphereUtils.js +1 -1
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
- package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +5 -0
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/cameraUtilsSpherical.js +1 -1
- package/views/3d/support/geometryUtils/sphere.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/webgl/ManagedDepthTexture.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.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/tooltip/content/TooltipContent.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +4 -0
- package/views/layers/LineOfSightLayerView.js +5 -0
- package/views/webgl/FBOAttachmentType.js +5 -0
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/RenderbufferDescriptor.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/webscene/InitialViewProperties.js +1 -1
- package/webscene/Presentation.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/SlideLegendInfo.js +1 -1
- package/webscene/background/ColorBackground.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/webscene/spec-certification/compare.js +1 -1
- package/webscene/spec-certification/index.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/webscene/spec-certification/utils.js +1 -1
- package/webscene/support/Description.js +1 -1
- package/webscene/support/SlideElements.js +1 -1
- package/webscene/support/SlideEnvironment.js +1 -1
- package/webscene/support/SlideGround.js +1 -1
- package/webscene/support/SlideVisibleLayer.js +1 -1
- package/webscene/support/Title.js +1 -1
- package/webscene/support/analysisUtils.js +5 -0
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/02176f84d6d57f1bc1c8.js +0 -2
- package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
- package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
- package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
- package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
- package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
- package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +0 -1
- package/assets/esri/core/workers/chunks/873327fc41edd3830afa.js +0 -319
- package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
- package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
- package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
- package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
- package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
- package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +0 -1
- package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
- package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +0 -1
- package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
- package/views/3d/webgl/formats.js +0 -5
package/layers/DimensionLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import s from"../analysis/DimensionAnalysis.js";import t from"../analysis/DimensionSimpleStyle.js";import r from"../analysis/LengthDimension.js";import o from"../core/Collection.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{watch as n,syncAndInitial as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import s from"../analysis/DimensionAnalysis.js";import t from"../analysis/DimensionSimpleStyle.js";import r from"../analysis/LengthDimension.js";import o from"../core/Collection.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{watch as n,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import y from"./Layer.js";import{OperationalLayer as m}from"./mixins/OperationalLayer.js";let u=class extends(m(i(y))){constructor(e){if(super(e),this.type="dimension",this.operationalLayerType="ArcGISDimensionLayer",this.source=new s,this.opacity=1,e){const{source:s,style:t}=e;s&&t&&(s.style=t)}}initialize(){this.addHandles([n((()=>this.source),((e,s)=>{null!=s&&s.parent===this&&(s.parent=null),null!=e&&(e.parent=this)}),l)])}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get style(){return this.source.style}set style(e){this.source.style=e}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new s)}get analysis(){return this.source}set analysis(e){this.source=e}get dimensions(){return this.source.dimensions}set dimensions(e){this.source.dimensions=e}writeDimensions(e,s,t,r){s.dimensions=e.filter((({startPoint:e,endPoint:s})=>null!=e&&null!=s)).toJSON(r)}};e([p({json:{read:!1},readOnly:!0})],u.prototype,"type",void 0),e([p({type:["ArcGISDimensionLayer"]})],u.prototype,"operationalLayerType",void 0),e([p({nonNullable:!0})],u.prototype,"source",void 0),e([p({readOnly:!0})],u.prototype,"spatialReference",null),e([p({types:{key:"type",base:null,typeMap:{simple:t}},json:{write:{ignoreOrigin:!0}}})],u.prototype,"style",null),e([p({readOnly:!0})],u.prototype,"fullExtent",null),e([p({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],u.prototype,"opacity",void 0),e([p({type:["show","hide"]})],u.prototype,"listMode",void 0),e([p({type:o.ofType(r),json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{ignoreOrigin:!0}}}}})],u.prototype,"dimensions",null),e([c("web-scene","dimensions")],u.prototype,"writeDimensions",null),u=e([a("esri.layers.DimensionLayer")],u);const d=u;export{d as default};
|
package/layers/RouteLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import g from"../geometry/Extent.js";import S from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as I}from"../geometry/support/spatialReferenceUtils.js";import P from"./Layer.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{OperationalLayer as N}from"./mixins/OperationalLayer.js";import{PortalLayer as D}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as _}from"./support/arcgisLayerUrl.js";import L from"./support/RouteSymbols.js";import O from"../portal/Portal.js";import R from"../portal/PortalItem.js";import{typeKeyword as T}from"../portal/support/portalItemUtils.js";import{read as F}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as A}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import x from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import E from"../rest/support/PolylineBarrier.js";import U from"../rest/support/RouteInfo.js";import W from"../rest/support/RouteParameters.js";import q from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map((({objectId:e})=>e)).filter((e=>null!=e));let o=Math.max(...r,0);for(const i of t)null==i.objectId&&(i.objectId=++o)}function Z(e,t){return!!e.length&&e.length===t.length&&z(e)&&z(t)}function z(e){return e.every((({objectId:e})=>null!=e))}function K(e){return e.length?e:null}function X(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:X("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:X("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function $(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function ee(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void he().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:a,distanceAttributeName:l}=n,u=i.find((({name:e})=>e===a)),p=i.find((({name:e})=>e===l)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===a||e===l||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:g}=e,{findBestSequence:S,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:I}=r;g.analysisSettings=new q({accumulateAttributes:d,directionsLanguage:f,findBestSequence:S,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:I,travelMode:n}),g.totalDuration=ne(g.totalCosts?.[a]??0,m),g.totalDistance=ae(g.totalCosts?.[l]??0,y),g.totalLateDuration=ne(g.totalViolations?.[a]??0,m),g.totalWaitDuration=ne(g.totalWait?.[a]??0,m),null!=g.totalCosts&&w(g.totalCosts),null!=g.totalViolations&&w(g.totalViolations),null!=g.totalWait&&w(g.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=ne(s.serviceCosts[a]??0,m),s.serviceDistance=ae(s.serviceCosts[l]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=ne(s.cumulativeCosts[a]??0,m),s.cumulativeDistance=ae(s.cumulativeCosts[l]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=ne(s.violations[a]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=ne(s.wait[a]??0,m),w(s.wait))}function te(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function re(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function ie(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.posAlong=r.posAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function se(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function ne(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ae(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function le(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const ue=i.ofType(x),pe=i.ofType(G),ce=i.ofType(J),me=i.ofType(M),ye=i.ofType(E),fe=i.ofType(V),de="esri.layers.RouteLayer",he=()=>n.getLogger(de);let we=class extends(j(C(N(D(a(P)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new L,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ce,this.polygonBarriers=new me,this.polylineBarriers=new ye,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new fe,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";l(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>x.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new g({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new S({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>E.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>U.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??I;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",_(e,he())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},a=this.write(void 0,n);return t.extent=await se(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=R.from(e).clone();r.extent??=await se(this.fullExtent),r.id=null,r.portal??=O.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",T.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:a}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??K(this.pointBarriers),n=e?.polylineBarriers??K(this.polylineBarriers),a=e?.polygonBarriers??K(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||$(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const l=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=W.from(e??{});let w;h.set(d);try{w=await k(c,h,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const g=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=g.routeInfo.name??"Route"),ee(g,m,h),g}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?ie(l,this.stops):this.set({stops:l}),Z(i,this.pointBarriers)?te(i,this.pointBarriers):this.set({pointBarriers:i}),Z(n,this.polylineBarriers)?re(n,this.polylineBarriers):this.set({polylineBarriers:n}),Z(s,this.polygonBarriers)?oe(s,this.polygonBarriers):this.set({polygonBarriers:s}),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),null!=a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const a=H(e)?e.layers:e.featureCollection?.layers,l=a?.find((e=>e.layerDefinition.name===t));if(null==l)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??I,d=m&&F(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await A(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||!e.length||!this.defaultSymbols.stops||e.every((({symbol:e})=>!!e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const a=e.map((({sequence:e})=>e)).filter((e=>null!=e)),l=Math.min(...a),u=Math.max(...a);for(const p of e)p.sequence!==l?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(o);const i=new fe(o),s=new me(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),n=new ye(e.polylineBarriers?.map((e=>{const t=E.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new ce(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),l=r[0].route?.toJSON(),u=U.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new pe(r[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{checksum:t,directionLines:new ue(r[0].directionLines?.features.map((e=>{const t=x.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",x.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>le(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():X(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",E.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",U.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],we.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],we.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],we.prototype,"_type",void 0),e([y({type:String})],we.prototype,"checksum",void 0),e([y({nonNullable:!0,type:L})],we.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],we.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],we.prototype,"readDirectionLines",null),e([y({readOnly:!0})],we.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],we.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],we.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],we.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],we.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],we.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],we.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],we.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],we.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],we.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],we.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],we.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],we.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],we.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],we.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(E)})],we.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],we.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],we.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],we.prototype,"readRouteInfo",null),e([y({type:B})],we.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],we.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],we.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],we.prototype,"readStops",null),e([y()],we.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],we.prototype,"type",void 0),e([y()],we.prototype,"url",null),we=e([d(de)],we);const ge=we;export{ge as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import g from"../geometry/Extent.js";import S from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import I from"./Layer.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{OperationalLayer as N}from"./mixins/OperationalLayer.js";import{PortalLayer as D}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as _}from"./support/arcgisLayerUrl.js";import L from"./support/RouteSymbols.js";import O from"../portal/Portal.js";import R from"../portal/PortalItem.js";import{typeKeyword as T}from"../portal/support/portalItemUtils.js";import{read as F}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as A}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import x from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import E from"../rest/support/PolylineBarrier.js";import U from"../rest/support/RouteInfo.js";import W from"../rest/support/RouteParameters.js";import q from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map((({objectId:e})=>e)).filter((e=>null!=e));let o=Math.max(...r,0);for(const i of t)null==i.objectId&&(i.objectId=++o)}function Z(e,t){return!!e.length&&e.length===t.length&&z(e)&&z(t)}function z(e){return e.every((({objectId:e})=>null!=e))}function K(e){return e.length?e:null}function X(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:X("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:X("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function $(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function ee(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function te(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function re(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.posAlong=r.posAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function ie(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function se(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ne(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function ae(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const le=i.ofType(x),ue=i.ofType(G),pe=i.ofType(J),ce=i.ofType(M),me=i.ofType(E),ye=i.ofType(V);let fe=class extends(j(C(N(D(a(I)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new L,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new pe,this.polygonBarriers=new ce,this.polylineBarriers=new me,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new ye,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";l(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>x.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new g({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new S({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>E.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>U.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",_(e,n.getLogger(this))):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},a=this.write(void 0,n);return t.extent=await ie(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=R.from(e).clone();r.extent??=await ie(this.fullExtent),r.id=null,r.portal??=O.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",T.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:a}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??K(this.pointBarriers),n=e?.polylineBarriers??K(this.polylineBarriers),a=e?.polygonBarriers??K(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||$(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const l=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=W.from(e??{});let w;h.set(d);try{w=await k(c,h,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const g=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=g.routeInfo.name??"Route"),this._populatePortalFields(g,m,h),g}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?oe(l,this.stops):this.set({stops:l}),Z(i,this.pointBarriers)?ee(i,this.pointBarriers):this.set({pointBarriers:i}),Z(n,this.polylineBarriers)?te(n,this.polylineBarriers):this.set({polylineBarriers:n}),Z(s,this.polygonBarriers)?re(s,this.polygonBarriers):this.set({polygonBarriers:s}),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),null!=a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const a=H(e)?e.layers:e.featureCollection?.layers,l=a?.find((e=>e.layerDefinition.name===t));if(null==l)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&F(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await A(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||!e.length||!this.defaultSymbols.stops||e.every((({symbol:e})=>!!e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const a=e.map((({sequence:e})=>e)).filter((e=>null!=e)),l=Math.min(...a),u=Math.max(...a);for(const p of e)p.sequence!==l?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(o);const i=new ye(o),s=new ce(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),n=new me(e.polylineBarriers?.map((e=>{const t=E.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new pe(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),l=r[0].route?.toJSON(),u=U.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new ue(r[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{checksum:t,directionLines:new le(r[0].directionLines?.features.map((e=>{const t=x.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",x.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>ae(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():X(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",E.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",U.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}_populatePortalFields(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],a=r.travelMode??t.defaultTravelMode;if(null==a)return void n.getLogger(this).warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:u}=a,p=i.find((({name:e})=>e===l)),c=i.find((({name:e})=>e===u)),m=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,y=p?.units,f=c?.units;if(!y||!f)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const d=r.directionsLanguage??t.directionsLanguage,h=r.accumulateAttributes??t.accumulateAttributeNames??[],w=new Set(i.filter((({name:e})=>e===l||e===u||e===m||null!=e&&h.includes(e))).map((({name:e})=>e))),g=e=>{for(const t in e)w.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[m]??0,g(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,g(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,g(s.costs));const{routeInfo:S}=e,{findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I}=r;S.analysisSettings=new q({accumulateAttributes:h,directionsLanguage:d,findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I,travelMode:a}),S.totalDuration=se(S.totalCosts?.[l]??0,y),S.totalDistance=ne(S.totalCosts?.[u]??0,f),S.totalLateDuration=se(S.totalViolations?.[l]??0,y),S.totalWaitDuration=se(S.totalWait?.[l]??0,y),null!=S.totalCosts&&g(S.totalCosts),null!=S.totalViolations&&g(S.totalViolations),null!=S.totalWait&&g(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=se(s.serviceCosts[l]??0,y),s.serviceDistance=ne(s.serviceCosts[u]??0,f),g(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=se(s.cumulativeCosts[l]??0,y),s.cumulativeDistance=ne(s.cumulativeCosts[u]??0,f),g(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=se(s.violations[l]??0,y),g(s.violations)),null!=s.wait&&(s.waitDuration=se(s.wait[l]??0,y),g(s.wait))}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],fe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],fe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],fe.prototype,"_type",void 0),e([y({type:String})],fe.prototype,"checksum",void 0),e([y({nonNullable:!0,type:L})],fe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],fe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],fe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],fe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],fe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],fe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],fe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],fe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],fe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],fe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],fe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],fe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],fe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],fe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],fe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],fe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(E)})],fe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],fe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],fe.prototype,"readRouteInfo",null),e([y({type:B})],fe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],fe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],fe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],fe.prototype,"readStops",null),e([y()],fe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],fe.prototype,"type",void 0),e([y()],fe.prototype,"url",null),fe=e([d("esri.layers.RouteLayer")],fe);const de=fe;export{de as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as u,sync as p}from"../core/reactiveUtils.js";import{sqlAnd as y}from"../core/sql.js";import{urlToObject as d,join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import b from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as P,computeEffectiveEditingEnabled as G,addAttachment as A,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as B,hasDataChanged as Z}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as W,createSimpleRenderersWithUniqueColors as X}from"./support/subtypeGroupLayerUtils.js";import Y from"./support/SubtypeSublayer.js";import ee from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as te}from"./support/versionUtils.js";import re from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{SaveOperationType as ie}from"../webdoc/interfaces.js";const oe="SubtypeGroupLayer",ae="esri.layers.SubtypeGroupLayer";function ne(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function le(e,t){const r=[];for(const s of e){const e=new Y;e.read(s,t),r.push(e)}return r}const ue=z();function pe(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let ye=class extends(L(F(v(w(_(E(I(S(x(T(o(j(g(t.ClonableMixin(b))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(Y)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case ie.SAVE:return s(this,t);case ie.SAVE_AS:return i(this,r,t)}})),this.addHandles(u((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),p))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(n).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return G(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=d(this.url);return null!=e&&null!=this.layerId&&(e.path=c(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?C(this.url,t):t}async addAttachment(e,t){const r=await A(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,oe);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return q(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=D(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=y(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,oe)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return k(this,e,t,oe)}async queryFeatures(e,t){const r=await this.load(),s=re.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await N(this,e,t,oe)).filter(se)}async queryFeatureCount(e,t){return Q(this,e,t,oe)}async queryExtent(e,t){return H(this,e,t,oe)}async queryRelatedFeatures(e,t){return J(this,e,t,oe)}async queryRelatedFeaturesCount(e,t){return B(this,e,t,oe)}async save(e){return this._debouncedSaveOperations(ie.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(ie.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ne(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ne(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&te(this,e)}async getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this.displayField&&this.fieldsIndex.has(this.displayField)?e.attributes[this.fieldsIndex.get(this.displayField).name]??"":this.objectIdField&&this.fieldsIndex.has(this.objectIdField)?e.attributes[this.fieldsIndex.get(this.objectIdField).name]??"":""}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return Z(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}};e([h({readOnly:!0})],ye.prototype,"createQueryVersion",null),e([h({readOnly:!0})],ye.prototype,"editingEnabled",null),e([h({readOnly:!0})],ye.prototype,"effectiveEditingEnabled",null),e([h({...ue.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ye.prototype,"fields",void 0),e([h(ue.fieldsIndex)],ye.prototype,"fieldsIndex",void 0),e([h(O)],ye.prototype,"id",void 0),e([h({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],ye.prototype,"listMode",void 0),e([h({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...pe(),origins:{"web-document":pe(),"portal-item":pe()}}})],ye.prototype,"operationalLayerType",null),e([h(ue.outFields)],ye.prototype,"outFields",void 0),e([h({readOnly:!0})],ye.prototype,"parsedUrl",null),e([h({clonable:!1})],ye.prototype,"source",null),e([h({type:r.ofType(Y),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=W(t,s);i=r?X(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new Y({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(Y))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=le(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=le(t.tables,s)),new(r.ofType(Y))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],ye.prototype,"sublayers",void 0),e([h()],ye.prototype,"useUniqueColorsForSublayers",void 0),e([h({type:ee})],ye.prototype,"timeInfo",void 0),e([h({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ye.prototype,"title",void 0),e([m("service","title",["name"])],ye.prototype,"readTitleFromService",null),e([h({json:{read:!1}})],ye.prototype,"type",void 0),e([h({clonable:!1,readOnly:!0})],ye.prototype,"featureTitleFields",null),ye=e([f(ae)],ye);const de=ye;export{de as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Clonable.js";import r from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n,whenOrAbort as l}from"../core/promiseUtils.js";import{watch as u,sync as p}from"../core/reactiveUtils.js";import{sqlAnd as y}from"../core/sql.js";import{urlToObject as d,join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import b from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as P,computeEffectiveEditingEnabled as G,addAttachment as A,updateAttachment as U,applyEdits as q,createQuery as D,deleteAttachments as M,fetchRecomputedExtents as R,computeDomainFromSubtypes as $,getFeatureSubtype as V,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as H,queryRelatedFeatures as J,queryRelatedFeaturesCount as B,hasDataChanged as Z}from"./support/featureLayerUtils.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixTimeInfoFields as K}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as W,createSimpleRenderersWithUniqueColors as X}from"./support/subtypeGroupLayerUtils.js";import Y from"./support/SubtypeSublayer.js";import ee from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as te}from"./support/versionUtils.js";import re from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{SaveOperationType as ie}from"../webdoc/interfaces.js";const oe="SubtypeGroupLayer";function ae(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ne(e,t){const r=[];for(const s of e){const e=new Y;e.read(s,t),r.push(e)}return r}const le=z();function ue(){return{name:"layerType",read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let pe=class extends(L(F(v(w(_(E(I(S(x(T(o(j(g(t.ClonableMixin(b))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(r.ofType(Y)),this.useUniqueColorsForSublayers=!0,this.supportedSourceTypes=new Set(["Feature Layer","Table"]),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/featureLayerUtils.js");switch(e){case ie.SAVE:return s(this,t);case ie.SAVE_AS:return i(this,r,t)}})),this.addHandles(u((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),p))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(n).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return G(this)}get operationalLayerType(){return this.isTable?"SubtypeGroupTable":"SubtypeGroupLayer"}get parsedUrl(){const e=d(this.url);return null!=e&&null!=this.layerId&&(e.path=c(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?C(this.url,t):t}async addAttachment(e,t){const r=await A(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const s=await U(this,e,t,r,oe);return this.lastEditsEventDate=new Date,s}async applyEdits(e,t){return q(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await l(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=D(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=y(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){const r=await M(this,e,t,oe);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return R(this,e,oe)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){const t=$(this,e);if(t)return t}const r=V(this,t?.feature);if(r){const t=r.domains?.[e];return"inherited"===t?.type?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return k(this,e,t,oe)}async queryFeatures(e,t){const r=await this.load(),s=re.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,t){return(await N(this,e,t,oe)).filter(se)}async queryFeatureCount(e,t){return Q(this,e,t,oe)}async queryExtent(e,t){return H(this,e,t,oe)}async queryRelatedFeatures(e,t){return J(this,e,t,oe)}async queryRelatedFeaturesCount(e,t){return B(this,e,t,oe)}async save(e){return this._debouncedSaveOperations(ie.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(ie.SAVE_AS,t,e)}write(e,t){const{origin:r,layerContainerType:i,messages:o}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==i)return o?.push(ae(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===i)return o?.push(ae(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&te(this,e)}async getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){const r=this.findSublayerForFeature(e);return r?await r.getFeatureTitle(e,t):this.displayField&&this.fieldsIndex.has(this.displayField)?e.attributes[this.fieldsIndex.get(this.displayField).name]??"":this.objectIdField&&this.fieldsIndex.has(this.objectIdField)?e.attributes[this.fieldsIndex.get(this.objectIdField).name]??"":""}get featureTitleFields(){const e=new Set;for(const t of this.sublayers){const r=t.featureTitleFields;for(const t of r)e.add(t)}return[...e]}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),K(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return Z(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)}))],"sublayers-owner"))}};e([h({readOnly:!0})],pe.prototype,"createQueryVersion",null),e([h({readOnly:!0})],pe.prototype,"editingEnabled",null),e([h({readOnly:!0})],pe.prototype,"effectiveEditingEnabled",null),e([h({...le.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],pe.prototype,"fields",void 0),e([h(le.fieldsIndex)],pe.prototype,"fieldsIndex",void 0),e([h(O)],pe.prototype,"id",void 0),e([h({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],pe.prototype,"listMode",void 0),e([h({type:["SubtypeGroupLayer","SubtypeGroupTable"],json:{...ue(),origins:{"web-document":ue(),"portal-item":ue()}}})],pe.prototype,"operationalLayerType",null),e([h(le.outFields)],pe.prototype,"outFields",void 0),e([h({readOnly:!0})],pe.prototype,"parsedUrl",null),e([h({clonable:!1})],pe.prototype,"source",null),e([h({type:r.ofType(Y),json:{origins:{service:{read:{source:"subtypes",reader(e,t,s){let i=null;if(this.useUniqueColorsForSublayers){const r=W(t,s);i=r?X(e.length,r):null}const o=e.map((({code:e},r)=>{const o=new Y({subtypeCode:e});o.read(t,s);const a=i?.[r];return a&&o.read({drawingInfo:{renderer:a.toJSON()}},s),o}));return new(r.ofType(Y))(o)}}}},read:{source:["layers","tables"],reader(e,t,s){let i;return"SubtypeGroupLayer"===t.layerType&&t.layers?.length?i=ne(t.layers,s):"SubtypeGroupTable"===t.layerType&&t.tables?.length&&(i=ne(t.tables,s)),new(r.ofType(Y))(i)}},write:{ignoreOrigin:!0,writer(e,t,r,s){const i=[];for(const o of e){const e=o.write({},s);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],pe.prototype,"sublayers",void 0),e([h()],pe.prototype,"useUniqueColorsForSublayers",void 0),e([h({type:ee})],pe.prototype,"timeInfo",void 0),e([h({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],pe.prototype,"title",void 0),e([m("service","title",["name"])],pe.prototype,"readTitleFromService",null),e([h({json:{read:!1}})],pe.prototype,"type",void 0),e([h({clonable:!1,readOnly:!0})],pe.prototype,"featureTitleFields",null),pe=e([f("esri.layers.SubtypeGroupLayer")],pe);const ye=pe;export{ye as default};
|
package/layers/ViewshedLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../analysis/Viewshed.js";import s from"../analysis/ViewshedAnalysis.js";import t from"../core/Collection.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{watch as i,syncAndInitial as a}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import c from"./Layer.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";let y=class extends(d(o(c))){constructor(e){super(e),this.type="viewshed",this.operationalLayerType="ViewshedLayer",this.source=new s,this.opacity=1}initialize(){this.addHandles(i((()=>this.source),((e,r)=>{null!=r&&r.parent===this&&(r.parent=null),null!=e&&(e.parent=this)}),a))}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new s)}get analysis(){return this.source}set analysis(e){this.source=e}get viewsheds(){return this.source.viewsheds}set viewsheds(e){this.source.viewsheds=e}writeViewsheds(e,r,s,t){r.viewsheds=e.filter((e=>e.valid)).
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../analysis/Viewshed.js";import s from"../analysis/ViewshedAnalysis.js";import t from"../core/Collection.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{watch as i,syncAndInitial as a}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import c from"./Layer.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";let y=class extends(d(o(c))){constructor(e){super(e),this.type="viewshed",this.operationalLayerType="ViewshedLayer",this.source=new s,this.opacity=1}initialize(){this.addHandles(i((()=>this.source),((e,r)=>{null!=r&&r.parent===this&&(r.parent=null),null!=e&&(e.parent=this)}),a))}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new s)}get analysis(){return this.source}set analysis(e){this.source=e}get viewsheds(){return this.source.viewsheds}set viewsheds(e){this.source.viewsheds=e}writeViewsheds(e,r,s,t){r.viewsheds=e.filter((e=>e.valid)).toJSON(t)}};e([p({json:{read:!1},readOnly:!0})],y.prototype,"type",void 0),e([p({type:["ViewshedLayer"]})],y.prototype,"operationalLayerType",void 0),e([p({type:s,nonNullable:!0})],y.prototype,"source",void 0),e([p({readOnly:!0})],y.prototype,"spatialReference",null),e([p({readOnly:!0})],y.prototype,"fullExtent",null),e([p({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],y.prototype,"opacity",void 0),e([p({type:["show","hide"]})],y.prototype,"listMode",void 0),e([p({type:t.ofType(r),json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{ignoreOrigin:!0}}}}})],y.prototype,"viewsheds",null),e([l("web-scene","viewsheds")],y.prototype,"writeViewsheds",null),y=e([n("esri.layers.ViewshedLayer")],y);const u=y;export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import r from"../../../core/JSONSupport.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,destroyMaybe as u}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as h}from"../../../core/unitUtils.js";import{getTransformation as c}from"../../../geometry/projection.js";import{set as m,negativeInfinity as f,create as d,expandWithAABB as y}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as g}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as x}from"../../../geometry/support/boundsUtils.js";import{isExtent as w,isPolygon as F}from"../../../geometry/support/jsonUtils.js";import{equals as _,isValid as S}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as R}from"../featureConversionUtils.js";import{getWhereClause as Q}from"./attributeSupport.js";import{cleanFromGeometryEngine as I,getGeometry as j}from"./geometryUtils.js";import{project as E,projectMany as b}from"./projectionSupport.js";import{QueryEngineCache as A}from"./QueryEngineCache.js";import{queryCapabilities as T}from"./QueryEngineCapabilities.js";import{QueryEngineResult as v}from"./QueryEngineResult.js";import{queryEngineEmptyResult as C,normalizeAttributeBinsQuery as P,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as M,validateQuery as G,validateStatisticsQuery as O}from"./queryValidationUtils.js";import{getSpatialQueryOperator as q,canQueryWithRBush as U}from"./spatialQuerySupport.js";import{getTimeExtent as k,getTimeOperator as B}from"./timeSupport.js";import Z from"../../support/FieldsIndex.js";import{noBudget as H}from"../../../views/support/Scheduler.js";const J="unsupported-query";class N{constructor(e,t=null,s,i,r){this.attributes=e,this.geometry=s,this.centroid=i,this.filterFlags=r,this.groupId=-1,this.displayId=t}}class L{constructor(e){this._changeHandle=null,this.capabilities={query:T},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new A,this.timeInfo=e.timeInfo,this._changeHandle=this.featureStore.events.on("changed",(()=>this._clearCache())),this.fieldsIndex=r.isSerializable(e.fieldsIndex)?e.fieldsIndex:Z.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map((e=>e.name))):this.availableFields=new Set(e.availableFields.map((e=>this.fieldsIndex.get(e)?.name)).filter((e=>null!=e))),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._changeHandle=n(this._changeHandle),this._frameTask=n(this._frameTask),this._clearCache(),u(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){const s=l(t);try{const t=await this._executeQuery(e,{},s);return await t.createQueryResponse()}catch(i){if(i!==C)throw i;return new v([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){const s=l(t);try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},s)).createQueryResponseForCount()}catch(i){if(i!==C)throw i;return 0}}async executeQueryForExtent(e,t){const s=l(t),i=e.outSR;try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},s),r=t.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(t.items,t.spatialReference,i||this.spatialReference)}}catch(r){if(r===C)return{count:0,extent:null};throw r}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){const s=l(t);try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},s),i=t.items,r=new Set;return await this.reschedule((()=>{for(const e of i)r.add(t.featureAdapter.getObjectId(e))}),s),r}catch(i){if(i===C)return new Set;throw i}}async executeQueryForLatestObservations(e,t){const s=l(t);if(!this.timeInfo?.trackIdField)throw new i(J,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const t=await this._executeQuery(e,{},s);return await this.reschedule((()=>this._filterLatest(t)),s),await t.createQueryResponse()}catch(r){if(r!==C)throw r;return new v([],e,this).createQueryResponse()}}async executeAttributeBinsQuery(e,t){const s=l(t);let i;e=a(e);try{e=await this.schedule((()=>P(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>M(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s);const t=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s);i=await this.reschedule((()=>this._executeGeometryQuery(e,t,s)),s),await this.reschedule((()=>this._executeAggregateIdsQuery(i)),s),await this.reschedule((()=>this.executeObjectIdsQuery(i)),s),await this.reschedule((()=>this.executeTimeQuery(i)),s),await this.reschedule((()=>this.executeAttributesQuery(i)),s)}catch(r){if(r!==C)throw r;i=new v([],e,this)}return i.createQueryBinsResponse(e)}async executeQueryForSummaryStatistics(e={},t,s){const i=l(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,s){const i=l(s),{field:r,field2:a,field3:n,valueExpression:u}=t;return(await this._executeQueryForStatistics(e,{field:r,field2:a,field3:n,valueExpression:u},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,s){const i=l(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,s){const i=l(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=k(this.timeInfo,this.featureStore);const[s,i]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:s,timeExtent:i}}async _getBounds(e,t,s){const i=m(d(),f);await this.featureStore.forEachBounds(e,(e=>y(i,e)));const r={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:I(this.spatialReference)};this.hasZ&&isFinite(i[2])&&isFinite(i[5])&&(r.zmin=i[2],r.zmax=i[5],r.hasZ=!0);const a=E(r,t,s);if(a.spatialReference=I(s),a.xmax-a.xmin==0){const e=h(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=h(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=h(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then((e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async schedule(e,t){return this._frameTask?.schedule(e,t)??e(H)}async reschedule(e,t){return this._frameTask?.reschedule(e,t)??e(H)}async _getAllFeaturesQueryEngineResult(e){return new v(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach((t=>e.push(t))))().then((()=>s(e)))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,s){e=a(e),e=await this.schedule((()=>z(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>G(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s),e={...e,...t};const i=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s),r=await this.reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this.reschedule((()=>this._executeAggregateIdsQuery(r)),s),await this.reschedule((()=>this.executeObjectIdsQuery(r)),s),await this.reschedule((()=>this.executeTimeQuery(r)),s),await this.reschedule((()=>this.executeAttributesQuery(r)),s),r}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:s,returnGeometry:i,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,u=null==a||_(a,n.spatialReference)?n:E(n,a);if(!u)return null;const l=i||r,o=S(s)&&!_(this.spatialReference,s)&&l?async e=>this._project(e,s):e=>e,h=this.featureAdapter,c=await this.reschedule((()=>this.searchFeatures(V(u))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const s=new Set;for(const e of c)s.add(h.getObjectId(e));const i=await this.reschedule((()=>this._getAllFeatures()),t),r=await this.reschedule((async()=>{const r=await q("esriSpatialRelDisjoint",u,this.geometryType,this.hasZ,this.hasM),a=e=>!s.has(h.getObjectId(e))||r(h.getGeometry(e)),n=await this.runSpatialFilter(i,a,t);return new v(n,e,this)}),t);return o(r)}if(!c.length)return new v([],e,this);if(this._canExecuteSinglePass(u,e))return o(new v(c,e,this));const m=await q("esriSpatialRelContains",u,this.geometryType,this.hasZ,this.hasM),f=await this.runSpatialFilter(c,(e=>m(h.getGeometry(e))),t);return o(new v(f,e,this))}async _executeGeometryQuery(s,i,r){if(null!=i&&0===i.items.length)return i;const{geometry:a,outSR:n,returnGeometry:u,returnCentroid:l}=s,o=i?null:this._getCacheKey(s),h=o?this._cache.get(o):null;if(h)return new v(h,s,this);const c=S(n)&&!_(this.spatialReference,n),m=u||l,f=async e=>(c&&m&&await this._project(e,n),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,y=!a||null==d||_(d,a.spatialReference)?a:E(a,d);if(!y)return f(null!=i?i:await this._getAllFeaturesQueryEngineResult(s));const p=this.featureAdapter;let g=await this.reschedule((()=>this.searchFeatures(V(a))),r);const x=s.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!g.length)return f(null!=i?i:await this._getAllFeaturesQueryEngineResult(s));const e=new Set;for(const s of g)e.add(p.getObjectId(s));const t=null!=i?i.items:await this.reschedule((()=>this._getAllFeatures()),r),a=await this.reschedule((async()=>{const i=await q(x,y,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(p.getObjectId(t))||i(p.getGeometry(t)),n=await this.runSpatialFilter(t,a,r);return new v(n,s,this)}),r);return f(a)}if(null!=i){const s=new t;g=g.filter((t=>e(i.items,t,i.items.length,s)>=0))}if(!g.length){const e=new v([],s,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(y,s))return f(new v(g,s,this));const w=await q(x,y,this.geometryType,this.hasZ,this.hasM),F=await this.runSpatialFilter(g,(e=>w(p.getGeometry(e))),r);return f(new v(F,s,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const i of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(i).forEach((e=>t.add(e)))}const s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}executeTimeQuery(e){if(0===e.items.length)return;const t=B(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}executeAttributesQuery(e){if(0===e.items.length)return;const t=Q(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async runSpatialFilter(e,t,s){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let i=0;const r=new Array,a=async n=>{for(;i<e.length;){const u=e[i++];t(u)&&(r.push(u),n.madeProgress()),n.done&&await this.reschedule((e=>a(e)),s)}};return this.reschedule((e=>a(e)),s).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:s,endTimeField:i}=this.timeInfo,r=i||s,a=new Map,n=this.featureAdapter.getAttribute;for(const u of e.items){const e=n(u,t),s=n(u,r),i=a.get(e);(!i||s>n(i,r))&&a.set(e,u)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:s,returnGeometry:i,returnCentroid:r,outSR:a,resultType:n,cacheHint:u}=e;if("tile"!==n&&!u)return null;const l=i||r;return S(a)&&!_(this.spatialReference,a)&&l?JSON.stringify([t,s,a]):JSON.stringify([t,s])}_canExecuteSinglePass(e,t){const{spatialRel:s}=t;return U(e)&&("esriSpatialRelEnvelopeIntersects"===s||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===s||"esriSpatialRelContains"===s))}async _project(e,t){if(!t||_(this.spatialReference,t))return e;const i=this.featureAdapter;let r;try{const e=await this._getFullExtent();r=c(this.spatialReference,t,e)}catch{}const a=await b(e.items.map((e=>j(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t,r);return e.items=s(a.map(((t,s)=>i.cloneWithGeometry(e.items[s],R(t,this.hasZ,this.hasM))))),e}async searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const s=Array.from(t.values());return t.clear(),s}async _executeQueryForStatistics(e,t,s){e=a(e);try{e=await this.schedule((()=>z(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>O(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s);const i=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s),r=await this.reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this.reschedule((()=>this._executeAggregateIdsQuery(r)),s),await this.reschedule((()=>this.executeObjectIdsQuery(r)),s),await this.reschedule((()=>this.executeTimeQuery(r)),s),await this.reschedule((()=>this.executeAttributesQuery(r)),s),r}catch(i){if(i!==C)throw i;return new v([],e,this)}}get test(){}}function V(e){if(U(e)){if(w(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map((e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[x(g(),e)]}export{N as Feature,L as QueryEngine,V as getQueryBBoxes};
|
|
5
|
+
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import{clone as r}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as u,throwIfAborted as l}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{isSerializable as h}from"../../../core/support/jsonUtils.js";import{getTransformation as c}from"../../../geometry/projection.js";import{set as m,negativeInfinity as f,create as d,expandWithAABB as y}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as g}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as x}from"../../../geometry/support/boundsUtils.js";import{isExtent as w,isPolygon as F}from"../../../geometry/support/jsonUtils.js";import{equals as _,isValid as S}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as R}from"../featureConversionUtils.js";import{getWhereClause as Q}from"./attributeSupport.js";import{cleanFromGeometryEngine as I,getGeometry as j}from"./geometryUtils.js";import{project as E,projectMany as b}from"./projectionSupport.js";import{QueryEngineCache as A}from"./QueryEngineCache.js";import{queryCapabilities as T}from"./QueryEngineCapabilities.js";import{QueryEngineResult as v}from"./QueryEngineResult.js";import{queryEngineEmptyResult as C,normalizeAttributeBinsQuery as P,normalizeQuery as M}from"./queryUtils.js";import{validateAttributeBinsQuery as z,validateQuery as G,validateStatisticsQuery as O}from"./queryValidationUtils.js";import{getSpatialQueryOperator as U,canQueryWithRBush as q}from"./spatialQuerySupport.js";import{getTimeExtent as k,getTimeOperator as B}from"./timeSupport.js";import Z from"../../support/FieldsIndex.js";import{noBudget as H}from"../../../views/support/Scheduler.js";const J="unsupported-query";class L{constructor(e,t=null,s,i,r){this.attributes=e,this.geometry=s,this.centroid=i,this.filterFlags=r,this.groupId=-1,this.displayId=t}}class N{constructor(e){this._changeHandle=null,this.capabilities={query:T},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new A,this.timeInfo=e.timeInfo,this._changeHandle=this.featureStore.events.on("changed",(()=>this._clearCache())),this.fieldsIndex=h(e.fieldsIndex)?e.fieldsIndex:Z.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map((e=>e.name))):this.availableFields=new Set(e.availableFields.map((e=>this.fieldsIndex.get(e)?.name)).filter((e=>null!=e))),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){const s=u(t);try{const t=await this._executeQuery(e,{},s);return await t.createQueryResponse()}catch(i){if(i!==C)throw i;return new v([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){const s=u(t);try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},s)).createQueryResponseForCount()}catch(i){if(i!==C)throw i;return 0}}async executeQueryForExtent(e,t){const s=u(t),i=e.outSR;try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},s),r=t.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(t.items,t.spatialReference,i||this.spatialReference)}}catch(r){if(r===C)return{count:0,extent:null};throw r}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){const s=u(t);try{const t=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},s),i=t.items,r=new Set;return await this.reschedule((()=>{for(const e of i)r.add(t.featureAdapter.getObjectId(e))}),s),r}catch(i){if(i===C)return new Set;throw i}}async executeQueryForLatestObservations(e,t){const s=u(t);if(!this.timeInfo?.trackIdField)throw new i(J,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const t=await this._executeQuery(e,{},s);return await this.reschedule((()=>this._filterLatest(t)),s),await t.createQueryResponse()}catch(r){if(r!==C)throw r;return new v([],e,this).createQueryResponse()}}async executeAttributeBinsQuery(e,t){const s=u(t);let i;e=r(e);try{e=await this.schedule((()=>P(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>z(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s);const t=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s);i=await this.reschedule((()=>this._executeGeometryQuery(e,t,s)),s),await this.reschedule((()=>this._executeAggregateIdsQuery(i)),s),await this.reschedule((()=>this.executeObjectIdsQuery(i)),s),await this.reschedule((()=>this.executeTimeQuery(i)),s),await this.reschedule((()=>this.executeAttributesQuery(i)),s)}catch(a){if(a!==C)throw a;i=new v([],e,this)}return i.createQueryBinsResponse(e)}async executeQueryForSummaryStatistics(e={},t,s){const i=u(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,s){const i=u(s),{field:r,field2:a,field3:n,valueExpression:l}=t;return(await this._executeQueryForStatistics(e,{field:r,field2:a,field3:n,valueExpression:l},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,s){const i=u(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,s){const i=u(s),{field:r,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:r,normalizationField:a,valueExpression:n},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const t=u(e);this._timeExtentPromise||=k(this.timeInfo,this.featureStore);const[s,i]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return l(t),{fullExtent:s,timeExtent:i}}async _getBounds(e,t,s){const i=m(d(),f);await this.featureStore.forEachBounds(e,(e=>y(i,e)));const r={xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:I(this.spatialReference)};this.hasZ&&isFinite(i[2])&&isFinite(i[5])&&(r.zmin=i[2],r.zmax=i[5],r.hasZ=!0);const a=E(r,t,s);if(a.spatialReference=I(s),a.xmax-a.xmin==0){const e=o(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=o(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=o(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then((e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async schedule(e,t){return this._frameTask?.schedule(e,t)??e(H)}async reschedule(e,t){return this._frameTask?.reschedule(e,t)??e(H)}async _getAllFeaturesQueryEngineResult(e){return new v(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach((t=>e.push(t))))().then((()=>s(e)))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,s){e=r(e),e=await this.schedule((()=>M(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>G(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s),e={...e,...t};const i=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s),a=await this.reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this.reschedule((()=>this._executeAggregateIdsQuery(a)),s),await this.reschedule((()=>this.executeObjectIdsQuery(a)),s),await this.reschedule((()=>this.executeTimeQuery(a)),s),await this.reschedule((()=>this.executeAttributesQuery(a)),s),a}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:s,returnGeometry:i,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,u=null==a||_(a,n.spatialReference)?n:E(n,a);if(!u)return null;const l=i||r,o=S(s)&&!_(this.spatialReference,s)&&l?async e=>this._project(e,s):e=>e,h=this.featureAdapter,c=await this.reschedule((()=>this.searchFeatures(V(u))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const s=new Set;for(const e of c)s.add(h.getObjectId(e));const i=await this.reschedule((()=>this._getAllFeatures()),t),r=await this.reschedule((async()=>{const r=await U("esriSpatialRelDisjoint",u,this.geometryType,this.hasZ,this.hasM),a=e=>!s.has(h.getObjectId(e))||r(h.getGeometry(e)),n=await this.runSpatialFilter(i,a,t);return new v(n,e,this)}),t);return o(r)}if(!c.length)return new v([],e,this);if(this._canExecuteSinglePass(u,e))return o(new v(c,e,this));const m=await U("esriSpatialRelContains",u,this.geometryType,this.hasZ,this.hasM),f=await this.runSpatialFilter(c,(e=>m(h.getGeometry(e))),t);return o(new v(f,e,this))}async _executeGeometryQuery(s,i,r){if(null!=i&&0===i.items.length)return i;const{geometry:a,outSR:n,returnGeometry:u,returnCentroid:l}=s,o=i?null:this._getCacheKey(s),h=o?this._cache.get(o):null;if(h)return new v(h,s,this);const c=S(n)&&!_(this.spatialReference,n),m=u||l,f=async e=>(c&&m&&await this._project(e,n),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,y=!a||null==d||_(d,a.spatialReference)?a:E(a,d);if(!y)return f(null!=i?i:await this._getAllFeaturesQueryEngineResult(s));const p=this.featureAdapter;let g=await this.reschedule((()=>this.searchFeatures(V(a))),r);const x=s.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!g.length)return f(null!=i?i:await this._getAllFeaturesQueryEngineResult(s));const e=new Set;for(const s of g)e.add(p.getObjectId(s));const t=null!=i?i.items:await this.reschedule((()=>this._getAllFeatures()),r),a=await this.reschedule((async()=>{const i=await U(x,y,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(p.getObjectId(t))||i(p.getGeometry(t)),n=await this.runSpatialFilter(t,a,r);return new v(n,s,this)}),r);return f(a)}if(null!=i){const s=new t;g=g.filter((t=>e(i.items,t,i.items.length,s)>=0))}if(!g.length){const e=new v([],s,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(y,s))return f(new v(g,s,this));const w=await U(x,y,this.geometryType,this.hasZ,this.hasM),F=await this.runSpatialFilter(g,(e=>w(p.getGeometry(e))),r);return f(new v(F,s,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const i of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(i).forEach((e=>t.add(e)))}const s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),s=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(s(e))))}executeTimeQuery(e){if(0===e.items.length)return;const t=B(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}executeAttributesQuery(e){if(0===e.items.length)return;const t=Q(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async runSpatialFilter(e,t,s){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let i=0;const r=new Array,a=async n=>{for(;i<e.length;){const u=e[i++];t(u)&&(r.push(u),n.madeProgress()),n.done&&await this.reschedule((e=>a(e)),s)}};return this.reschedule((e=>a(e)),s).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:s,endTimeField:i}=this.timeInfo,r=i||s,a=new Map,n=this.featureAdapter.getAttribute;for(const u of e.items){const e=n(u,t),s=n(u,r),i=a.get(e);(!i||s>n(i,r))&&a.set(e,u)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:s,returnGeometry:i,returnCentroid:r,outSR:a,resultType:n,cacheHint:u}=e;if("tile"!==n&&!u)return null;const l=i||r;return S(a)&&!_(this.spatialReference,a)&&l?JSON.stringify([t,s,a]):JSON.stringify([t,s])}_canExecuteSinglePass(e,t){const{spatialRel:s}=t;return q(e)&&("esriSpatialRelEnvelopeIntersects"===s||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===s||"esriSpatialRelContains"===s))}async _project(e,t){if(!t||_(this.spatialReference,t))return e;const i=this.featureAdapter;let r;try{const e=await this._getFullExtent();r=c(this.spatialReference,t,e)}catch{}const a=await b(e.items.map((e=>j(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t,r);return e.items=s(a.map(((t,s)=>i.cloneWithGeometry(e.items[s],R(t,this.hasZ,this.hasM))))),e}async searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const s=Array.from(t.values());return t.clear(),s}async _executeQueryForStatistics(e,t,s){e=r(e);try{e=await this.schedule((()=>M(e,this.definitionExpression,this.spatialReference)),s),e=await this.reschedule((()=>O(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference})),s);const i=await this.reschedule((()=>this._executeSceneFilterQuery(e,s)),s),r=await this.reschedule((()=>this._executeGeometryQuery(e,i,s)),s);return await this.reschedule((()=>this._executeAggregateIdsQuery(r)),s),await this.reschedule((()=>this.executeObjectIdsQuery(r)),s),await this.reschedule((()=>this.executeTimeQuery(r)),s),await this.reschedule((()=>this.executeAttributesQuery(r)),s),r}catch(i){if(i!==C)throw i;return new v([],e,this)}}get test(){}}function V(e){if(q(e)){if(w(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map((e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[x(g(),e)]}export{L as Feature,N as QueryEngine,V as getQueryBBoxes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,
|
|
5
|
+
import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,h as s}from"../../../chunks/sphere.js";import{isElevationSource as f}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as m,rectifyMapPointPanoramic as l}from"./rectifyMapPoint.js";import{or as p,isUpdateElevationWithElevationSource as y,isElevationSampler as u,scaleWithFactor as h,scaleAndAddWithFactor as d,computeNewReferenceCoordinates as g,projectiveTransform as w,validatePixelsToTransform as v,validateRotationMatrix as x,getWebMercatorScalingFactor as A,computeFarplaneVertices as P,computeHFOVAndVFOV as j,vecToPoint as R,hasAngles as V,convertPixelToHeadingPitch as F,convertHeadingPitchToSphereVertex as M,reducerFn as T}from"./utils.js";import{worldToImage as b}from"./worldToImage.js";import{defaultImageSphereCenter as L}from"../../../widgets/PanoramicViewer/constants.js";async function O(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=z(e,r),m=new Array;return await E(s,n,i,f,r,m,c,o,t,a),Array.isArray(e)?m:m[0]}async function E(e,r,a,t,i,o,n,c,s,f){let l=i.averageElevation;for(const h of e){const e=q(r,a,h,t,i);if(f&&p(u(f.elevationSample),y(f))){l=(await m(t(e),{x:h[0],y:h[1]},{...i,...f,farPlaneVertices:r.map(t)}))[2]}o.push(t(k(e,n,c,l,i.cameraPitch,s)))}}function k(e,i,o,n,c,s){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=h(t(a(),e,i),1/m,1/o);if(S(e[2],n,c,s)){const e=Math.abs((i[2]-n)/-l[2])*o;f=d(i,l,e,o)}else f[2]=n;return f}function S(e,r,a,t){return e<r||a+t/2<90}function q(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,m=r;for(;s<=n;){const e=D(a,m,f,i);if(c=e.error,o=e.transformedPoint,p(c<=1,s===n))break;f=g(f,c,a,r),m=B(f,t,i),s++}return o}function B(e,r,a){return b(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function D(e,r,a,t){const{cameraLocation:o}=t,n=w(e,r,a),{x:c,y:s}=b(new i(n,o.spatialReference),t);return{transformedPoint:n,error:H(e,[c,s,1])}}function H(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function z(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:o,rotationMatrix:n}=a;if(v(t,o),x(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=A(o.y,o.spatialReference),s=P({...a,scalingFactor:c}),f=b(s.map((e=>new i(e,o.spatialReference))),a),{vfov:m}=j(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:o.toArray(),imageBoundaries:f.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:R(o.spatialReference)}}async function I(e,r,t){const{cameraHeading:m,cameraLocation:p,farDistance:y,imageHeight:h,imageWidth:d,verticalFieldOfView:g}=r,w=A(p.y,p.spatialReference),v=new Array,[x,P,j]=p.toArray(),R=c([x,P,j??0],y*w),b=L.toArray(),O=Array.isArray(e)?e:[e];for(const c of O){let e,A;if(V(c))e=c.heading,A=c.pitch;else{const r=F({x:c.x,y:c.y},d,h);e=r.heading,A=r.pitch}e=(e+m)%360;const L=o([b[0],b[1],b[2]],M(e,A)),O=n([x,P,j??0],L.direction),E=a();s(R,O,E);let S=r.averageElevation;if(t&&(f(t)||u(t.elevationSample))&&A+g/2<90){S=(await l(new i(E,p.spatialReference),{heading:e,pitch:A},{...r,...t,farPlaneVertices:T(y,y).map((([e,r])=>new i([p.x+e,p.y+r],p.spatialReference)))}))[2]}v.push(new i(k(E,p.toArray(),w,S,A,g),p.spatialReference))}return Array.isArray(e)?v:v[0]}export{O as imageToWorld,I as imageToWorldPanoramic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function F(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=s();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=s();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,i,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=e();switch(i){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function Z(t,n,a,i=E/2){const{heading:e,pitch:o}=U(t,n,a);return Y(e,o,i)}async function $(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>w(t?.elevationSource)&&null!=t?.extent,Mt=t=>y(t?.elevationSource),gt=async(t,a)=>null!=a&&(mt(a)||Mt(a))?a:pt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,Z as convertPixelLocationToSphereVertex,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,S as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
|
|
5
|
+
import t from"../../../core/Error.js";import{deg2rad as n,rad2deg as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,g as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(a,e,o,r=!0){if(!Number.isFinite(a))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?n(a):a),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function k(t,n=!0){return N(t,H.HPR,n)}function A(t,a,i){const e=Math.sin(n(i)),o=Math.cos(n(i)),r=[[t,0],[t,a],[0,a]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,a){const i=n(t[1]),e=n(t[0]),o=t[2],[r,c,s,l]=a,f=n(r),h=n(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function U(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=n(c),u=n(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=a(O);return[a(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,n){const i=a(Math.acos(-t.z/n));return{heading:a(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,a,i=E/2){return[i*(Math.sin(n(t))*Math.sin(n(a))),i*(Math.cos(n(t))*Math.sin(n(a))),i*Math.cos(n(180-a))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,n,i){const e=await g(n,t.spatialReference,i);let o=a(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>w(t?.elevationSource)&&null!=t?.extent,Mt=t=>y(t?.elevationSource),gt=async(t,n)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:a,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,h=i();l(h,r);const p=2*Math.tan(n(f)/2)*e*s,M=2*Math.tan(n(o)/2)*e*s,g=L([0,0,-1],h),v=C([a.x,a.y,a.z],g,t.farDistance*s,s),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,s),y=R(x,M/2,s),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,U as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import i from"../../core/
|
|
5
|
+
import e from"../../core/Error.js";import i from"../../core/Logger.js";import{getOrCreateMapValue as t}from"../../core/MapUtils.js";import{UnknownTimeZone as s}from"../../core/sql/UnknownTimeZone.js";import{isSerializable as n}from"../../core/support/jsonUtils.js";import{isDateField as r,isNumericField as l,isObjectIDField as o,isGlobalIDField as d,getFieldDefaultValue as a,isTimeOnlyField as m,normalizeFieldName as u}from"./fieldUtils.js";import{utc as f,unknown as F}from"../../time/constants.js";import{fromTimeReference as h}from"../../time/timeZoneUtils.js";import{FixedOffsetZone as c,IANAZone as p}from"luxon";function y(e){return"timeZone"in e}function _(e){return"timeZone"in e}function g(e){return"dateFieldsTimeZone"in e}const T=new Map;class Z{static fromJSON(e){return new Z(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new Z(e.fields??[],S(e))}static fromLayerJSON(e){return new Z(e.fields??[],S(e))}constructor(e=[],i){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=i?new Map(i):null;const t=[];for(const s of this.fields){const e=s?.name,i=M(e);if(e&&i){const n=w(e);this._fieldsMap.set(e,s),this._fieldsMap.set(n,s),this._normalizedFieldsMap.set(i,s),t.push(`${n}:${s.type}:${this._timeZoneByFieldName?.get(e)}`),r(s)?(this.dateFields.push(s),this._dateFieldsSet.add(s)):l(s)&&(this._numericFieldsSet.add(s),this.numericFields.push(s)),o(s)||d(s)||(s.editable=null==s.editable||!!s.editable,s.nullable=null==s.nullable||!!s.nullable)}}t.sort(),this.uid=t.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)o(e)||d(e)||e.nullable||void 0!==a(e)||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return null!=this.get(e)}get(e){if(!e)return;let i=this._fieldsMap.get(e);return i||(i=this._fieldsMap.get(w(e))??this._normalizedFieldsMap.get(M(e)),i&&this._fieldsMap.set(e,i),i)}getTimeZone(t){const s=this.get(t&&"string"!=typeof t?t.name:t);return s?this._timeZoneByFieldName?this._timeZoneByFieldName.get(s.name):"date"===s.type||"esriFieldTypeDate"===s.type?(i.getLogger("esri.layers.support.FieldsIndex").errorOnce(new e("getTimeZone:no-timezone-information",`no time zone information for field '${s.name}'`)),f):N.has(s.type)?F:null:null}getLuxonTimeZone(e){const i=this.getTimeZone(e);return i?i===F?s.instance:i===f?c.utcInstance:t(T,i,(()=>p.create(i))):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return m(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map((e=>n(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function w(e){return e.trim().toLowerCase()}function M(e){return u(e)?.toLowerCase()??""}const N=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function S(e){const i=new Map;if(!e.fields)return i;const t=!0===e.datesInUnknownTimezone,{timeInfo:s,editFieldsInfo:n}=e,r=(s?"startField"in s?s.startField:s.startTimeField:"")??"",l=(s?"endField"in s?s.endField:s.endTimeField:"")??"",o=g(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?h(e.dateFieldsTimeReference):null,d=n?y(n)?n.timeZone??o:n.dateFieldsTimeReference?h(n.dateFieldsTimeReference):o??f:null,a=s?_(s)?s.timeZone??o:s.timeReference?h(s.timeReference):o:null,m=new Map([[w(n?.creationDateField??""),d],[w(n?.editDateField??""),d],[w(r),a],[w(l),a]]);for(const{name:u,type:f}of e.fields)if(N.has(f))i.set(u,F);else if("date"!==f&&"esriFieldTypeDate"!==f)i.set(u,null);else if(t)i.set(u,F);else{const e=m.get(w(u??""))??o;i.set(u,e)}return i}export{Z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import r from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{isAbsolute as i,makeAbsolute as n,getProxyRule as a,addProxy as c,isBlobProtocol as d,isDataProtocol as l}from"../../core/urlUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import h from"./MediaElementBase.js";import{mediaElementUrlProperty as y,mediaTypeProperty as v}from"./mediaUtils.js";import{whenVideoPlayable as g}from"./videoUtils.js";import{VideoElementSymbol as f}from"../../support/mediaLayerUtils.js";import{i as j}from"../../chunks/persistableUrlUtils.js";var b;const U=Symbol("canplay");let w=class extends h{static{b=f}constructor(e){super(e),this.autoplay=!0,this.content=null,this.type="video",this[b]=!0}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(this._preProcessVideoUrl(e).then((async e=>{const t=document.createElement("video");return t.src=encodeURI(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 o("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;const t=s(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){"not-loaded"===this.loadStatus?this._set("video",e):r.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const a=_(e)?e:null;if(!a)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!i(a)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(a);const c=n(a);!j(c)?t[r]=c:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(a(e))return c(e);try{return await t(e,{method:"head"}),e}catch{try{return c(e,!0)}catch{return e}}}async _loadVideo(e){"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",d(e.src)||(e.src=e.src));try{await g(e,(e=>this.addHandles(e,U))),this.autoplay&&await e.play().catch((e=>{throw console.error(e),e}))}finally{this.removeHandles(U)}}};e([p()],w.prototype,"autoplay",void 0),e([p({readOnly:!0})],w.prototype,"content",void 0),e([p({readOnly:!0})],w.prototype,"contentWidth",null),e([p({readOnly:!0})],w.prototype,"contentHeight",null),e([p({type:Number})],w.prototype,"currentTime",null),e([p({type:Number})],w.prototype,"duration",null),e([p(y)],w.prototype,"video",null),e([m("video")],w.prototype,"writeVideo",null),e([p(v)],w.prototype,"type",void 0),w=e([u("esri.layers.support.VideoElement")],w);const V=w;function _(e){return"string"==typeof e&&!l(e)&&!d(e)}export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Polygon.js";import o from"./BaseRaster.js";import{clip as a}from"../rasterFunctions/clipUtils.js";import{approximateTransform as n}from"../rasterFunctions/pixelUtils.js";import{projectPolygon as l}from"../rasterFunctions/rasterProjectionHelper.js";import c from"../../../rest/support/FeatureSet.js";const p=40;let m=class extends o{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async fetchPixels(t,e,r,s={}){const{rasters:i,rasterIds:o}=this.primaryRasters;let l=!1;const{interpolation:c}=s,p=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&p&&(l=1===i.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:l});const m=i.map((i=>i.fetchPixels(t,e,r,s))),u=await Promise.all(m),h=u.map((t=>t.pixelBlock)),f=l||s.requestRawData?u.map((t=>t.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((t=>null==t)))return u[0];const d=u.find((t=>null!=t.pixelBlock))?.extent??t;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o});const{transformGrid:g}=u[0];if(!l||null==y||null==g){const t=s.noClip?null:this.getClippingGeometry(d.spatialReference);return s.noClip||s.requestRawData||null==y||!t||(y=await a(y,d,t)),{...u[0],pixelBlock:y}}const x={rows:g.spacing[0],cols:g.spacing[1]};let R;if(this.rasterJobHandler){R=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:e,height:r},coefs:g.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:c,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock}else R=n(y,{width:e,height:r},g.coefficients,x,c);const w=s.noClip?null:this.getClippingGeometry(t.spatialReference);return s.noClip||s.requestRawData||null==R||null==w||(R=await a(R,t,w)),{extent:t,srcExtent:u[0].srcExtent,pixelBlock:R}}getClippingGeometry(t){const e=this._clippingGeometry.get("0");if(!t||!e)return e;const r=f(t);let s=this._clippingGeometry.get(r);return null!=s||(s=t.equals(e.spatialReference)?e:l(e,t),this._clippingGeometry.set(r,s)),s}async _open(t){const{rasterFunction:r}=this;this.primaryRasters?.rasters?.length?r.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=r.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((t=>t.rasterJobHandler=this.rasterJobHandler)));const{rasters:s,rasterIds:i}=this.primaryRasters,o=s.map((e=>e.rasterInfo?void 0:e.open(t)));await Promise.all(o);const a=s.map((({rasterInfo:t})=>t)),n=r.bind({rasterInfos:a,rasterIds:i});if(r.rawSourceRasterInfos=a,!n.success||0===a.length)throw new e("raster-function:open",`cannot bind the function: ${n.error??""}`);const l="Table"===r.functionName?r:r.functionArguments?.raster;"Table"===l?.functionName&&(r.rasterInfo.attributeTable=c.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const p=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((t=>h(t,p))),this.set("sourceJSON",s[0].sourceJSON),this.set("rasterInfo",r.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async _updateClipGeometry(){const t=this.rasterFunction.getClippingGeometries()[0];let e=t?.clippingGeometry;if(e&&"inside"===t.clippingType){const{extent:t}=this.rasterInfo,r=await import("../../../geometry/operators/densifyOperator.js"),s=await import("../../../geometry/operators/differenceOperator.js");let o=r.execute(i.fromExtent(t),2*(t.width+t.height)/p);o=l(o,e.spatialReference),e=s.execute(o,e)}this._clippingGeometry.clear(),e&&this._clippingGeometry.set("0",e)}};t([r({type:String,json:{write:!0}})],m.prototype,"datasetFormat",void 0),t([r()],m.prototype,"tileType",void 0),t([r()],m.prototype,"rasterFunction",void 0),t([r()],m.prototype,"primaryRasters",void 0),m=t([s("esri.layers.support.rasterDatasets.FunctionRaster")],m);const u=m;function h(t,e){const{storageInfo:r,pixelSize:s,spatialReference:i,extent:o}=t,{storageInfo:a,pixelSize:n,spatialReference:l,extent:c}=e;return s.x===n.x&&s.y===n.y&&i.equals(l)&&o.equals(c)&&r.blockHeight===a.blockHeight&&r.blockWidth===a.blockWidth&&r.maximumPyramidLevel===a.maximumPyramidLevel}function f(t){return String(t.wkid??t.wkt??t.wkt2)}export{u as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Polygon.js";import o from"./BaseRaster.js";import{clip as a}from"../rasterFunctions/clipUtils.js";import{approximateTransform as n}from"../rasterFunctions/pixelUtils.js";import{projectPolygon as l}from"../rasterFunctions/rasterProjectionHelper.js";import c from"../../../rest/support/FeatureSet.js";const p=40;let m=class extends o{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async fetchPixels(t,e,r,s={}){const{rasters:i,rasterIds:o}=this.primaryRasters;let l=!1;const{interpolation:c}=s,p=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&p&&(l=1===i.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:l});const m=i.map((i=>i.fetchPixels(t,e,r,s))),u=await Promise.all(m),h=u.map((t=>t.pixelBlock)),f=l||s.requestRawData?u.map((t=>t.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((t=>null==t)))return u[0];const d=u.find((t=>null!=t.pixelBlock))?.extent??t;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o});const{transformGrid:g}=u[0];if(!l||null==y||null==g){const t=s.noClip?null:this.getClippingGeometry(d.spatialReference);return s.noClip||s.requestRawData||null==y||!t||(y=await a(y,d,t)),{...u[0],pixelBlock:y}}const x={rows:g.spacing[0],cols:g.spacing[1]};let R;if(this.rasterJobHandler){R=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:e,height:r},coefs:g.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:c,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock}else R=n(y,{width:e,height:r},g.coefficients,x,c);const w=s.noClip?null:this.getClippingGeometry(t.spatialReference);return s.noClip||s.requestRawData||null==R||null==w||(R=await a(R,t,w)),{extent:t,srcExtent:u[0].srcExtent,pixelBlock:R}}getClippingGeometry(t){const e=this._clippingGeometry.get("0");if(!t||!e)return e;const r=f(t);let s=this._clippingGeometry.get(r);return null!=s||(s=t.equals(e.spatialReference)?e:l(e,t),this._clippingGeometry.set(r,s)),s}async _open(t){const{rasterFunction:r}=this;r.isRoot=!0,this.primaryRasters?.rasters?.length?r.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=r.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((t=>t.rasterJobHandler=this.rasterJobHandler)));const{rasters:s,rasterIds:i}=this.primaryRasters,o=s.map((e=>e.rasterInfo?void 0:e.open(t)));await Promise.all(o);const a=s.map((({rasterInfo:t})=>t)),n=r.bind({rasterInfos:a,rasterIds:i});if(r.rawSourceRasterInfos=a,!n.success||0===a.length)throw new e("raster-function:open",`cannot bind the function: ${n.error??""}`);const l="Table"===r.functionName?r:r.functionArguments?.raster;"Table"===l?.functionName&&(r.rasterInfo.attributeTable=c.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const p=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((t=>h(t,p))),this.set("sourceJSON",s[0].sourceJSON),this.set("rasterInfo",r.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async _updateClipGeometry(){const t=this.rasterFunction.getClippingGeometries()[0];let e=t?.clippingGeometry;if(e&&"inside"===t.clippingType){const{extent:t}=this.rasterInfo,r=await import("../../../geometry/operators/densifyOperator.js"),s=await import("../../../geometry/operators/differenceOperator.js");let o=r.execute(i.fromExtent(t),2*(t.width+t.height)/p);o=l(o,e.spatialReference),e=s.execute(o,e)}this._clippingGeometry.clear(),e&&this._clippingGeometry.set("0",e)}};t([r({type:String,json:{write:!0}})],m.prototype,"datasetFormat",void 0),t([r()],m.prototype,"tileType",void 0),t([r()],m.prototype,"rasterFunction",void 0),t([r()],m.prototype,"primaryRasters",void 0),m=t([s("esri.layers.support.rasterDatasets.FunctionRaster")],m);const u=m;function h(t,e){const{storageInfo:r,pixelSize:s,spatialReference:i,extent:o}=t,{storageInfo:a,pixelSize:n,spatialReference:l,extent:c}=e;return s.x===n.x&&s.y===n.y&&i.equals(l)&&o.equals(c)&&r.blockHeight===a.blockHeight&&r.blockWidth===a.blockWidth&&r.maximumPyramidLevel===a.maximumPyramidLevel}function f(t){return String(t.wkid??t.wkt??t.wkt2)}export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import f from"../RasterInfo.js";import l from"../RasterStorageInfo.js";import u from"./BaseRaster.js";import c from"./DBFParser.js";import{parsePAMInfo as h,parseSpatialReference as p}from"./pamParser.js";import{parseSignature as d,getPyramidIFDs as m,getMaskIFDs as y,parseIFD as g,parseFieldValues as x,isBSQConfig as T,getImageInfo as w}from"../rasterFormats/TiffDecoder.js";import I from"../rasterFormats/TiffTags.js";import{estimateStatisticsFromHistograms as R}from"../rasterFunctions/stretchUtils.js";import _ from"../rasterTransforms/PolynomialTransform.js";import O from"../../../rest/support/FeatureSet.js";const F=(e,t)=>e.get(t)?.values,S=(e,t)=>e.get(t)?.values?.[0];let b=class extends u{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const s=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=s&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,i,!0,r);null!=a&&a.pixels[0]instanceof Uint8Array&&(s.mask=a.pixels[0])}return s}async _open(e){const r=e?e.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:r});if(!s)throw new t("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:a,firstIFDPos:n,isBigTiff:o}=d(s),f=[],l={fileChunk:s,posIFD:n,fileOffset:0};await this._readIFDs(f,l,a,o?8:4,r);const{imageInfo:u,rasterInfo:c}=k(f),h=m(f),p=y(f);if(this._headerInfo={littleEndian:a,isBigTiff:o,ifds:f,pyramidIFDs:h,maskIFDs:p,...u},this._set("rasterInfo",c),!u.isSupported)throw new t("tiffraster:open","this tiff is not supported: "+u.message);if(!u.tileWidth)throw new t("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");c.isPseudoSpatialReference&&i.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const g=f[0].get("PREDICTOR")?.values?.[0],x=f[0].get("SAMPLEFORMAT")?.values?.[0];if(3===x&&2===g)throw new t("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:T,skipExtensions:w=[]}=this.ioConfig;if(!w.includes("aux.xml")&&!T){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&E(t,c)}w.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||T||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),T&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:s}=e;if(s+8>=i.byteLength||s<0){r=s+r;i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,s=0}return{fileChunk:i,fileOffset:r,posIFD:s}}async _readIFDs(e,i,r,s=4,a){if(!i.posIFD)return null;i=await this._validateOrFetchHeaderBuffer(i,a);const n=await this._readIFD(i,r,I.tiffTags,s,a);if(!n?.ifd)throw new t("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;i.posIFD=n.nextIFD-i.fileOffset,await this._readIFDs(e,i,r,s,a)}async _readIFD(e,t,i=I.tiffTags,r=4,s){let{fileChunk:a,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;const f=g(a,t,n,o,i,r);if(f.success){const e=[];if(f.ifd?.forEach((t=>{t.values||e.push(t)})),e.length>0&&await this._fillOffsets(e,t,f.nextIFD,s),f.ifd?.has("GEOKEYDIRECTORY")){const e=f.ifd.get("GEOKEYDIRECTORY"),i=e?.values;if(i&&i.length>4){const r=i[0]+"."+i[1]+"."+i[2];n=e.valueOffset+6-o;const f=await this._validateOrFetchHeaderBuffer({fileChunk:a,posIFD:n,fileOffset:o},s),l=await this._readIFD(f,t,I.geoKeys,2,s);e.data=l?.ifd,e.data&&e.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return f}if(f.requiredBufferSize){return a=(await this.request(this.url,{range:{from:o,to:o+n+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,a.byteLength<n+f.requiredBufferSize?null:(e.fileChunk=a,e.fileOffset=o,this._readIFD(e,t,i,r,s))}return null}async _fillOffsets(e,t,i,r){const s=e.filter((e=>null!=e.offlineOffsetSize));if(0===s.length)return;const a=s.map((e=>e.offlineOffsetSize)),n=Math.min.apply(null,a.map((e=>e[0]))),o=Math.max.apply(null,a.map((e=>e[0]+e[1])));let f=1===a.length||o-n<=this._bufferSize;if(!f&&a.length>1){a.sort(((e,t)=>e[0]-t[0]));f=a.reduce(((e,t)=>e===t[0]?t[0]+t[1]:0),a[0][0])===o}if(f){const e=await this._fetchOffsets(n,Math.max(o,n+this._bufferSize),r);return void s.forEach((i=>x(e,t,i,n)))}const l=s.map((async e=>{const i=e.offlineOffsetSize,s=await this._fetchOffsets(i[0],i[1]+i[0],r);x(s,t,e,i[0])}));await Promise.all(l)}async _fetchOffsets(e,t,i){const r=[],s=this._chunkSize,a=Math.ceil((t-e)/s);let n=e;for(let l=0;l<a;l++)r.push(this.request(this.url,{range:{from:n,to:l===a-1?t:n+s-1},responseType:"array-buffer",signal:i})),n+=s;const o=await Promise.all(r);if(1===a)return o[0].data;const f=new Uint8Array(t-e+1);for(let l=0;l<a;l++)f.set(new Uint8Array(o[l].data),l*s);return f.buffer}async _fetchRawTiffTile(e,t,i,r,s={}){const a=this._getTileLocation(e,t,i,r);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:f,ifd:l}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),c=await Promise.all(u),h=c.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===c.length?c[0].data:new ArrayBuffer(h),d=[0],m=[0];if(c.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<c.length;t++){const r=c[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let T,w,I;if(o!==y||f!==g){let e=x.mask;if(e)for(T=0;T<g;T++)if(I=T*y,T<f)for(w=o;w<y;w++)e[I+w]=0;else for(w=0;w<y;w++)e[I+w]=0;else for(e=new Uint8Array(y*g),x.mask=e,T=0;T<f;T++)for(I=T*y,w=0;w<o;w++)e[I+w]=1}return x}_getTileLocation(e,t,i,r=!1){const{firstPyramidLevel:s,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const f=r?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!f)return null;const l=T(f,o),u=F(f,"TILEOFFSETS");if(void 0===u)return null;const c=F(f,"TILEBYTECOUNTS"),{minRow:h,minCol:p,maxRow:d,maxCol:m}=a[n];if(t>d||i>m||t<h||i<p)return null;const y=S(f,"IMAGEWIDTH"),g=S(f,"IMAGELENGTH"),x=S(f,"TILEWIDTH"),w=S(f,"TILELENGTH"),I=[];if(l){const{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){const e=r*(d+1)*(m+1)+t*(m+1)+i;I[r]={from:u[e],to:u[e]+c[e]-1}}}else{const e=t*(m+1)+i;I.push({from:u[e],to:u[e]+c[e]-1})}for(let T=0;T<I.length;T++)if(null==I[T].from||!I[T].to||I[T].to<0)return null;return{ranges:I,ifd:f,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return h(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=c.parse(t);return i?.recordSet?O.fromJSON(i.recordSet):null}catch{return null}}};function k(e){const t=w(e),{width:i,height:r,tileWidth:s,tileHeight:u,planes:c,pixelType:h,compression:d,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidBlockWidth:g,pyramidBlockHeight:x,pyramidResolutions:T,tileBoundary:I,affine:R,metadata:O}=t,b=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid;let k=p(b),E=!!t.isPseudoGeographic;null==k&&(E=!0,k=new o({wkid:3857}));const D=new a({...t.extent,spatialReference:k}),v=new n(D?{x:D.xmin,y:D.ymax,spatialReference:k}:{x:0,y:0}),P=new l({blockWidth:s,blockHeight:u,pyramidBlockWidth:g,pyramidBlockHeight:x,compression:d,origin:v,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidResolutions:T,blockBoundary:I}),B=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),C=O?{BandProperties:O.bandProperties,DataType:O.dataType}:{};let L=null;const z=S(e[0],"PHOTOMETRICINTERPRETATION"),j=F(e[0],"COLORMAP");if(z<=3&&j?.length>3&&j.length%3==0){L=[];const e=j.length/3;for(let t=0;t<e;t++)L.push([t,j[t]>>>8,j[t+e]>>>8,j[t+2*e]>>>8])}const A=new f({width:i,height:r,bandCount:c,pixelType:h,pixelSize:B,storageInfo:P,spatialReference:k,isPseudoSpatialReference:E,keyProperties:C,extent:D,colormap:L,statistics:O?O.statistics:null});if(R?.length&&(A.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:k}),A.transform=new _({polynomialOrder:1,forwardCoefficients:[R[2]+R[0]/2,R[5]-R[3]/2,R[0],R[3],-R[1],-R[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),P.origin.x=-.5,P.origin.y=.5),T){const{x:e,y:t}=A.pixelSize;T.forEach((i=>{i.x*=e,i.y*=t}))}return{imageInfo:t,rasterInfo:A}}function E(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=R(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new n({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}e([r()],b.prototype,"_files",void 0),e([r()],b.prototype,"_headerInfo",void 0),e([r()],b.prototype,"_bufferSize",void 0),e([r()],b.prototype,"_chunkSize",void 0),e([r({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),b=e([s("esri.layers.support.rasterDatasets.TIFFRaster")],b);const D=b;export{D as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import f from"../RasterInfo.js";import l from"../RasterStorageInfo.js";import u from"./BaseRaster.js";import c from"./DBFParser.js";import{parsePAMInfo as h,parseSpatialReference as p}from"./pamParser.js";import{parseSignature as d,getPyramidIFDs as m,getMaskIFDs as y,parseIFD as g,parseFieldValues as x,isBSQConfig as w,getImageInfo as I}from"../rasterFormats/TiffDecoder.js";import{tiffTags as T,geoKeys as R}from"../rasterFormats/tiffTag.js";import{estimateStatisticsFromHistograms as _}from"../rasterFunctions/stretchUtils.js";import O from"../rasterTransforms/PolynomialTransform.js";import F from"../../../rest/support/FeatureSet.js";const S=(e,t)=>e.get(t)?.values,b=(e,t)=>e.get(t)?.values?.[0];let k=class extends u{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const s=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=s&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,i,!0,r);null!=a&&a.pixels[0]instanceof Uint8Array&&(s.mask=a.pixels[0])}return s}async _open(e){const r=e?e.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:r});if(!s)throw new t("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:a,firstIFDPos:n,isBigTiff:o}=d(s),f=[],l={fileChunk:s,posIFD:n,fileOffset:0};await this._readIFDs(f,l,a,o?8:4,r);const{imageInfo:u,rasterInfo:c}=E(f),h=m(f),p=y(f);if(this._headerInfo={littleEndian:a,isBigTiff:o,ifds:f,pyramidIFDs:h,maskIFDs:p,...u},this._set("rasterInfo",c),!u.isSupported)throw new t("tiffraster:open","this tiff is not supported: "+u.message);if(!u.tileWidth)throw new t("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");c.isPseudoSpatialReference&&i.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const g=f[0].get("PREDICTOR")?.values?.[0],x=f[0].get("SAMPLEFORMAT")?.values?.[0];if(3===x&&2===g)throw new t("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:w,skipExtensions:I=[]}=this.ioConfig;if(!I.includes("aux.xml")&&!w){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&D(t,c)}I.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||w||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),w&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:s}=e;if(s+8>=i.byteLength||s<0){r=s+r;i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,s=0}return{fileChunk:i,fileOffset:r,posIFD:s}}async _readIFDs(e,i,r,s=4,a){if(!i.posIFD)return null;i=await this._validateOrFetchHeaderBuffer(i,a);const n=await this._readIFD(i,r,T,s,a);if(!n?.ifd)throw new t("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;i.posIFD=n.nextIFD-i.fileOffset,await this._readIFDs(e,i,r,s,a)}async _readIFD(e,t,i=T,r=4,s){let{fileChunk:a,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;const f=g(a,t,n,o,i,r);if(f.success){const e=[];if(f.ifd?.forEach((t=>{t.values||e.push(t)})),e.length>0&&await this._fillOffsets(e,t,f.nextIFD,s),f.ifd?.has("GEOKEYDIRECTORY")){const e=f.ifd.get("GEOKEYDIRECTORY"),i=e?.values;if(i&&i.length>4){const r=i[0]+"."+i[1]+"."+i[2];n=e.valueOffset+6-o;const f=await this._validateOrFetchHeaderBuffer({fileChunk:a,posIFD:n,fileOffset:o},s),l=await this._readIFD(f,t,R,2,s);e.data=l?.ifd,e.data&&e.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return f}if(f.requiredBufferSize){return a=(await this.request(this.url,{range:{from:o,to:o+n+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,a.byteLength<n+f.requiredBufferSize?null:(e.fileChunk=a,e.fileOffset=o,this._readIFD(e,t,i,r,s))}return null}async _fillOffsets(e,t,i,r){const s=e.filter((e=>null!=e.offlineOffsetSize));if(0===s.length)return;const a=s.map((e=>e.offlineOffsetSize)),n=Math.min.apply(null,a.map((e=>e[0]))),o=Math.max.apply(null,a.map((e=>e[0]+e[1])));let f=1===a.length||o-n<=this._bufferSize;if(!f&&a.length>1){a.sort(((e,t)=>e[0]-t[0]));f=a.reduce(((e,t)=>e===t[0]?t[0]+t[1]:0),a[0][0])===o}if(f){const e=await this._fetchOffsets(n,Math.max(o,n+this._bufferSize),r);return void s.forEach((i=>x(e,t,i,n)))}const l=s.map((async e=>{const i=e.offlineOffsetSize,s=await this._fetchOffsets(i[0],i[1]+i[0],r);x(s,t,e,i[0])}));await Promise.all(l)}async _fetchOffsets(e,t,i){const r=[],s=this._chunkSize,a=Math.ceil((t-e)/s);let n=e;for(let l=0;l<a;l++)r.push(this.request(this.url,{range:{from:n,to:l===a-1?t:n+s-1},responseType:"array-buffer",signal:i})),n+=s;const o=await Promise.all(r);if(1===a)return o[0].data;const f=new Uint8Array(t-e+1);for(let l=0;l<a;l++)f.set(new Uint8Array(o[l].data),l*s);return f.buffer}async _fetchRawTiffTile(e,t,i,r,s={}){const a=this._getTileLocation(e,t,i,r);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:f,ifd:l}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),c=await Promise.all(u),h=c.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===c.length?c[0].data:new ArrayBuffer(h),d=[0],m=[0];if(c.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<c.length;t++){const r=c[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,I,T;if(o!==y||f!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(T=w*y,w<f)for(I=o;I<y;I++)e[T+I]=0;else for(I=0;I<y;I++)e[T+I]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<f;w++)for(T=w*y,I=0;I<o;I++)e[T+I]=1}return x}_getTileLocation(e,t,i,r=!1){const{firstPyramidLevel:s,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const f=r?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!f)return null;const l=w(f,o),u=S(f,"TILEOFFSETS");if(void 0===u)return null;const c=S(f,"TILEBYTECOUNTS"),{minRow:h,minCol:p,maxRow:d,maxCol:m}=a[n];if(t>d||i>m||t<h||i<p)return null;const y=b(f,"IMAGEWIDTH"),g=b(f,"IMAGELENGTH"),x=b(f,"TILEWIDTH"),I=b(f,"TILELENGTH"),T=[];if(l){const{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){const e=r*(d+1)*(m+1)+t*(m+1)+i;T[r]={from:u[e],to:u[e]+c[e]-1}}}else{const e=t*(m+1)+i;T.push({from:u[e],to:u[e]+c[e]-1})}for(let w=0;w<T.length;w++)if(null==T[w].from||!T[w].to||T[w].to<0)return null;return{ranges:T,ifd:f,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%I||I}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return h(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=c.parse(t);return i?.recordSet?F.fromJSON(i.recordSet):null}catch{return null}}};function E(e){const t=I(e),{width:i,height:r,tileWidth:s,tileHeight:u,planes:c,pixelType:h,compression:d,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidBlockWidth:g,pyramidBlockHeight:x,pyramidResolutions:w,tileBoundary:T,affine:R,metadata:_}=t,F=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid;let k=p(F),E=!!t.isPseudoGeographic;null==k&&(E=!0,k=new o({wkid:3857}));const D=new a({...t.extent,spatialReference:k}),v=new n(D?{x:D.xmin,y:D.ymax,spatialReference:k}:{x:0,y:0}),P=new l({blockWidth:s,blockHeight:u,pyramidBlockWidth:g,pyramidBlockHeight:x,compression:d,origin:v,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidResolutions:w,blockBoundary:T}),B=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),C=_?{BandProperties:_.bandProperties,DataType:_.dataType}:{};let L=null;const z=b(e[0],"PHOTOMETRICINTERPRETATION"),j=S(e[0],"COLORMAP");if(z<=3&&j?.length>3&&j.length%3==0){L=[];const e=j.length/3;for(let t=0;t<e;t++)L.push([t,j[t]>>>8,j[t+e]>>>8,j[t+2*e]>>>8])}const A=new f({width:i,height:r,bandCount:c,pixelType:h,pixelSize:B,storageInfo:P,spatialReference:k,isPseudoSpatialReference:E,keyProperties:C,extent:D,colormap:L,statistics:_?_.statistics:null});if(R?.length&&(A.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:k}),A.transform=new O({polynomialOrder:1,forwardCoefficients:[R[2]+R[0]/2,R[5]-R[3]/2,R[0],R[3],-R[1],-R[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),P.origin.x=-.5,P.origin.y=.5),w){const{x:e,y:t}=A.pixelSize;w.forEach((i=>{i.x*=e,i.y*=t}))}return{imageInfo:t,rasterInfo:A}}function D(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=_(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new n({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}e([r()],k.prototype,"_files",void 0),e([r()],k.prototype,"_headerInfo",void 0),e([r()],k.prototype,"_bufferSize",void 0),e([r()],k.prototype,"_chunkSize",void 0),e([r({type:String,json:{write:!0}})],k.prototype,"datasetFormat",void 0),k=e([s("esri.layers.support.rasterDatasets.TIFFRaster")],k);const v=k;export{v as default};
|