@arcgis/core 6.0.0-next.15 → 6.0.0-next.17
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/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164c8eeefa8232b2b191.js +2 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/{261fea092ee7d27608a0.js → 20a2124cbe43e5527c40.js} +1 -1
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2853606099602f73d379.js +1 -0
- package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +2 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +2 -0
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 34e0a8a3a2beea50f4f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3e30b96a8c75bd5b9ae2.js +1 -0
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → 42753cf4965a94bc91ca.js} +1 -1
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/{b564ec4e03478f5659db.js → 4c240ca50f70bf30813f.js} +1 -1
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/{70d3055f15d8b0cf4074.js → 532e9cda8ac3601d8892.js} +1 -1
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/{953ba13299e7aa92c1a0.js → 564565246dae080f5e6c.js} +1 -1
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/{2145a512d269d64036b0.js → 58c3ae6030def2ed5f31.js} +1 -1
- package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +1 -0
- package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 5b91e2dffdc84c006539.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → 60f92eb03c6e17ab4747.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b077c92345ffb5916c2.js → 65c98f3449044fa4fd79.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bd4ee083ca4ad221f8b.js → 65cb5e39c467a35621ca.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/67a35155b8b4d36f171e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → 6ad309154fe84210d23c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2190361247f35b02b32.js → 7b5cd150a4d0139850be.js} +1 -1
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/9503eedfdda55fc5adab.js +1 -0
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +1 -0
- package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +1 -0
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
- package/assets/esri/core/workers/chunks/a596779eaeec7310671d.js +1 -0
- package/assets/esri/core/workers/chunks/{d5d0fe8e198ff5a902ee.js → a5c8f9f5be4ef5063b42.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → ab1660f5f8a5268c2fac.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/ae0563d573baf91e01f7.js +1 -0
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +2 -0
- package/assets/esri/core/workers/chunks/{aa36c3a9bbaa086e3757.js → b8fd7c3b36981261378b.js} +1 -1
- package/assets/esri/core/workers/chunks/bd046399e05e759e0bc2.js +1 -0
- package/assets/esri/core/workers/chunks/bd46a04a9ee4ea9e6ef1.js +2 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +1 -0
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → dd0310184fe4832755a8.js} +1 -1
- package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{634523cc7757da9020e4.js → fb70ab267a08e24b710f.js} +1 -1
- package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +1 -0
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -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/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/sql/WhereGrammar.js +2 -2
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/effects/parser.js +3 -3
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ElevationCodec.js +2 -0
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/LercWorker.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TileInfo.d.ts +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/layerOriginUtils.js +1 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +6 -6
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/time/TimeExtent.d.ts +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/snapping/allLayerSnapping.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/Expand/ExpandViewModel.d.ts +2 -0
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
- package/widgets/Home/HomeViewModel.d.ts +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
- package/widgets/Swipe/types.d.ts +9 -2
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
- package/widgets/TimeSlider/types.d.ts +7 -0
- package/widgets/TimeSlider.d.ts +2 -3
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track/TrackViewModel.d.ts +4 -0
- package/widgets/Track/types.d.ts +1 -0
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/Selector3D/selectorUtils.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0050916e462e3c9e0627.js +0 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/34cbaf844730ac2d92c2.js +0 -2
- package/assets/esri/core/workers/chunks/3c301a689c7853c9fa67.js +0 -2
- package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/604f0f4150fb79ee54c8.js +0 -1
- package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +0 -1
- package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +0 -1
- package/assets/esri/core/workers/chunks/76ab353d80d786777161.js +0 -2
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/8483c50ed8f280fd74bb.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +0 -2
- package/assets/esri/core/workers/chunks/b557824bc1fa163d72a3.js +0 -2
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/assets/esri/core/workers/chunks/{b557824bc1fa163d72a3.js.LICENSE.txt → 164c8eeefa8232b2b191.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b49df4ebd4be1181b0f9.js.LICENSE.txt → 2981e904ab62f3ed80d0.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{34cbaf844730ac2d92c2.js.LICENSE.txt → 32cc59e126df8c96a0cf.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{3c301a689c7853c9fa67.js.LICENSE.txt → b686cd74975da09b9c91.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{76ab353d80d786777161.js.LICENSE.txt → bd46a04a9ee4ea9e6ef1.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import f from"../graphic/ImageryTileGraphicOrigin.js";import p from"./Layer.js";import{ArcGISService as m}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as v}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as y}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{TiledImagery as C}from"./mixins/TiledImagery.js";import{isFunctionRaster as w,getPrimaryRasters as T}from"./raster/datasets/datasetUtils.js";import E from"./raster/datasets/FunctionRaster.js";import D from"./raster/datasets/RasterFactory.js";import{getPrimaryRasterUrls as O,create as k}from"./raster/functions/rasterFunctionHelper.js";import{legendEnabled as A,screenSizePerspectiveEnabled as j}from"./support/commonProperties.js";import M from"./support/Field.js";import{getServicePixelValueField as N,getRawServicePixelValueField as P,getRasterAttributeTableFields as F,getMagnitudeField as I,getDirectionField as L,getMultidimensionalFields as R,commonRasterFieldNames as z,setDefaultRasterFieldFormats as B}from"./support/rasterFieldUtils.js";import V from"./support/RasterFunction.js";import{getRasterJobHandler as H,releaseRasterJobHandler as U}from"./support/rasterJobHelper.js";import W from"./support/TileInfo.js";import{logInvalidElevationInfoWarning as G,elevationModeUnsupportedMessage as K,featureExpressionUnsupportedMessage as q}from"../support/elevationInfoUtils.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import Y from"../symbols/support/ElevationInfo.js";import{addLayerUnsupportedError as X}from"../webdoc/support/unsupportedErrors.js";let Z=class extends h(x(g(_(y(te(C(v(S(m(b(o(n(p))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new f(this),this.legendEnabled=!0,this.isReference=null,this.listMode=`show`,this.sourceJSON=null,this.version=null,this.type=`imagery-tile`,this.operationalLayerType=`ArcGISTiledImageServiceLayer`,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/imageryUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`Image Service`]},e).catch(ee).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=a(this._releaseWorkerHandle)}set elevationInfo(e){e?.mode!==`relative-to-scene`&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[N(`Pixel Value`),P(`Raw Pixel Value`)],t=this.raster?.rasterInfo??this.serviceRasterInfo,n=t?.attributeTable;if(n){let t=F(n);e.push(...t)}let r=t?.dataType,i=t?.multidimensionalInfo;if((r===`vector-magdir`||r===`vector-uv`)&&i!=null){let t=i.variables[0].unit?.trim(),n=I(t),r=L();e.push(n,r)}if(i){let t=R(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,n=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==z.rawServicePixelValue)),r=J({fields:t,title:this.title},{...e,visibleFieldNames:n}),{rasterInfo:i}=this.raster;return r?.fieldInfos&&i&&B(r.fieldInfos,i),r}async generateRasterInfo(e,t){let n=d(V,e);if(await this.load(),!n||n.functionName?.toLowerCase()===`none`)return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(n,t);return e}catch(e){throw e instanceof r?e:new r(`imagery-tile-layer`,`the given raster function is not supported`)}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t=e?.datasetFormat===`RasterTileServer`,n=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),i=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&e?.tileType===`Raster`&&(r===`cache/jpegplus`||r===`cache/jpegpng`),a=e?.tileType===`Map`||i;return t&&n&&a}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?e.datasetFormat===`RasterTileServer`&&(e.tileType===`Raster`||e.tileType===`Map`):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):(X(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:n}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set(`serviceRasterInfo`,e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),n&&this.read(n,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=w(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:n,source:i}=this;if(!(t||i))throw new r(`imagery-tile-layer:open`,`missing url or source parameter`);i?await this._openFromSource(i,e):n?await this._openFromUrlWithRasterFunction(t,n,e):await this._openFromUrl(t,e)}let n=this.raster.rasterInfo;if(!n)throw new r(`imagery-tile-layer:load`,`cannot load resources on `+this.url);if(this._set(`serviceRasterInfo`,t?n:this._primaryRasters[0].rasterInfo),this._set(`spatialReference`,n.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){let e=this.raster.tileType===`Map`&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:`service`})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:`service`});this.title||=this.raster.datasetName,this.raster.tileType===`Map`&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(c(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=T(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,n){let i=[e];t&&O(t.toJSON(),i);let a;i.some(e=>$(e))&&(a=await H(),this._releaseWorkerHandle={remove:()=>U()});let o=await Promise.all(i.map(e=>D.open({url:e,rasterInfo:i.length===1?this.serviceRasterInfo:void 0,sourceJSON:i.length===1?this.sourceJSON:void 0,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:a,signal:n}))),s=o.findIndex(e=>e==null);if(s>-1)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${i[s]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let n;$(e)&&(n=await H(),this._releaseWorkerHandle={remove:()=>U()});let i=await D.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:n,signal:t});if(i==null)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){let n=`the tiled imagery data source is not supported`,i=e.type?.toLowerCase()===`coverage`?`CovJSON`:e.extent&&e.pixelBlock?`MEMORY`:null;if(!i)throw new r(`imagery-tile-layer:open`,n);i===`MEMORY`&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await D.open({url:``,source:e,datasetFormat:i,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(a==null)throw new r(`imagery-tile-layer:open`,n);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let n={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>n[e.url]=e);let r=k(e.functionDefinition?.toJSON()??e.toJSON(),n),i=new E({rasterFunction:r});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof r&&i.getLogger(this).error(`imagery-tile-layer:open`,e.message),i.getLogger(this).warn(`imagery-tile-layer:open`,`the raster function cannot be applied and is removed`),this._set(`rasterFunction`,null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){G(i.getLogger(this),K(`ImageryTile layers`,`relative-to-scene`,e)),G(i.getLogger(this),q(`ImageryTile layers`,e))}};e([l({clonable:!1})],Z.prototype,`_primaryRasters`,void 0),e([l({clonable:!1})],Z.prototype,`_releaseWorkerHandle`,void 0),e([l({json:{origins:{"web-scene":{write:!1}},write:!0}})],Z.prototype,`charts`,void 0),e([l({type:Y,value:null,json:{name:`layerDefinition.elevationInfo`,write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Z.prototype,`elevationInfo`,null),e([l({type:W})],Z.prototype,`tileInfo`,void 0),e([l({readOnly:!0,clonable:!1})],Z.prototype,`graphicOrigin`,void 0),e([l(A)],Z.prototype,`legendEnabled`,void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Z.prototype,`isReference`,void 0),e([l({type:[`show`,`hide`]})],Z.prototype,`listMode`,void 0),e([l({json:{read:!0,write:!0}})],Z.prototype,`blendMode`,void 0),e([l({type:V,json:{name:`renderingRule`,write:!0}})],Z.prototype,`rasterFunction`,void 0),e([l()],Z.prototype,`sourceJSON`,void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:`currentVersion`}}}}})],Z.prototype,`version`,void 0),e([l({readOnly:!0,json:{read:!1}})],Z.prototype,`type`,void 0),e([l({type:[`ArcGISTiledImageServiceLayer`]})],Z.prototype,`operationalLayerType`,void 0),e([l({type:Boolean,value:!0,json:{read:{source:`disablePopup`,reader(e,t){return!t.disablePopup}},write:{target:`disablePopup`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}},writer(e,t,n){t[n]=!e}}}})],Z.prototype,`popupEnabled`,void 0),e([l({type:t,json:{read:{source:`popupInfo`},write:{target:`popupInfo`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}}}}})],Z.prototype,`popupTemplate`,void 0),e([l({readOnly:!0})],Z.prototype,`defaultPopupTemplate`,null),e([l(j)],Z.prototype,`screenSizePerspectiveEnabled`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`fields`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Z.prototype,`source`,void 0),Z=e([u(`esri.layers.ImageryTileLayer`)],Z);const Q=Z;function $(e){return/\.(png|gif|bmp)$/i.test(e)}export{Q as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as l,subclass as u}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import f from"../graphic/ImageryTileGraphicOrigin.js";import p from"./Layer.js";import{ArcGISService as m}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as v}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as y}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{TiledImagery as C}from"./mixins/TiledImagery.js";import{isFunctionRaster as w,getPrimaryRasters as T}from"./raster/datasets/datasetUtils.js";import E from"./raster/datasets/FunctionRaster.js";import D from"./raster/datasets/RasterFactory.js";import{getPrimaryRasterUrls as O,create as k}from"./raster/functions/rasterFunctionHelper.js";import{legendEnabled as A,screenSizePerspectiveEnabled as j}from"./support/commonProperties.js";import M from"./support/Field.js";import{getServicePixelValueField as N,getRawServicePixelValueField as P,getRasterAttributeTableFields as F,getMagnitudeField as I,getDirectionField as L,getMultidimensionalFields as R,commonRasterFieldNames as z,setDefaultRasterFieldFormats as B}from"./support/rasterFieldUtils.js";import V from"./support/RasterFunction.js";import{getRasterJobHandler as H,releaseRasterJobHandler as U}from"./support/rasterJobHelper.js";import W from"./support/TileInfo.js";import{logInvalidElevationInfoWarning as G,elevationModeUnsupportedMessage as K,featureExpressionUnsupportedMessage as q}from"../support/elevationInfoUtils.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import Y from"../symbols/support/ElevationInfo.js";import{addLayerUnsupportedError as X}from"../webdoc/support/unsupportedErrors.js";let Z=class extends h(x(g(_(y(te(C(v(S(m(b(o(n(p))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new f(this),this.legendEnabled=!0,this.isReference=null,this.listMode=`show`,this.sourceJSON=null,this.version=null,this.type=`imagery-tile`,this.operationalLayerType=`ArcGISTiledImageServiceLayer`,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/imageryUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`Image Service`]},e).catch(ee).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=a(this._releaseWorkerHandle)}set elevationInfo(e){e?.mode!==`relative-to-scene`&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[N(`Pixel Value`),P(`Raw Pixel Value`)],t=this.raster?.rasterInfo??this.serviceRasterInfo,n=t?.attributeTable;if(n){let t=F(n);e.push(...t)}let r=t?.dataType,i=t?.multidimensionalInfo;if((r===`vector-magdir`||r===`vector-uv`)&&i!=null){let t=i.variables[0].unit?.trim(),n=I(t),r=L();e.push(n,r)}if(i){let t=R(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,n=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==z.rawServicePixelValue)),r=J({fields:t,title:this.title},{...e,visibleFieldNames:n}),{rasterInfo:i}=this.raster;return r?.fieldInfos&&i&&B(r.fieldInfos,i),r}async generateRasterInfo(e,t){let n=d(V,e);if(await this.load(),!n||n.functionName?.toLowerCase()===`none`)return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(n,t);return e}catch(e){throw e instanceof r?e:new r(`imagery-tile-layer`,`the given raster function is not supported`)}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t=e?.datasetFormat===`RasterTileServer`,n=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),i=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&e?.tileType===`Raster`&&(r===`cache/jpegplus`||r===`cache/jpegpng`),a=e?.tileType===`Map`||i;return t&&n&&a}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?e.datasetFormat===`RasterTileServer`&&(e.tileType===`Raster`||e.tileType===`Map`):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):(X(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:n}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set(`serviceRasterInfo`,e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),n&&this.read(n,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=w(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:n,source:i}=this;if(!(t||i))throw new r(`imagery-tile-layer:open`,`missing url or source parameter`);i?await this._openFromSource(i,e):n?await this._openFromUrlWithRasterFunction(t,n,e):await this._openFromUrl(t,e)}let n=this.raster.rasterInfo;if(!n)throw new r(`imagery-tile-layer:load`,`cannot load resources on `+this.url);if(this._set(`serviceRasterInfo`,t?n:this._primaryRasters[0].rasterInfo),this._set(`spatialReference`,n.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){let e=this.raster.tileType===`Map`&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:`service`})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:`service`});this.title||=this.raster.datasetName,this.raster.tileType===`Map`&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(c(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=T(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,n){let i=[e];t&&O(t.toJSON(),i);let a;i.some(e=>$(e,this.ioConfig))&&(a=await H(),this._releaseWorkerHandle={remove:()=>U()});let o=await Promise.all(i.map(e=>D.open({url:e,rasterInfo:i.length===1?this.serviceRasterInfo:void 0,sourceJSON:i.length===1?this.sourceJSON:void 0,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:a,signal:n}))),s=o.findIndex(e=>e==null);if(s>-1)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${i[s]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let n;$(e,this.ioConfig)&&(n=await H(),this._releaseWorkerHandle={remove:()=>U()});let i=await D.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:n,signal:t});if(i==null)throw new r(`imagery-tile-layer:open`,`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){let n=`the tiled imagery data source is not supported`,i=e.type?.toLowerCase()===`coverage`?`CovJSON`:e.extent&&e.pixelBlock?`MEMORY`:null;if(!i)throw new r(`imagery-tile-layer:open`,n);i===`MEMORY`&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await D.open({url:``,source:e,datasetFormat:i,ioConfig:{sampling:`closest`,...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(a==null)throw new r(`imagery-tile-layer:open`,n);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let n={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>n[e.url]=e);let r=k(e.functionDefinition?.toJSON()??e.toJSON(),n),i=new E({rasterFunction:r});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof r&&i.getLogger(this).error(`imagery-tile-layer:open`,e.message),i.getLogger(this).warn(`imagery-tile-layer:open`,`the raster function cannot be applied and is removed`),this._set(`rasterFunction`,null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){G(i.getLogger(this),K(`ImageryTile layers`,`relative-to-scene`,e)),G(i.getLogger(this),q(`ImageryTile layers`,e))}};e([l({clonable:!1})],Z.prototype,`_primaryRasters`,void 0),e([l({clonable:!1})],Z.prototype,`_releaseWorkerHandle`,void 0),e([l({json:{origins:{"web-scene":{write:!1}},write:!0}})],Z.prototype,`charts`,void 0),e([l({type:Y,value:null,json:{name:`layerDefinition.elevationInfo`,write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Z.prototype,`elevationInfo`,null),e([l({type:W})],Z.prototype,`tileInfo`,void 0),e([l({readOnly:!0,clonable:!1})],Z.prototype,`graphicOrigin`,void 0),e([l(A)],Z.prototype,`legendEnabled`,void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Z.prototype,`isReference`,void 0),e([l({type:[`show`,`hide`]})],Z.prototype,`listMode`,void 0),e([l({json:{read:!0,write:!0}})],Z.prototype,`blendMode`,void 0),e([l({type:V,json:{name:`renderingRule`,write:!0}})],Z.prototype,`rasterFunction`,void 0),e([l()],Z.prototype,`sourceJSON`,void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:`currentVersion`}}}}})],Z.prototype,`version`,void 0),e([l({readOnly:!0,json:{read:!1}})],Z.prototype,`type`,void 0),e([l({type:[`ArcGISTiledImageServiceLayer`]})],Z.prototype,`operationalLayerType`,void 0),e([l({type:Boolean,value:!0,json:{read:{source:`disablePopup`,reader(e,t){return!t.disablePopup}},write:{target:`disablePopup`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}},writer(e,t,n){t[n]=!e}}}})],Z.prototype,`popupEnabled`,void 0),e([l({type:t,json:{read:{source:`popupInfo`},write:{target:`popupInfo`,overridePolicy(){return{enabled:!this.loaded||this.raster.tileType===`Raster`}}}}})],Z.prototype,`popupTemplate`,void 0),e([l({readOnly:!0})],Z.prototype,`defaultPopupTemplate`,null),e([l(j)],Z.prototype,`screenSizePerspectiveEnabled`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`fields`,void 0),e([l({readOnly:!0,type:[M]})],Z.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Z.prototype,`source`,void 0),Z=e([u(`esri.layers.ImageryTileLayer`)],Z);const Q=Z;function $(e,t){let{tileGeneration:n}=t??{};return n===`immediate`||/\.(png|gif|bmp)$/i.test(e)}export{Q as default};
|
|
@@ -101,16 +101,17 @@ export interface LineOfSightLayerProperties extends LayerProperties, Operational
|
|
|
101
101
|
* abortController.abort();
|
|
102
102
|
* ```
|
|
103
103
|
*
|
|
104
|
-
* If the [observer position](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisObserver/#position) or
|
|
105
|
-
* [target position](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisTarget/#position) have [z-values](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/#hasZ)
|
|
106
|
-
* then these will be treated as absolute values, otherwise the points will be aligned to the ground.
|
|
107
|
-
*
|
|
108
104
|
* > [!WARNING]
|
|
109
105
|
* >
|
|
110
|
-
* > **
|
|
111
|
-
* >
|
|
112
|
-
* >
|
|
113
|
-
* >
|
|
106
|
+
* > **Things to consider:**
|
|
107
|
+
* > * This layer is only supported in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
|
|
108
|
+
* > * The results of the tool vary depending on the zoom level, as changes in zoom level affect the level of detail (LOD) of the scene geometry.
|
|
109
|
+
* > * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from
|
|
110
|
+
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
111
|
+
* > * Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key.
|
|
112
|
+
* > * Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries),
|
|
113
|
+
* > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
|
|
114
|
+
* > [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/).
|
|
114
115
|
*
|
|
115
116
|
* @since 4.24
|
|
116
117
|
* @see [LineOfSightLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LineOfSightLayerView/)
|
|
@@ -118,6 +119,7 @@ export interface LineOfSightLayerProperties extends LayerProperties, Operational
|
|
|
118
119
|
* @see [LineOfSightAnalysisTarget](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisTarget/)
|
|
119
120
|
* @see [LineOfSightAnalysisObserver](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysisObserver/)
|
|
120
121
|
* @see [LineOfSightAnalysisView3D](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/LineOfSightAnalysisView3D/)
|
|
122
|
+
* @see [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/)
|
|
121
123
|
* @see [Line Of Sight component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-line-of-sight/)
|
|
122
124
|
*/
|
|
123
125
|
export default class LineOfSightLayer extends LineOfSightLayerSuperclass {
|
package/layers/SceneLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return(typeof e!=`object`||!e)&&(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load()}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return typeof e==`object`&&e||(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load()}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
|
|
@@ -19,10 +19,10 @@ import type { CustomParametersMixin, CustomParametersMixinProperties } from "./m
|
|
|
19
19
|
import type { DisplayFilteredLayer, DisplayFilteredLayerProperties } from "./mixins/DisplayFilteredLayer.js";
|
|
20
20
|
import type { EditBusLayer, EditBusLayerEvents } from "./mixins/EditBusLayer.js";
|
|
21
21
|
import type { FeatureLayerBase, FeatureLayerBaseProperties } from "./mixins/FeatureLayerBase.js";
|
|
22
|
-
import type { FeatureLayerReload } from "./mixins/FeatureLayerReload.js";
|
|
23
22
|
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
|
|
24
23
|
import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js";
|
|
25
24
|
import type { RefreshableLayerEvents, RefreshableLayer, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js";
|
|
25
|
+
import type { ReloadableLayer } from "./mixins/ReloadableLayer.js";
|
|
26
26
|
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
|
|
27
27
|
import type { TemporalLayer, TemporalLayerProperties } from "./mixins/TemporalLayer.js";
|
|
28
28
|
import type { PortalItemProperties } from "../portal/PortalItem.js";
|
|
@@ -880,4 +880,4 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
|
|
|
880
880
|
*/
|
|
881
881
|
updateAttachment(feature: Graphic, attachmentId: number, attachment: HTMLFormElement | FormData, options?: AttachmentEditOptions): Promise<FeatureEditResult>;
|
|
882
882
|
}
|
|
883
|
-
declare const SubtypeGroupLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof EditBusLayer & typeof DisplayFilteredLayer & typeof FeatureLayerBase & typeof
|
|
883
|
+
declare const SubtypeGroupLayerSuperclass: typeof Layer & typeof ClonableMixin & typeof APIKeyMixin & typeof CustomParametersMixin & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof BlendLayer & typeof EditBusLayer & typeof DisplayFilteredLayer & typeof FeatureLayerBase & typeof ReloadableLayer
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import n from"../core/Collection.js";import r from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{getOrCreateMapValue as a}from"../core/MapUtils.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee,whenOrAbort as c}from"../core/promiseUtils.js";import{watch as te,sync as ne}from"../core/reactiveUtils.js";import{sqlAnd as re}from"../core/sql.js";import{property as l,subclass as ie}from"../core/accessorSupport/decorators.js";import u from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISService as ae}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as p}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as m}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as h}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as g}from"./mixins/FeatureLayerBase.js";import{FeatureLayerReload as _}from"./mixins/FeatureLayerReload.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as w}from"./support/commonProperties.js";import{ensureLayerCredential as T,computeEffectiveEditingEnabled as E,addAttachment as D,updateAttachment as O,applyEdits as k,createQuery as A,deleteAttachments as oe,fetchRecomputedExtents as j,computeDomainFromSubtypes as M,getFeatureSubtype as N,queryAttachments as P,queryObjectIds as F,queryFeatureCount as I,queryExtent as L,queryRelatedFeatures as R,queryRelatedFeaturesCount as z,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as V}from"./support/fieldProperties.js";import{fixTimeInfoFields as H}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as U,createSimpleRenderersWithUniqueColors as W}from"./support/subtypeGroupLayerUtils.js";import G from"./support/SubtypeSublayer.js";import{serviceSupportsSpatialReference as K}from"./support/versionUtils.js";import q from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{addLayerUnsupportedError as J}from"../webdoc/support/unsupportedErrors.js";import{reader as ce}from"../core/accessorSupport/decorators/reader.js";const Y=`SubtypeGroupLayer`;function X(e,t){let n=[];for(let r of e){let e=new G;e.read(r,t),n.push(e)}return n}const Z=V();function Q(){return{name:`layerType`,read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let $=class extends _(g(m(h(f(S(x(b(ae(v(y(o(p(d(t(u))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(n.ofType(G)),this.useUniqueColorsForSublayers=!0,this.supportedPortalItemTypes=[`Feature Service`],this.supportedSourceTypes=new Set([`Feature Layer`,`Table`]),this.title=`Layer`,this.type=`subtype-group`,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/featureLayerUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}}),this.addHandles(te(()=>this.sublayers,(e,t)=>this._handleSublayersChange(e,t),ne))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:this.supportedPortalItemTypes},e).catch(ee).then(async()=>{if(!this.url)throw new r(`subtype-grouplayer:missing-url-or-source`,`SubtypeGroupLayer must be created with either a url or a portal item`);if(this.layerId==null)throw new r(`subtype-grouplayer:missing-layerid`,`layerId is required for a SubtypeGroupLayer created with url`);this._initLayerProperties(await this.createGraphicsSource(t))}).then(()=>T(this,`load`,e));return this.addResolvingPromise(n),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&&this.capabilities!=null&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return E(this)}get operationalLayerType(){return this.isTable?`SubtypeGroupTable`:`SubtypeGroupLayer`}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,n){let r=await D(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,n,r){let i=await O(this,e,t,n,Y,r);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return k(this,e,t)}async createGraphicsSource(e){let{default:t}=await c(import(`./graphics/sources/FeatureLayerSource.js`),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){let e=A(this),t=this.sublayers.map(e=>e.subtypeCode);return e.where=re(`${this.subtypeField} IN (${t.join(`,`)})`,this.definitionExpression),e}async deleteAttachments(e,t,n){let r=await oe(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return j(this,e,Y)}findSublayerForFeature(e){let t=this.fieldsIndex.get(this.subtypeField),n=e.attributes[t.name];return this.findSublayerForSubtypeCode(n)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){let t=M(this,e);if(t)return t}let n=N(this,t?.feature);if(n){let t=n.domains?.[e];return t?.type===`inherited`?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,e=>{e(this.sublayers)})}async queryAttachments(e,t){return P(this,e,t,Y)}async queryFeatures(e,t){let n=await this.load(),r=q.from(e)??n.createQuery(),i=r.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),r.outFields=i);let a=await n.source.queryFeatures(r,t);if(a?.features)for(let e of a.features)e.origin=this.findSublayerForFeature(e)?.graphicOrigin,e.layer=e.sourceLayer=this.findSublayerForFeature(e);return a}async queryObjectIds(e,t){return(await F(this,e,t,Y)).filter(se)}async queryFeatureCount(e,t){return I(this,e,t,Y)}async queryExtent(e,t){return L(this,e,t,Y)}async queryRelatedFeatures(e,t){return R(this,e,t,Y)}async queryRelatedFeaturesCount(e,t){return z(this,e,t,Y)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){let{origin:n,layerContainerType:i,messages:a}=t;if(this.isTable){if(n===`web-scene`||n===`web-map`&&i!==`tables`)return J(t,this,`a table source cannot be written to web scenes and web maps`),null}else if(this.loaded&&n===`web-map`&&i===`tables`)return J(t,this,`a non-table source cannot be written to tables in web maps`),null;return this.sublayers?.length?super.write(e,t):(a?.push(new r(`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?K(this,e):!1}async getFeatureTitle(e,t){let n=this.findSublayerForFeature(e);return n?await n.getFeatureTitle(e,t):this._getFeatureTitleForUnknownSublayer(e)}async getFeatureTitles(e,t){let n=new Map,r=new Map,i=[],o=[r];if(e.forEach(e=>{let o=this.findSublayerForFeature(e);if(o)a(n,o,()=>[]).push(e);else{let n=e.getObjectId()??e.attributes[this.objectIdField];t?.fetchMissingFields?i.push(e):r.set(n,this._getFeatureTitleForUnknownSublayer(e))}}),i.length>0){let e=new Set(this.featureTitleFields);e.add(this.objectIdField),e.add(this.subtypeField);let t=await this.queryFeatures({outFields:[...e],returnGeometry:!1,objectIds:i.map(e=>e.getObjectId()??e.attributes[this.objectIdField])}),o=new Set;for(let e of t.features??[]){let t=e.getObjectId()??e.attributes[this.objectIdField];o.add(t);let i=this.findSublayerForFeature(e);i?a(n,i,()=>[]).push(e):r.set(t,this._getFeatureTitleForUnknownSublayer(e))}for(let e of i){let t=e.getObjectId()??e.attributes[this.objectIdField];o.has(t)||r.set(t,this._getFeatureTitleForUnknownSublayer(e))}}(await Promise.all(Array.from(n).map(([e,n])=>e.getFeatureTitles(n,t)))).forEach(e=>o.push(e));let s=new Map(o.flatMap(e=>[...e]));return r.forEach((e,t)=>{s.set(t,e)}),s}get featureTitleFields(){let e=new Set;for(let t of this.sublayers){let n=t.featureTitleFields;for(let t of n)e.add(t)}return[...e]}_getLayerDomain(e){let t=this.fieldsIndex.get(e);return t?t.domain:null}_initLayerProperties(e){this._set(`source`,e);let{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:`service`,url:this.parsedUrl})),!this.subtypes?.length)throw new r(`subtype-grouplayer:missing-subtypes`,`SubtypeGroupLayer must be created using a layer with subtypes`);this._verifyFields(),H(this.timeInfo,this.fieldsIndex)}async reloadFromService(e){let t=this.source;await t.reload({signal:e}),this._initLayerProperties(t)}async hasDataChanged(){return B(this)}_verifyFields(){let e=this.parsedUrl?.path??`undefined`;this.objectIdField||console.log(`SubtypeGroupLayer: 'objectIdField' property is not defined (url: `+e+`)`),!this.isTable&&e.search(/\/FeatureServer\//i)===-1&&!this.fields?.some(e=>e.type===`geometry`)&&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`))}_getFeatureTitleForUnknownSublayer(e){let{displayField:t,fieldsIndex:n,objectIdField:r}=this;if(t&&n.has(t))return e.attributes[n.get(t).name]??``;let i=e.getObjectId();return i==null?r&&n.has(r)?e.attributes[n.get(r).name]??``:``:i.toString()}};e([l({readOnly:!0})],$.prototype,`createQueryVersion`,null),e([l({readOnly:!0})],$.prototype,`editingEnabled`,null),e([l({readOnly:!0})],$.prototype,`effectiveEditingEnabled`,null),e([l({...Z.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],$.prototype,`fields`,void 0),e([l(Z.fieldsIndex)],$.prototype,`fieldsIndex`,void 0),e([l(w)],$.prototype,`id`,void 0),e([l({type:[`show`,`hide`,`hide-children`],json:{origins:{"portal-item":{read:!1,write:!1}}}})],$.prototype,`listMode`,void 0),e([l({type:[`SubtypeGroupLayer`,`SubtypeGroupTable`],json:{...Q(),origins:{"web-document":Q(),"portal-item":Q()}}})],$.prototype,`operationalLayerType`,null),e([l(Z.outFields)],$.prototype,`outFields`,void 0),e([l({clonable:!1})],$.prototype,`source`,null),e([l({type:n.ofType(G),json:{origins:{service:{read:{source:`subtypes`,reader(e,t,r){let i=null;if(this.useUniqueColorsForSublayers){let n=U(t,r);i=n?W(e.length,n):null}let a=e.map(({code:e},n)=>{let a=new G({subtypeCode:e});a.read(t,r);let o=i?.[n];return o&&a.read({drawingInfo:{renderer:o.toJSON()}},r),a});return new(n.ofType(G))(a)}}}},read:{source:[`layers`,`tables`],reader(e,t,r){let i;return t.layerType===`SubtypeGroupLayer`&&t.layers?.length?i=X(t.layers,r):t.layerType===`SubtypeGroupTable`&&t.tables?.length&&(i=X(t.tables,r)),new(n.ofType(G))(i)}},write:{ignoreOrigin:!0,writer(e,t,n,r){let i=[];for(let t of e){let e=t.write({},r);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],$.prototype,`sublayers`,void 0),e([l()],$.prototype,`useUniqueColorsForSublayers`,void 0),e([l({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],$.prototype,`title`,void 0),e([ce(`service`,`title`,[`name`])],$.prototype,`readTitleFromService`,null),e([l({json:{read:!1}})],$.prototype,`type`,void 0),e([l({clonable:!1,readOnly:!0})],$.prototype,`featureTitleFields`,null),$=e([ie(`esri.layers.SubtypeGroupLayer`)],$);const le=$;export{le as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import n from"../core/Collection.js";import r from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{getOrCreateMapValue as a}from"../core/MapUtils.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as ee,whenOrAbort as c}from"../core/promiseUtils.js";import{watch as te,sync as ne}from"../core/reactiveUtils.js";import{sqlAnd as re}from"../core/sql.js";import{property as l,subclass as ie}from"../core/accessorSupport/decorators.js";import u from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISService as ae}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as p}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as m}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as h}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as g}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as y}from"./mixins/RefreshableLayer.js";import{ReloadableLayer as b}from"./mixins/ReloadableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as C}from"./support/arcgisLayerUrl.js";import{id as w}from"./support/commonProperties.js";import{ensureLayerCredential as T,computeEffectiveEditingEnabled as E,addAttachment as D,updateAttachment as O,applyEdits as k,createQuery as A,deleteAttachments as oe,fetchRecomputedExtents as j,computeDomainFromSubtypes as M,getFeatureSubtype as N,queryAttachments as P,queryObjectIds as F,queryFeatureCount as I,queryExtent as L,queryRelatedFeatures as R,queryRelatedFeaturesCount as z,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as V}from"./support/fieldProperties.js";import{fixTimeInfoFields as H}from"./support/fieldUtils.js";import{getSymbolWithColorSupport as U,createSimpleRenderersWithUniqueColors as W}from"./support/subtypeGroupLayerUtils.js";import G from"./support/SubtypeSublayer.js";import{serviceSupportsSpatialReference as K}from"./support/versionUtils.js";import q from"../rest/support/Query.js";import{isNumber as se}from"../support/guards.js";import{addLayerUnsupportedError as J}from"../webdoc/support/unsupportedErrors.js";import{reader as ce}from"../core/accessorSupport/decorators/reader.js";const Y=`SubtypeGroupLayer`;function X(e,t){let n=[];for(let r of e){let e=new G;e.read(r,t),n.push(e)}return n}const Z=V();function Q(){return{name:`layerType`,read:{enabled:!0},write:{enabled:!0,ignoreOrigin:!0,isRequired:!0}}}let $=class extends b(g(m(h(f(S(x(y(ae(_(v(o(p(d(t(u))))))))))))))){constructor(...e){super(...e),this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(n.ofType(G)),this.useUniqueColorsForSublayers=!0,this.supportedPortalItemTypes=[`Feature Service`],this.supportedSourceTypes=new Set([`Feature Layer`,`Table`]),this.title=`Layer`,this.type=`subtype-group`,this._debouncedSaveOperations=s(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/featureLayerUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}}),this.addHandles(te(()=>this.sublayers,(e,t)=>this._handleSublayersChange(e,t),ne))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:this.supportedPortalItemTypes},e).catch(ee).then(async()=>{if(!this.url)throw new r(`subtype-grouplayer:missing-url-or-source`,`SubtypeGroupLayer must be created with either a url or a portal item`);if(this.layerId==null)throw new r(`subtype-grouplayer:missing-layerid`,`layerId is required for a SubtypeGroupLayer created with url`);this._initLayerProperties(await this.createGraphicsSource(t))}).then(()=>T(this,`load`,e));return this.addResolvingPromise(n),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&&this.capabilities!=null&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return E(this)}get operationalLayerType(){return this.isTable?`SubtypeGroupTable`:`SubtypeGroupLayer`}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,n){let r=await D(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,n,r){let i=await O(this,e,t,n,Y,r);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return k(this,e,t)}async createGraphicsSource(e){let{default:t}=await c(import(`./graphics/sources/FeatureLayerSource.js`),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){let e=A(this),t=this.sublayers.map(e=>e.subtypeCode);return e.where=re(`${this.subtypeField} IN (${t.join(`,`)})`,this.definitionExpression),e}async deleteAttachments(e,t,n){let r=await oe(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return j(this,e,Y)}findSublayerForFeature(e){let t=this.fieldsIndex.get(this.subtypeField),n=e.attributes[t.name];return this.findSublayerForSubtypeCode(n)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains){let t=M(this,e);if(t)return t}let n=N(this,t?.feature);if(n){let t=n.domains?.[e];return t?.type===`inherited`?this._getLayerDomain(e):t}return this._getLayerDomain(e)}loadAll(){return i(this,e=>{e(this.sublayers)})}async queryAttachments(e,t){return P(this,e,t,Y)}async queryFeatures(e,t){let n=await this.load(),r=q.from(e)??n.createQuery(),i=r.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),r.outFields=i);let a=await n.source.queryFeatures(r,t);if(a?.features)for(let e of a.features)e.origin=this.findSublayerForFeature(e)?.graphicOrigin,e.layer=e.sourceLayer=this.findSublayerForFeature(e);return a}async queryObjectIds(e,t){return(await F(this,e,t,Y)).filter(se)}async queryFeatureCount(e,t){return I(this,e,t,Y)}async queryExtent(e,t){return L(this,e,t,Y)}async queryRelatedFeatures(e,t){return R(this,e,t,Y)}async queryRelatedFeaturesCount(e,t){return z(this,e,t,Y)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){let{origin:n,layerContainerType:i,messages:a}=t;if(this.isTable){if(n===`web-scene`||n===`web-map`&&i!==`tables`)return J(t,this,`a table source cannot be written to web scenes and web maps`),null}else if(this.loaded&&n===`web-map`&&i===`tables`)return J(t,this,`a non-table source cannot be written to tables in web maps`),null;return this.sublayers?.length?super.write(e,t):(a?.push(new r(`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?K(this,e):!1}async getFeatureTitle(e,t){let n=this.findSublayerForFeature(e);return n?await n.getFeatureTitle(e,t):this._getFeatureTitleForUnknownSublayer(e)}async getFeatureTitles(e,t){let n=new Map,r=new Map,i=[],o=[r];if(e.forEach(e=>{let o=this.findSublayerForFeature(e);if(o)a(n,o,()=>[]).push(e);else{let n=e.getObjectId()??e.attributes[this.objectIdField];t?.fetchMissingFields?i.push(e):r.set(n,this._getFeatureTitleForUnknownSublayer(e))}}),i.length>0){let e=new Set(this.featureTitleFields);e.add(this.objectIdField),e.add(this.subtypeField);let t=await this.queryFeatures({outFields:[...e],returnGeometry:!1,objectIds:i.map(e=>e.getObjectId()??e.attributes[this.objectIdField])}),o=new Set;for(let e of t.features??[]){let t=e.getObjectId()??e.attributes[this.objectIdField];o.add(t);let i=this.findSublayerForFeature(e);i?a(n,i,()=>[]).push(e):r.set(t,this._getFeatureTitleForUnknownSublayer(e))}for(let e of i){let t=e.getObjectId()??e.attributes[this.objectIdField];o.has(t)||r.set(t,this._getFeatureTitleForUnknownSublayer(e))}}(await Promise.all(Array.from(n).map(([e,n])=>e.getFeatureTitles(n,t)))).forEach(e=>o.push(e));let s=new Map(o.flatMap(e=>[...e]));return r.forEach((e,t)=>{s.set(t,e)}),s}get featureTitleFields(){let e=new Set;for(let t of this.sublayers){let n=t.featureTitleFields;for(let t of n)e.add(t)}return[...e]}_getLayerDomain(e){let t=this.fieldsIndex.get(e);return t?t.domain:null}_initLayerProperties(e){this._set(`source`,e);let{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:`service`,url:this.parsedUrl})),!this.subtypes?.length)throw new r(`subtype-grouplayer:missing-subtypes`,`SubtypeGroupLayer must be created using a layer with subtypes`);this._verifyFields(),H(this.timeInfo,this.fieldsIndex)}async reloadFromService(e){let t=this.source;await t.reload({signal:e}),this._initLayerProperties(t)}async hasDataChanged(){return B(this)}_verifyFields(){let e=this.parsedUrl?.path??`undefined`;this.objectIdField||console.log(`SubtypeGroupLayer: 'objectIdField' property is not defined (url: `+e+`)`),!this.isTable&&e.search(/\/FeatureServer\//i)===-1&&!this.fields?.some(e=>e.type===`geometry`)&&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`))}_getFeatureTitleForUnknownSublayer(e){let{displayField:t,fieldsIndex:n,objectIdField:r}=this;if(t&&n.has(t))return e.attributes[n.get(t).name]??``;let i=e.getObjectId();return i==null?r&&n.has(r)?e.attributes[n.get(r).name]??``:``:i.toString()}};e([l({readOnly:!0})],$.prototype,`createQueryVersion`,null),e([l({readOnly:!0})],$.prototype,`editingEnabled`,null),e([l({readOnly:!0})],$.prototype,`effectiveEditingEnabled`,null),e([l({...Z.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],$.prototype,`fields`,void 0),e([l(Z.fieldsIndex)],$.prototype,`fieldsIndex`,void 0),e([l(w)],$.prototype,`id`,void 0),e([l({type:[`show`,`hide`,`hide-children`],json:{origins:{"portal-item":{read:!1,write:!1}}}})],$.prototype,`listMode`,void 0),e([l({type:[`SubtypeGroupLayer`,`SubtypeGroupTable`],json:{...Q(),origins:{"web-document":Q(),"portal-item":Q()}}})],$.prototype,`operationalLayerType`,null),e([l(Z.outFields)],$.prototype,`outFields`,void 0),e([l({clonable:!1})],$.prototype,`source`,null),e([l({type:n.ofType(G),json:{origins:{service:{read:{source:`subtypes`,reader(e,t,r){let i=null;if(this.useUniqueColorsForSublayers){let n=U(t,r);i=n?W(e.length,n):null}let a=e.map(({code:e},n)=>{let a=new G({subtypeCode:e});a.read(t,r);let o=i?.[n];return o&&a.read({drawingInfo:{renderer:o.toJSON()}},r),a});return new(n.ofType(G))(a)}}}},read:{source:[`layers`,`tables`],reader(e,t,r){let i;return t.layerType===`SubtypeGroupLayer`&&t.layers?.length?i=X(t.layers,r):t.layerType===`SubtypeGroupTable`&&t.tables?.length&&(i=X(t.tables,r)),new(n.ofType(G))(i)}},write:{ignoreOrigin:!0,writer(e,t,n,r){let i=[];for(let t of e){let e=t.write({},r);i.push(e)}this.isTable?t.tables=i:t.layers=i}}}})],$.prototype,`sublayers`,void 0),e([l()],$.prototype,`useUniqueColorsForSublayers`,void 0),e([l({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],$.prototype,`title`,void 0),e([ce(`service`,`title`,[`name`])],$.prototype,`readTitleFromService`,null),e([l({json:{read:!1}})],$.prototype,`type`,void 0),e([l({clonable:!1,readOnly:!0})],$.prototype,`featureTitleFields`,null),$=e([ie(`esri.layers.SubtypeGroupLayer`)],$);const le=$;export{le as default};
|
|
@@ -64,7 +64,7 @@ export interface ViewshedLayerProperties extends LayerProperties, OperationalLay
|
|
|
64
64
|
* const layerView = await view.whenLayerView(viewshedLayer);
|
|
65
65
|
*
|
|
66
66
|
* // allow existing viewsheds in the layer to be selected and edited
|
|
67
|
-
* // select a viewshed by hovering and clicking on their
|
|
67
|
+
* // select a viewshed by hovering and clicking on their observer
|
|
68
68
|
* layerView.interactive = true;
|
|
69
69
|
*
|
|
70
70
|
* // start placing new viewsheds interactively
|
package/layers/VoxelLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Collection.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{Integer as l}from"../core/accessorSupport/ensureType.js";import{normalize as u}from"../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../geometry/Extent.js";import p from"../graphic/VoxelGraphicOrigin.js";import m from"./Layer.js";import{APIKeyMixin as h}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as _}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as b}from"./mixins/ScaleRangeLayer.js";import{SceneService as x}from"./mixins/SceneService.js";import{sanitizeUrl as S}from"./support/arcgisLayerUrl.js";import{legendEnabled as C,url as w}from"./support/commonProperties.js";import T from"./support/Field.js";import E from"./support/FieldsIndex.js";import D from"./support/TimeInfo.js";import O from"./voxel/VoxelSection.js";import k from"./voxel/VoxelSimpleShading.js";import A from"./voxel/VoxelVariable.js";import j from"./voxel/VoxelVariableStyle.js";import M from"./voxel/VoxelVolume.js";import N from"./voxel/VoxelVolumeIndex.js";import P from"./voxel/VoxelVolumeStyle.js";import{createPopupTemplate as F}from"../support/popupUtils.js";import I from"../time/TimeExtent.js";import L from"../time/TimeInterval.js";import{reader as R}from"../core/accessorSupport/decorators/reader.js";let z=class extends x(g(v(y(b(a(_(h(m)))))))){constructor(e){super(e),this.serviceRoot=``,this.operationalLayerType=`Voxel`,this.legendEnabled=!0,this.title=null,this.sections=null,this.currentVariableId=0,this.volumeStyles=null,this.renderMode=`volume`,this.variableStyles=null,this.enableSlices=!0,this.enableSections=!0,this.enableDynamicSections=!0,this.enableIsosurfaces=!0,this.graphicOrigin=new p(this),this.shading=new k,this.opacity=1,this.variables=new n,this.volumes=new n,this.index=null,this.minScale=0,this.maxScale=0,this.type=`voxel`,this.version={major:NaN,minor:NaN,versionString:``},this.fullExtent=null,this.popupEnabled=!1,this.popupTemplate=null,this.test=null,this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0,this.volumeStyles=new(n.ofType(P)),this.variableStyles=new(n.ofType(j)),this.sections=new(n.ofType(O))}normalizeCtorArgs(e){return e?.constantUpscaling&&(this.test={constantUpscaling:!0},delete e.constantUpscaling),e}set url(e){this._set(`url`,S(e,i.getLogger(this)))}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(o).then(()=>this._fetchService(t)).then(()=>this.serviceRoot=this.url);return this.addResolvingPromise(n),Promise.resolve(this)}read(e,t){super.read(e,t),t?.origin===`service`&&this.version.major<=3&&this.version.minor<=0&&!this.getAtOrigin(`popupTemplate`,`service`)&&this.setAtOrigin(`popupTemplate`,this.createPopupTemplate(),`service`);for(let e of this.volumes)e.spatialReference=this.spatialReference}readVersion(e,t){return super.parseVersionString(e)}validateLayer(e){if(e.layerType&&e.layerType!==this.operationalLayerType)throw new r(`voxel-layer:layer-type-not-supported`,`VoxelLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor)||this.version.major<3)throw new r(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`3.x`});if(this.version.major>3)throw new r(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`3.x`})}readFullExtent(e,t,n){if(typeof e==`object`&&e){let r=f.fromJSON(e,n);if(r.zmin===0&&r.zmax===0&&Array.isArray(t.volumes)){let e=M.fromJSON(t.volumes[0]);if(e.isValid&&e.volumeType!==`xyt`){let t=e.dimensions[2];if(t.isRegular){let e=t.regularSpacing.offset,n=t.regularSpacing.offset+t.regularSpacing.scale*(t.size-1);if(e>n){let t=e;e=n,n=t}r.zmin=e,r.zmax=n}}}return r}return null}get fields(){let e=[new T({name:`Voxel.Position`,alias:`Voxel Position`,domain:null,editable:!1,length:128,type:`string`}),new T({name:`Voxel.CurrentVariable`,alias:`Current Variable`,domain:null,editable:!1,length:128,type:`string`})];for(let t of this.variables){let n=new T({name:t.name,alias:t.description,domain:null,editable:!1,length:128,type:t.renderingFormat.continuity===`discrete`?`string`:`double`});e.push(n)}let t=this.getVolume(null);if(t!=null){if(t.volumeType===`xyzt`||t.volumeType===`xyt`){let t=new T({name:`Voxel.LocalTime`,alias:`Local Time`,domain:null,editable:!1,length:256,type:`date`});e.push(t);let n=new T({name:`Voxel.SourceTime`,alias:`Source Time`,domain:null,editable:!1,length:256,type:`string`});e.push(n)}if(t.volumeType!==`xyt`){let t=new T({name:`Voxel.Depth`,alias:`Depth`,domain:null,editable:!1,length:128,type:`double`});e.push(t)}}return e}get fieldsIndex(){return this.loaded?new E(this.fields):null}getField(e){return this.fieldsIndex?.get(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(e){let t=this.fields;return F({fields:t,title:`{Voxel.Position}`},e)}getConfiguration(){let e={layerType:this.operationalLayerType,version:this.version.versionString,name:this.title,spatialReference:this.spatialReference,fullExtent:this.fullExtent,volumes:this.volumes.toJSON(),variables:this.variables.toJSON(),index:this.index?.toJSON(),sections:this.getSections(),style:{volumeStyles:this.getVolumeStyles(),currentVariableId:this.currentVariableId,renderMode:this.renderMode,variableStyles:this.getVariableStyles(),enableSections:this.enableSections,enableDynamicSections:this.enableDynamicSections,enableIsosurfaces:this.enableIsosurfaces,enableSlices:this.enableSlices,shading:this.shading}};return!e.index||!this.index?.isValid()?``:JSON.stringify(e)}getVariableStyle(e){let t=-1;if(t=e??this.currentVariableId,!this.variableStyles||t===-1)return null;let n=this.variableStyles.findIndex(e=>e.variableId===t);return n<0?null:this.variableStyles.at(n)}getVariable(e){let t=-1;if(t=e??this.currentVariableId,!this.variables||t===-1)return null;let n=this.variables.findIndex(e=>e.id===t);return n<0?null:this.variables.at(n)}getVolume(e){let t=this.getVariable(e);return t==null?null:this.volumes.find(({id:e})=>e===t.volumeId)}get timeInfo(){let e=this.getVolume(null);if(e?.volumeType!==`xyzt`)return null;let t=e.timeStops;if(!t?.length)return null;let n=new I({start:t[0],end:t.at(-1)});return new D({fullTimeExtent:n,stops:t})}getVolumeStyle(e){let t=this.getVariable(e);return t==null?null:this.volumeStyles.find(({volumeId:e})=>e===t.volumeId)}getColorForContinuousDataValue(e,t,n){let r=this.getVariable(e);if(r==null||r.renderingFormat?.continuity!==`continuous`||!this.variableStyles)return null;let i=this.variableStyles.findIndex(t=>t.variableId===e);if(i<0)return null;let a=this.variableStyles.at(i);return a?.transferFunction?a.transferFunction.getColorForContinuousDataValue(t,n):null}getSections(){let e=[];for(let t of this.sections)e.push(new O({enabled:t.enabled,href:t.href,id:t.id,label:t.label,normal:t.normal,point:t.point,sizeInPixel:t.sizeInPixel,slices:t.slices,timeId:t.timeId,variableId:t.variableId}));return e}getVariableStyles(){let e=[];for(let t of this.variableStyles){let n=this._getVariable(t);if(n!=null){let r=t.clone();r.isosurfaces.length>4&&(r.isosurfaces=r.isosurfaces.slice(0,3),i.getLogger(this).error(`A maximum of 4 isosurfaces are supported for Voxel Layers.`));for(let e of r.isosurfaces)if(!e.colorLocked){let t=this.getColorForContinuousDataValue(r.variableId,e.value,!1);t!=null&&!t.equals(e.color)&&(e.color=t)}if(n.renderingFormat.continuity===`continuous`)(r.transferFunction===null||r.transferFunction.colorStops.length<2)&&i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. At least 2 color stops are required in the transferFunction for continuous Voxel Layer variables.`),r.transferFunction!==null&&(!Array.isArray(r.transferFunction.stretchRange)||r.transferFunction.stretchRange.length!==2)&&(i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. The stretchRange of the transferFunction for continuous Voxel Layer variables must be of the form [minimumDataValue, maximumDataValue].`),r.transferFunction.stretchRange=[0,1],r.transferFunction.colorStops.removeAll());else if(n.renderingFormat.continuity===`discrete`){if(t.uniqueValues.length===0)i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. Unique values are required for discrete Voxel Layer variables.`);else for(let e of t.uniqueValues)(e.label===null||e.label===void 0)&&e.value!==null&&e.value!==void 0&&(e.label=e.value.toString())}e.push(r)}else i.getLogger(this).error(`VoxelVariable ID=${t.variableId} doesn't exist, VoxelVariableStyle for this VoxelVariable will be ignored.`)}return e}getVolumeStyles(){let e=[];for(let t of this.volumeStyles){let n=this._getVolumeFromVolumeId(t.volumeId);if(n!=null){let r=t.clone();for(let e of r.slices)this._isPlaneValid(e,[0,1,n.zDimension],n.dimensions)||(e.enabled=!1,e.label=`invalid`);for(let e of r.dynamicSections)this._isPlaneValid(e,[0,1,n.zDimension],n.dimensions)||(e.enabled=!1,e.label=`invalid`);e.push(r)}else i.getLogger(this).error(`VoxelVolume ID=${t.volumeId} doesn't exist, VoxelVolumeStyle for this VoxelVolume will be ignored.`)}return e}_getVariable(e){let t=e.variableId;for(let e of this.variables)if(e.id===t)return e;return null}_getVolumeFromVolumeId(e){for(let t of this.volumes)if(t.id===e)return t;return null}_isPlaneValid(e,t,n){if(!e.point||!Array.isArray(e.point)||e.point.length!==3||!e.normal||!Array.isArray(e.normal)||e.normal.length!==3)return!1;let r=d(e.normal[0],e.normal[1],e.normal[2]);return u(r,r),Math.abs(r[0])+Math.abs(r[1])+Math.abs(r[2])<1e-6?!1:(e.normal[0]=r[0],e.normal[1]=r[1],e.normal[2]=r[2],!0)}};e([s({type:[`Voxel`]})],z.prototype,`operationalLayerType`,void 0),e([s(C)],z.prototype,`legendEnabled`,void 0),e([s({json:{write:!0}})],z.prototype,`title`,void 0),e([s(w)],z.prototype,`url`,null),e([s({type:n.ofType(O),json:{origins:{"web-scene":{name:`layerDefinition.sections`,write:!0}}}})],z.prototype,`sections`,void 0),e([s({type:l,json:{origins:{"web-scene":{name:`layerDefinition.style.currentVariableId`,write:{enabled:!0,isRequired:!0,ignoreOrigin:!0}},service:{name:`style.currentVariableId`}}}})],z.prototype,`currentVariableId`,void 0),e([s({type:n.ofType(P),json:{origins:{"web-scene":{name:`layerDefinition.style.volumeStyles`,write:!0},service:{name:`style.volumeStyles`}}}})],z.prototype,`volumeStyles`,void 0),e([s({type:[`volume`,`surfaces`],json:{origins:{"web-scene":{name:`layerDefinition.style.renderMode`,write:!0},service:{name:`style.renderMode`}}}})],z.prototype,`renderMode`,void 0),e([s({type:n.ofType(j),json:{origins:{"web-scene":{name:`layerDefinition.style.variableStyles`,write:!0},service:{name:`style.variableStyles`}}}})],z.prototype,`variableStyles`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableSlices`,write:!0},service:{name:`style.enableSlices`}}}})],z.prototype,`enableSlices`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableSections`,write:!0},service:{name:`style.enableSections`}}}})],z.prototype,`enableSections`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableDynamicSections`,write:!0},service:{name:`style.enableDynamicSections`}}}})],z.prototype,`enableDynamicSections`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableIsosurfaces`,write:!0},service:{name:`style.enableIsosurfaces`}}}})],z.prototype,`enableIsosurfaces`,void 0),e([s({readOnly:!0})],z.prototype,`graphicOrigin`,void 0),e([s({type:k,json:{origins:{"web-scene":{name:`layerDefinition.style.shading`,write:!0},service:{name:`style.shading`}}}})],z.prototype,`shading`,void 0),e([s({type:[`show`,`hide`]})],z.prototype,`listMode`,void 0),e([s({type:Number,range:{min:0,max:1},nonNullable:!0,json:{read:!1,write:!1,origins:{"web-scene":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],z.prototype,`opacity`,void 0),e([s({type:n.ofType(A)})],z.prototype,`variables`,void 0),e([s({type:n.ofType(M)})],z.prototype,`volumes`,void 0),e([s({type:N})],z.prototype,`index`,void 0),e([s({type:Number,json:{name:`layerDefinition.minScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],z.prototype,`minScale`,void 0),e([s({type:Number,json:{name:`layerDefinition.maxScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],z.prototype,`maxScale`,void 0),e([s({json:{read:!1},readOnly:!0})],z.prototype,`type`,void 0),e([s({readOnly:!0,json:{name:`serviceVersion`}})],z.prototype,`version`,void 0),e([R(`service`,`version`)],z.prototype,`readVersion`,null),e([s({type:f})],z.prototype,`fullExtent`,void 0),e([R(`service`,`fullExtent`,[`fullExtent`])],z.prototype,`readFullExtent`,null),e([s({readOnly:!0,clonable:!1,json:{read:!1}})],z.prototype,`fields`,null),e([s({readOnly:!0})],z.prototype,`fieldsIndex`,null),e([s({type:Boolean,json:{name:`disablePopup`,read:{reader(e,t){return!t.disablePopup}},write:{enabled:!0,ignoreOrigin:!0,writer(e,t,n){t[n]=!e}},origins:{"portal-item":{default:!0},"web-scene":{default:!0}}}})],z.prototype,`popupEnabled`,void 0),e([s({type:t,json:{name:`popupInfo`,write:!0}})],z.prototype,`popupTemplate`,void 0),e([s({readOnly:!0,json:{read:!1}})],z.prototype,`defaultPopupTemplate`,null),e([s({type:D,readOnly:!0,json:{read:!1}})],z.prototype,`timeInfo`,null),e([s({type:I,json:{read:!1}})],z.prototype,`timeExtent`,void 0),e([s({type:L,json:{read:!1}})],z.prototype,`timeOffset`,void 0),e([s({type:Boolean,nonNullable:!0,json:{origins:{"web-scene":{name:`timeAnimation`,write:!0},service:{read:!1}}}})],z.prototype,`useViewTime`,void 0),z=e([c(`esri.layers.VoxelLayer`)],z);const B=z;export{B as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Collection.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{Integer as l}from"../core/accessorSupport/ensureType.js";import{normalize as u}from"../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../geometry/Extent.js";import p from"../graphic/VoxelGraphicOrigin.js";import m from"./Layer.js";import{APIKeyMixin as h}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as _}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as b}from"./mixins/ScaleRangeLayer.js";import{SceneService as x}from"./mixins/SceneService.js";import{sanitizeUrl as S}from"./support/arcgisLayerUrl.js";import{legendEnabled as C,url as w}from"./support/commonProperties.js";import T from"./support/Field.js";import E from"./support/FieldsIndex.js";import D from"./support/TimeInfo.js";import O from"./voxel/VoxelSection.js";import k from"./voxel/VoxelSimpleShading.js";import A from"./voxel/VoxelVariable.js";import j from"./voxel/VoxelVariableStyle.js";import M from"./voxel/VoxelVolume.js";import N from"./voxel/VoxelVolumeIndex.js";import P from"./voxel/VoxelVolumeStyle.js";import{createPopupTemplate as F}from"../support/popupUtils.js";import I from"../time/TimeExtent.js";import L from"../time/TimeInterval.js";import{reader as R}from"../core/accessorSupport/decorators/reader.js";let z=class extends x(g(v(y(b(a(_(h(m)))))))){constructor(e){super(e),this.serviceRoot=``,this.operationalLayerType=`Voxel`,this.legendEnabled=!0,this.title=null,this.sections=null,this.currentVariableId=0,this.volumeStyles=null,this.renderMode=`volume`,this.variableStyles=null,this.enableSlices=!0,this.enableSections=!0,this.enableDynamicSections=!0,this.enableIsosurfaces=!0,this.graphicOrigin=new p(this),this.shading=new k,this.opacity=1,this.variables=new n,this.volumes=new n,this.index=null,this.minScale=0,this.maxScale=0,this.type=`voxel`,this.version={major:NaN,minor:NaN,versionString:``},this.fullExtent=null,this.popupEnabled=!1,this.popupTemplate=null,this.test=null,this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0,this.volumeStyles=new(n.ofType(P)),this.variableStyles=new(n.ofType(j)),this.sections=new(n.ofType(O))}normalizeCtorArgs(e){return e?.constantUpscaling&&(this.test={constantUpscaling:!0},delete e.constantUpscaling),e}set url(e){this._set(`url`,S(e,i.getLogger(this)))}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(o).then(()=>this._fetchService(t)).then(()=>this.serviceRoot=this.url);return this.addResolvingPromise(n),Promise.resolve(this)}read(e,t){super.read(e,t),t?.origin===`service`&&this.version.major<=3&&this.version.minor<=0&&!this.getAtOrigin(`popupTemplate`,`service`)&&this.setAtOrigin(`popupTemplate`,this.createPopupTemplate(),`service`);for(let e of this.volumes)e.spatialReference=this.spatialReference}readVersion(e,t){return super.parseVersionString(e)}validateLayer(e){if(e.layerType&&e.layerType!==this.operationalLayerType)throw new r(`voxel-layer:layer-type-not-supported`,`VoxelLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor)||this.version.major<3)throw new r(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`3.x`});if(this.version.major>3)throw new r(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`3.x`})}readFullExtent(e,t,n){if(typeof e==`object`&&e){let r=f.fromJSON(e,n);if(r.zmin===0&&r.zmax===0&&Array.isArray(t.volumes)){let e=M.fromJSON(t.volumes[0]);if(e.isValid&&e.volumeType!==`xyt`){let t=e.dimensions[2];if(t.isRegular){let e=t.regularSpacing.offset,n=t.regularSpacing.offset+t.regularSpacing.scale*(t.size-1);if(e>n){let t=e;e=n,n=t}r.zmin=e,r.zmax=n}}}return r}return null}get fields(){let e=[new T({name:`Voxel.Position`,alias:`Voxel Position`,domain:null,editable:!1,length:128,type:`string`}),new T({name:`Voxel.CurrentVariable`,alias:`Current Variable`,domain:null,editable:!1,length:128,type:`string`})];for(let t of this.variables){let n=new T({name:t.name,alias:t.description,domain:null,editable:!1,length:128,type:t.renderingFormat.continuity===`discrete`?`string`:`double`});e.push(n)}let t=this.getVolume(null);if(t!=null){if(t.volumeType===`xyzt`||t.volumeType===`xyt`){let t=new T({name:`Voxel.LocalTime`,alias:`Local Time`,domain:null,editable:!1,length:256,type:`date`});e.push(t);let n=new T({name:`Voxel.SourceTime`,alias:`Source Time`,domain:null,editable:!1,length:256,type:`string`});e.push(n)}if(t.volumeType!==`xyt`){let t=new T({name:`Voxel.Depth`,alias:`Depth`,domain:null,editable:!1,length:128,type:`double`});e.push(t)}}return e}get fieldsIndex(){return this.loaded?new E(this.fields):null}getField(e){return this.fieldsIndex?.get(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(e){let t=this.fields;return F({fields:t,title:`{Voxel.Position}`},e)}getConfiguration(){let e={layerType:this.operationalLayerType,version:this.version.versionString,name:this.title,spatialReference:this.spatialReference,fullExtent:this.fullExtent,volumes:this.volumes.toJSON(),variables:this.variables.toJSON(),index:this.index?.toJSON(),sections:this.getSections(),style:{volumeStyles:this.getVolumeStyles(),currentVariableId:this.currentVariableId,renderMode:this.renderMode,variableStyles:this.getVariableStyles(),enableSections:this.enableSections,enableDynamicSections:this.enableDynamicSections,enableIsosurfaces:this.enableIsosurfaces,enableSlices:this.enableSlices,shading:this.shading}};return!e.index||!this.index?.isValid()?``:JSON.stringify(e)}getVariableStyle(e){let t=-1;if(t=e??this.currentVariableId,!this.variableStyles||t===-1)return null;let n=this.variableStyles.findIndex(e=>e.variableId===t);return n<0?null:this.variableStyles.at(n)}getVariable(e){let t=-1;if(t=e??this.currentVariableId,!this.variables||t===-1)return null;let n=this.variables.findIndex(e=>e.id===t);return n<0?null:this.variables.at(n)}getVolume(e){let t=this.getVariable(e);return t==null?null:this.volumes.find(({id:e})=>e===t.volumeId)}get timeInfo(){let e=this.getVolume(null);if(e?.volumeType!==`xyzt`)return null;let t=e.timeStops;if(!t?.length)return null;let n=new I({start:t[0],end:t.at(-1)});return new D({fullTimeExtent:n,stops:t})}getVolumeStyle(e){let t=this.getVariable(e);return t==null?null:this.volumeStyles.find(({volumeId:e})=>e===t.volumeId)}getColorForContinuousDataValue(e,t,n){let r=this.getVariable(e);if(r==null||r.renderingFormat?.continuity!==`continuous`||!this.variableStyles)return null;let i=this.variableStyles.findIndex(t=>t.variableId===e);if(i<0)return null;let a=this.variableStyles.at(i);return a?.transferFunction?a.transferFunction.getColorForContinuousDataValue(t,n):null}getSections(){let e=[];for(let t of this.sections)e.push(new O({enabled:t.enabled,href:t.href,id:t.id,label:t.label,normal:t.normal,point:t.point,sizeInPixel:t.sizeInPixel,slices:t.slices,timeId:t.timeId,variableId:t.variableId}));return e}getVariableStyles(){let e=[];for(let t of this.variableStyles){let n=this._getVariable(t);if(n!=null){let r=t.clone();r.isosurfaces.length>4&&(r.isosurfaces=r.isosurfaces.slice(0,3),i.getLogger(this).error(`A maximum of 4 isosurfaces are supported for Voxel Layers.`));for(let e of r.isosurfaces)if(!e.colorLocked){let t=this.getColorForContinuousDataValue(r.variableId,e.value,!1);t!=null&&!t.equals(e.color)&&(e.color=t)}if(n.renderingFormat.continuity===`continuous`)(r.transferFunction===null||r.transferFunction.colorStops.length<2)&&i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. At least 2 color stops are required in the transferFunction for continuous Voxel Layer variables.`),r.transferFunction!==null&&(Array.isArray(r.transferFunction.stretchRange)&&r.transferFunction.stretchRange.length===2||(i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. The stretchRange of the transferFunction for continuous Voxel Layer variables must be of the form [minimumDataValue, maximumDataValue].`),r.transferFunction.stretchRange=[0,1],r.transferFunction.colorStops.removeAll()));else if(n.renderingFormat.continuity===`discrete`){if(t.uniqueValues.length===0)i.getLogger(this).error(`VoxelVariableStyle for variable ${n.id} is invalid. Unique values are required for discrete Voxel Layer variables.`);else for(let e of t.uniqueValues)(e.label===null||e.label===void 0)&&e.value!==null&&e.value!==void 0&&(e.label=e.value.toString())}e.push(r)}else i.getLogger(this).error(`VoxelVariable ID=${t.variableId} doesn't exist, VoxelVariableStyle for this VoxelVariable will be ignored.`)}return e}getVolumeStyles(){let e=[];for(let t of this.volumeStyles){let n=this._getVolumeFromVolumeId(t.volumeId);if(n!=null){let r=t.clone();for(let e of r.slices)this._isPlaneValid(e,[0,1,n.zDimension],n.dimensions)||(e.enabled=!1,e.label=`invalid`);for(let e of r.dynamicSections)this._isPlaneValid(e,[0,1,n.zDimension],n.dimensions)||(e.enabled=!1,e.label=`invalid`);e.push(r)}else i.getLogger(this).error(`VoxelVolume ID=${t.volumeId} doesn't exist, VoxelVolumeStyle for this VoxelVolume will be ignored.`)}return e}_getVariable(e){let t=e.variableId;for(let e of this.variables)if(e.id===t)return e;return null}_getVolumeFromVolumeId(e){for(let t of this.volumes)if(t.id===e)return t;return null}_isPlaneValid(e,t,n){if(!e.point||!Array.isArray(e.point)||e.point.length!==3||!e.normal||!Array.isArray(e.normal)||e.normal.length!==3)return!1;let r=d(e.normal[0],e.normal[1],e.normal[2]);return u(r,r),Math.abs(r[0])+Math.abs(r[1])+Math.abs(r[2])<1e-6?!1:(e.normal[0]=r[0],e.normal[1]=r[1],e.normal[2]=r[2],!0)}};e([s({type:[`Voxel`]})],z.prototype,`operationalLayerType`,void 0),e([s(C)],z.prototype,`legendEnabled`,void 0),e([s({json:{write:!0}})],z.prototype,`title`,void 0),e([s(w)],z.prototype,`url`,null),e([s({type:n.ofType(O),json:{origins:{"web-scene":{name:`layerDefinition.sections`,write:!0}}}})],z.prototype,`sections`,void 0),e([s({type:l,json:{origins:{"web-scene":{name:`layerDefinition.style.currentVariableId`,write:{enabled:!0,isRequired:!0,ignoreOrigin:!0}},service:{name:`style.currentVariableId`}}}})],z.prototype,`currentVariableId`,void 0),e([s({type:n.ofType(P),json:{origins:{"web-scene":{name:`layerDefinition.style.volumeStyles`,write:!0},service:{name:`style.volumeStyles`}}}})],z.prototype,`volumeStyles`,void 0),e([s({type:[`volume`,`surfaces`],json:{origins:{"web-scene":{name:`layerDefinition.style.renderMode`,write:!0},service:{name:`style.renderMode`}}}})],z.prototype,`renderMode`,void 0),e([s({type:n.ofType(j),json:{origins:{"web-scene":{name:`layerDefinition.style.variableStyles`,write:!0},service:{name:`style.variableStyles`}}}})],z.prototype,`variableStyles`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableSlices`,write:!0},service:{name:`style.enableSlices`}}}})],z.prototype,`enableSlices`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableSections`,write:!0},service:{name:`style.enableSections`}}}})],z.prototype,`enableSections`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableDynamicSections`,write:!0},service:{name:`style.enableDynamicSections`}}}})],z.prototype,`enableDynamicSections`,void 0),e([s({type:Boolean,json:{origins:{"web-scene":{name:`layerDefinition.style.enableIsosurfaces`,write:!0},service:{name:`style.enableIsosurfaces`}}}})],z.prototype,`enableIsosurfaces`,void 0),e([s({readOnly:!0})],z.prototype,`graphicOrigin`,void 0),e([s({type:k,json:{origins:{"web-scene":{name:`layerDefinition.style.shading`,write:!0},service:{name:`style.shading`}}}})],z.prototype,`shading`,void 0),e([s({type:[`show`,`hide`]})],z.prototype,`listMode`,void 0),e([s({type:Number,range:{min:0,max:1},nonNullable:!0,json:{read:!1,write:!1,origins:{"web-scene":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],z.prototype,`opacity`,void 0),e([s({type:n.ofType(A)})],z.prototype,`variables`,void 0),e([s({type:n.ofType(M)})],z.prototype,`volumes`,void 0),e([s({type:N})],z.prototype,`index`,void 0),e([s({type:Number,json:{name:`layerDefinition.minScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],z.prototype,`minScale`,void 0),e([s({type:Number,json:{name:`layerDefinition.maxScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],z.prototype,`maxScale`,void 0),e([s({json:{read:!1},readOnly:!0})],z.prototype,`type`,void 0),e([s({readOnly:!0,json:{name:`serviceVersion`}})],z.prototype,`version`,void 0),e([R(`service`,`version`)],z.prototype,`readVersion`,null),e([s({type:f})],z.prototype,`fullExtent`,void 0),e([R(`service`,`fullExtent`,[`fullExtent`])],z.prototype,`readFullExtent`,null),e([s({readOnly:!0,clonable:!1,json:{read:!1}})],z.prototype,`fields`,null),e([s({readOnly:!0})],z.prototype,`fieldsIndex`,null),e([s({type:Boolean,json:{name:`disablePopup`,read:{reader(e,t){return!t.disablePopup}},write:{enabled:!0,ignoreOrigin:!0,writer(e,t,n){t[n]=!e}},origins:{"portal-item":{default:!0},"web-scene":{default:!0}}}})],z.prototype,`popupEnabled`,void 0),e([s({type:t,json:{name:`popupInfo`,write:!0}})],z.prototype,`popupTemplate`,void 0),e([s({readOnly:!0,json:{read:!1}})],z.prototype,`defaultPopupTemplate`,null),e([s({type:D,readOnly:!0,json:{read:!1}})],z.prototype,`timeInfo`,null),e([s({type:I,json:{read:!1}})],z.prototype,`timeExtent`,void 0),e([s({type:L,json:{read:!1}})],z.prototype,`timeOffset`,void 0),e([s({type:Boolean,nonNullable:!0,json:{origins:{"web-scene":{name:`timeAnimation`,write:!0},service:{read:!1}}}})],z.prototype,`useViewTime`,void 0),z=e([c(`esri.layers.VoxelLayer`)],z);const B=z;export{B as default};
|
package/layers/WMSLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../config.js";import n from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../request.js";import a from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import s from"../core/Error.js";import{JSONMap as c}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONSupportMixin as u}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d}from"../core/promiseUtils.js";import{on as f,sync as p,watch as m}from"../core/reactiveUtils.js";import{renderingSanitizer as h}from"../core/sanitizerUtils.js";import{urlToObject as g,addQueryParameters as _,addProxy as v,makeAbsolute as y,Url as b}from"../core/urlUtils.js";import{property as x,subclass as S}from"../core/accessorSupport/decorators.js";import{Integer as C}from"../core/accessorSupport/ensureType.js";import{willPropertyWrite as w}from"../core/accessorSupport/write.js";import T from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as D}from"../geometry/support/scaleUtils.js";import{equals as O}from"../geometry/support/spatialReferenceUtils.js";import ee from"./Layer.js";import{BlendLayer as te}from"./mixins/BlendLayer.js";import{OperationalLayer as k}from"./mixins/OperationalLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as P}from"./ogc/crsUtils.js";import{isWmsServer as F}from"./support/arcgisLayerUrl.js";import{legendEnabled as I,url as L}from"./support/commonProperties.js";import{ExportWMSImageParameters as R}from"./support/ExportWMSImageParameters.js";import{createBitmap as z}from"./support/imageBitmapUtils.js";import B from"./support/WMSSublayer.js";import{normalizeWKID as V,toTimeQueryParameter as H,getPopupLayers as U,parseCapabilities as W}from"./support/wmsUtils.js";import G from"../time/TimeExtent.js";import K from"../time/TimeInterval.js";import{reader as q}from"../core/accessorSupport/decorators/reader.js";import{writer as J}from"../core/accessorSupport/decorators/writer.js";const Y=new c({bmp:`image/bmp`,gif:`image/gif`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`},{ignoreUnknown:!1});function X(e){return e===`text/html`}function Z(e){return e===`text/plain`}let Q=class extends te(N(j(M(k(A(u(ee))))))){constructor(...e){super(...e),this.allSublayers=new o({getCollections:()=>[this.sublayers],getChildrenFunction(e){return e.sublayers}}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType=`WMS`,this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type=`wms`,this.version=null,this.addHandles([f(()=>this.sublayers,`after-add`,({item:e})=>{e.parent=e.layer=this},p),f(()=>this.sublayers,`after-remove`,({item:e})=>{e.layer=e.parent=null},p),m(()=>this.sublayers,(e,t)=>{if(t)for(let e of t)e.layer=e.parent=null;if(e)for(let t of e)t.parent=t.layer=this},p)])}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`WMS`]},e).catch(d).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}get timeInfo(){return super.timeInfo}set timeInfo(e){super.timeInfo=e}readFullExtentFromItemOrMap(e,t){let n=t.extent;return n?new T({xmin:n[0][0],ymin:n[0][1],xmax:n[1][0],ymax:n[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return this.featureInfoFormats==null?null:this.featureInfoFormats.find(X)??this.featureInfoFormats.find(Z)??null}set featureInfoFormat(e){e==null?(this.revertToOrigin(`featureInfoFormat`,`service`),this._clearOverride(`featureInfoFormat`)):(X(e)||Z(e))&&this._override(`featureInfoFormat`,e)}readImageFormat(e,t){let n=t.supportedImageFormatTypes;return n&&n.includes(`image/png`)?`image/png`:n&&n[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){let n=this.spatialReference?.wkid;e&&n?(t.spatialReferences=e.filter(e=>e!==n),t.spatialReferences.unshift(n)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,n){return $(t.layers,n,t.visibleLayers)}readSublayers(e,t,n){return $(t.layers,n)}writeSublayers(e,t,n,r){t.layers=[];let i=new Map,a=e.flatten(({sublayers:e})=>e??[]);for(let e of a)if(typeof e.parent?.id==`number`){let t=i.get(e.parent.id);t==null?i.set(e.parent.id,[e.id]):t.push(e.id)}for(let e of a){let n={sublayer:e,...r},a=e.write({parentLayerId:typeof e.parent?.id==`number`?e.parent.id:-1},n);if(i.has(e.id)&&(a.sublayerIds=i.get(e.id)),!e.sublayers&&e.name){let r=e.write({},n);delete r.id,t.layers.push(r)}}t.visibleLayers=a.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e){this._set(`url`,e);return}let{path:t,query:n}=g(e);for(let e in n)/^(request|service)$/i.test(e)&&delete n[e];let r=_(t,n??{});this._set(`url`,r)}createExportImageParameters(e,t,n,r){let i=r?.pixelRatio??1,a=D({extent:e,width:t})*i,o=new R({layer:this,scale:a}),{xmin:s,ymin:c,xmax:l,ymax:u,spatialReference:d}=e,f=V(d,this.spatialReferences),p=this.version===`1.3.0`&&P(f)?`${c},${s},${u},${l}`:`${s},${c},${l},${u}`,m=o.toJSON();return{bbox:p,[this.version===`1.3.0`?`crs`:`srs`]:f==null||isNaN(f)?void 0:`EPSG:`+f,...m}}async fetchImage(e,t,n,r){let a=this.mapUrl,o=this.createExportImageParameters(e,t,n,r);if(!o.layers){let e=document.createElement(`canvas`);return e.width=t,e.height=n,e}let s=H(r?.timeExtent),c={responseType:`image`,query:this._mixCustomParameters({width:t,height:n,...o,time:s,...this.refreshParameters}),signal:r?.signal};return i(a??``,c).then(e=>e.data)}async fetchImageBitmap(e,t,n,r){let a=this.mapUrl??``,o=this.createExportImageParameters(e,t,n,r);if(!o.layers){let e=document.createElement(`canvas`);return e.width=t,e.height=n,e}let s=H(r?.timeExtent),c={responseType:`blob`,query:this._mixCustomParameters({width:t,height:n,...o,time:s,...this.refreshParameters}),signal:r?.signal},{data:l}=await i(a,c);return z(l,a,r)}fetchFeatureInfo(e,t,n,r,i){let a=D({extent:e,width:t}),o=new R({layer:this,scale:a}),s=U(o.visibleSublayers);if(this.featureInfoUrl==null||s==null||this.fetchFeatureInfoFunction==null&&this.featureInfoFormat==null)return Promise.resolve([]);let c=this.version===`1.3.0`?{I:r,J:i}:{x:r,y:i},l={query_layers:s,request:`GetFeatureInfo`,info_format:this.featureInfoFormat,feature_count:25,width:t,height:n,...c},u={...this.createExportImageParameters(e,t,n),...l},d=this._mixCustomParameters(u);return this.fetchFeatureInfoFunction==null?this._defaultFetchFeatureInfoFunction(_(this.featureInfoUrl,d)):this.fetchFeatureInfoFunction(d)}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return F(this.url)||this.spatialReferences!=null&&this.spatialReferences.some(t=>{let n=t===900913?E.WebMercator:new E({wkid:t});return O(n,e)})}_defaultFetchFeatureInfoFunction(e){let t=document.createElement(`iframe`);t.src=v(h.sanitizeUrl(y(e))),t.style.border=`none`,t.style.margin=`0`,t.style.width=`100%`,t.setAttribute(`sandbox`,``);let i=new r({title:this.title,content:t}),a=new n({sourceLayer:this,popupTemplate:i});return Promise.resolve([a])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){let{path:t,query:n}=this.parsedUrl,{data:r}=await i(t,{query:{SERVICE:`WMS`,REQUEST:`GetCapabilities`,...n,...this.customParameters},responseType:`xml`,signal:e});this.resourceInfo=W(r)}if(this.parsedUrl){let e=new b(this.parsedUrl.path),{httpsDomains:n}=t.request;e.scheme===`https`&&(!e.port||e.port===`443`)&&e.host&&!n.includes(e.host)&&n.push(e.host)}this.read(this.resourceInfo,{origin:`service`})}_checkLayerValidity(){if(!this.allSublayers.length)throw new s(`wmslayer:empty-layer`,`The layer doesn't have any sublayer`)}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;let t={...this.customParameters,...this.customLayerParameters};for(let n in t)e[n.toLowerCase()]=t[n];return e}};e([x({type:G})],Q.prototype,`timeExtent`,void 0),e([x({type:K})],Q.prototype,`timeOffset`,void 0),e([x({readOnly:!0})],Q.prototype,`allSublayers`,void 0),e([x({json:{type:Object,write:!0}})],Q.prototype,`customParameters`,void 0),e([x({json:{type:Object,write:!0}})],Q.prototype,`customLayerParameters`,void 0),e([x({type:String,json:{write:!0}})],Q.prototype,`copyright`,void 0),e([x()],Q.prototype,`description`,void 0),e([x({readOnly:!0})],Q.prototype,`dimensions`,void 0),e([x({json:{type:[[Number]],read:{source:`extent`},write:{target:`extent`},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,`fullExtent`,void 0),e([q([`web-document`,`portal-item`],`fullExtent`,[`extent`])],Q.prototype,`readFullExtentFromItemOrMap`,null),e([J([`web-document`,`portal-item`],`fullExtent`,{extent:{type:[[Number]]}})],Q.prototype,`writeFullExtent`,null),e([x({type:[T]})],Q.prototype,`fullExtents`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`featureInfoFormat`,null),e([x({type:[String],readOnly:!0})],Q.prototype,`featureInfoFormats`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`featureInfoUrl`,void 0),e([x()],Q.prototype,`fetchFeatureInfoFunction`,void 0),e([x({type:String,json:{origins:{"web-document":{default:`image/png`,type:Y.jsonValues,read:{reader:Y.read,source:`format`},write:{writer:Y.write,target:`format`}}}}})],Q.prototype,`imageFormat`,void 0),e([q(`imageFormat`,[`supportedImageFormatTypes`])],Q.prototype,`readImageFormat`,null),e([x({type:Number,json:{read:{source:`maxHeight`},write:{target:`maxHeight`}}})],Q.prototype,`imageMaxHeight`,void 0),e([x({type:Number,json:{read:{source:`maxWidth`},write:{target:`maxWidth`}}})],Q.prototype,`imageMaxWidth`,void 0),e([x()],Q.prototype,`imageTransparency`,void 0),e([x(I)],Q.prototype,`legendEnabled`,void 0),e([x({type:[`show`,`hide`,`hide-children`]})],Q.prototype,`listMode`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`mapUrl`,void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,`isReference`,void 0),e([x({type:[`WMS`]})],Q.prototype,`operationalLayerType`,void 0),e([x()],Q.prototype,`resourceInfo`,void 0),e([x({type:E,json:{origins:{service:{read:{source:`extent.spatialReference`}}},write:!1}})],Q.prototype,`spatialReference`,void 0),e([q([`web-document`,`portal-item`],`spatialReference`,[`spatialReferences`])],Q.prototype,`readSpatialReferenceFromItemOrDocument`,null),e([x({type:[C],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,`spatialReferences`,void 0),e([J([`web-document`,`portal-item`],`spatialReferences`)],Q.prototype,`writeSpatialReferences`,null),e([x({type:a.ofType(B),json:{write:{target:`layers`,overridePolicy(e,t,n){if(ne(this.allSublayers,n))return{ignoreOrigin:!0}}}}})],Q.prototype,`sublayers`,void 0),e([q([`web-document`,`portal-item`],`sublayers`,[`layers`,`visibleLayers`])],Q.prototype,`readSublayersFromItemOrMap`,null),e([q(`service`,`sublayers`,[`layers`])],Q.prototype,`readSublayers`,null),e([J(`sublayers`,{layers:{type:[B]},visibleLayers:{type:[String]}})],Q.prototype,`writeSublayers`,null),e([x({json:{read:!1},readOnly:!0,value:`wms`})],Q.prototype,`type`,void 0),e([x(L)],Q.prototype,`url`,null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`version`,void 0),Q=e([S(`esri.layers.WMSLayer`)],Q);function ne(e,t){return e.some(e=>{for(let n in e)if(w(e,n,null,t))return!0;return!1})}function $(e,t,n){e??=[];let r=new Map;e.every(e=>e.id==null)&&(e=l(e),e.forEach((e,t)=>e.id=t));for(let i of e){let e=new B;e.read(i,t),n&&!n.includes(e.name)&&(e.visible=!1),r.set(e.id,e)}let i=[];for(let t of e){let e=t.id==null?null:r.get(t.id);if(e){if(t.parentLayerId!=null&&t.parentLayerId>=0){let n=r.get(t.parentLayerId);if(!n)continue;n.sublayers||=new a,n.sublayers.push(e)}else i.push(e)}}return i}const re=Q;export{re as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../config.js";import n from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../request.js";import a from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import s from"../core/Error.js";import{JSONMap as c}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONSupportMixin as u}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d}from"../core/promiseUtils.js";import{on as f,sync as p,watch as m}from"../core/reactiveUtils.js";import{renderingSanitizer as h}from"../core/sanitizerUtils.js";import{urlToObject as g,addQueryParameters as _,addProxy as v,makeAbsolute as y,Url as b}from"../core/urlUtils.js";import{property as x,subclass as S}from"../core/accessorSupport/decorators.js";import{Integer as C}from"../core/accessorSupport/ensureType.js";import{willPropertyWrite as w}from"../core/accessorSupport/write.js";import T from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as D}from"../geometry/support/scaleUtils.js";import{equals as O}from"../geometry/support/spatialReferenceUtils.js";import ee from"./Layer.js";import{BlendLayer as te}from"./mixins/BlendLayer.js";import{OperationalLayer as k}from"./mixins/OperationalLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as P}from"./ogc/crsUtils.js";import{isWmsServer as F}from"./support/arcgisLayerUrl.js";import{legendEnabled as I,url as L}from"./support/commonProperties.js";import{ExportWMSImageParameters as R}from"./support/ExportWMSImageParameters.js";import{createBitmap as z}from"./support/imageBitmapUtils.js";import B from"./support/WMSSublayer.js";import{normalizeWKID as V,toTimeQueryParameter as H,getPopupLayers as U,parseCapabilities as W}from"./support/wmsUtils.js";import G from"../time/TimeExtent.js";import K from"../time/TimeInterval.js";import{reader as q}from"../core/accessorSupport/decorators/reader.js";import{writer as J}from"../core/accessorSupport/decorators/writer.js";const Y=new c({bmp:`image/bmp`,gif:`image/gif`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`},{ignoreUnknown:!1});function X(e){return e===`text/html`}function Z(e){return e===`text/plain`}let Q=class extends te(N(j(M(k(A(u(ee))))))){constructor(...e){super(...e),this.allSublayers=new o({getCollections:()=>[this.sublayers],getChildrenFunction(e){return e.sublayers}}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType=`WMS`,this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type=`wms`,this.version=null,this.addHandles([f(()=>this.sublayers,`after-add`,({item:e})=>{e.parent=e.layer=this},p),f(()=>this.sublayers,`after-remove`,({item:e})=>{e.layer=e.parent=null},p),m(()=>this.sublayers,(e,t)=>{if(t)for(let e of t)e.layer=e.parent=null;if(e)for(let t of e)t.parent=t.layer=this},p)])}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:[`WMS`]},e).catch(d).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}get timeInfo(){return super.timeInfo}set timeInfo(e){super.timeInfo=e}readFullExtentFromItemOrMap(e,t){let n=t.extent;return n?new T({xmin:n[0][0],ymin:n[0][1],xmax:n[1][0],ymax:n[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return this.featureInfoFormats==null?null:this.featureInfoFormats.find(X)??this.featureInfoFormats.find(Z)??null}set featureInfoFormat(e){e==null?(this.revertToOrigin(`featureInfoFormat`,`service`),this._clearOverride(`featureInfoFormat`)):(X(e)||Z(e))&&this._override(`featureInfoFormat`,e)}readImageFormat(e,t){let n=t.supportedImageFormatTypes;return n&&n.includes(`image/png`)?`image/png`:n&&n[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){let n=this.spatialReference?.wkid;e&&n?(t.spatialReferences=e.filter(e=>e!==n),t.spatialReferences.unshift(n)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,n){return $(t.layers,n,t.visibleLayers)}readSublayers(e,t,n){return $(t.layers,n)}writeSublayers(e,t,n,r){t.layers=[];let i=new Map,a=e.flatten(({sublayers:e})=>e??[]);for(let e of a)if(typeof e.parent?.id==`number`){let t=i.get(e.parent.id);t==null?i.set(e.parent.id,[e.id]):t.push(e.id)}for(let e of a){let n={sublayer:e,...r},a=e.write({parentLayerId:typeof e.parent?.id==`number`?e.parent.id:-1},n);if(i.has(e.id)&&(a.sublayerIds=i.get(e.id)),!e.sublayers&&e.name){let r=e.write({},n);delete r.id,t.layers.push(r)}}t.visibleLayers=a.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e){this._set(`url`,e);return}let{path:t,query:n}=g(e);for(let e in n)/^(request|service)$/i.test(e)&&delete n[e];let r=_(t,n??{});this._set(`url`,r)}createExportImageParameters(e,t,n,r){let i=r?.pixelRatio??1,a=D({extent:e,width:t})*i,o=new R({layer:this,scale:a}),{xmin:s,ymin:c,xmax:l,ymax:u,spatialReference:d}=e,f=V(d,this.spatialReferences),p=this.version===`1.3.0`&&P(f)?`${c},${s},${u},${l}`:`${s},${c},${l},${u}`,m=o.toJSON();return{bbox:p,[this.version===`1.3.0`?`crs`:`srs`]:f==null||isNaN(f)?void 0:`EPSG:`+f,...m}}async fetchImage(e,t,n,r){let a=this.mapUrl,o=this.createExportImageParameters(e,t,n,r);if(!o.layers){let e=document.createElement(`canvas`);return e.width=t,e.height=n,e}let s=H(r?.timeExtent),c={responseType:`image`,query:this._mixCustomParameters({width:t,height:n,...o,time:s,...this.refreshParameters}),signal:r?.signal};return i(a??``,c).then(e=>e.data)}async fetchImageBitmap(e,t,n,r){let a=this.mapUrl??``,o=this.createExportImageParameters(e,t,n,r);if(!o.layers){let e=document.createElement(`canvas`);return e.width=t,e.height=n,e}let s=H(r?.timeExtent),c={responseType:`blob`,query:this._mixCustomParameters({width:t,height:n,...o,time:s,...this.refreshParameters}),signal:r?.signal},{data:l}=await i(a,c);return z(l,a,r)}fetchFeatureInfo(e,t,n,r,i){let a=D({extent:e,width:t}),o=new R({layer:this,scale:a}),s=U(o.visibleSublayers);if(this.featureInfoUrl==null||s==null||this.fetchFeatureInfoFunction==null&&this.featureInfoFormat==null)return Promise.resolve([]);let c=this.version===`1.3.0`?{I:r,J:i}:{x:r,y:i},l={query_layers:s,request:`GetFeatureInfo`,info_format:this.featureInfoFormat,feature_count:25,width:t,height:n,...c},u={...this.createExportImageParameters(e,t,n),...l},d=this._mixCustomParameters(u);return this.fetchFeatureInfoFunction==null?this._defaultFetchFeatureInfoFunction(_(this.featureInfoUrl,d)):this.fetchFeatureInfoFunction(d)}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return F(this.url)||this.spatialReferences!=null&&this.spatialReferences.some(t=>{let n=t===900913?E.WebMercator:new E({wkid:t});return O(n,e)})}_defaultFetchFeatureInfoFunction(e){let t=document.createElement(`iframe`);t.src=v(h.sanitizeUrl(y(e))),t.style.border=`none`,t.style.margin=`0`,t.style.width=`100%`,t.setAttribute(`sandbox`,``);let i=new r({title:this.title,content:t}),a=new n({sourceLayer:this,popupTemplate:i});return Promise.resolve([a])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){let{path:t,query:n}=this.parsedUrl,{data:r}=await i(t,{query:{SERVICE:`WMS`,REQUEST:`GetCapabilities`,...n,...this.customParameters},responseType:`xml`,signal:e});this.resourceInfo=W(r)}if(this.parsedUrl){let e=new b(this.parsedUrl.path),{httpsDomains:n}=t.request;e.scheme!==`https`||e.port&&e.port!==`443`||!e.host||n.includes(e.host)||n.push(e.host)}this.read(this.resourceInfo,{origin:`service`})}_checkLayerValidity(){if(!this.allSublayers.length)throw new s(`wmslayer:empty-layer`,`The layer doesn't have any sublayer`)}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;let t={...this.customParameters,...this.customLayerParameters};for(let n in t)e[n.toLowerCase()]=t[n];return e}};e([x({type:G})],Q.prototype,`timeExtent`,void 0),e([x({type:K})],Q.prototype,`timeOffset`,void 0),e([x({readOnly:!0})],Q.prototype,`allSublayers`,void 0),e([x({json:{type:Object,write:!0}})],Q.prototype,`customParameters`,void 0),e([x({json:{type:Object,write:!0}})],Q.prototype,`customLayerParameters`,void 0),e([x({type:String,json:{write:!0}})],Q.prototype,`copyright`,void 0),e([x()],Q.prototype,`description`,void 0),e([x({readOnly:!0})],Q.prototype,`dimensions`,void 0),e([x({json:{type:[[Number]],read:{source:`extent`},write:{target:`extent`},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,`fullExtent`,void 0),e([q([`web-document`,`portal-item`],`fullExtent`,[`extent`])],Q.prototype,`readFullExtentFromItemOrMap`,null),e([J([`web-document`,`portal-item`],`fullExtent`,{extent:{type:[[Number]]}})],Q.prototype,`writeFullExtent`,null),e([x({type:[T]})],Q.prototype,`fullExtents`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`featureInfoFormat`,null),e([x({type:[String],readOnly:!0})],Q.prototype,`featureInfoFormats`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`featureInfoUrl`,void 0),e([x()],Q.prototype,`fetchFeatureInfoFunction`,void 0),e([x({type:String,json:{origins:{"web-document":{default:`image/png`,type:Y.jsonValues,read:{reader:Y.read,source:`format`},write:{writer:Y.write,target:`format`}}}}})],Q.prototype,`imageFormat`,void 0),e([q(`imageFormat`,[`supportedImageFormatTypes`])],Q.prototype,`readImageFormat`,null),e([x({type:Number,json:{read:{source:`maxHeight`},write:{target:`maxHeight`}}})],Q.prototype,`imageMaxHeight`,void 0),e([x({type:Number,json:{read:{source:`maxWidth`},write:{target:`maxWidth`}}})],Q.prototype,`imageMaxWidth`,void 0),e([x()],Q.prototype,`imageTransparency`,void 0),e([x(I)],Q.prototype,`legendEnabled`,void 0),e([x({type:[`show`,`hide`,`hide-children`]})],Q.prototype,`listMode`,void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`mapUrl`,void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,`isReference`,void 0),e([x({type:[`WMS`]})],Q.prototype,`operationalLayerType`,void 0),e([x()],Q.prototype,`resourceInfo`,void 0),e([x({type:E,json:{origins:{service:{read:{source:`extent.spatialReference`}}},write:!1}})],Q.prototype,`spatialReference`,void 0),e([q([`web-document`,`portal-item`],`spatialReference`,[`spatialReferences`])],Q.prototype,`readSpatialReferenceFromItemOrDocument`,null),e([x({type:[C],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,`spatialReferences`,void 0),e([J([`web-document`,`portal-item`],`spatialReferences`)],Q.prototype,`writeSpatialReferences`,null),e([x({type:a.ofType(B),json:{write:{target:`layers`,overridePolicy(e,t,n){if(ne(this.allSublayers,n))return{ignoreOrigin:!0}}}}})],Q.prototype,`sublayers`,void 0),e([q([`web-document`,`portal-item`],`sublayers`,[`layers`,`visibleLayers`])],Q.prototype,`readSublayersFromItemOrMap`,null),e([q(`service`,`sublayers`,[`layers`])],Q.prototype,`readSublayers`,null),e([J(`sublayers`,{layers:{type:[B]},visibleLayers:{type:[String]}})],Q.prototype,`writeSublayers`,null),e([x({json:{read:!1},readOnly:!0,value:`wms`})],Q.prototype,`type`,void 0),e([x(L)],Q.prototype,`url`,null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,`version`,void 0),Q=e([S(`esri.layers.WMSLayer`)],Q);function ne(e,t){return e.some(e=>{for(let n in e)if(w(e,n,null,t))return!0;return!1})}function $(e,t,n){e??=[];let r=new Map;e.every(e=>e.id==null)&&(e=l(e),e.forEach((e,t)=>e.id=t));for(let i of e){let e=new B;e.read(i,t),n&&!n.includes(e.name)&&(e.visible=!1),r.set(e.id,e)}let i=[];for(let t of e){let e=t.id==null?null:r.get(t.id);if(e){if(t.parentLayerId!=null&&t.parentLayerId>=0){let n=r.get(t.parentLayerId);if(!n)continue;n.sublayers||=new a,n.sublayers.push(e)}else i.push(e)}}return i}const re=Q;export{re as default};
|
package/layers/effects/parser.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{hexToRgba as e,isNamedColor as t,getNamedColorCopy as n,hslaToRgba as r}from"../../colorUtils.js";import i from"../../core/Error.js";import{BloomEffect as a,DropShadowEffect as o,BlurEffect as s,HueRotateEffect as c,OpacityEffect as l,ColorMatrixEffect as u}from"./effects.js";import{canInterpolateEffects as d,normalizeEffects as f}from"./utils.js";class
|
|
2
|
+
import{hexToRgba as e,isNamedColor as t,getNamedColorCopy as n,hslaToRgba as r}from"../../colorUtils.js";import i from"../../core/Error.js";import{BloomEffect as a,DropShadowEffect as o,BlurEffect as s,HueRotateEffect as c,OpacityEffect as l,ColorMatrixEffect as u}from"./effects.js";import{canInterpolateEffects as d,normalizeEffects as f}from"./utils.js";class p extends SyntaxError{constructor(e,t,n,r){super(e),this.expected=t,this.found=n,this.location=r,this.name=`SyntaxError`}format(e){let t=`Error: `+this.message;if(this.location){let n=null,r=e.find(e=>e.source===this.location.source);r&&(n=r.text.split(/\r\n|\n|\r/g));let i=this.location.start,a=this.location.source&&typeof this.location.source.offset==`function`?this.location.source.offset(i):i,o=this.location.source+`:`+a.line+`:`+a.column;if(n){let e=this.location.end,r=``.padEnd(a.line.toString().length,` `),s=n[i.line-1],c=(i.line===e.line?e.column:s.length+1)-i.column||1;t+=`
|
|
3
3
|
--> `+o+`
|
|
4
4
|
`+r+` |
|
|
5
5
|
`+a.line+` | `+s+`
|
|
6
6
|
`+r+` | `+``.padEnd(i.column-1,` `)+``.padEnd(c,`^`)}else t+=`
|
|
7
|
-
at `+o}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,`unicode`)?RegExp(`[\\p{C}\\p{Mn}\\p{Mc}]`,`gu`):null;function i(e){return r?e.replace(r,e=>`\\u{`+n(e)+`}`):e}function a(e){return i(e.replace(
|
|
8
|
-
`,`\r`],!1,!1,!1),ne=K(`function`),v=W(`(`,!1),re=K(`identifier`),y=G([[`a`,`z`],`-`],!1,!1,!1),b=K(`percentage`),x=W(`%`,!1),S=K(`length`),C=W(`px`,!1),w=W(`cm`,!1),T=W(`mm`,!1),ie=W(`in`,!1),E=W(`pt`,!1),ae=W(`pc`,!1),D=K(`angle`),oe=W(`deg`,!1),O=W(`rad`,!1),k=W(`grad`,!1),A=W(`turn`,!1),j=K(`number`),M=K(`color`),N=W(`#`,!1),P=G([[`0`,`9`],[`a`,`f`],[`A`,`F`]],!1,!1,!1),se=G([`+`,`-`],!1,!1,!1),F=G([[`0`,`9`]],!1,!1,!1),ce=W(`.`,!1),le=W(`e`,!1);function ue(){return[]}function de(e,t){return{type:`function`,name:e,parameters:t||[]}}function fe(e,t){return t.length>0?Ye(e,t,3):[e]}function pe(e){return{type:`quantity`,value:e.value,unit:e.unit}}function me(e){return{type:`color`,colorType:e.type,value:e.value}}function he(e){return e}function ge(){return U()}function _e(e){return{value:e,unit:`%`}}function ve(e){return{value:e,unit:`px`}}function ye(e){return{value:e,unit:`cm`}}function be(e){return{value:e,unit:`mm`}}function xe(e){return{value:e,unit:`in`}}function Se(e){return{value:e,unit:`pt`}}function Ce(e){return{value:e,unit:`pc`}}function we(e){return{value:e,unit:`deg`}}function Te(e){return{value:e,unit:`rad`}}function Ee(e){return{value:e,unit:`grad`}}function De(e){return{value:e,unit:`turn`}}function Oe(e){return{value:e,unit:null}}function ke(){return{type:`hex`,value:U()}}function Ae(e){return{type:`function`,value:e}}function je(){return{type:`named`,value:U()}}function Me(){return parseFloat(U())}let I=t.peg$currPos|0,L=I,R=[{line:1,column:1}],z=I,B=t.peg$maxFailExpected||[],V=t.peg$silentFails|0,H;if(t.startRule){if(!(t.startRule in i))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);a=i[t.startRule]}function U(){return e.substring(L,I)}function Ne(t=I){let n=e.codePointAt(t);return n===void 0?``:String.fromCodePoint(n)}function W(e,t){return{type:`literal`,text:e,ignoreCase:t}}function G(e,t,n,r){return{type:`class`,parts:e,inverted:t,ignoreCase:n,unicode:r}}function Pe(){return{type:`end`}}function K(e){return{type:`other`,description:e}}function Fe(t){let n=R[t],r;if(n)return n;if(t>=R.length)r=R.length-1;else for(r=t;!R[--r];);for(n=R[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return R[t]=n,n}function Ie(e,t,n){let i=Fe(e),a=Fe(t);return{source:r,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:a.line,column:a.column}}}function q(e){I<z||(I>z&&(z=I,B=[]),B.push(e))}function Le(e,t,n){return new ee(ee.buildMessage(e,t),e,t,n)}function J(){let e;return e=Re(),e===n&&(e=ze()),e}function Re(){let t,r;return V++,t=I,Z(),e.substr(I,4)===o?(r=o,I+=4):(r=n,V===0&&q(m)),r===n?(I=t,t=n):(Z(),L=t,t=ue()),V--,t===n&&V===0&&q(te),t}function ze(){let e,t;if(e=[],t=Y(),t!==n)for(;t!==n;)e.push(t),t=Y();else e=n;return e}function Y(){let t,r,i,a;return t=I,Z(),r=Ve(),r===n?(I=t,t=n):(Z(),i=Be(),i===n&&(i=null),Z(),e.charCodeAt(I)===41?(a=`)`,I++):(a=n,V===0&&q(h)),a===n?(I=t,t=n):(Z(),L=t,t=de(r,i))),t}function Be(){let t,r,i,a,o,s,c,l;if(t=I,r=X(),r!==n){for(i=[],a=I,o=Z(),e.charCodeAt(I)===44?(s=`,`,I++):(s=n,V===0&&q(g)),s===n&&(s=null),c=Z(),l=X(),l===n?(I=a,a=n):(o=[o,s,c,l],a=o);a!==n;)i.push(a),a=I,o=Z(),e.charCodeAt(I)===44?(s=`,`,I++):(s=n,V===0&&q(g)),s===n&&(s=null),c=Z(),l=X(),l===n?(I=a,a=n):(o=[o,s,c,l],a=o);L=t,t=fe(r,i)}else I=t,t=n;return t}function X(){let e,t;return e=I,t=Ue(),t===n&&(t=We(),t===n&&(t=Ge(),t===n&&(t=Ke()))),t!==n&&(L=e,t=pe(t)),e=t,e===n&&(e=I,t=qe(),t!==n&&(L=e,t=me(t)),e=t),e}function Z(){let t,r;for(V++,t=[],r=e.charAt(I),l.test(r)?I++:(r=n,V===0&&q(_));r!==n;)t.push(r),r=e.charAt(I),l.test(r)?I++:(r=n,V===0&&q(_));return V--,t}function Ve(){let t,r,i;return V++,t=I,r=He(),r===n?(I=t,t=n):(e.charCodeAt(I)===40?(i=`(`,I++):(i=n,V===0&&q(v)),i===n?(I=t,t=n):(L=t,t=he(r))),V--,t===n&&(r=n,V===0&&q(ne)),t}function He(){let t,r,i;if(V++,t=I,r=[],i=e.charAt(I),u.test(i)?I++:(i=n,V===0&&q(y)),i!==n)for(;i!==n;)r.push(i),i=e.charAt(I),u.test(i)?I++:(i=n,V===0&&q(y));else r=n;return r!==n&&(L=t,r=ge()),t=r,V--,t===n&&(r=n,V===0&&q(re)),t}function Ue(){let t,r,i;return V++,t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.charCodeAt(I)===37?(i=`%`,I++):(i=n,V===0&&q(x)),i===n?(I=t,t=n):(L=t,t=_e(r))),V--,t===n&&V===0&&q(b),t}function We(){let t,r,i;return V++,t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`px`?(i=`px`,I+=2):(i=n,V===0&&q(C)),i===n?(I=t,t=n):(L=t,t=ve(r))),t===n&&(t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`cm`?(i=`cm`,I+=2):(i=n,V===0&&q(w)),i===n?(I=t,t=n):(L=t,t=ye(r))),t===n&&(t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`mm`?(i=`mm`,I+=2):(i=n,V===0&&q(T)),i===n?(I=t,t=n):(L=t,t=be(r))),t===n&&(t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`in`?(i=`in`,I+=2):(i=n,V===0&&q(ie)),i===n?(I=t,t=n):(L=t,t=xe(r))),t===n&&(t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`pt`?(i=`pt`,I+=2):(i=n,V===0&&q(E)),i===n?(I=t,t=n):(L=t,t=Se(r))),t===n&&(t=I,Z(),r=Q(),r===n?(I=t,t=n):(e.substr(I,2)===`pc`?(i=`pc`,I+=2):(i=n,V===0&&q(ae)),i===n?(I=t,t=n):(L=t,t=Ce(r)))))))),V--,t===n&&V===0&&q(S),t}function Ge(){let t,r,i;return V++,t=I,r=Q(),r===n?(I=t,t=n):(e.substr(I,3)===`deg`?(i=`deg`,I+=3):(i=n,V===0&&q(oe)),i===n?(I=t,t=n):(L=t,t=we(r))),t===n&&(t=I,r=Q(),r===n?(I=t,t=n):(e.substr(I,3)===`rad`?(i=`rad`,I+=3):(i=n,V===0&&q(O)),i===n?(I=t,t=n):(L=t,t=Te(r))),t===n&&(t=I,r=Q(),r===n?(I=t,t=n):(e.substr(I,4)===s?(i=s,I+=4):(i=n,V===0&&q(k)),i===n?(I=t,t=n):(L=t,t=Ee(r))),t===n&&(t=I,r=Q(),r===n?(I=t,t=n):(e.substr(I,4)===c?(i=c,I+=4):(i=n,V===0&&q(A)),i===n?(I=t,t=n):(L=t,t=De(r)))))),V--,t===n&&(r=n,V===0&&q(D)),t}function Ke(){let e,t;return V++,e=I,Z(),t=Q(),t===n?(I=e,e=n):(L=e,e=Oe(t)),V--,e===n&&V===0&&q(j),e}function qe(){let t,r,i,a;if(V++,t=I,e.charCodeAt(I)===35?(r=`#`,I++):(r=n,V===0&&q(N)),r!==n){if(i=[],a=e.charAt(I),d.test(a)?I++:(a=n,V===0&&q(P)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(I),d.test(a)?I++:(a=n,V===0&&q(P));else i=n;i===n?(I=t,t=n):(L=t,t=ke())}else I=t,t=n;return t===n&&(t=I,r=Y(),r!==n&&(L=t,r=Ae(r)),t=r,t===n&&(t=I,r=He(),r!==n&&(L=t,r=je()),t=r)),V--,t===n&&(r=n,V===0&&q(M)),t}function Q(){let t,r,i,a,o,s,c,l;for(t=I,r=e.charAt(I),f.test(r)?I++:(r=n,V===0&&q(se)),r===n&&(r=null),i=I,a=[],o=e.charAt(I),p.test(o)?I++:(o=n,V===0&&q(F));o!==n;)a.push(o),o=e.charAt(I),p.test(o)?I++:(o=n,V===0&&q(F));if(e.charCodeAt(I)===46?(o=`.`,I++):(o=n,V===0&&q(ce)),o!==n){if(s=[],c=e.charAt(I),p.test(c)?I++:(c=n,V===0&&q(F)),c!==n)for(;c!==n;)s.push(c),c=e.charAt(I),p.test(c)?I++:(c=n,V===0&&q(F));else s=n;s===n?(I=i,i=n):(a=[a,o,s],i=a)}else I=i,i=n;if(i===n){if(i=[],a=e.charAt(I),p.test(a)?I++:(a=n,V===0&&q(F)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(I),p.test(a)?I++:(a=n,V===0&&q(F));else i=n}if(i!==n){if(a=I,e.charCodeAt(I)===101?(o=`e`,I++):(o=n,V===0&&q(le)),o!==n){if(s=e.charAt(I),f.test(s)?I++:(s=n,V===0&&q(se)),s===n&&(s=null),c=[],l=e.charAt(I),p.test(l)?I++:(l=n,V===0&&q(F)),l!==n)for(;l!==n;)c.push(l),l=e.charAt(I),p.test(l)?I++:(l=n,V===0&&q(F));else c=n;c===n?(I=a,a=n):(o=[o,s,c],a=o)}else I=a,a=n;a===n&&(a=null),L=t,t=Me()}else I=t,t=n;return t}function Je(e,t){return e.map(function(e){return e[t]})}function Ye(e,t,n){return[e].concat(Je(t,n))}H=a();let $=H!==n&&I===e.length;function Xe(){throw H!==n&&I<e.length&&q(Pe()),Le(B,z<e.length?Ne(z):null,z<e.length?Ie(z,z+1):Ie(z,z))}if(t.peg$library)return{peg$result:H,peg$currPos:I,peg$FAILED:n,peg$maxFailExpected:B,peg$maxFailPos:z,peg$success:$,peg$throw:$?void 0:Xe};if($)return H;Xe()}function te(e){if(!e||e.length===0)return null;if(typeof e==`string`){let t=m(e);return!t||t.length===0?null:t}let t=e.map(e=>{if(!Number.isFinite(e.scale)||e.scale<=0)throw new i(`effect:invalid-scale`,`scale must be finite and greater than 0`,{stop:e});return{scale:e.scale,effects:m(e.value)}});t.sort((e,t)=>t.effects.length-e.effects.length);for(let e=0;e<t.length-1;e++){if(!d(t[e].effects,t[e+1].effects))throw new i(`effect:interpolation-impossible`,`Cannot interpolate by scale between 2 lists of mixed effects`,{a:t[e].effects,b:t[e+1].effects});f(t[e].effects,t[e+1].effects)}return t.sort((e,t)=>t.scale-e.scale),t}function m(e){let t;if(!e)return[];try{t=p(e)}catch(t){throw new i(`effect:invalid-syntax`,`Invalid effect syntax`,{value:e,error:t})}return t.map(e=>h(e))}function h(e){try{switch(e.name){case`grayscale`:case`sepia`:case`saturate`:case`invert`:case`brightness`:case`contrast`:return g(e);case`opacity`:return _(e);case`hue-rotate`:return ne(e);case`blur`:return v(e);case`drop-shadow`:return re(e);case`bloom`:return y(e)}}catch(t){throw t.details.filter=e,t}throw new i(`effect:unknown-effect`,`Effect '${e.name}' is not supported`,{effect:e})}function g(e){let t=1;return b(e.parameters,1),e.parameters.length===1&&(t=D(e.parameters[0])),new u(e.name,t)}function _(e){let t=1;return b(e.parameters,1),e.parameters.length===1&&(t=D(e.parameters[0])),new l(t)}function ne(e){let t=0;return b(e.parameters,1),e.parameters.length===1&&(t=O(e.parameters[0])),new c(t)}function v(e){let t=0;return b(e.parameters,1),e.parameters.length===1&&(t=k(e.parameters[0]),S(t,e.parameters[0])),new s(t)}function re(e){let t=[],n=null;for(let r of e.parameters)if(r.type===`color`){if(t.length&&Object.freeze(t),n)throw new i(`effect:type-error`,`Accepts only one color`,{});n=A(r)}else{let e=k(r);if(Object.isFrozen(t))throw new i(`effect:type-error`,`<length> parameters not consecutive`,{lengths:t});t.push(e),t.length===3&&S(e,r)}if(t.length<2||t.length>3)throw new i(`effect:type-error`,`Expected <length>{2,3}, Actual: <length>{${t.length}}`,{lengths:t});return new o(t[0],t[1],t[2]||0,n||j(`black`))}function y(e){let t=1,n=0,r=0;return b(e.parameters,3),e.parameters[0]&&(t=D(e.parameters[0])),e.parameters[1]&&(n=k(e.parameters[1]),S(n,e.parameters[1])),e.parameters[2]&&(r=D(e.parameters[2])),new a(t,n,r)}function b(e,t){if(e.length>t)throw new i(`effect:type-error`,`Function supports up to ${t} parameters, Actual: ${e.length}`,{parameters:e})}function x(e){if(e.type===`color`)return`<color>`;if(e.unit){if(e.unit in E)return`<length>`;if(e.unit in T)return`<angle>`;if(e.unit===`%`)return`<percentage>`}return`<double>`}function S(e,t){if(e<0)throw new i(`effect:type-error`,`Negative values are not allowed, Actual: ${e}`,{term:t})}function C(e){if(e.type!==`quantity`||e.unit!==null)throw new i(`effect:type-error`,`Expected <double>, Actual: ${x(e)}`,{term:e})}function w(e){if(e.type!==`quantity`||e.unit!==null&&e.unit!==`%`)throw new i(`effect:type-error`,`Expected <double> or <percentage>, Actual: ${x(e)}`,{term:e})}const T={deg:1,grad:360/400,rad:180/Math.PI,turn:360};function ie(e){if(!(e.type===`quantity`&&(e.value===0&&e.unit===null||e.unit&&T[e.unit]!=null)))throw new i(`effect:type-error`,`Expected <angle>, Actual: ${x(e)}`,{term:e})}const E={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function ae(e){if(!(e.type===`quantity`&&(e.value===0&&e.unit===null||e.unit&&E[e.unit]!=null)))throw new i(`effect:type-error`,`Expected <length>, Actual: ${x(e)}`,{term:e})}function D(e){w(e);let t=e.value;return S(t,e),e.unit===`%`?t*.01:t}function oe(e){return C(e),S(e.value,e),e.value}function O(e){return ie(e),e.value*T[e.unit]||0}function k(e){return ae(e),e.value*E[e.unit]||0}function A(t){switch(t.colorType){case`hex`:return e(t.value);case`named`:return j(t.value);case`function`:return P(t.value)}}function j(e){if(!t(e))throw new i(`effect:unknown-color`,`color '${e}' isn't valid`,{namedColor:e});return n(e)}const M=/^rgba?/i,N=/^hsla?/i;function P(e){if(b(e.parameters,4),M.test(e.name))return[D(e.parameters[0]),D(e.parameters[1]),D(e.parameters[2]),e.parameters[3]?D(e.parameters[3]):1];if(N.test(e.name))return r(oe(e.parameters[0]),D(e.parameters[1]),D(e.parameters[2]),e.parameters[3]?D(e.parameters[3]):1);throw new i(`effect:syntax-error`,`Invalid color function '${e.name}'`,{colorFunction:e})}export{te as parse};
|
|
7
|
+
at `+o}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,`unicode`)?RegExp(`[\\p{C}\\p{Mn}\\p{Mc}]`,`gu`):null;function i(e){return r?e.replace(r,e=>`\\u{`+n(e)+`}`):e}function a(e,t){return i(e.replace(t,`\\$&`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e)))}function o(e){return a(e,/[\\"]/g)}function s(e){return a(e,/[\\\]^-]/g)}let c={literal(e){return`"`+o(e.text)+`"`},class(e){let t=e.parts.map(e=>Array.isArray(e)?s(e[0])+`-`+s(e[1]):s(e));return`[`+(e.inverted?`^`:``)+t.join(``)+`]`+(e.unicode?`u`:``)},any(){return`any character`},end(){return`end of input`},other(e){return e.description}};function l(e){return c[e.type](e)}function u(e){let t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let n=1;n<t.length;n++)t[n-1]!==t[n]&&(t[e]=t[n],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+` or `+t[1];default:return t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}}function d(e){return e?`"`+o(e)+`"`:`end of input`}return`Expected `+u(e)+` but `+d(t)+` found.`}}function ee(e,t){t=t===void 0?{}:t;let n={},r=t.grammarSource,i={start:je},a=je,o=`none`,s=`grad`,c=`turn`,l=Y(`none`),u=q(`none`,!1),d=q(`)`,!1),f=q(`,`,!1),ee=J([` `,` `,`
|
|
8
|
+
`,`\r`],!1,!1,!1),te=Y(`function`),m=q(`(`,!1),h=Y(`identifier`),g=J([[`a`,`z`],`-`],!1,!1,!1),_=Y(`percentage`),v=q(`%`,!1),y=Y(`length`),b=q(`px`,!1),x=q(`cm`,!1),S=q(`mm`,!1),C=q(`in`,!1),w=q(`pt`,!1),T=q(`pc`,!1),E=Y(`angle`),D=q(`deg`,!1),O=q(`rad`,!1),k=q(`grad`,!1),ne=q(`turn`,!1),A=Y(`number`),re=Y(`color`),j=q(`#`,!1),M=J([[`0`,`9`],[`a`,`f`],[`A`,`F`]],!1,!1,!1),N=J([`+`,`-`],!1,!1,!1),P=J([[`0`,`9`]],!1,!1,!1),F=q(`.`,!1),I=q(`e`,!1);function L(){return[]}function ie(e,t){return{type:`function`,name:e,parameters:t||[]}}function ae(e,t){return t.length>0?Ge(e,t,3):[e]}function oe(e){return{type:`quantity`,value:e.value,unit:e.unit}}function se(e){return{type:`color`,colorType:e.type,value:e.value}}function ce(e){return e}function le(){return K()}function ue(e){return{value:e,unit:`%`}}function de(e){return{value:e,unit:`px`}}function fe(e){return{value:e,unit:`cm`}}function pe(e){return{value:e,unit:`mm`}}function me(e){return{value:e,unit:`in`}}function he(e){return{value:e,unit:`pt`}}function ge(e){return{value:e,unit:`pc`}}function _e(e){return{value:e,unit:`deg`}}function ve(e){return{value:e,unit:`rad`}}function ye(e){return{value:e,unit:`grad`}}function be(e){return{value:e,unit:`turn`}}function xe(e){return{value:e,unit:null}}function Se(){return{type:`hex`,value:K()}}function Ce(e){return{type:`function`,value:e}}function we(){return{type:`named`,value:K()}}function Te(){return parseFloat(K())}let R=t.peg$currPos|0,z=R,B=[{line:1,column:1}],V=R,H=t.peg$maxFailExpected||[],U=t.peg$silentFails|0,W,G;if(t.startRule){if(!(t.startRule in i))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);a=i[t.startRule]}function K(){return e.substring(z,R)}function Ee(t=R){let n=e.codePointAt(t);return n===void 0?``:String.fromCodePoint(n)}function q(e,t){return{type:`literal`,text:e,ignoreCase:t}}function J(e,t,n,r){return{type:`class`,parts:e,inverted:t,ignoreCase:n,unicode:r}}function De(){return{type:`end`}}function Y(e){return{type:`other`,description:e}}function Oe(t){let n=B[t],r;if(n)return n;if(t>=B.length)r=B.length-1;else for(r=t;!B[--r];);for(n=B[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return B[t]=n,n}function ke(e,t,n){let i=Oe(e),a=Oe(t);return{source:r,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:a.line,column:a.column}}}function X(e){R<V||(R>V&&(V=R,H=[]),H.push(e))}function Ae(e,t,n){return new p(p.buildMessage(e,t),e,t,n)}function je(){let e;return e=Me(),e===n&&(e=Ne()),e}function Me(){let t,r;return U++,t=R,Z(),e.substr(R,4)===o?(r=o,R+=4):(r=n,U===0&&X(u)),r===n?(R=t,t=n):(Z(),z=t,t=L()),U--,t===n&&U===0&&X(l),t}function Ne(){let e,t;for(e=[];t=Pe(),t!==n;)e.push(t);return e.length<1&&(e=n),e}function Pe(){let t,r,i,a;return t=R,Z(),r=Le(),r===n?(R=t,t=n):(Z(),i=Fe(),i===n&&(i=null),Z(),e.charCodeAt(R)===41?(a=`)`,R++):(a=n,U===0&&X(d)),a===n?(R=t,t=n):(Z(),z=t,t=ie(r,i))),t}function Fe(){let t,r,i,a,o,s,c,l;if(t=R,r=Ie(),r!==n){for(i=[];a=R,o=Z(),e.charCodeAt(R)===44?(s=`,`,R++):(s=n,U===0&&X(f)),s===n&&(s=null),c=Z(),l=Ie(),l===n?(R=a,a=n):(o=[o,s,c,l],a=o),a!==n;)i.push(a);z=t,t=ae(r,i)}else R=t,t=n;return t}function Ie(){let e,t;return e=R,t=ze(),t===n&&(t=Be(),t===n&&(t=Ve(),t===n&&(t=He()))),t!==n&&(z=e,t=oe(t)),e=t,e===n&&(e=R,t=Ue(),t!==n&&(z=e,t=se(t)),e=t),e}function Z(){let t,r;for(U++,t=[];r=e.charAt(R),G=r.charCodeAt(0),G===32||G===9||G===10||G===13?R++:(r=n,U===0&&X(ee)),r!==n;)t.push(r);return U--,t}function Le(){let t,r,i;return U++,t=R,r=Re(),r===n?(R=t,t=n):(e.charCodeAt(R)===40?(i=`(`,R++):(i=n,U===0&&X(m)),i===n?(R=t,t=n):(z=t,t=ce(r))),U--,t===n&&(r=n,U===0&&X(te)),t}function Re(){let t,r,i;for(U++,t=R,r=[];i=e.charAt(R),G=i.charCodeAt(0),G>=97&&G<=122||G===45?R++:(i=n,U===0&&X(g)),i!==n;)r.push(i);return r.length<1&&(r=n),r!==n&&(z=t,r=le()),t=r,U--,t===n&&(r=n,U===0&&X(h)),t}function ze(){let t,r,i;return U++,t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.charCodeAt(R)===37?(i=`%`,R++):(i=n,U===0&&X(v)),i===n?(R=t,t=n):(z=t,t=ue(r))),U--,t===n&&U===0&&X(_),t}function Be(){let t,r,i;return U++,t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`px`?(i=`px`,R+=2):(i=n,U===0&&X(b)),i===n?(R=t,t=n):(z=t,t=de(r))),t===n&&(t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`cm`?(i=`cm`,R+=2):(i=n,U===0&&X(x)),i===n?(R=t,t=n):(z=t,t=fe(r))),t===n&&(t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`mm`?(i=`mm`,R+=2):(i=n,U===0&&X(S)),i===n?(R=t,t=n):(z=t,t=pe(r))),t===n&&(t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`in`?(i=`in`,R+=2):(i=n,U===0&&X(C)),i===n?(R=t,t=n):(z=t,t=me(r))),t===n&&(t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`pt`?(i=`pt`,R+=2):(i=n,U===0&&X(w)),i===n?(R=t,t=n):(z=t,t=he(r))),t===n&&(t=R,Z(),r=Q(),r===n?(R=t,t=n):(e.substr(R,2)===`pc`?(i=`pc`,R+=2):(i=n,U===0&&X(T)),i===n?(R=t,t=n):(z=t,t=ge(r)))))))),U--,t===n&&U===0&&X(y),t}function Ve(){let t,r,i;return U++,t=R,r=Q(),r===n?(R=t,t=n):(e.substr(R,3)===`deg`?(i=`deg`,R+=3):(i=n,U===0&&X(D)),i===n?(R=t,t=n):(z=t,t=_e(r))),t===n&&(t=R,r=Q(),r===n?(R=t,t=n):(e.substr(R,3)===`rad`?(i=`rad`,R+=3):(i=n,U===0&&X(O)),i===n?(R=t,t=n):(z=t,t=ve(r))),t===n&&(t=R,r=Q(),r===n?(R=t,t=n):(e.substr(R,4)===s?(i=s,R+=4):(i=n,U===0&&X(k)),i===n?(R=t,t=n):(z=t,t=ye(r))),t===n&&(t=R,r=Q(),r===n?(R=t,t=n):(e.substr(R,4)===c?(i=c,R+=4):(i=n,U===0&&X(ne)),i===n?(R=t,t=n):(z=t,t=be(r)))))),U--,t===n&&(r=n,U===0&&X(E)),t}function He(){let e,t;return U++,e=R,Z(),t=Q(),t===n?(R=e,e=n):(z=e,e=xe(t)),U--,e===n&&U===0&&X(A),e}function Ue(){let t,r,i,a;if(U++,t=R,e.charCodeAt(R)===35?(r=`#`,R++):(r=n,U===0&&X(j)),r!==n){for(i=[];a=e.charAt(R),G=a.charCodeAt(0),G>=48&&G<=57||G>=97&&G<=102||G>=65&&G<=70?R++:(a=n,U===0&&X(M)),a!==n;)i.push(a);i.length<1&&(i=n),i===n?(R=t,t=n):(z=t,t=Se())}else R=t,t=n;return t===n&&(t=R,r=Pe(),r!==n&&(z=t,r=Ce(r)),t=r,t===n&&(t=R,r=Re(),r!==n&&(z=t,r=we()),t=r)),U--,t===n&&(r=n,U===0&&X(re)),t}function Q(){let t,r,i,a,o,s,c,l;for(t=R,r=e.charAt(R),G=r.charCodeAt(0),G===43||G===45?R++:(r=n,U===0&&X(N)),r===n&&(r=null),i=R,a=[];o=e.charAt(R),G=o.charCodeAt(0),G>=48&&G<=57?R++:(o=n,U===0&&X(P)),o!==n;)a.push(o);if(e.charCodeAt(R)===46?(o=`.`,R++):(o=n,U===0&&X(F)),o!==n){for(s=[];c=e.charAt(R),G=c.charCodeAt(0),G>=48&&G<=57?R++:(c=n,U===0&&X(P)),c!==n;)s.push(c);s.length<1&&(s=n),s===n?(R=i,i=n):(a=[a,o,s],i=a)}else R=i,i=n;if(i===n){for(i=[];a=e.charAt(R),G=a.charCodeAt(0),G>=48&&G<=57?R++:(a=n,U===0&&X(P)),a!==n;)i.push(a);i.length<1&&(i=n)}if(i!==n){if(a=R,e.charCodeAt(R)===101?(o=`e`,R++):(o=n,U===0&&X(I)),o!==n){for(s=e.charAt(R),G=s.charCodeAt(0),G===43||G===45?R++:(s=n,U===0&&X(N)),s===n&&(s=null),c=[];l=e.charAt(R),G=l.charCodeAt(0),G>=48&&G<=57?R++:(l=n,U===0&&X(P)),l!==n;)c.push(l);c.length<1&&(c=n),c===n?(R=a,a=n):(o=[o,s,c],a=o)}else R=a,a=n;a===n&&(a=null),z=t,t=Te()}else R=t,t=n;return t}function We(e,t){return e.map(function(e){return e[t]})}function Ge(e,t,n){return[e].concat(We(t,n))}W=a();let $=W!==n&&R===e.length;function Ke(){throw W!==n&&R<e.length&&X(De()),Ae(H,V<e.length?Ee(V):null,V<e.length?ke(V,V+1):ke(V,V))}if(t.peg$library)return{peg$result:W,peg$currPos:R,peg$FAILED:n,peg$maxFailExpected:H,peg$maxFailPos:V,peg$success:$,peg$throw:$?void 0:Ke};if($)return W;Ke()}function te(e){if(!e||e.length===0)return null;if(typeof e==`string`){let t=m(e);return!t||t.length===0?null:t}let t=e.map(e=>{if(!Number.isFinite(e.scale)||e.scale<=0)throw new i(`effect:invalid-scale`,`scale must be finite and greater than 0`,{stop:e});return{scale:e.scale,effects:m(e.value)}});t.sort((e,t)=>t.effects.length-e.effects.length);for(let e=0;e<t.length-1;e++){if(!d(t[e].effects,t[e+1].effects))throw new i(`effect:interpolation-impossible`,`Cannot interpolate by scale between 2 lists of mixed effects`,{a:t[e].effects,b:t[e+1].effects});f(t[e].effects,t[e+1].effects)}return t.sort((e,t)=>t.scale-e.scale),t}function m(e){let t;if(!e)return[];try{t=ee(e)}catch(t){throw new i(`effect:invalid-syntax`,`Invalid effect syntax`,{value:e,error:t})}return t.map(e=>h(e))}function h(e){try{switch(e.name){case`grayscale`:case`sepia`:case`saturate`:case`invert`:case`brightness`:case`contrast`:return g(e);case`opacity`:return _(e);case`hue-rotate`:return v(e);case`blur`:return y(e);case`drop-shadow`:return b(e);case`bloom`:return x(e)}}catch(t){throw t.details.filter=e,t}throw new i(`effect:unknown-effect`,`Effect '${e.name}' is not supported`,{effect:e})}function g(e){let t=1;return S(e.parameters,1),e.parameters.length===1&&(t=A(e.parameters[0])),new u(e.name,t)}function _(e){let t=1;return S(e.parameters,1),e.parameters.length===1&&(t=A(e.parameters[0])),new l(t)}function v(e){let t=0;return S(e.parameters,1),e.parameters.length===1&&(t=j(e.parameters[0])),new c(t)}function y(e){let t=0;return S(e.parameters,1),e.parameters.length===1&&(t=M(e.parameters[0]),w(t,e.parameters[0])),new s(t)}function b(e){let t=[],n=null;for(let r of e.parameters)if(r.type===`color`){if(t.length&&Object.freeze(t),n)throw new i(`effect:type-error`,`Accepts only one color`,{});n=N(r)}else{let e=M(r);if(Object.isFrozen(t))throw new i(`effect:type-error`,`<length> parameters not consecutive`,{lengths:t});t.push(e),t.length===3&&w(e,r)}if(t.length<2||t.length>3)throw new i(`effect:type-error`,`Expected <length>{2,3}, Actual: <length>{${t.length}}`,{lengths:t});return new o(t[0],t[1],t[2]||0,n||P(`black`))}function x(e){let t=1,n=0,r=0;return S(e.parameters,3),e.parameters[0]&&(t=A(e.parameters[0])),e.parameters[1]&&(n=M(e.parameters[1]),w(n,e.parameters[1])),e.parameters[2]&&(r=A(e.parameters[2])),new a(t,n,r)}function S(e,t){if(e.length>t)throw new i(`effect:type-error`,`Function supports up to ${t} parameters, Actual: ${e.length}`,{parameters:e})}function C(e){if(e.type===`color`)return`<color>`;if(e.unit){if(e.unit in k)return`<length>`;if(e.unit in D)return`<angle>`;if(e.unit===`%`)return`<percentage>`}return`<double>`}function w(e,t){if(e<0)throw new i(`effect:type-error`,`Negative values are not allowed, Actual: ${e}`,{term:t})}function T(e){if(e.type!==`quantity`||e.unit!==null)throw new i(`effect:type-error`,`Expected <double>, Actual: ${C(e)}`,{term:e})}function E(e){if(e.type!==`quantity`||e.unit!==null&&e.unit!==`%`)throw new i(`effect:type-error`,`Expected <double> or <percentage>, Actual: ${C(e)}`,{term:e})}const D={deg:1,grad:360/400,rad:180/Math.PI,turn:360};function O(e){if(!(e.type===`quantity`&&(e.value===0&&e.unit===null||e.unit&&D[e.unit]!=null)))throw new i(`effect:type-error`,`Expected <angle>, Actual: ${C(e)}`,{term:e})}const k={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function ne(e){if(!(e.type===`quantity`&&(e.value===0&&e.unit===null||e.unit&&k[e.unit]!=null)))throw new i(`effect:type-error`,`Expected <length>, Actual: ${C(e)}`,{term:e})}function A(e){E(e);let t=e.value;return w(t,e),e.unit===`%`?t*.01:t}function re(e){return T(e),w(e.value,e),e.value}function j(e){return O(e),e.value*D[e.unit]||0}function M(e){return ne(e),e.value*k[e.unit]||0}function N(t){switch(t.colorType){case`hex`:return e(t.value);case`named`:return P(t.value);case`function`:return L(t.value)}}function P(e){if(!t(e))throw new i(`effect:unknown-color`,`color '${e}' isn't valid`,{namedColor:e});return n(e)}const F=/^rgba?/i,I=/^hsla?/i;function L(e){if(S(e.parameters,4),F.test(e.name))return[A(e.parameters[0]),A(e.parameters[1]),A(e.parameters[2]),e.parameters[3]?A(e.parameters[3]):1];if(I.test(e.name))return r(re(e.parameters[0]),A(e.parameters[1]),A(e.parameters[2]),e.parameters[3]?A(e.parameters[3]):1);throw new i(`effect:syntax-error`,`Invalid color function '${e.name}'`,{colorFunction:e})}export{te as parse};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as r}from"../../core/libs/gl-matrix-2/math/vec2.js";import i from"../../geometry/Extent.js";import a from"../../geometry/Polygon.js";import{densifyExecute as o}from"../../geometry/operators/densifyOperator.js";import{projectExecute as s}from"../../geometry/operators/projectOperator.js";class c{constructor(e){this.ctm=e.ctm,this.spatialReference=e.
|
|
2
|
+
import e from"../../core/Error.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as r}from"../../core/libs/gl-matrix-2/math/vec2.js";import i from"../../geometry/Extent.js";import a from"../../geometry/Polygon.js";import{densifyExecute as o}from"../../geometry/operators/densifyOperator.js";import{projectExecute as s}from"../../geometry/operators/projectOperator.js";class c{constructor(e){this.ctm=e.ctm,this.spatialReference=e.spatialReference,this.pairedNeatline=e.pairedNeatline,this.outerExtentMediabox=l(e.outerExtentMediaBox,this.ctm,this.spatialReference),this.geoControlPoints=e.geoControlPoints,this.outerMediaBox=e.outerExtentMediaBox,this.sourceMediaBoxPolygon=this.createSourceMediaBoxPolygon(),this.sourceNeatlinePolygon=this.createSourceNeatlinePolygon()}createSourceMediaBoxPolygon(){let e=[];for(let[t,n]of this.outerMediaBox){let r=u(this.ctm,t,n);e.push([r[0],r[1]])}return new a({rings:[e],spatialReference:this.spatialReference})}createSourceNeatlinePolygon(){let e=[];for(let[t,n]of this.pairedNeatline){let r=u(this.ctm,t,n);e.push([r[0],r[1]])}return new a({rings:[e],spatialReference:this.spatialReference})}createProjectedPolygon(n,r,i){t(i);let a=n;if(a.spatialReference.equals(r))return a;if(!a||!a.extent)throw new e(`geospatial-pdf-layer:load`,`Could not project neatline`);let c=Math.max(a.extent.width,a.extent.height)/256,l=o(a,c);return s(l,r)}toExtent(){return l(this.pairedNeatline,this.ctm,this.spatialReference)}}function l(e,t,n){let r=1/0,a=1/0,o=-1/0,s=-1/0;for(let n=0;n<e.length;n++){let i=u(t,e[n][0],e[n][1]);r=Math.min(r,i[0]),a=Math.min(a,i[1]),o=Math.max(o,i[0]),s=Math.max(s,i[1])}return new i({xmin:r,ymin:a,xmax:o,ymax:s,spatialReference:n})}function u(e,t,i){let[a,o,s,c,l,u]=e,d=n();return r(d,a*t+s*i+l,o*t+c*i+u),d}export{c as default};
|