@arcgis/core 5.2.0-next.167 → 5.2.0-next.169
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/Map.d.ts +6 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/057f245d70e57a1bcb46.js +1 -0
- package/assets/esri/core/workers/chunks/{1419bf346978b81b08cc.js → 094eb9677cdebfaa9e1b.js} +1 -1
- package/assets/esri/core/workers/chunks/0d52e1b6d38f2670658c.js +1 -0
- package/assets/esri/core/workers/chunks/0f7455dbe8c2ee464194.js +1 -0
- package/assets/esri/core/workers/chunks/10878932826ddb60fac4.js +1 -0
- package/assets/esri/core/workers/chunks/144bad0c2415c345736a.js +1 -0
- package/assets/esri/core/workers/chunks/1a614bac5db42c6263f8.js +1 -0
- package/assets/esri/core/workers/chunks/{99a0a434ea2162166754.js → 2095f220dc2b8f8f62db.js} +1 -1
- package/assets/esri/core/workers/chunks/{5daa9429808ca31279f2.js → 216a239142dfe1306c6c.js} +1 -1
- package/assets/esri/core/workers/chunks/25c3be410d1c03f8f39d.js +1 -0
- package/assets/esri/core/workers/chunks/294276ed397023dcda44.js +1 -0
- package/assets/esri/core/workers/chunks/2a2a4650dd9b953d317c.js +1 -0
- package/assets/esri/core/workers/chunks/2b6684d057d9ad17ac13.js +1 -0
- package/assets/esri/core/workers/chunks/{ad96132bc89671e595f3.js → 2d3e0e4442dbc6ec6def.js} +1 -1
- package/assets/esri/core/workers/chunks/2d83ba260dd6bbe38206.js +1 -0
- package/assets/esri/core/workers/chunks/{69d5f8ef78b9b8b3d33d.js → 3286cf2afeb7f48564d9.js} +1 -1
- package/assets/esri/core/workers/chunks/3321cb0d4cb68b2ec8bf.js +1 -0
- package/assets/esri/core/workers/chunks/{e99c8c71c757bb161d87.js → 3636c2ac9b77950776d6.js} +1 -1
- package/assets/esri/core/workers/chunks/367b2f25cfe37847a48d.js +1 -0
- package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +1 -0
- package/assets/esri/core/workers/chunks/3c881b1adc8a5dea9a90.js +1 -0
- package/assets/esri/core/workers/chunks/{6a2562cc00727155fc01.js → 4024becaf4012c1f15a7.js} +1 -1
- package/assets/esri/core/workers/chunks/435ad7e6ed326da2b969.js +1 -0
- package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +1 -0
- package/assets/esri/core/workers/chunks/46f0510846a309a390ca.js +1 -0
- package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +1 -0
- package/assets/esri/core/workers/chunks/509a74e9334f31b931d4.js +1 -0
- package/assets/esri/core/workers/chunks/50e8943d2c0b96fab2c1.js +1 -0
- package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +1 -0
- package/assets/esri/core/workers/chunks/546f5f57c9249627bb89.js +1 -0
- package/assets/esri/core/workers/chunks/561c48cb4d49b150765b.js +1 -0
- package/assets/esri/core/workers/chunks/{d90a3bfd45b5ed4092e0.js → 590fe0f56bc4c33a50e7.js} +1 -1
- package/assets/esri/core/workers/chunks/5d42f0898bf30ae940ea.js +1 -0
- package/assets/esri/core/workers/chunks/5f1cb79aec9c4a9b7ddc.js +29 -0
- package/assets/esri/core/workers/chunks/{5d2f043ebe1051326c56.js → 63b5418a1c3fe0a97a86.js} +1 -1
- package/assets/esri/core/workers/chunks/63c3a573dfe703056f8f.js +1 -0
- package/assets/esri/core/workers/chunks/673c61c964524150d9bc.js +1 -0
- package/assets/esri/core/workers/chunks/692f0093c444fcc752b5.js +1 -0
- package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +1 -0
- package/assets/esri/core/workers/chunks/{e6d10136bc08aef255ff.js → 712559f121f76c4e71ab.js} +1 -1
- package/assets/esri/core/workers/chunks/71a51795f715332fb4fe.js +1 -0
- package/assets/esri/core/workers/chunks/735c1dffc3439bdba3cc.js +1 -0
- package/assets/esri/core/workers/chunks/7862abd24fb5c3b12e6b.js +1 -0
- package/assets/esri/core/workers/chunks/{44d5508042cacdfcac47.js → 7d2be06dfbd92c8b9484.js} +1 -1
- package/assets/esri/core/workers/chunks/7f5b887a753bb67c8486.js +1 -0
- package/assets/esri/core/workers/chunks/822f83d7c09ef0a9bbdf.js +1 -0
- package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +1 -0
- package/assets/esri/core/workers/chunks/8d86b0cb0e004ad72040.js +1 -0
- package/assets/esri/core/workers/chunks/{76196c414e48834f7b92.js → 8f008eedb11685ee2048.js} +1 -1
- package/assets/esri/core/workers/chunks/98760040f0c9d47c718d.js +1 -0
- package/assets/esri/core/workers/chunks/{4b99b4cf729881e616bc.js → 98d1efb6f2439c6344cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{18f20fd43ec9ce03cef1.js → 9e04703ee5f5ec47db43.js} +1 -1
- package/assets/esri/core/workers/chunks/9e0b0262dec496451762.js +1 -0
- package/assets/esri/core/workers/chunks/{23fd4de56de352f63e2d.js → a2196a49f89d57a0a1c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{89c8b0f684c1f27d149e.js → a2f0894218e665780a21.js} +1 -1
- package/assets/esri/core/workers/chunks/a79cae328e866272754a.js +1 -0
- package/assets/esri/core/workers/chunks/a85cdafbaf1848bb924b.js +1 -0
- package/assets/esri/core/workers/chunks/b01688ccc29d33bfc82d.js +1 -0
- package/assets/esri/core/workers/chunks/b0a612d8ffa5c46d7db4.js +1 -0
- package/assets/esri/core/workers/chunks/b5eff28cf482d920b9ea.js +1 -0
- package/assets/esri/core/workers/chunks/b70885deebc6106597ad.js +1 -0
- package/assets/esri/core/workers/chunks/bedaa5e64ed81803829a.js +1 -0
- package/assets/esri/core/workers/chunks/{a88f346786b04bd194dc.js → c0b38f8c808d434af5f6.js} +1 -1
- package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +1 -0
- package/assets/esri/core/workers/chunks/c249a91dd23104723fab.js +1 -0
- package/assets/esri/core/workers/chunks/c45edd0a7d57263bb7d6.js +1 -0
- package/assets/esri/core/workers/chunks/c4bbe4707e90b7cd0379.js +1 -0
- package/assets/esri/core/workers/chunks/c52466eb1f3c33ae1f5a.js +1 -0
- package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +1 -0
- package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +1 -0
- package/assets/esri/core/workers/chunks/c7699edd14497d174445.js +1 -0
- package/assets/esri/core/workers/chunks/c80a3b039e510c118399.js +1 -0
- package/assets/esri/core/workers/chunks/{196979cc6a765be3c5cd.js → c88a70f68c8ce8c30e9b.js} +1 -1
- package/assets/esri/core/workers/chunks/c9feffb9884cfed52c4b.js +1 -0
- package/assets/esri/core/workers/chunks/caaf6306cc73f618d27d.js +1 -0
- package/assets/esri/core/workers/chunks/{b704f489d0f072a0bfcd.js → ccd19c490ca24db6ffb1.js} +1 -1
- package/assets/esri/core/workers/chunks/cdacc3e42f01c3b852d6.js +1 -0
- package/assets/esri/core/workers/chunks/d1d6154b4af1c9cc497b.js +1 -0
- package/assets/esri/core/workers/chunks/d20dcd4ce4b0111d924f.js +1 -0
- package/assets/esri/core/workers/chunks/{784a2fba3e18286958d1.js → d56fdf5ce5ff53dc0e69.js} +1 -1
- package/assets/esri/core/workers/chunks/d7cf32a8c6060a208f06.js +1 -0
- package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +1 -0
- package/assets/esri/core/workers/chunks/dd08dff19a2ffd36f284.js +1 -0
- package/assets/esri/core/workers/chunks/de3f140058aa0b907b65.js +1 -0
- package/assets/esri/core/workers/chunks/df375d1b0dab5ecbd1be.js +1 -0
- package/assets/esri/core/workers/chunks/{e2775b4b753306dc8477.js → df7603ef7d2a7cbeaaa2.js} +1 -1
- package/assets/esri/core/workers/chunks/e9cdb0b0f074583edebd.js +1 -0
- package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +1 -0
- package/assets/esri/core/workers/chunks/edd36a1fc80b1d29907e.js +1 -0
- package/assets/esri/core/workers/chunks/{444e5f214abce3d607cd.js → eeb068c265bd3a22a8c1.js} +1 -1
- package/assets/esri/core/workers/chunks/f2cfee8a761ae91f7a3e.js +1 -0
- package/assets/esri/core/workers/chunks/f3fdf75843ade0ca591e.js +1 -0
- package/assets/esri/core/workers/chunks/f5cc78291b53931b91e8.js +1 -0
- package/assets/esri/core/workers/chunks/f9dc38761b314d33890f.js +1 -0
- package/assets/esri/core/workers/chunks/feb6e041dd0aa1c59c31.js +1 -0
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
- package/config.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +2 -2
- package/geometry/operators/containsOperator.d.ts +1 -1
- package/geometry/operators/densifyOperator.d.ts +1 -1
- package/geometry/operators/differenceOperator.d.ts +6 -4
- package/geometry/operators/distanceOperator.d.ts +1 -1
- package/geometry/operators/geodesicProximityOperator.d.ts +8 -8
- package/geometry/operators/graphicBufferOperator.d.ts +6 -6
- package/geometry/operators/integrateOperator.d.ts +2 -2
- package/geometry/operators/intersectsOperator.d.ts +3 -3
- package/geometry/operators/linesToPolygonsOperator.d.ts +2 -2
- package/geometry/operators/locateBetweenOperator.d.ts +2 -2
- package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
- package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
- package/geometry/operators/polygonSlicerOperator.d.ts +2 -2
- package/geometry/operators/projectOperator.d.ts +2 -2
- package/geometry/operators/proximityOperator.d.ts +15 -15
- package/geometry/operators/shapePreservingProjectOperator.d.ts +2 -2
- package/geometry/operators/simplifyOperator.d.ts +2 -2
- package/geometry/operators/support/GeographicTransformationStep.d.ts +3 -3
- package/geometry/operators/support/Transformation.d.ts +8 -8
- package/geometry/operators/support/geographicTransformationUtils.d.ts +3 -3
- package/geometry/operators/symmetricDifferenceOperator.d.ts +2 -2
- package/geometry/operators/withinOperator.d.ts +3 -3
- package/graphic/MapNotesGraphicOrigin.d.ts +1 -0
- package/kernel.js +1 -1
- package/layers/ElevationLayer.d.ts +6 -2
- package/layers/GeospatialPDFLayer.d.ts +2 -2
- package/layers/ParquetLayer.d.ts +1 -1
- package/layers/VectorTileLayer.d.ts +10 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/orientedImagery/transformations/rotationUtils.js +2 -0
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/package.json +2 -2
- package/popup/FeaturesModel.js +1 -1
- package/popup/support/featureUtils.js +1 -1
- package/rest/featureService/FeatureService.d.ts +0 -5
- package/rest/networks/support/TraceLocation.d.ts +2 -1
- package/rest/networks/support/TraceResult.d.ts +0 -4
- package/rest/support/OutDistance.d.ts +0 -1
- package/smartMapping/statistics/histogramForTimeSeries.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForTimeSeries.js +1 -1
- package/support/BasemapStyle.d.ts +2 -2
- package/symbols/cim/types.d.ts +7 -9
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterVertexPack.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/support/visualVariableSimpleUtils.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +15 -2
- package/views/3d/environment/VirtualLighting.d.ts +15 -2
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawScreenTool.js +1 -1
- package/views/input/types.d.ts +2 -4
- package/views/interactive/options/LabelOptions.d.ts +5 -5
- package/views/interactive/options/SnappingOptions.d.ts +2 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +0 -1
- package/widgets/Editor/VisibleElements.d.ts +4 -0
- package/widgets/Editor.d.ts +2 -0
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +2 -0
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer/support/NonPanoramicMedia.js +1 -1
- package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Search/LayerSearchSource.d.ts +1 -1
- package/widgets/Sketch/VisibleElements.d.ts +4 -0
- package/widgets/Sketch.d.ts +2 -0
- package/widgets/support/iconUtils.js +1 -1
- package/assets/esri/core/workers/chunks/010f57ec7fdbedf78d02.js +0 -1
- package/assets/esri/core/workers/chunks/02e10f44edf911832c2a.js +0 -1
- package/assets/esri/core/workers/chunks/07f7177bfaf9de73bc25.js +0 -1
- package/assets/esri/core/workers/chunks/090adefe20412e8a5084.js +0 -1
- package/assets/esri/core/workers/chunks/0d9c4c6c571ce26d356b.js +0 -1
- package/assets/esri/core/workers/chunks/1201b8c5852830836eac.js +0 -1
- package/assets/esri/core/workers/chunks/151e5799ede763a03ee2.js +0 -1
- package/assets/esri/core/workers/chunks/168a523bdc3653081f8a.js +0 -1
- package/assets/esri/core/workers/chunks/175c268e64ccd01f8c25.js +0 -1
- package/assets/esri/core/workers/chunks/18787aa685524b958561.js +0 -1
- package/assets/esri/core/workers/chunks/1e1c45f75020d5e05dc3.js +0 -1
- package/assets/esri/core/workers/chunks/28104681ba161967039f.js +0 -1
- package/assets/esri/core/workers/chunks/2a36fe3f3f257a779a1b.js +0 -1
- package/assets/esri/core/workers/chunks/30af63b3b750142faadb.js +0 -1
- package/assets/esri/core/workers/chunks/3dddae78286d05eb10fc.js +0 -1
- package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
- package/assets/esri/core/workers/chunks/40d803584eeade4df433.js +0 -1
- package/assets/esri/core/workers/chunks/41773d858e212468db88.js +0 -1
- package/assets/esri/core/workers/chunks/426b4eb500fdfe9df325.js +0 -1
- package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +0 -1
- package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +0 -1
- package/assets/esri/core/workers/chunks/4932773663469919d10a.js +0 -1
- package/assets/esri/core/workers/chunks/49b967d89d2841cea675.js +0 -1
- package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +0 -1
- package/assets/esri/core/workers/chunks/4cb751dc8d00bdaeb04c.js +0 -1
- package/assets/esri/core/workers/chunks/4d3d7ec407ee5cd5f036.js +0 -1
- package/assets/esri/core/workers/chunks/4fd0d9688df6fcc0d0b8.js +0 -1
- package/assets/esri/core/workers/chunks/53ff68d4f9e365fc15cd.js +0 -1
- package/assets/esri/core/workers/chunks/548b8f74a6883e364931.js +0 -1
- package/assets/esri/core/workers/chunks/5af8fb4ec2c72697e35b.js +0 -1
- package/assets/esri/core/workers/chunks/5d76f4d97beee494bbbf.js +0 -1
- package/assets/esri/core/workers/chunks/5dc604e3691f36f03959.js +0 -1
- package/assets/esri/core/workers/chunks/611e3cdf67283c11576f.js +0 -1
- package/assets/esri/core/workers/chunks/61552b4b8111a8624d84.js +0 -1
- package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
- package/assets/esri/core/workers/chunks/632fdf1d95ad69109427.js +0 -1
- package/assets/esri/core/workers/chunks/652faf4359ac072c5dde.js +0 -1
- package/assets/esri/core/workers/chunks/6b9961261241fdce0e94.js +0 -1
- package/assets/esri/core/workers/chunks/710b8251a59884aee31e.js +0 -1
- package/assets/esri/core/workers/chunks/7159d9c36869cd82599e.js +0 -29
- package/assets/esri/core/workers/chunks/7393f63043a1da3d05a6.js +0 -1
- package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +0 -1
- package/assets/esri/core/workers/chunks/771dd92cb3e6a3427f66.js +0 -1
- package/assets/esri/core/workers/chunks/7748c2886d0122b40eeb.js +0 -1
- package/assets/esri/core/workers/chunks/78c4e43cfa1eda06b4d9.js +0 -1
- package/assets/esri/core/workers/chunks/7e0f04a5038e2a4f6e4b.js +0 -1
- package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +0 -1
- package/assets/esri/core/workers/chunks/7f16ae01ccd9b6114d1c.js +0 -1
- package/assets/esri/core/workers/chunks/82a022cc21364c9a8539.js +0 -1
- package/assets/esri/core/workers/chunks/8924e2f3b7d03afb3a6a.js +0 -1
- package/assets/esri/core/workers/chunks/90153b5230b3a4985c14.js +0 -1
- package/assets/esri/core/workers/chunks/9189dfe19a2a2ccd5173.js +0 -1
- package/assets/esri/core/workers/chunks/9215b59c5ccecf9add58.js +0 -1
- package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +0 -1
- package/assets/esri/core/workers/chunks/967b4992b400517ee712.js +0 -1
- package/assets/esri/core/workers/chunks/9dd1fc56eb1ea6eb705e.js +0 -1
- package/assets/esri/core/workers/chunks/a163c6005aba3378edaa.js +0 -1
- package/assets/esri/core/workers/chunks/a53823cf03dbdce1aecd.js +0 -1
- package/assets/esri/core/workers/chunks/a62c12925303ff802c3d.js +0 -1
- package/assets/esri/core/workers/chunks/acb265a22be5e12f38e5.js +0 -1
- package/assets/esri/core/workers/chunks/acdfd275dbf8533a67f3.js +0 -1
- package/assets/esri/core/workers/chunks/ace802483484519658f3.js +0 -1
- package/assets/esri/core/workers/chunks/b3007aedbf731dacaff1.js +0 -1
- package/assets/esri/core/workers/chunks/b4334713bacdfe40ce3d.js +0 -1
- package/assets/esri/core/workers/chunks/b83cef2d3f528726d492.js +0 -1
- package/assets/esri/core/workers/chunks/be97a629e2ae4d13ceb3.js +0 -1
- package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +0 -1
- package/assets/esri/core/workers/chunks/c47d095434d09b5f10c6.js +0 -1
- package/assets/esri/core/workers/chunks/c4b7111dcedd9d6e1c2a.js +0 -1
- package/assets/esri/core/workers/chunks/c5d85be6e16bc895e7fb.js +0 -1
- package/assets/esri/core/workers/chunks/c8d6bb5cca49926a0214.js +0 -1
- package/assets/esri/core/workers/chunks/cb4be68cc5085d421615.js +0 -1
- package/assets/esri/core/workers/chunks/cb4db5489388559d6bd9.js +0 -1
- package/assets/esri/core/workers/chunks/cc794bb94ebc1cb66024.js +0 -1
- package/assets/esri/core/workers/chunks/cc94bf05b235e65291fc.js +0 -1
- package/assets/esri/core/workers/chunks/d4af9faa5d901274fad2.js +0 -1
- package/assets/esri/core/workers/chunks/d77c68e0fc3b259bf4f9.js +0 -1
- package/assets/esri/core/workers/chunks/daf9b691817e83a11f3c.js +0 -1
- package/assets/esri/core/workers/chunks/de0f335f702ae85a1df3.js +0 -1
- package/assets/esri/core/workers/chunks/e11159e3dc3353b27c57.js +0 -1
- package/assets/esri/core/workers/chunks/f8379cd45f750f28a3d8.js +0 -1
- package/assets/esri/core/workers/chunks/f905f1a1aa4c123cbe83.js +0 -1
- package/assets/esri/core/workers/chunks/fd4635410b27bcedb752.js +0 -1
- package/assets/esri/core/workers/chunks/fda83bcb8e40e8044c24.js +0 -1
- package/assets/esri/core/workers/chunks/feb4f8c807bb0dca488f.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=await this._getRequiredFields(e),a=(await L()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,l=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);l.push(n),s=await o.next(r)}return X(l,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await l(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await L()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,u=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,createRotationMatrixFromHPR as D,transformMat3 as O,scaleAndAddWithFactor as k,scaleWithFactor as A,computeHFOVAndVFOV as j,projectiveTransform as M}from"../transformations/utils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?te(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=V(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=ee(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function ee(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),D([e,t,h??0])),v=re({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=O([0,0,-1],_),{x:b,y:x}=c,S=k([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=O([0,1,0],_),E=O([1,0,0],_),j=A(T,C/2,u),M=A(E,w/2,u),P=a(r(),j,M),F=o(r(),j,M),I=L([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function L(e,t,n,r){return e.map(e=>ie(e,t,n,r))}function te(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function ne(e,t){return e.contains(t)}function R({cameraHeading:e,cameraPitch:t,cameraRoll:r,farDistance:a,horizontalFieldOfView:o,nearDistance:s,vectorToPoint:l,verticalFieldOfView:u}){let d=i(n(),D([e,t,r])),f=O([1,0,0],d),p=O([0,1,0],d),m=O([0,0,-1],d),h=c(l,f),g=c(l,p),_=c(l,m);if(_<=0||_<s||_>a)return!1;let v=_*Math.tan(o*N/2),y=_*Math.tan(u*N/2);return Math.abs(h)<=v&&Math.abs(g)<=y}function z(e,t){let n=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:r,location:i,nearDistance:a,verticalFieldOfView:o}=n,c=V(n);if(r==null||o==null||!Number.isFinite(a)||a<0||!Number.isFinite(c)||c<=0)return!1;let l=E(i.y,i.spatialReference),u=i.z??0,d=[(t.x-i.x)/l,(t.y-i.y)/l,t.z-u];if(n.isSpherical){let e=s(d);return a<=e&&e<=c}let f={vectorToPoint:d,verticalFieldOfView:o,nearDistance:a,farDistance:c};if(r>150){let e=Math.ceil(r/5),t=r/e;return I(e,n.cameraHeading,r).some(e=>R({...f,cameraHeading:e,cameraPitch:90,cameraRoll:0,horizontalFieldOfView:t}))}return R({...f,cameraHeading:n.cameraHeading,cameraPitch:n.cameraPitch,cameraRoll:n.cameraRoll??0,horizontalFieldOfView:r})}function B(e,t){return Math.sign(e)!==Math.sign(t)}function re(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=H(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=O(w,t),C=k([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=k([l.x,l.y,m],w,f,g),E=[0,1,0];E=O(E,t);let D=[1,0,0];D=O(D,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(o(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,a(r(),A(E,v/2,g),A(D,b/2,g)))),j=j.concat(a(r(),T,o(r(),A(E,v/2,g),A(D,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(o(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,a(r(),A(E,x/2,g),A(D,S/2,g)))),j=j.concat(a(r(),C,o(r(),A(E,x/2,g),A(D,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function ie(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=A(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=A(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return B(l[0],p[0])&&B(l[1],p[1])&&B(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function ae(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=H(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function V(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function H(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function U(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=A(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=k([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function W(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=j(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await se(o,e,l,c,g,_,y,h):await G(o,e,t,i,r,y,g,_,h)}async function G(e,t,n,r,i,a,o,s,c){let l=K(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function K(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];oe(r,s,e,o),q(r,s,e,a)}return{farPlane:a,nearPlane:o}}function q(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function oe(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function se(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=M([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{z as checkIfFrustumContainsSelectedPoint,ne as checkIfPolygonContainsSelectedPoint,ae as computePolygonForInspection,P as createCoveragePolygon,L as limitZToGround,J as projectVertices,U as resizePolygon,W as updateFrustum};
|
|
2
|
+
import{deg2rad as e}from"../../../core/mathUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as i}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{sub as a,add as o,length as s,dot as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import l from"../../../geometry/Circle.js";import u from"../../../geometry/Mesh.js";import d from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectAsync as p}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as h}from"../../../geometry/support/centroid.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import _ from"../../../geometry/support/MeshComponent.js";import{createSphere as v}from"../../../geometry/support/meshUtils.js";import y from"../../../geometry/support/MeshVertexAttributes.js";import{create as b,fromArray as x,intersectRay as S}from"../../../geometry/support/plane.js";import{isWebMercator as C}from"../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnitOfSR as w}from"./utils.js";import{convertToSRUnits as T,getWebMercatorScalingFactor as E,transformMat3 as D,scaleAndAddWithFactor as O,scaleWithFactor as k,computeHFOVAndVFOV as A,projectiveTransform as j}from"../transformations/utils.js";import{createRotationMatrixFromHPR as M}from"../transformations/rotationUtils.js";const N=Math.PI/180;function P(e,t,n){let r=T(e,t.spatialReference);return r.cameraHeight=(t.z??r.cameraHeight)-n,e.isSpherical?z(r,t):F(r,t)}function F(e,t){let{horizontalFieldOfView:n,verticalFieldOfView:r,cameraHeading:i}=e,a=E(t.y,t.spatialReference),o=e.cameraPitch,s=e.cameraRoll??0,c=150;n>150&&(o=90,s=0,c=5);let l=Math.ceil(n/c),u=I(l,i,n),d=K(e)*a,p=new f({spatialReference:t?.spatialReference});p.imageID=e.objectId;let m=null;for(let i of u)m=L(i,o,e.cameraHeight,t,d,a,r,n,l,p,s,e.nearDistance);return m.imageID=e.objectId,{polygon:p,frustum:m}}function I(e,t,n){let r=[];if(e%2==0)for(let i=0;i<e/2;i++)r.push(t-n/e*(i+.5),t+n/e*(i+.5));else{r.push(t);for(let i=1;i<e/2;i++)r.push(t-n/e*i,t+n/e*i)}return r.sort(),r}function L(e,t,s,c,l,u,d,f,p,m,h=0,g=0){let _=i(n(),M([e,t,h??0])),v=W({cameraHeight:s,cameraPitch:t,farDistance:l,location:c,horizontalFieldOfView:f,nearDistance:g,verticalFieldOfView:d},_),y=D([0,0,-1],_),{x:b,y:x}=c,S=O([b,x,c.z??s],y,l,u),C=2*Math.tan(d*N/2)*l,w=2*Math.tan(f/p*N/2)*l,T=D([0,1,0],_),E=D([1,0,0],_),A=k(T,C/2,u),j=k(E,w/2,u),P=a(r(),A,j),F=o(r(),A,j),I=R([o(r(),S,P),o(r(),S,F),a(r(),S,P),a(r(),S,F)],s,c,u);return I.push(I[0]),m.addRing(I),v}function R(e,t,n,r){return e.map(e=>G(e,t,n,r))}function z(e,t){let{farDistance:n,objectId:r,nearDistance:i,cameraHeight:a}=e,o=E(t.y,t.spatialReference),s=new l({center:t.clone(),radius:n*o});if(s.imageID=r,i){let e=new l({center:t.clone(),radius:i*o});s.addRing(e.rings[0])}let c=t.clone();c.z=(t.z??a)-n*o;let u=v(c,{size:2*n*o});return u.imageID=r,{polygon:s,frustum:u}}function B(e,t){return e.contains(t)}function V({cameraHeading:e,cameraPitch:t,cameraRoll:r,farDistance:a,horizontalFieldOfView:o,nearDistance:s,vectorToPoint:l,verticalFieldOfView:u}){let d=i(n(),M([e,t,r])),f=D([1,0,0],d),p=D([0,1,0],d),m=D([0,0,-1],d),h=c(l,f),g=c(l,p),_=c(l,m);if(_<=0||_<s||_>a)return!1;let v=_*Math.tan(o*N/2),y=_*Math.tan(u*N/2);return Math.abs(h)<=v&&Math.abs(g)<=y}function H(e,t){let n=T(e,e.location.spatialReference);if(t.z==null)return!1;let{horizontalFieldOfView:r,location:i,nearDistance:a,verticalFieldOfView:o}=n,c=K(n);if(r==null||o==null||!Number.isFinite(a)||a<0||!Number.isFinite(c)||c<=0)return!1;let l=E(i.y,i.spatialReference),u=i.z??0,d=[(t.x-i.x)/l,(t.y-i.y)/l,t.z-u];if(n.isSpherical){let e=s(d);return a<=e&&e<=c}let f={vectorToPoint:d,verticalFieldOfView:o,nearDistance:a,farDistance:c};if(r>150){let e=Math.ceil(r/5),t=r/e;return I(e,n.cameraHeading,r).some(e=>V({...f,cameraHeading:e,cameraPitch:90,cameraRoll:0,horizontalFieldOfView:t}))}return V({...f,cameraHeading:n.cameraHeading,cameraPitch:n.cameraPitch,cameraRoll:n.cameraRoll??0,horizontalFieldOfView:r})}function U(e,t){return Math.sign(e)!==Math.sign(t)}function W(e,t,n){let{cameraHeight:i,cameraPitch:s,farDistance:c,location:l,horizontalFieldOfView:d,nearDistance:f,verticalFieldOfView:p}=e,m=l.z??i,h=m-i,g=q(l),_=!(s+p/2>=90),v=2*Math.tan(p*N/2)*f,b=2*Math.tan(d*N/2)*f,x=2*Math.tan(p*N/2)*c,S=2*Math.tan(d*N/2)*c,C,w=[0,0,-1];w=D(w,t),C=O([l.x,l.y,m],w,c,g),_&&(C[2]=h);let T=O([l.x,l.y,m],w,f,g),E=[0,1,0];E=D(E,t);let A=[1,0,0];A=D(A,t);let j=[],M=[];f?(M=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],j=j.concat(o(r(),T,a(r(),k(E,v/2,g),k(A,b/2,g)))),j=j.concat(o(r(),T,o(r(),k(E,v/2,g),k(A,b/2,g)))),j=j.concat(a(r(),T,a(r(),k(E,v/2,g),k(A,b/2,g)))),j=j.concat(a(r(),T,o(r(),k(E,v/2,g),k(A,b/2,g))))):(j=[l.x,l.y,m],M=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),j=j.concat(o(r(),C,a(r(),k(E,x/2,g),k(A,S/2,g)))),j=j.concat(o(r(),C,o(r(),k(E,x/2,g),k(A,S/2,g)))),j=j.concat(a(r(),C,a(r(),k(E,x/2,g),k(A,S/2,g)))),j=j.concat(a(r(),C,o(r(),k(E,x/2,g),k(A,S/2,g))));let P=new y({position:Float64Array.from(j)});return new u({vertexAttributes:P,components:M,spatialReference:l.spatialReference})}function G(e,t,n,i){{let o=n.z??t,s=o-t,c=Math.sqrt((e[2]-o)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/i)**2)*i,l=k(a(r(),[e[0],e[1],e[2]],[n.x,n.y,o]),1/c,1/i),u=t/(o-e[2]),d={x:(1-u)*n.x+u*e[0],y:(1-u)*n.y+u*e[1],z:(1-u)*o+u*e[2]},f=Math.sqrt((d.z-o)**2+(Math.sqrt((d.x-n.x)**2+(d.y-n.y)**2)/i)**2)*i,p=k(a(r(),[d.x,d.y,d.z],[n.x,n.y,o]),1/f,1/i);return U(l[0],p[0])&&U(l[1],p[1])&&U(l[2],p[2])||e[2]>=s?[e[0],e[1],s]:[d.x,d.y,d.z]}}function ee(e){let{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:i,cameraPitch:a,farDistance:o,nearDistance:s}=e,c=q(e.geometry),l=new f({spatialReference:t}),u=Math.abs(1.44*o*c),d=Math.abs(1.44*s*c);(a<20||i==null)&&(d=u);let p=[];return p[0]={x:n+u*Math.sin((i-45)*N),y:r+u*Math.cos((i-45)*N)},p[1]={x:n+u*Math.sin((i+45)*N),y:r+u*Math.cos((i+45)*N)},p[2]={x:n+d*Math.sin((i+135)*N),y:r+d*Math.cos((i+135)*N)},p[3]={x:n+d*Math.sin((i+225)*N),y:r+d*Math.cos((i+225)*N)},l.addRing([[p[0].x,p[0].y,0],[p[1].x,p[1].y,0],[p[2].x,p[2].y,0],[p[3].x,p[3].y,0],[p[0].x,p[0].y,0]]),l}function K(t){let{cameraHeight:n,cameraPitch:r,farDistance:i,location:a,verticalFieldOfView:o}=t;return i??(r+o/2>=90?20/w(a.spatialReference):n/Math.cos(e(r)))}function q(e){return e&&C(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/g.radius))):1}function te(e,t){let n=1+t/100;if(e.declaredClass===`esri.geometry.Circle`){let{radius:t,center:r}=e,i=t*n,a=new l({radius:i,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if(e.declaredClass===`esri.geometry.Polygon`){let t=new f({spatialReference:e.spatialReference}),i=h(e);if(i){let o=[];for(let t=0;t<e.rings[0].length;t++){let s=Math.sqrt((i.x-e.rings[0][t][0])**2+(i.y-e.rings[0][t][1])**2),c=k(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[i.x,i.y,0]),1/s,1),l=O([i.x,i.y,0],c,s*n,1);o.push({x:l[0],y:l[1]})}t.addRing([[o[0].x,o[0].y,0],[o[1].x,o[1].y,0],[o[2].x,o[2].y,0],[o[3].x,o[3].y,0],[o[0].x,o[0].y,0]])}return t}return e}async function ne(e,t,n){let{cameraHeight:r,cameraLocation:i,cameraPitch:a,frustumVertices:o,horizontalFieldOfView:s,imageHeight:c,imageWidth:l,inSRS:u,outSRS:d,verticalFieldOfView:f,cameraRoll:p,options:h}=n,g=new m(u),_=new m(d),v=A(s,f,p??0),y=o.length>15;return a+v.vfov/2>=90?await se(o,e,l,c,g,_,y,h):await re(o,e,t,i,r,y,g,_,h)}async function re(e,t,n,r,i,a,o,s,c){let l=ie(e,t,n,r,i);if(!l)return;let{farPlane:d,nearPlane:f}=l,p=await J([...f?.vertexPositions??e.slice(0,3),...d.vertexPositions],o,s,c),m=$(p);return new u({vertexAttributes:new y({position:p}),components:Q(a?X(m,!0):Z(m,!0)),spatialReference:s})}function ie(e,t,n,r,i){let a=Y(e),o=Y(e,`near`);if(!a)return;let s=t.length;for(let e=0;e<s;e++){let t=Array.from(n[e]),s=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??i)];oe(r,s,e,o),ae(r,s,e,a)}return{farPlane:a,nearPlane:o}}function ae(e,t,n,i){let{coefficients:a,vertexPositions:o}=i,s=r();S(a,{origin:e,direction:t},s)&&o.splice(n*3,3,...s)}function oe(e,t,n,i){if(!i)return;let a=r();S(i.coefficients,{origin:e,direction:t},a)&&i.vertexPositions.splice(n*3,3,...a)}async function se(e,t,n,r,i,a,o,s){let c=o?[]:[e[0],e[1],e[2]],l,d=[];for(let i of t)o?(l=j([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),c=c.concat(...l),l=j([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),d=d.concat(...l)):(l=j([i[0],i[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),c=c.concat(...l));c=c.concat(d);let f=await J(c,i,a,s),p=$(f);return new u({vertexAttributes:new y({position:f}),components:Q(o?X(p,!0):Z(p,!0)),spatialReference:a})}async function J(e,n,r,i){if(n.equals(r))return e;let a=e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]||(e[r]=[]),e[r].push(t),e},[]),{points:o}=await p(new d({points:a,spatialReference:n}),r,i);return t(i),o.flat()}function Y(e,t=`far`){let n=b(),r;switch(t){case`far`:if(r=Array.from(e.length===15?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case`near`:return r=Array.from(e.slice(0,12)),e.length===15||!x(n,r,!1)?void 0:{coefficients:n,vertexPositions:r}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw Error(`Invalid number of vertices`);let n=[],r=e/2,i=Math.round((t?e-2:e)/2);for(let a=0;a<i;a++){let i=a+r,o=t?i+1:i,s=o%e,c=(t?i:o+1)%e;n.push({faces:new Uint32Array([a,c,s,a,a+1,s])})}return n};function Z(e,t=!1){if(e<3||t&&e-1<3)throw Error(`Invalid number of vertices`);let n=[],r=t?e-2:e-1;for(let e=0;e<r;e++)n.push({faces:new Uint32Array([0,e+1,e+2])});return n}const Q=e=>e.map(e=>new _(e)),$=e=>e.length/3;export{H as checkIfFrustumContainsSelectedPoint,B as checkIfPolygonContainsSelectedPoint,ee as computePolygonForInspection,P as createCoveragePolygon,R as limitZToGround,J as projectVertices,te as resizePolygon,ne as updateFrustum};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i(n,a.cameraLocation.spatialReference));continue}d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i(o,a.spatialReference),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i(e,a.spatialReference)),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i(M,o.spatialReference));continue}let N=n.averageElevation;r&&
|
|
2
|
+
import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i(n,a.cameraLocation.spatialReference));continue}d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i(o,a.spatialReference),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i(e,a.spatialReference)),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i(M,o.spatialReference));continue}let N=n.averageElevation,F;if(r&&T<90){let e=await a(new i(M,o.spatialReference),{heading:s,pitch:T},{...n,...r,farPlaneVertices:d(f,f).map(([e,t])=>new i([o.x+e,o.y+t],o.spatialReference))});F=e,N=e?.[2]??N}let I=(N-w)/(M[2]-w),L=T>=90||!!r&&!F||!Number.isFinite(I)||I<0;x.push(new i(L?[M[0],M[1],N]:D(M,o.toArray(),y,N,T,h),o.spatialReference))}return Array.isArray(e)?x:x[0]}export{w as imageToWorld,F as imageToWorldPanoramic};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,
|
|
2
|
+
import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,intersectRay as i,fromPoints as a,intersectLine as o}from"../../../geometry/support/plane.js";import{fromPoints as s}from"../../../geometry/support/ray.js";import c from"./updateElevation.js";import{pointToArray as l,or as u}from"./utils.js";import{worldToImagePanoramic as d,worldToImage as f}from"./worldToImage.js";import{normalizeDegrees as p}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";async function m(n,r,i,s=g){let{cameraLocation:c,farPlaneVertices:d}=i,f=l(c),p=[];await v(d,i,p);let m=a(p[0],p[1],p[2]),h=n.clone();for(let d=0;d<s;d++){let s=e();if(!o(m,f,l(n),s))break;let d=0,g=null;if({error:d,imagePoint:g,pointWithZ:h}=await y(r,new t(s,c.spatialReference),i),d<=1)break;let[v,b]=_(c.spatialReference,p);if(u(v<=1,b<=1))break;p.splice(0,p.length,...await S(v,b,new t(s,c.spatialReference),i)),m=a(p[0],p[1],p[2])}return l(h)}async function h(n,a,o,c=g){let{cameraLocation:d,farPlaneVertices:f}=o,p=l(d),m=s(p,l(n)),h=[];await v(f,o,h);let y=[0,0,0,0],x=r(y,h.flat(),!1),C=n.clone();for(let n=0;n<c;n++){let n=e();if(!i(y,m,n)||!x)return;let s=0,c;if({error:s,imagePoint:c,pointWithZ:C}=await b(a,new t(n,d.spatialReference),o),s<=1)return l(C);let[f,p]=_(d.spatialReference,h);if(u(f<=1,p<=1))break;h.splice(0,h.length,...await S(f,p,new t(n,d.spatialReference),o)),x=r(y,h.flat(),!1)}}const g=10;function _(e,t){let r=new n({spatialReference:e});return r.addRing(t),[r.extent?.width?r.extent.width/10:1,r.extent?.height?r.extent.height/10:1]}async function v(e,t,n){let r=e.map(e=>e.clone()),i=await c(r,t);n.push(...i.map(l))}async function y(e,t,n){let r=await c(t,n),i=f(r,n);return{error:x(i,e),imagePoint:i,pointWithZ:r}}async function b(e,t,n){let r=await c(t,n),i=d(r,n),a=p(i.heading+n.cameraHeading);return{error:Math.abs(a-e.heading)+Math.abs(i.pitch-e.pitch),imagePoint:i,pointWithZ:r}}const x=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y);async function S(e,n,r,i){let a=[[-e,-n],[e,-n],[e,n],[-e,n]].map(([e,n])=>new t([r.x+e,r.y+n],r.spatialReference));return c(a,i).then(e=>e.map(e=>e.toArray()))}export{m as rectifyMapPoint,h as rectifyMapPointPanoramic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import e from"../../../core/Error.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";const i={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]],YPR:[[0,-1],[1,-1],[2,-1]]};function a(r,i,a,o=!0){if(!Number.isFinite(r))throw new e(`InvalidRotationAngle`,`Please specify a valid angle for rotation`);let s=a*(o?t(r):r),c=Math.cos(s),l=Math.sin(s),u=n();switch(i){case 0:u[4]=c,u[5]=-l,u[7]=l,u[8]=c;break;case 1:u[0]=c,u[2]=l,u[6]=-l,u[8]=c;break;case 2:u[0]=c,u[1]=-l,u[3]=l,u[4]=c;break;default:throw new e(`InvalidRotationAxis`,`Please specify either 0, 1 or 2 for X, Y or Z axis respectively`)}return u}function o(t,i,o=!0){if(t?.length!==3||i?.length!==3)throw new e(`InvalidRotationAngles`,`Please specify three angles with config for rotation`);let s=n();for(let e=0;e<3;e++){let[n,c]=i[e],l=a(t[e],n,c,o);r(s,l,s)}return s}function s(e,t=!0){return o(e,i.HPR,t)}export{o as createRotationMatrix,s as createRotationMatrixFromHPR,i as defaultAxisRotationInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{deg2rad as t,rad2deg as n}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as i,fromValues as a}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{zeros as o,create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{multiply as l,transpose as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as d,mul as f}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{scale as p,sub as m,add as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{isSerializable as g}from"../../../core/support/jsonUtils.js";import _ from"../../../geometry/Point.js";import{projectAsync as v}from"../../../geometry/projectionUtils.js";import{earth as y}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as S,ConstantElevation as C,isElevationSource as w}from"../core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as T}from"../core/utils.js";import{getElevationSampler as ee}from"./updateElevationUtils.js";import{isNumber as E}from"../../../support/guards.js";import{defaultImageSphereSize as D}from"../../../widgets/PanoramicViewer/constants.js";function O(e,t,n){let[r,a,o,s]=t,[c,l,u,p]=n;k(r,a,o,s);let m=k(c,l,u,p),h=A(r,a,o,s),g=A(c,l,u,p),_=d(i(),h),[v,y,b,x]=ne(e,f(i(),_,g));return[v/x,y/x,m?0:b/x]}function k(e,t,n,r){return e[2]===0&&t[2]===0&&n[2]===0&&r[2]===0&&(e[2]=t[2]=n[2]=r[2]=1,!0)}function te(e){return e===0?1:e}function ne(e,t){let[n,r,i]=e,a=[0,0,0,0];return a[0]=n*t[0]+r*t[1]+i*t[2]+t[3],a[1]=n*t[4]+r*t[5]+i*t[6]+t[7],a[2]=n*t[8]+r*t[9]+i*t[10]+t[11],a[3]=te(n*t[12]+r*t[13]+i*t[14]+t[15]),a}function A(e,t,n,r){let o=re(c([...r,1]),d(Array(16),a(e[0],t[0],n[0],0,e[1],t[1],n[1],0,e[2],t[2],n[2],0,1,1,1,1))),s=o[0],l=o[1],u=o[2],f=i();return f[0]=s*e[0],f[1]=l*t[0],f[2]=u*n[0],f[3]=0,f[4]=s*e[1],f[5]=l*t[1],f[6]=u*n[1],f[7]=0,f[8]=s*e[2],f[9]=l*t[2],f[10]=u*n[2],f[11]=0,f[12]=s,f[13]=l,f[14]=u,f[15]=1,f}function j(e,t,n,r,i=o()){return i[0]=e[0]+t[0]*n,i[1]=e[1]+t[1]*n,i[2]=e[2]+t[2]*(n/r),i}function M(e,t,n){let r=o();return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*(t/n),r}function N(e,t){let[n,r,i]=e,a=o();return a[0]=n*t[0]+r*t[3]+i*t[6],a[1]=n*t[1]+r*t[4]+i*t[7],a[2]=n*t[2]+r*t[5]+i*t[8],a}function re(e,t){let[n,r,i,a]=e,o=[,,,,];return o[0]=n*t[0]+r*t[1]+i*t[2]+a*t[3],o[1]=n*t[4]+r*t[5]+i*t[6]+a*t[7],o[2]=n*t[8]+r*t[9]+i*t[10]+a*t[11],o[3]=n*t[12]+r*t[13]+i*t[14]+a*t[15],o}function ie(n,i,a,o=!0){if(!Number.isFinite(n))throw new e(`InvalidRotationAngle`,`Please specify a valid angle for rotation`);let s=a*(o?t(n):n),c=Math.cos(s),l=Math.sin(s),u=r();switch(i){case 0:u[4]=c,u[5]=-l,u[7]=l,u[8]=c;break;case 1:u[0]=c,u[2]=l,u[6]=-l,u[8]=c;break;case 2:u[0]=c,u[1]=-l,u[3]=l,u[4]=c;break;default:throw new e(`InvalidRotationAxis`,`Please specify either 0, 1 or 2 for X, Y or Z axis respectively`)}return u}const P={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]],YPR:[[0,-1],[1,-1],[2,-1]]};function F(t,n,i=!0){if(t?.length!==3||n?.length!==3)throw new e(`InvalidRotationAngles`,`Please specify three angles with config for rotation`);let a=r();for(let e=0;e<3;e++){let[r,o]=n[e],s=ie(t[e],r,o,i);l(a,s,a)}return a}function I(e,t=!0){return F(e,P.OPK,t)}function L(e,t=!0){return F(e,P.HPR,t)}function ae(e,n,r){let i=Math.sin(t(r)),a=Math.cos(t(r)),o=[[e,0],[e,n],[0,n]];o.forEach((e,t)=>{o[t]=[a*e[0]-i*e[1],i*e[0]+a*e[1]]});let s={xmin:Math.min(0,o[0][0],o[1][0],o[2][0]),xmax:Math.max(0,o[0][0],o[1][0],o[2][0]),ymin:Math.min(0,o[0][1],o[1][1],o[2][1]),ymax:Math.max(0,o[0][1],o[1][1],o[2][1])};return{hfov:Math.abs(s.xmax-s.xmin),vfov:Math.abs(s.ymax-s.ymin)}}function oe(e,r){let i=Number(e[0]),a=Number(e[1]),o=Number(e[2]),[s,c,l,u]=r,d=t(s),f=t(c),p=l/Math.sqrt(1-u*Math.sin(d)**2),m=i/p,h=a/p,g=o/p,_=Math.cos(d)-Math.sin(d)*h+Math.cos(d)*g,v=Math.sin(d)+Math.cos(d)*h+Math.sin(d)*g,y=Math.sqrt(_**2+m**2),b=u*p*Math.sin(d),x=(e,t=5)=>{if(t===0)return e;let n=x(e,t-1);return Math.atan(v/y-(b-u*(l/Math.sqrt(1-u*Math.sin(n)**2))*Math.sin(n))/(p*y))},S=x(d),C=Math.atan(i/(p*_))+f,w=n(S);return[n(C),w,i/(Math.cos(S)*Math.sin(C-f))-l/Math.sqrt(1-u*Math.sin(S)**2)]}function R(e,t,n){let r=360/t,i=180/n,a=e.x-t/2,o=e.y-n/2;return{heading:a*r,pitch:90-o*i}}function se(e,t,n,r,i=D/2){let{heading:a,pitch:o}=B(e,i),s=r?$(a,o,r):[a,o];return{heading:a,pitch:o,...z(s[0],s[1],t,n)}}function z(e,t,n,r){let i=360/n,a=180/r,o=e%360,s=o<-180?o+360:o>180?o-360:o;return{x:n/2+s/i,y:r-t/a}}function B(e,t){let r=n(Math.acos(-e.z/t));return{heading:n(Math.atan2(e.x,e.y)),pitch:r}}function V(e,n){return[Math.sin(t(e))*Math.sin(t(n)),Math.cos(t(e))*Math.sin(t(n)),Math.cos(t(180-n))]}function H(e,t,n,r=D/2){let i=n?$(e,t,n,!0):[e,t];return p(s(),V(i[0],i[1]),r)}function ce(e,t,n,r,i=D/2){let{heading:a,pitch:o}=R(e,t,n);return H(a,o,r,i)}async function le(e,t,r){let i=await v(t,e.spatialReference,r),a=n(Math.atan2(i.y-e.y,i.x-e.x));return a=a>=0&&a<=90?90-a:a>90&&a<=180?360-a+90:90+Math.abs(a),a}function ue(e,t,n){let r=Math.cos(n),i=Math.sin(n),a=[1,0,0,1,0,0],o=a[0]*r+a[2]*i,s=a[1]*r+a[3]*i,c=-a[0]*i+a[2]*r,l=-a[1]*i+a[3]*r;return a[0]=o,a[1]=s,a[2]=c,a[3]=l,[e*a[0]+t*a[2]+a[4],e*a[1]+t*a[3]+a[5]]}const de=e=>e.toArray(),U=(...e)=>e.some(e=>e);function fe(e,t){if(U(e.length===0,e.some(({x:e,y:t})=>U(e==null,t==null)),!t.hasZ))throw Error(`Input pixels must have x, y and camera location must have z value`)}function pe(e,t){if(e.some(e=>e.z==null)||t.z==null)throw Error(`Input points and camera location must have z value`)}function me(e){if(e?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`)}function he(e,t){return b(t)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e/y.radius))):1}const ge=e=>t=>new _({x:t[0],y:t[1],z:t[2],spatialReference:e});function _e(e,t,n,r){return[[-t,-t],[+t,-t],[+t,+t],[-t,+t]].map(([t,i])=>O(x(o(),n,[t,i,0]),r,e))}function W({a0:e,a1:t,a2:n,b0:r,b1:i,b2:a},o,s,c){let l=[e??o/2-.5,t,n??0,r??s/2-.5,i??0,a].map(ve);return c!=null&&G(l)?{affines:l,focalLength:c}:{affines:[o/2-.5,1,0,s/2-.5,0,-1]}}function ve(e,t){if(e==null)return null;let n=parseFloat(`${e}`);return isNaN(n)?null:n}function G(e){return e[1]!=null&&e[5]!=null}function ye(e,t,n){let{cameraHeight:r,cameraPitch:i,cameraRoll:a,elevation:o,farDistance:s,horizontalFieldOfView:c,location:l,verticalFieldOfView:u}=Q(e,e.location.spatialReference),d=o??(l.z??0)-r;return{...K(e,t,n),averageElevation:d,cameraPitch:i,cameraRoll:a??0,farDistance:s,horizontalFieldOfView:c,verticalFieldOfView:u}}function be(e,t,n,r){return X(r)?I([r.omega,r.phi,r.kappa]):Z(r)?L([r.heading,r.pitch,r.roll]):L([e,t,n??0])}function xe(e,t,n){let{cameraHeading:r,cameraHeight:i,farDistance:a,horizontalFieldOfView:o,location:s,verticalFieldOfView:c}=Q(e,e.location.spatialReference),l=(s.z??0)-i,u=-r,d=0,f=0;if(e?.matrix){let{matrix:t}=e;[d,f,u]=Ee(t)}return{averageElevation:l,cameraLocation:s,cameraHeading:r,farDistance:a,horizontalFieldOfView:o,imageHeight:n,imageWidth:t,verticalFieldOfView:c,horizonYaw:u,horizonPitch:d,horizonRoll:f}}function K(e,t,n){let{a0:r,a1:i,a2:a,b0:o,b1:s,b2:c,cameraHeading:l,cameraOrientation:u,cameraPitch:d,cameraRoll:f,focalLength:p,horizontalFieldOfView:m,location:h,matrix:g,principalX:_,principalY:v,radial:y,tangential:b,verticalFieldOfView:x}=e,{affines:S,focalLength:C}=W({a0:r,a1:i,a2:a,b0:o,b1:s,b2:c},t,n,p),w=g??be(l,d,f,u),T=_!=null&&v!=null?[_,v]:void 0;return{affineTransformations:u?.affineTransformations??S,cameraLocation:h.clone(),focalLength:u?.focalLength??C,horizontalFieldOfView:m,imageHeight:n,imageWidth:t,principalOffsetPoint:u?.principalOffsetPoint??T,radialDistortionCoefficients:u?.radialDistortionCoefficients??y,rotationMatrix:w,tangentialDistortionCoefficients:u?.tangentialDistortionCoefficients??b,verticalFieldOfView:x}}const q=e=>e!=null&&`elevationSample`in e&&e.elevationSample!=null,J=e=>w(e?.elevationSource)&&e?.extent!=null,Y=e=>S(e?.elevationSource),Se=async(e,t,n,r,i)=>{let a=T(e),o=t-n/a;return q(r)?r:Y(r)?(r.elevationSource=new C({constantElevation:r.elevationSource.constantElevation/a}),r):J(r)?{elevationSample:await ee({...g(r.elevationSource)?r.elevationSource.toJSON():r.elevationSource,extent:r.extent},i),elevationSource:new C({constantElevation:o})}:{averageGroundElevation:o,spatialReference:e}},Ce=e=>E(e?.heading)&&E(e?.pitch),we=(e,t)=>[[-e,-t],[e,-t],[e,t],[-e,t]];function Te(e){let{cameraLocation:n,farDistance:i,horizontalFieldOfView:a,rotationMatrix:s,scalingFactor:c,verticalFieldOfView:l}=e,d=r();u(d,s);let f=2*Math.tan(t(l)/2)*i*c,p=2*Math.tan(t(a)/2)*i*c,g=N([0,0,-1],d),_=j([n.x,n.y,n.z],g,e.farDistance*c,c),v=N([0,1,0],d),y=N([1,0,0],d),b=M(v,f/2,c),x=M(y,p/2,c),S=m(o(),b,x),C=h(o(),b,x);return[h(o(),_,S),h(o(),_,C),m(o(),_,S),m(o(),_,C)]}const X=e=>e?.type===2,Z=e=>e?.type===1;function Q(e,t,n=!0){let r=T(t),i=n?e.clone():e;return i.cameraHeight/=r,i.farDistance/=r,i.nearDistance/=r,S(i.elevationSource)&&(i.elevationSource.constantElevation/=r),i}function Ee(e){return[n(Math.asin(-e[6])),n(Math.atan(e[7]/e[8])),n(Math.atan2(e[3],e[0]))]}function $(e,t,n,r=!1){return De(V(e,t),n,r)}function De(e,t,i=!1){let a=i?u(r(),F(t,P.YPR)):F(t,P.YPR),o=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],s=e[0]*a[3]+e[1]*a[4]+e[2]*a[5],c=e[0]*a[6]+e[1]*a[7]+e[2]*a[8],l=n(Math.acos(-c));return[n(Math.atan2(o,s)),l]}export{$ as adjustHorizonAngles,De as adjustHorizonAnglesVec3,Te as computeFarplaneVertices,ae as computeHFOVAndVFOV,_e as computeNewReferenceCoordinates,H as convertHeadingPitchToSphereVertex,z as convertOrientationToPixelLocation,ce as convertPixelLocationToSphereVertex,R as convertPixelToHeadingPitch,B as convertSphereVertexToOrientation,se as convertSphereVertexToPixelLocation,Q as convertToSRUnits,V as createMeshSpaceVector,F as createRotationMatrix,L as createRotationMatrixFromHPR,I as createRotationMatrixFromOPK,Ee as extractHorizonAngles,W as getAffinesAndFocalLength,xe as getImageToWorldPanoramicProperties,ye as getImageToWorldProperties,le as getInitialAngle,Se as getUpdateElevationProps,he as getWebMercatorScalingFactor,K as getWorldToImageProperties,Ce as hasAngles,Z as hasHeadingPitchRoll,X as hasOmegaPhiKappa,q as isUpdateElevationWithElevationSampler,J as isUpdateElevationWithElevationSource,Y as isUpdateUsingConstantElevation,G as isValidAffines,A as linearEquationSolve,oe as ltpToGeographic,U as or,de as pointToArray,O as projectiveTransform,we as reducerFn,ue as rotatePixel,j as scaleAndAddWithFactor,M as scaleWithFactor,N as transformMat3,re as transformMat4,fe as validatePixelsToTransform,pe as validatePointsToTransform,me as validateRotationMatrix,ge as vecToPoint};
|
|
2
|
+
import{rad2deg as e,deg2rad as t}from"../../../core/mathUtils.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r,fromValues as i}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{zeros as a,create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as s}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as l,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{scale as d,sub as f,add as p}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{isSerializable as m}from"../../../core/support/jsonUtils.js";import h from"../../../geometry/Point.js";import{projectAsync as g}from"../../../geometry/projectionUtils.js";import{earth as _}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as v}from"../../../geometry/support/spatialReferenceUtils.js";import{a as y}from"../../../chunks/vec3.js";import{isConstantElevation as b,ConstantElevation as x,isElevationSource as S}from"../core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as C}from"../core/utils.js";import{createRotationMatrix as w,defaultAxisRotationInfo as T,createRotationMatrixFromHPR as E}from"./rotationUtils.js";import{getElevationSampler as ee}from"./updateElevationUtils.js";import{isNumber as D}from"../../../support/guards.js";import{defaultImageSphereSize as O}from"../../../widgets/PanoramicViewer/constants.js";function k(e,t,n){let[i,a,o,s]=t,[c,d,f,p]=n;A(i,a,o,s);let m=A(c,d,f,p),h=j(i,a,o,s),g=j(c,d,f,p),_=l(r(),h),[v,y,b,x]=ne(e,u(r(),_,g));return[v/x,y/x,m?0:b/x]}function A(e,t,n,r){return e[2]===0&&t[2]===0&&n[2]===0&&r[2]===0&&(e[2]=t[2]=n[2]=r[2]=1,!0)}function te(e){return e===0?1:e}function ne(e,t){let[n,r,i]=e,a=[0,0,0,0];return a[0]=n*t[0]+r*t[1]+i*t[2]+t[3],a[1]=n*t[4]+r*t[5]+i*t[6]+t[7],a[2]=n*t[8]+r*t[9]+i*t[10]+t[11],a[3]=te(n*t[12]+r*t[13]+i*t[14]+t[15]),a}function j(e,t,n,a){let o=F(s([...a,1]),l(Array(16),i(e[0],t[0],n[0],0,e[1],t[1],n[1],0,e[2],t[2],n[2],0,1,1,1,1))),c=o[0],u=o[1],d=o[2],f=r();return f[0]=c*e[0],f[1]=u*t[0],f[2]=d*n[0],f[3]=0,f[4]=c*e[1],f[5]=u*t[1],f[6]=d*n[1],f[7]=0,f[8]=c*e[2],f[9]=u*t[2],f[10]=d*n[2],f[11]=0,f[12]=c,f[13]=u,f[14]=d,f[15]=1,f}function M(e,t,n,r,i=a()){return i[0]=e[0]+t[0]*n,i[1]=e[1]+t[1]*n,i[2]=e[2]+t[2]*(n/r),i}function N(e,t,n){let r=a();return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*(t/n),r}function P(e,t){let[n,r,i]=e,o=a();return o[0]=n*t[0]+r*t[3]+i*t[6],o[1]=n*t[1]+r*t[4]+i*t[7],o[2]=n*t[2]+r*t[5]+i*t[8],o}function F(e,t){let[n,r,i,a]=e,o=[,,,,];return o[0]=n*t[0]+r*t[1]+i*t[2]+a*t[3],o[1]=n*t[4]+r*t[5]+i*t[6]+a*t[7],o[2]=n*t[8]+r*t[9]+i*t[10]+a*t[11],o[3]=n*t[12]+r*t[13]+i*t[14]+a*t[15],o}function I(e,t=!0){return w(e,T.OPK,t)}function re(e,n,r){let i=Math.sin(t(r)),a=Math.cos(t(r)),o=[[e,0],[e,n],[0,n]];o.forEach((e,t)=>{o[t]=[a*e[0]-i*e[1],i*e[0]+a*e[1]]});let s={xmin:Math.min(0,o[0][0],o[1][0],o[2][0]),xmax:Math.max(0,o[0][0],o[1][0],o[2][0]),ymin:Math.min(0,o[0][1],o[1][1],o[2][1]),ymax:Math.max(0,o[0][1],o[1][1],o[2][1])};return{hfov:Math.abs(s.xmax-s.xmin),vfov:Math.abs(s.ymax-s.ymin)}}function ie(n,r){let i=Number(n[0]),a=Number(n[1]),o=Number(n[2]),[s,c,l,u]=r,d=t(s),f=t(c),p=l/Math.sqrt(1-u*Math.sin(d)**2),m=i/p,h=a/p,g=o/p,_=Math.cos(d)-Math.sin(d)*h+Math.cos(d)*g,v=Math.sin(d)+Math.cos(d)*h+Math.sin(d)*g,y=Math.sqrt(_**2+m**2),b=u*p*Math.sin(d),x=(e,t=5)=>{if(t===0)return e;let n=x(e,t-1);return Math.atan(v/y-(b-u*(l/Math.sqrt(1-u*Math.sin(n)**2))*Math.sin(n))/(p*y))},S=x(d),C=Math.atan(i/(p*_))+f,w=e(S);return[e(C),w,i/(Math.cos(S)*Math.sin(C-f))-l/Math.sqrt(1-u*Math.sin(S)**2)]}function L(e,t,n){let r=360/t,i=180/n,a=e.x-t/2,o=e.y-n/2;return{heading:a*r,pitch:90-o*i}}function ae(e,t,n,r,i=O/2){let{heading:a,pitch:o}=z(e,i),s=r?$(a,o,r):[a,o];return{heading:a,pitch:o,...R(s[0],s[1],t,n)}}function R(e,t,n,r){let i=360/n,a=180/r,o=e%360,s=o<-180?o+360:o>180?o-360:o;return{x:n/2+s/i,y:r-t/a}}function z(t,n){let r=e(Math.acos(-t.z/n));return{heading:e(Math.atan2(t.x,t.y)),pitch:r}}function B(e,n){return[Math.sin(t(e))*Math.sin(t(n)),Math.cos(t(e))*Math.sin(t(n)),Math.cos(t(180-n))]}function V(e,t,n,r=O/2){let i=n?$(e,t,n,!0):[e,t];return d(o(),B(i[0],i[1]),r)}function oe(e,t,n,r,i=O/2){let{heading:a,pitch:o}=L(e,t,n);return V(a,o,r,i)}async function se(t,n,r){let i=await g(n,t.spatialReference,r),a=e(Math.atan2(i.y-t.y,i.x-t.x));return a=a>=0&&a<=90?90-a:a>90&&a<=180?360-a+90:90+Math.abs(a),a}function ce(e,t,n){let r=Math.cos(n),i=Math.sin(n),a=[1,0,0,1,0,0],o=a[0]*r+a[2]*i,s=a[1]*r+a[3]*i,c=-a[0]*i+a[2]*r,l=-a[1]*i+a[3]*r;return a[0]=o,a[1]=s,a[2]=c,a[3]=l,[e*a[0]+t*a[2]+a[4],e*a[1]+t*a[3]+a[5]]}const le=e=>e.toArray(),H=(...e)=>e.some(e=>e);function ue(e,t){if(H(e.length===0,e.some(({x:e,y:t})=>H(e==null,t==null)),!t.hasZ))throw Error(`Input pixels must have x, y and camera location must have z value`)}function de(e,t){if(e.some(e=>e.z==null)||t.z==null)throw Error(`Input points and camera location must have z value`)}function fe(e){if(e?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`)}function pe(e,t){return v(t)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e/_.radius))):1}const me=e=>t=>new h({x:t[0],y:t[1],z:t[2],spatialReference:e});function he(e,t,n,r){return[[-t,-t],[+t,-t],[+t,+t],[-t,+t]].map(([t,i])=>k(y(a(),n,[t,i,0]),r,e))}function U({a0:e,a1:t,a2:n,b0:r,b1:i,b2:a},o,s,c){let l=[e??o/2-.5,t,n??0,r??s/2-.5,i??0,a].map(ge);return c!=null&&W(l)?{affines:l,focalLength:c}:{affines:[o/2-.5,1,0,s/2-.5,0,-1]}}function ge(e,t){if(e==null)return null;let n=parseFloat(`${e}`);return isNaN(n)?null:n}function W(e){return e[1]!=null&&e[5]!=null}function _e(e,t,n){let{cameraHeight:r,cameraPitch:i,cameraRoll:a,elevation:o,farDistance:s,horizontalFieldOfView:c,location:l,verticalFieldOfView:u}=Z(e,e.location.spatialReference),d=o??(l.z??0)-r;return{...G(e,t,n),averageElevation:d,cameraPitch:i,cameraRoll:a??0,farDistance:s,horizontalFieldOfView:c,verticalFieldOfView:u}}function ve(e,t,n,r){return Y(r)?I([r.omega,r.phi,r.kappa]):X(r)?E([r.heading,r.pitch,r.roll]):E([e,t,n??0])}function ye(e,t,n){let{cameraHeading:r,cameraHeight:i,farDistance:a,horizontalFieldOfView:o,location:s,verticalFieldOfView:c}=Z(e,e.location.spatialReference),l=(s.z??0)-i,u=-r,d=0,f=0;if(e?.matrix){let{matrix:t}=e;[d,f,u]=Q(t)}return{averageElevation:l,cameraLocation:s,cameraHeading:r,farDistance:a,horizontalFieldOfView:o,imageHeight:n,imageWidth:t,verticalFieldOfView:c,horizonYaw:u,horizonPitch:d,horizonRoll:f}}function G(e,t,n){let{a0:r,a1:i,a2:a,b0:o,b1:s,b2:c,cameraHeading:l,cameraOrientation:u,cameraPitch:d,cameraRoll:f,focalLength:p,horizontalFieldOfView:m,location:h,matrix:g,principalX:_,principalY:v,radial:y,tangential:b,verticalFieldOfView:x}=e,{affines:S,focalLength:C}=U({a0:r,a1:i,a2:a,b0:o,b1:s,b2:c},t,n,p),w=g??ve(l,d,f,u),T=_!=null&&v!=null?[_,v]:void 0;return{affineTransformations:u?.affineTransformations??S,cameraLocation:h.clone(),focalLength:u?.focalLength??C,horizontalFieldOfView:m,imageHeight:n,imageWidth:t,principalOffsetPoint:u?.principalOffsetPoint??T,radialDistortionCoefficients:u?.radialDistortionCoefficients??y,rotationMatrix:w,tangentialDistortionCoefficients:u?.tangentialDistortionCoefficients??b,verticalFieldOfView:x}}const K=e=>e!=null&&`elevationSample`in e&&e.elevationSample!=null,q=e=>S(e?.elevationSource)&&e?.extent!=null,J=e=>b(e?.elevationSource),be=async(e,t,n,r,i)=>{let a=C(e),o=t-n/a;return K(r)?r:J(r)?(r.elevationSource=new x({constantElevation:r.elevationSource.constantElevation/a}),r):q(r)?{elevationSample:await ee({...m(r.elevationSource)?r.elevationSource.toJSON():r.elevationSource,extent:r.extent},i),elevationSource:new x({constantElevation:o})}:{averageGroundElevation:o,spatialReference:e}},xe=e=>D(e?.heading)&&D(e?.pitch),Se=(e,t)=>[[-e,-t],[e,-t],[e,t],[-e,t]];function Ce(e){let{cameraLocation:r,farDistance:i,horizontalFieldOfView:o,rotationMatrix:s,scalingFactor:l,verticalFieldOfView:u}=e,d=n();c(d,s);let m=2*Math.tan(t(u)/2)*i*l,h=2*Math.tan(t(o)/2)*i*l,g=P([0,0,-1],d),_=M([r.x,r.y,r.z],g,e.farDistance*l,l),v=P([0,1,0],d),y=P([1,0,0],d),b=N(v,m/2,l),x=N(y,h/2,l),S=f(a(),b,x),C=p(a(),b,x);return[p(a(),_,S),p(a(),_,C),f(a(),_,S),f(a(),_,C)]}const Y=e=>e?.type===2,X=e=>e?.type===1;function Z(e,t,n=!0){let r=C(t),i=n?e.clone():e;return i.cameraHeight/=r,i.farDistance/=r,i.nearDistance/=r,b(i.elevationSource)&&(i.elevationSource.constantElevation/=r),i}function Q(t){return[e(Math.asin(-t[6])),e(Math.atan(t[7]/t[8])),e(Math.atan2(t[3],t[0]))]}function $(e,t,n,r=!1){return we(B(e,t),n,r)}function we(t,r,i=!1){let a=i?c(n(),w(r,T.YPR)):w(r,T.YPR),o=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],s=t[0]*a[3]+t[1]*a[4]+t[2]*a[5],l=t[0]*a[6]+t[1]*a[7]+t[2]*a[8],u=e(Math.acos(-l));return[e(Math.atan2(o,s)),u]}export{$ as adjustHorizonAngles,we as adjustHorizonAnglesVec3,Ce as computeFarplaneVertices,re as computeHFOVAndVFOV,he as computeNewReferenceCoordinates,V as convertHeadingPitchToSphereVertex,R as convertOrientationToPixelLocation,oe as convertPixelLocationToSphereVertex,L as convertPixelToHeadingPitch,z as convertSphereVertexToOrientation,ae as convertSphereVertexToPixelLocation,Z as convertToSRUnits,B as createMeshSpaceVector,w as createRotationMatrix,E as createRotationMatrixFromHPR,I as createRotationMatrixFromOPK,Q as extractHorizonAngles,U as getAffinesAndFocalLength,ye as getImageToWorldPanoramicProperties,_e as getImageToWorldProperties,se as getInitialAngle,be as getUpdateElevationProps,pe as getWebMercatorScalingFactor,G as getWorldToImageProperties,xe as hasAngles,X as hasHeadingPitchRoll,Y as hasOmegaPhiKappa,K as isUpdateElevationWithElevationSampler,q as isUpdateElevationWithElevationSource,J as isUpdateUsingConstantElevation,W as isValidAffines,j as linearEquationSolve,ie as ltpToGeographic,H as or,le as pointToArray,k as projectiveTransform,Se as reducerFn,ce as rotatePixel,M as scaleAndAddWithFactor,N as scaleWithFactor,P as transformMat3,F as transformMat4,ue as validatePixelsToTransform,de as validatePointsToTransform,fe as validateRotationMatrix,me as vecToPoint};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.169",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.8",
|
|
23
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
23
|
+
"@arcgis/toolkit": "5.2.0-next.169",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
|
|
25
25
|
"@esri/calcite-components": "^5.2.0",
|
|
26
26
|
"@vaadin/grid": "~25.3.2",
|
package/popup/FeaturesModel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>!!this.view?.focusRegionVisible,()=>{this._initialDisplayMode===void 0&&this._syncSelectedFeatureIndex(this.features)}),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=_(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(A(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!E(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getHighlightLayer as w,getHighlightLayerView as T}from"./support/featureUtils.js";import{getDisplayedSymbol as E}from"../symbols/support/symbolUtils.js";import{system as D}from"../time/constants.js";import{highlightsSupported as O}from"../views/support/layerViewUtils.js";import{GoTo as k}from"../widgets/support/GoTo.js";const A=Symbol(`feature-stream-flush`);let j=null;function M(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let N=class extends k(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>!!this.view?.focusRegionVisible,()=>{this._initialDisplayMode===void 0&&this._syncSelectedFeatureIndex(this.features)}),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??D}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await E(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(A);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),j??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=j;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}_getHighlightLayer(e){return w(e,this.map)}_getHighlightTarget(e,t,n){if(M(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=T(i,o,this.map);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!O(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},A);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(A),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],N.prototype,`_initialDisplayMode`,void 0),e([d()],N.prototype,`_activeFeatureStream`,void 0),e([d()],N.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],N.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],N.prototype,`defaultActions`,null),e([d({readOnly:!0})],N.prototype,`active`,null),e([d()],N.prototype,`activeFeature`,void 0),e([d()],N.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],N.prototype,`content`,null),e([d({type:Boolean})],N.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],N.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],N.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],N.prototype,`featureCount`,null),e([d({value:null})],N.prototype,`featurePage`,null),e([d({value:[]})],N.prototype,`features`,null),e([d()],N.prototype,`featureStream`,null),e([d()],N.prototype,`featuresPerPage`,void 0),e([d()],N.prototype,`featureMenuOpen`,void 0),e([d({type:C})],N.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],N.prototype,`featureModels`,void 0),e([d()],N.prototype,`heading`,void 0),e([d()],N.prototype,`highlightEnabled`,void 0),e([d()],N.prototype,`includeDefaultActions`,void 0),e([d()],N.prototype,`initialDisplayMode`,null),e([d({type:p})],N.prototype,`location`,null),e([d()],N.prototype,`map`,null),e([d()],N.prototype,`open`,void 0),e([d({readOnly:!0})],N.prototype,`pendingLocation`,null),e([d({readOnly:!0})],N.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],N.prototype,`selectedFeature`,null),e([d({value:-1})],N.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],N.prototype,`selectedFeatureItem`,null),e([d({type:h})],N.prototype,`spatialReference`,null),e([d({readOnly:!0})],N.prototype,`state`,null),e([d()],N.prototype,`timeZone`,null),e([d()],N.prototype,`updateLocationEnabled`,void 0),e([d()],N.prototype,`view`,void 0),e([d({readOnly:!0})],N.prototype,`waitingForContents`,null),e([d({readOnly:!0})],N.prototype,`waitingForResult`,null),e([d()],N.prototype,`zoomFactor`,void 0),N=e([f(`esri.popup.FeaturesModel`)],N);const P=N;export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Logger.js";import{replace as t}from"../../core/string.js";import{getGraphicLayer as n}from"../../graphic/graphicOriginUtils.js";import{formatDate as r,convertDateFormatToIntlOptions as i}from"../../intl/date.js";import{convertNumberFieldFormatToIntlOptions as a,convertNumberFormatToIntlOptions as o,formatNumber as s}from"../../intl/number.js";import{typesHaveUniqueIdsAndNames as c}from"../../layers/support/featureLayerUtils.js";import{fieldFormatFromFieldInfo as l}from"../../layers/support/fieldFormatUtils.js";import{isRasterPixelValueField as u,featureHasFields as d,isTimeOnlyField as f}from"../../layers/support/fieldUtils.js";import{getFieldConfigurationsContainer as p,getEffectiveLayerCapabilities as m}from"../../layers/support/layerUtils.js";import{formatAnyDate as h,isAnyDateField as g}from"../../smartMapping/support/utils.js";import{loadArcade as _}from"../../support/loadArcade.js";import{getTimeZoneFormattingOptions as v}from"../../time/timeZoneUtils.js";const y=()=>e.getLogger(`esri.popup.support.featureUtils`),b=/href=(""|'')/gi,ee=/(\{([^{\r\n]+)\})/g,te=/'/g,x=/^\s*expression\//i,ne=/(\n)/gi,re=/[\u00A0-\u9999<>&]/gim,ie=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,ae=/^(?:mailto:|tel:)/,S=`relationships/`,C=i(`short-date-short-time`);function oe(e){if(e!=null)return(e.sourceLayer||e.layer)??void 0}const se=new Set([`building`,`knowledge-graph`,`link-chart`,`map-image`,`map-notes`,`subtype-group`,`tile`]);function ce(e){let t=e?.origin;return(t==null?void 0:se.has(t.type??``)?t.sublayer:t.layer)??e?.layer}async function le({type:e,value:t,event:n}){try{return typeof t==`function`?t(n):await t}catch(r){y().error(`error`,`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t});return}}function ue(e=``){if(e)return!ae.test(e.trim().toLowerCase())}function w(e){return e?x.test(e):!1}function T(e,t){if(!t||!w(t)||!e)return;let n=t.replace(x,``).toLowerCase();return e.find(({name:e})=>e.toLowerCase()===n)}function E(e){let{fieldInfo:t,graphic:n,layer:r}=e;return de({fieldInfo:t,graphic:n})?p(r,{graphic:n}):null}function de({fieldInfo:e,graphic:t}){return!!e?.fieldName&&!w(e.fieldName)&&!J(e.fieldName)&&!t?.popupTemplate}function fe({expressionInfos:e,fieldInfo:t,graphic:n,isContentFieldInfos:r,layer:i}){if(!t?.fieldName)return null;let a=T(e,t.fieldName);if(a)return a.title||null;let o=E({fieldInfo:t,graphic:n,layer:i});if(o){let e=o.getFieldAlias(t.fieldName);return r?t.label||e||t.fieldName:e||t.fieldName}return t.label||t.fieldName}function D(e){let{configurableFieldsContainer:t,fieldInfo:n,isContentFieldInfos:r}=e;if(!n?.fieldName)return null;let i=!t.popupTemplate&&!t.fieldConfigurations?l(n,t.getField(n.fieldName)):t.getFieldConfiguration(n.fieldName)?.fieldFormat;return r&&n.fieldFormat||i}function pe(e,t){return`{${t.get(e.toLowerCase())?.fieldName||e}}`}function me(e){return e.replaceAll(b,``)}function O(e,t){let n=k(t,e);return n?n.name:e}function he(e,t){return e&&e.map(e=>O(e,t))}function k(e,t){return!(e&&typeof e.getField==`function`)||!t?null:e.getField(t)??null}function A(e){return`${e}`.trim()}function ge({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:a}){return r?j({formattedAttributes:t,template:I(r,{...t,...i,...e},n),fieldInfoMap:a}):``}function j({formattedAttributes:e,template:n,fieldInfoMap:r}){return A(me(t(t(n,e=>pe(e,r)),e)))}function M(e,t,n=!1){let r=t[e];typeof r==`string`&&(t[e]=(n?encodeURIComponent(r):r).replaceAll(te,`%27`))}function N(e,t=!1){let n={...e};return Object.keys(n).forEach(e=>M(e,n,t)),n}function P(e,n,r){n=A(n);let i=n&&!n.startsWith(`{`);return t(e,N(r,i||!1))}function F(e,t){return e.replaceAll(ee,(e,n,r)=>{let i=k(t,r);return i?`{${i.name}}`:n})}function I(e,t,n){let r=F(e,n);return r&&r.replaceAll(ie,(e,n,r)=>P(e,n||r,t))}function L(e,t){let n=t?.fieldFormat?.type===`number`||t?.format&&t.format.dateFormat==null&&(t.format.places!=null||t.format.digitSeparator!=null);if(typeof e==`string`&&n){let t=Number(e);if(!isNaN(t))return t}return e}function R(e){return typeof e==`object`&&!!e&&`fieldsIndex`in e&&`geometryType`in e&&`getField`in e&&`load`in e&&`loaded`in e&&`objectIdField`in e&&`spatialReference`in e&&`type`in e&&(e.type===`feature`||e.type===`scene`||e.type===`subtype-group`||e.type===`subtype-sublayer`||e.type===`sublayer`)&&`when`in e}function z(e){return typeof e==`object`&&!!e&&`createQuery`in e&&`queryFeatureCount`in e&&`queryObjectIds`in e&&`queryRelatedFeatures`in e&&`queryRelatedFeaturesCount`in e&&`relationships`in e}function B(e){return R(e)&&z(e)}function _e(e){return e&&typeof e==`object`&&`createQuery`in e&&`getField`in e&&`queryFeatureCount`in e&&`queryFeatures`in e&&`queryObjectIds`in e&&`capabilities`in e&&`fields`in e&&`fieldsIndex`in e&&`type`in e&&(e.type===`feature`||e.type===`subtype-group`||e.type===`subtype-sublayer`||e.type===`sublayer`)&&`when`in e?e.type===`subtype-sublayer`&&`parent`in e&&e.parent&&typeof e.parent==`object`?`globalIdField`in e.parent:`globalIdField`in e:!1}function ve(e){return!e||typeof e!=`object`?!1:B(n(e))}function V(e,t){let{fieldInfos:n,fieldName:r,graphic:i,isContentFieldInfos:c,layer:l,preventPlacesFormatting:d,timeZone:f}=t,p=U(n,r),m=E({fieldInfo:p,graphic:i,layer:l}),g=k(m||l,r),_=m?null:p?.format,v=m?D({configurableFieldsContainer:m,fieldInfo:p,isContentFieldInfos:c}):null,y=v?.type===`number`;if(p&&!u(r)){let t=g?.type,n=v?.type===`date-time`,r=_?.dateFormat;if(t===`date`||t===`date-only`||t===`time-only`||t===`timestamp-offset`||n||r)return h(e,{format:n?void 0:r,fieldFormat:n?v:void 0,fieldType:t,timeZoneOptions:{layerTimeZone:l&&`preferredTimeZone`in l?l.preferredTimeZone:null,viewTimeZone:f,datesInUnknownTimezone:l&&`datesInUnknownTimezone`in l?!!l.datesInUnknownTimezone:!1}})}if(typeof e==`string`&&u(r)&&_)return ye(e,_);if(e=L(e,{format:y?void 0:_,fieldFormat:y?v:void 0}),typeof e==`string`||e==null||_==null&&v==null)return G(e);let b=y?a(v):_?o(_):void 0;return d?s(e,{...b,minimumFractionDigits:0,maximumFractionDigits:20}):s(e,b)}function ye(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(`,`)?H(e,`,`,`, `,t):e.includes(`;`)?H(e,`;`,`; `,t):e.includes(` `)?H(e,` `,` `,t):s(Number(e),o(t))}function H(e,t,n,r){return e.trim().split(t).map(e=>s(Number(e),o(r))).join(n)}function U(e,t){if(e?.length&&t)return e.find(e=>e.fieldName?.toLowerCase()===t.toLowerCase())}function be({fieldName:e,graphic:t,layer:n}){if(J(e)||!n||typeof n.getFeatureType!=`function`)return null;let{typeIdField:r}=n;if(!r||e!==r)return null;let i=n.getFeatureType(t);return i?i.name:null}function xe({fieldName:e,value:t,graphic:n,layer:r}){if(J(e)||!r||typeof r.getFieldDomain!=`function`)return null;let i=n&&r.getFieldDomain(e,{feature:n});return!i||i.type!==`coded-value`?null:i.getName(t)}function Se(e,t,n,i){let{creatorField:a,creationDateField:o,editorField:s,editDateField:c}=e;if(!t)return;let l=v(i&&`preferredTimeZone`in i?i.preferredTimeZone:null,i&&`datesInUnknownTimezone`in i?!!i.datesInUnknownTimezone:!1,n,C,`date`),u={...C,...l},d=t[c];if(typeof d==`number`){let e=t[s];return{type:`edit`,date:r(d,u),user:e}}let f=t[o];if(typeof f==`number`){let e=t[a];return{type:`create`,date:r(f,u),user:e}}return null}function W(e,t){let n=new Map;if(!e)return n;for(let r of e){if(!r.fieldName)continue;let e=O(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function Ce(e){let t=[];if(!e)return t;let{fieldInfos:n,content:r}=e;return n&&t.push(...n),!r||!Array.isArray(r)||r.forEach(e=>{if(e.type===`fields`){let n=e?.fieldInfos;n&&t.push(...n)}}),t}function we(e){return e.replaceAll(re,e=>`&#${e.charCodeAt(0)};`)}function G(e){return typeof e==`string`?e.replaceAll(ne,`<br class="esri-text-new-line" />`):e}function K(e){let{fieldInfoMap:t,fieldInfos:n,fieldName:r,graphic:i,isContentFieldInfos:a,layer:o,timeZone:s,value:l}=e;if(l==null)return``;let u=xe({fieldName:r,value:l,graphic:i,layer:o});if(u)return u;let d=o?.types&&c(o.types)?be({fieldName:r,graphic:i,layer:o}):null;if(d)return d;if(t.get(r.toLowerCase()))return V(l,{fieldInfos:n||Array.from(t.values()),fieldName:r,graphic:i,isContentFieldInfos:a,layer:o,timeZone:s});let p=o?.fieldsIndex?.get(r);return p&&(g(p)||f(p))?h(l,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&`preferredTimeZone`in o?o.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:o&&`datesInUnknownTimezone`in o?!!o.datesInUnknownTimezone:!1}}):G(l)}function Te({attributes:e,fieldInfoMap:t,fieldInfos:n,graphic:r,isContentFieldInfos:i,layer:a,relatedInfos:o,timeZone:s}){let c={};return o?.forEach(e=>Ae({attributes:c,relatedInfo:e,fieldInfoMap:t,fieldInfos:n,layer:a,timeZone:s})),e&&Object.keys(e).forEach(o=>{let l=e[o];c[o]=K({fieldInfoMap:t,fieldInfos:n,fieldName:o,graphic:r,isContentFieldInfos:i,layer:a,timeZone:s,value:l})}),c}async function q(e,t){let{layer:n,graphic:r,outFields:i,objectIds:a,returnGeometry:o,spatialReference:s}=e,c=a[0];if(typeof c!=`number`&&typeof c!=`string`){let e={layer:n,graphic:r,objectId:c,requiredFields:i};return y().warn(`Could not query required fields for the specified feature. The feature's ID is invalid.`,e),null}if(!m(n)?.operations?.supportsQuery){let e={layer:n,graphic:r,requiredFields:i,returnGeometry:o};return y().warn(`The specified layer cannot be queried. The following fields will not be available.`,e),null}let l=n.createQuery();return l.objectIds=a,l.outFields=i?.length?i:[n.objectIdField],l.returnGeometry=!!o,l.returnZ=!!o,l.returnM=!!o,l.outSpatialReference=s,(await n.queryFeatures(l,t)).features[0]}async function Ee(e){if(!e.expressionInfos?.length)return!1;let{arcadeUtils:{hasGeometryFunctions:t}}=await _();return t(e)}async function De(e){if(!e.expressionInfos?.length)return!1;let{arcadeUtils:{requiresTrack:t}}=await _();return t(e)}async function Oe({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t||(typeof n.load==`function`&&await n.load(i),!e.attributes))return;let a=n.objectIdField,o=e.attributes[a];if(o==null)return;let s=[o],c=new Set(await t.getRequiredFields(n.fieldsIndex));n.timeInfo?.trackIdField!=null&&!c.has(n.timeInfo.trackIdField)&&await De(t)&&c.add(n.timeInfo.trackIdField);let l=d(e,c),u=l?[]:c.has(a)?[...c]:[...c,a],f=t.returnGeometry||await Ee(t);if(l&&!f)return;let p=await q({layer:n,graphic:e,outFields:u,objectIds:s,returnGeometry:f,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function J(e=``){return e?e.includes(S):!1}function ke(e){return e?`${S}${e.layerId}/${e.fieldName}`:``}function Y({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:a,timeZone:o}){e&&t&&n&&Object.keys(t.attributes).forEach(s=>{let c=ke({layerId:n.relation.id.toString(),fieldName:s}),l=t.attributes[s];e[c]=K({fieldName:c,fieldInfos:r,fieldInfoMap:i,layer:a,value:l,graphic:t,timeZone:o})})}function Ae({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a}){e&&t&&(t.relatedFeatures?.forEach(o=>Y({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a})),t.relatedStatsFeatures?.forEach(o=>Y({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a})))}const X=e=>{if(!e)return!1;let t=e.toUpperCase();return t.includes(`CURRENT_TIMESTAMP`)||t.includes(`CURRENT_DATE`)||t.includes(`CURRENT_TIME`)},Z=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||t===`attachments`)return;let i=n.where==null?null:n.where,a=n.geometry==null?null:n.geometry;e.capabilities.query.supportsCacheHint&&!X(r)&&!X(i)&&a?.type!==`extent`&&n.resultType!==`tile`&&(n.cacheHint=!0)},je=({query:e,layer:t,method:n})=>{Z({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??``}`})},Me=({queryPayload:e,layer:t,method:n})=>{Z({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??``}`})};function Ne(e,t,n){return!e||!t||!n?null:t.type===`sublayer`?$({layers:t.layer?.allSublayers,map:e,relatedLayer:t,relationship:n})||$({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):$({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||$({layers:e.allTables,map:e,relatedLayer:t,relationship:n})}function Pe(e,t){return!e||!(`utilityNetworks`in e)||!t?null:e.utilityNetworks?.find(e=>e.isUtilityLayer(t))}function Q(e,t){return e?.allTables.find(e=>e.type===`feature`&&e.layerId===t.id&&e.url===t.layer?.url)}function $({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(let a of i){if(a.type===`map-image`){let n=$({layers:a.sublayers,map:e,relatedLayer:r,relationship:t})||$({layers:a.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!B(a))continue;if(r.type===`sublayer`){if(a!==r&&a.id===n)return a.isTable?Q(e,a):a;continue}let i=r.type===`scene`&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if(a.type===`sublayer`){if(a!==r&&a.layer?.url===i&&a.id===n)return a.isTable?Q(e,a):a;continue}if(a!==r&&a.url===i&&a.layerId===n)return a}return null}export{G as applyTextFormattingHTML,W as createFieldInfoMap,Ne as findRelatedLayer,Pe as findUtilityNetwork,F as fixTokens,Te as formatAttributes,Se as formatEditInfo,V as formatValueToFieldInfo,Ce as getAllFieldInfos,E as getConfigurableFieldsContainer,D as getFieldFormat,U as getFieldInfo,fe as getFieldInfoLabel,O as getFixedFieldName,he as getFixedFieldNames,ce as getPopupLayer,oe as getSourceLayer,le as graphicCallback,we as htmlEntities,_e as isAssociatedFeatureSupportedLayer,w as isExpressionField,R as isFeatureSupportedLayer,ve as isGraphicForRelatableFeatureSupportedLayer,B as isRelatableFeatureSupportedLayer,z as isRelatableLayer,J as isRelatedField,je as preLayerQueryCallback,Me as preRequestCallback,q as querySourceLayer,Oe as queryUpdatedFeature,ue as shouldOpenInNewTab,j as substituteAttributes,ge as substituteFieldsInLinksAndAttributes};
|
|
2
|
+
import e from"../../core/Logger.js";import{replace as t}from"../../core/string.js";import{getGraphicLayer as n}from"../../graphic/graphicOriginUtils.js";import{formatDate as r,convertDateFormatToIntlOptions as i}from"../../intl/date.js";import{convertNumberFieldFormatToIntlOptions as a,convertNumberFormatToIntlOptions as o,formatNumber as s}from"../../intl/number.js";import{typesHaveUniqueIdsAndNames as c}from"../../layers/support/featureLayerUtils.js";import{fieldFormatFromFieldInfo as l}from"../../layers/support/fieldFormatUtils.js";import{isRasterPixelValueField as u,featureHasFields as d,isTimeOnlyField as f}from"../../layers/support/fieldUtils.js";import{getFieldConfigurationsContainer as p,getEffectiveLayerCapabilities as m}from"../../layers/support/layerUtils.js";import{formatAnyDate as h,isAnyDateField as g}from"../../smartMapping/support/utils.js";import{loadArcade as _}from"../../support/loadArcade.js";import{getTimeZoneFormattingOptions as v}from"../../time/timeZoneUtils.js";const y=()=>e.getLogger(`esri.popup.support.featureUtils`),b=/href=(""|'')/gi,ee=/(\{([^{\r\n]+)\})/g,te=/'/g,x=/^\s*expression\//i,ne=/(\n)/gi,re=/[\u00A0-\u9999<>&]/gim,ie=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,ae=/^(?:mailto:|tel:)/,S=`relationships/`,C=i(`short-date-short-time`);function oe(e){if(e!=null)return(e.sourceLayer||e.layer)??void 0}const se=new Set([`building`,`knowledge-graph`,`link-chart`,`map-image`,`map-notes`,`subtype-group`,`tile`]);function ce(e){let t=e?.origin;return(t==null?void 0:se.has(t.type??``)?t.sublayer:t.layer)??e?.layer}function le(e,t){let r=n(e);r&&`layer`in r&&r.layer&&(r=r.layer);let i=r?.type===`subtype-sublayer`?r.parent:r;return i&&t?.allLayers.includes(i)?r:e.layer??r}function ue(e,t,n){let r=t.type===`subtype-sublayer`&&t.parent&&n?.allLayers?.includes(t.parent)?t.parent:n?.allLayers?.includes(t)?t:null;return r?e.when().then(()=>e.whenLayerView(r)):null}async function w({type:e,value:t,event:n}){try{return typeof t==`function`?t(n):await t}catch(r){y().error(`error`,`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t});return}}function T(e=``){if(e)return!ae.test(e.trim().toLowerCase())}function E(e){return e?x.test(e):!1}function de(e,t){if(!t||!E(t)||!e)return;let n=t.replace(x,``).toLowerCase();return e.find(({name:e})=>e.toLowerCase()===n)}function D(e){let{fieldInfo:t,graphic:n,layer:r}=e;return fe({fieldInfo:t,graphic:n})?p(r,{graphic:n}):null}function fe({fieldInfo:e,graphic:t}){return!!e?.fieldName&&!E(e.fieldName)&&!J(e.fieldName)&&!t?.popupTemplate}function pe({expressionInfos:e,fieldInfo:t,graphic:n,isContentFieldInfos:r,layer:i}){if(!t?.fieldName)return null;let a=de(e,t.fieldName);if(a)return a.title||null;let o=D({fieldInfo:t,graphic:n,layer:i});if(o){let e=o.getFieldAlias(t.fieldName);return r?t.label||e||t.fieldName:e||t.fieldName}return t.label||t.fieldName}function O(e){let{configurableFieldsContainer:t,fieldInfo:n,isContentFieldInfos:r}=e;if(!n?.fieldName)return null;let i=!t.popupTemplate&&!t.fieldConfigurations?l(n,t.getField(n.fieldName)):t.getFieldConfiguration(n.fieldName)?.fieldFormat;return r&&n.fieldFormat||i}function me(e,t){return`{${t.get(e.toLowerCase())?.fieldName||e}}`}function he(e){return e.replaceAll(b,``)}function k(e,t){let n=A(t,e);return n?n.name:e}function ge(e,t){return e&&e.map(e=>k(e,t))}function A(e,t){return!(e&&typeof e.getField==`function`)||!t?null:e.getField(t)??null}function j(e){return`${e}`.trim()}function M({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:a}){return r?N({formattedAttributes:t,template:_e(r,{...t,...i,...e},n),fieldInfoMap:a}):``}function N({formattedAttributes:e,template:n,fieldInfoMap:r}){return j(he(t(t(n,e=>me(e,r)),e)))}function P(e,t,n=!1){let r=t[e];typeof r==`string`&&(t[e]=(n?encodeURIComponent(r):r).replaceAll(te,`%27`))}function F(e,t=!1){let n={...e};return Object.keys(n).forEach(e=>P(e,n,t)),n}function I(e,n,r){n=j(n);let i=n&&!n.startsWith(`{`);return t(e,F(r,i||!1))}function L(e,t){return e.replaceAll(ee,(e,n,r)=>{let i=A(t,r);return i?`{${i.name}}`:n})}function _e(e,t,n){let r=L(e,n);return r&&r.replaceAll(ie,(e,n,r)=>I(e,n||r,t))}function ve(e,t){let n=t?.fieldFormat?.type===`number`||t?.format&&t.format.dateFormat==null&&(t.format.places!=null||t.format.digitSeparator!=null);if(typeof e==`string`&&n){let t=Number(e);if(!isNaN(t))return t}return e}function R(e){return typeof e==`object`&&!!e&&`fieldsIndex`in e&&`geometryType`in e&&`getField`in e&&`load`in e&&`loaded`in e&&`objectIdField`in e&&`spatialReference`in e&&`type`in e&&(e.type===`feature`||e.type===`scene`||e.type===`subtype-group`||e.type===`subtype-sublayer`||e.type===`sublayer`)&&`when`in e}function z(e){return typeof e==`object`&&!!e&&`createQuery`in e&&`queryFeatureCount`in e&&`queryObjectIds`in e&&`queryRelatedFeatures`in e&&`queryRelatedFeaturesCount`in e&&`relationships`in e}function B(e){return R(e)&&z(e)}function ye(e){return e&&typeof e==`object`&&`createQuery`in e&&`getField`in e&&`queryFeatureCount`in e&&`queryFeatures`in e&&`queryObjectIds`in e&&`capabilities`in e&&`fields`in e&&`fieldsIndex`in e&&`type`in e&&(e.type===`feature`||e.type===`subtype-group`||e.type===`subtype-sublayer`||e.type===`sublayer`)&&`when`in e?e.type===`subtype-sublayer`&&`parent`in e&&e.parent&&typeof e.parent==`object`?`globalIdField`in e.parent:`globalIdField`in e:!1}function be(e){return!e||typeof e!=`object`?!1:B(n(e))}function V(e,t){let{fieldInfos:n,fieldName:r,graphic:i,isContentFieldInfos:c,layer:l,preventPlacesFormatting:d,timeZone:f}=t,p=U(n,r),m=D({fieldInfo:p,graphic:i,layer:l}),g=A(m||l,r),_=m?null:p?.format,v=m?O({configurableFieldsContainer:m,fieldInfo:p,isContentFieldInfos:c}):null,y=v?.type===`number`;if(p&&!u(r)){let t=g?.type,n=v?.type===`date-time`,r=_?.dateFormat;if(t===`date`||t===`date-only`||t===`time-only`||t===`timestamp-offset`||n||r)return h(e,{format:n?void 0:r,fieldFormat:n?v:void 0,fieldType:t,timeZoneOptions:{layerTimeZone:l&&`preferredTimeZone`in l?l.preferredTimeZone:null,viewTimeZone:f,datesInUnknownTimezone:l&&`datesInUnknownTimezone`in l?!!l.datesInUnknownTimezone:!1}})}if(typeof e==`string`&&u(r)&&_)return xe(e,_);if(e=ve(e,{format:y?void 0:_,fieldFormat:y?v:void 0}),typeof e==`string`||e==null||_==null&&v==null)return G(e);let b=y?a(v):_?o(_):void 0;return d?s(e,{...b,minimumFractionDigits:0,maximumFractionDigits:20}):s(e,b)}function xe(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(`,`)?H(e,`,`,`, `,t):e.includes(`;`)?H(e,`;`,`; `,t):e.includes(` `)?H(e,` `,` `,t):s(Number(e),o(t))}function H(e,t,n,r){return e.trim().split(t).map(e=>s(Number(e),o(r))).join(n)}function U(e,t){if(e?.length&&t)return e.find(e=>e.fieldName?.toLowerCase()===t.toLowerCase())}function Se({fieldName:e,graphic:t,layer:n}){if(J(e)||!n||typeof n.getFeatureType!=`function`)return null;let{typeIdField:r}=n;if(!r||e!==r)return null;let i=n.getFeatureType(t);return i?i.name:null}function W({fieldName:e,value:t,graphic:n,layer:r}){if(J(e)||!r||typeof r.getFieldDomain!=`function`)return null;let i=n&&r.getFieldDomain(e,{feature:n});return!i||i.type!==`coded-value`?null:i.getName(t)}function Ce(e,t,n,i){let{creatorField:a,creationDateField:o,editorField:s,editDateField:c}=e;if(!t)return;let l=v(i&&`preferredTimeZone`in i?i.preferredTimeZone:null,i&&`datesInUnknownTimezone`in i?!!i.datesInUnknownTimezone:!1,n,C,`date`),u={...C,...l},d=t[c];if(typeof d==`number`){let e=t[s];return{type:`edit`,date:r(d,u),user:e}}let f=t[o];if(typeof f==`number`){let e=t[a];return{type:`create`,date:r(f,u),user:e}}return null}function we(e,t){let n=new Map;if(!e)return n;for(let r of e){if(!r.fieldName)continue;let e=k(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function Te(e){let t=[];if(!e)return t;let{fieldInfos:n,content:r}=e;return n&&t.push(...n),!r||!Array.isArray(r)||r.forEach(e=>{if(e.type===`fields`){let n=e?.fieldInfos;n&&t.push(...n)}}),t}function Ee(e){return e.replaceAll(re,e=>`&#${e.charCodeAt(0)};`)}function G(e){return typeof e==`string`?e.replaceAll(ne,`<br class="esri-text-new-line" />`):e}function K(e){let{fieldInfoMap:t,fieldInfos:n,fieldName:r,graphic:i,isContentFieldInfos:a,layer:o,timeZone:s,value:l}=e;if(l==null)return``;let u=W({fieldName:r,value:l,graphic:i,layer:o});if(u)return u;let d=o?.types&&c(o.types)?Se({fieldName:r,graphic:i,layer:o}):null;if(d)return d;if(t.get(r.toLowerCase()))return V(l,{fieldInfos:n||Array.from(t.values()),fieldName:r,graphic:i,isContentFieldInfos:a,layer:o,timeZone:s});let p=o?.fieldsIndex?.get(r);return p&&(g(p)||f(p))?h(l,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&`preferredTimeZone`in o?o.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:o&&`datesInUnknownTimezone`in o?!!o.datesInUnknownTimezone:!1}}):G(l)}function De({attributes:e,fieldInfoMap:t,fieldInfos:n,graphic:r,isContentFieldInfos:i,layer:a,relatedInfos:o,timeZone:s}){let c={};return o?.forEach(e=>Me({attributes:c,relatedInfo:e,fieldInfoMap:t,fieldInfos:n,layer:a,timeZone:s})),e&&Object.keys(e).forEach(o=>{let l=e[o];c[o]=K({fieldInfoMap:t,fieldInfos:n,fieldName:o,graphic:r,isContentFieldInfos:i,layer:a,timeZone:s,value:l})}),c}async function q(e,t){let{layer:n,graphic:r,outFields:i,objectIds:a,returnGeometry:o,spatialReference:s}=e,c=a[0];if(typeof c!=`number`&&typeof c!=`string`){let e={layer:n,graphic:r,objectId:c,requiredFields:i};return y().warn(`Could not query required fields for the specified feature. The feature's ID is invalid.`,e),null}if(!m(n)?.operations?.supportsQuery){let e={layer:n,graphic:r,requiredFields:i,returnGeometry:o};return y().warn(`The specified layer cannot be queried. The following fields will not be available.`,e),null}let l=n.createQuery();return l.objectIds=a,l.outFields=i?.length?i:[n.objectIdField],l.returnGeometry=!!o,l.returnZ=!!o,l.returnM=!!o,l.outSpatialReference=s,(await n.queryFeatures(l,t)).features[0]}async function Oe(e){if(!e.expressionInfos?.length)return!1;let{arcadeUtils:{hasGeometryFunctions:t}}=await _();return t(e)}async function ke(e){if(!e.expressionInfos?.length)return!1;let{arcadeUtils:{requiresTrack:t}}=await _();return t(e)}async function Ae({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t||(typeof n.load==`function`&&await n.load(i),!e.attributes))return;let a=n.objectIdField,o=e.attributes[a];if(o==null)return;let s=[o],c=new Set(await t.getRequiredFields(n.fieldsIndex));n.timeInfo?.trackIdField!=null&&!c.has(n.timeInfo.trackIdField)&&await ke(t)&&c.add(n.timeInfo.trackIdField);let l=d(e,c),u=l?[]:c.has(a)?[...c]:[...c,a],f=t.returnGeometry||await Oe(t);if(l&&!f)return;let p=await q({layer:n,graphic:e,outFields:u,objectIds:s,returnGeometry:f,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function J(e=``){return e?e.includes(S):!1}function je(e){return e?`${S}${e.layerId}/${e.fieldName}`:``}function Y({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:a,timeZone:o}){e&&t&&n&&Object.keys(t.attributes).forEach(s=>{let c=je({layerId:n.relation.id.toString(),fieldName:s}),l=t.attributes[s];e[c]=K({fieldName:c,fieldInfos:r,fieldInfoMap:i,layer:a,value:l,graphic:t,timeZone:o})})}function Me({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a}){e&&t&&(t.relatedFeatures?.forEach(o=>Y({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a})),t.relatedStatsFeatures?.forEach(o=>Y({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:a})))}const X=e=>{if(!e)return!1;let t=e.toUpperCase();return t.includes(`CURRENT_TIMESTAMP`)||t.includes(`CURRENT_DATE`)||t.includes(`CURRENT_TIME`)},Z=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||t===`attachments`)return;let i=n.where==null?null:n.where,a=n.geometry==null?null:n.geometry;e.capabilities.query.supportsCacheHint&&!X(r)&&!X(i)&&a?.type!==`extent`&&n.resultType!==`tile`&&(n.cacheHint=!0)},Ne=({query:e,layer:t,method:n})=>{Z({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??``}`})},Pe=({queryPayload:e,layer:t,method:n})=>{Z({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??``}`})};function Fe(e,t,n){return!e||!t||!n?null:t.type===`sublayer`?$({layers:t.layer?.allSublayers,map:e,relatedLayer:t,relationship:n})||$({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):$({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||$({layers:e.allTables,map:e,relatedLayer:t,relationship:n})}function Ie(e,t){return!e||!(`utilityNetworks`in e)||!t?null:e.utilityNetworks?.find(e=>e.isUtilityLayer(t))}function Q(e,t){return e?.allTables.find(e=>e.type===`feature`&&e.layerId===t.id&&e.url===t.layer?.url)}function $({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(let a of i){if(a.type===`map-image`){let n=$({layers:a.sublayers,map:e,relatedLayer:r,relationship:t})||$({layers:a.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!B(a))continue;if(r.type===`sublayer`){if(a!==r&&a.id===n)return a.isTable?Q(e,a):a;continue}let i=r.type===`scene`&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if(a.type===`sublayer`){if(a!==r&&a.layer?.url===i&&a.id===n)return a.isTable?Q(e,a):a;continue}if(a!==r&&a.url===i&&a.layerId===n)return a}return null}export{G as applyTextFormattingHTML,we as createFieldInfoMap,Fe as findRelatedLayer,Ie as findUtilityNetwork,L as fixTokens,De as formatAttributes,Ce as formatEditInfo,V as formatValueToFieldInfo,Te as getAllFieldInfos,D as getConfigurableFieldsContainer,O as getFieldFormat,U as getFieldInfo,pe as getFieldInfoLabel,k as getFixedFieldName,ge as getFixedFieldNames,le as getHighlightLayer,ue as getHighlightLayerView,ce as getPopupLayer,oe as getSourceLayer,w as graphicCallback,Ee as htmlEntities,ye as isAssociatedFeatureSupportedLayer,E as isExpressionField,R as isFeatureSupportedLayer,be as isGraphicForRelatableFeatureSupportedLayer,B as isRelatableFeatureSupportedLayer,z as isRelatableLayer,J as isRelatedField,Ne as preLayerQueryCallback,Pe as preRequestCallback,q as querySourceLayer,Ae as queryUpdatedFeature,T as shouldOpenInNewTab,N as substituteAttributes,M as substituteFieldsInLinksAndAttributes};
|
|
@@ -159,11 +159,6 @@ export default class FeatureService extends FeatureServiceSuperclass {
|
|
|
159
159
|
* > Example: The service has a horizontal spatial reference with `feet` units, and `applyEdits()` is called with z-values based on `meter` units,
|
|
160
160
|
* > then the method will automatically convert the z values from `meter` to `feet` units. `applyEdits()` will pass in a `sessionId` during an active edit session.
|
|
161
161
|
*
|
|
162
|
-
* > [!WARNING]
|
|
163
|
-
* >
|
|
164
|
-
* > The `deleteAssociations`, `combineGroupedObjects`, and `divideGroupedObjects` edits are in beta and are reserved for
|
|
165
|
-
* > future use in a telecom domain network.
|
|
166
|
-
*
|
|
167
162
|
* @param edits - Object containing features and attachments to be added, updated or deleted.
|
|
168
163
|
* @param options - Additional edit options to specify when editing features or attachments.
|
|
169
164
|
* @returns Results returned from the [applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/rest/featureService/FeatureService/#applyEdits) method. It contains features
|
|
@@ -67,9 +67,10 @@ export default class TraceLocation extends TraceLocationSuperclass {
|
|
|
67
67
|
accessor percentAlong: number;
|
|
68
68
|
/**
|
|
69
69
|
* The terminal Id to place the starting location at. Applicable for junction/device sources only. Users can use `getTerminalConfiguration()` in [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/) to get the terminal.
|
|
70
|
+
*
|
|
70
71
|
* > [!NOTE]
|
|
71
72
|
* >
|
|
72
|
-
* >
|
|
73
|
+
* > Point features and junction objects used as a `TraceLocation` in a telecom domain network must specify `terminalId: 1`, or the trace location cannot be found.
|
|
73
74
|
*
|
|
74
75
|
* @see [Terminal](https://developers.arcgis.com/javascript/latest/references/core/networks/support/Terminal/)
|
|
75
76
|
*/
|
|
@@ -31,10 +31,6 @@ export default class TraceResult extends JSONSupport {
|
|
|
31
31
|
/**
|
|
32
32
|
* An array of network elements returned by the trace. The network element is a representation of how the network topology defines its graph.
|
|
33
33
|
* This is returned only if the elements result type is defined in the trace configuration.
|
|
34
|
-
* > [!WARNING]
|
|
35
|
-
* >
|
|
36
|
-
* > The elements property returning a [TelecomNetworkElement](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/TelecomNetworkElement/) is in beta and is reserved for
|
|
37
|
-
* > future use in a telecom domain network.
|
|
38
34
|
*
|
|
39
35
|
* @see [NetworkElement](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/NetworkElement/)
|
|
40
36
|
* @see [TelecomNetworkElement](https://developers.arcgis.com/javascript/latest/references/core/rest/networks/support/TelecomNetworkElement/)
|
|
@@ -44,7 +44,6 @@ export default class OutDistance extends OutDistanceSuperclass {
|
|
|
44
44
|
* Indicates whether to return features sorted by distance.
|
|
45
45
|
* The `"ascending"` option returns the nearest features first while the `"descending"` option returns farthest
|
|
46
46
|
* features first, and null indicates there should be no distance-based ordering.
|
|
47
|
-
* A `null` value indicates that there should be no distance-based ordering.
|
|
48
47
|
*
|
|
49
48
|
* @since 5.2
|
|
50
49
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./histogram.js";import
|
|
2
|
+
import{throwIfAborted as e}from"../../core/promiseUtils.js";import{getSourceLayer as t}from"../../layers/support/dataSeriesUtils.js";import n from"./histogram.js";import r from"./summaryStatisticsForTimeSeries.js";import{processTimeSeriesParams as i,combineHistograms as a}from"./support/timeSeriesUtils.js";import{createLayerAdapter as o,featureCapableLayerTypes as s}from"../support/adapters/support/layerUtils.js";async function c(c){let{statisticInputs:l,...u}=await i(c,`histogram-for-time-series`),d=u.minValue==null||u.maxValue==null?await r({...c,minValue:void 0,maxValue:void 0}):void 0,f=u.minValue??d?.min,p=u.maxValue??d?.max;if(f==null||p==null)return{bins:[],minValue:f,maxValue:p};let m=l.flatMap(e=>`field`in e?[e.field]:[]);if(!u.forBinning&&m.length>1&&m.length<=50&&m.length===l.length){let r=o(u.layer,s,u.forBinning);if(r){await r.load(u.signal==null?null:{signal:u.signal});let i=t(r),a=r.getField(m[0])?.type;if(r.supportsSQLExpression&&i?.capabilities?.operations?.supportsQueryPivot&&m.every(e=>r.getField(e)?.type===a))try{return await n({...u,fields:m,classificationMethod:`equal-interval`,minValue:f,maxValue:p})}catch{e(u.signal)}}}let h=await Promise.all(l.map(e=>n({...u,...e,classificationMethod:`equal-interval`,minValue:f,maxValue:p})));return a(h)}export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./summaryStatistics.js";import{processTimeSeriesParams as t,combineSummaryStatistics as n}from"./support/timeSeriesUtils.js";import{
|
|
2
|
+
import e from"./summaryStatistics.js";import{processTimeSeriesParams as t,combineSummaryStatistics as n}from"./support/timeSeriesUtils.js";import{createLayerAdapter as r,featureCapableLayerTypes as i}from"../support/adapters/support/layerUtils.js";import{processSummaryStatisticsResult as a}from"../../statistics/utils.js";async function o(o){let{statisticInputs:s,...c}=await t(o,`summary-statistics-for-time-series`),l=s.flatMap(e=>`field`in e?[e.field]:[]);if(!c.forBinning&&l.length>1&&l.length===s.length){let t=r(c.layer,i,c.forBinning);if(t){await t.load(c.signal==null?null:{signal:c.signal});let n=t.getField(l[0])?.type;if(l.every(e=>t.getField(e)?.type===n)){let t=await e({...c,fields:l,outStatisticTypes:{exclude:[`median`]}});return a(t,c.outStatisticTypes)}}}let u=await Promise.all(s.map(t=>e({...c,...t,outStatisticTypes:{exclude:[`median`]}})));return a(n(u),c.outStatisticTypes)}export{o as default};
|
|
@@ -16,8 +16,8 @@ export interface BasemapStyleProperties extends Partial<Pick<BasemapStyle, "apiK
|
|
|
16
16
|
*
|
|
17
17
|
* > [!CAUTION]
|
|
18
18
|
* >
|
|
19
|
-
* > Use of the basemap style service requires authentication via an [API key](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-apiKey) or [user authentication](https://developers.arcgis.com/javascript/latest/
|
|
20
|
-
* > see the [API
|
|
19
|
+
* > Use of the basemap style service requires authentication via an [API key](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-apiKey) or [user authentication](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#user-authentication). To learn more about API keys,
|
|
20
|
+
* > see the [API key authentication](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-key-authentication) section.
|
|
21
21
|
*
|
|
22
22
|
* @since 4.28
|
|
23
23
|
* @see [Basemap styles service (v2)](https://developers.arcgis.com/rest/basemap-styles/)
|