@arcgis/core 4.31.0-next.20240819 → 4.31.0-next.20240821
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d2fa4d2887692a1ec9b1.js → 0553357f4cdf4deb13d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b21db356f243d097ab3e.js → 122f3f294b8f95619f27.js} +1 -1
- package/assets/esri/core/workers/chunks/{dc03a639c97a6f99dbc9.js → 1ac47b7a77818c372e1a.js} +1 -1
- package/assets/esri/core/workers/chunks/{23a6700a3278d2cfcd75.js → 203cf58345df86caf4ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2c40517266fe420017c.js → 25fa59544c13db8cee30.js} +1 -1
- package/assets/esri/core/workers/chunks/29545cd255b763d393d0.js +1 -0
- package/assets/esri/core/workers/chunks/3f75b7ed24b440b4508a.js +1 -0
- package/assets/esri/core/workers/chunks/40e4224f700206c67053.js +1 -0
- package/assets/esri/core/workers/chunks/48ab5ce08a97e5dac709.js +1 -0
- package/assets/esri/core/workers/chunks/{56bb7b589a0c040263ff.js → 4f1d44ce2f68e2ec2b60.js} +1 -1
- package/assets/esri/core/workers/chunks/5429c2e1d2f159f332f9.js +1 -0
- package/assets/esri/core/workers/chunks/{d8f416440963b77595e3.js → 58c476c8f6c274d77c0c.js} +1 -1
- package/assets/esri/core/workers/chunks/5c4173205f885cd21422.js +1 -0
- package/assets/esri/core/workers/chunks/5cb07fa227b7fd06499f.js +1 -0
- package/assets/esri/core/workers/chunks/6f7c2d02fbd29870f6ee.js +1 -0
- package/assets/esri/core/workers/chunks/75ac4dfa3c8feeb82de2.js +1 -0
- package/assets/esri/core/workers/chunks/7fda3d3b211b6da5b0e5.js +1 -0
- package/assets/esri/core/workers/chunks/{1e7ce327435e0f4a4bec.js → 8224351edd777843180d.js} +1 -1
- package/assets/esri/core/workers/chunks/949cbb667531527e6918.js +1 -0
- package/assets/esri/core/workers/chunks/{6e966c885e2ac9dff46b.js → 991295637f51e8207efe.js} +1 -1
- package/assets/esri/core/workers/chunks/{252ff37bf5e12dae0b18.js → 9acc02df376d5bdfac87.js} +1 -1
- package/assets/esri/core/workers/chunks/9bbf7129579fe04ab268.js +1 -0
- package/assets/esri/core/workers/chunks/{492137ecf03ad2b2c2e3.js → a0fdb0fa96680ac758c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ab02b7660e751cffe1c.js → a4b0e6084971989c526b.js} +1 -1
- package/assets/esri/core/workers/chunks/a6834f66d8da628c3fb2.js +1 -0
- package/assets/esri/core/workers/chunks/{238936d241e76c4c0343.js → ace8b6351ed35b03499b.js} +1 -1
- package/assets/esri/core/workers/chunks/b08689e5b0d1449877f5.js +1 -0
- package/assets/esri/core/workers/chunks/b686d70586623f7bf9a6.js +1 -0
- package/assets/esri/core/workers/chunks/b6dffcacd8b02384d6e2.js +1 -0
- package/assets/esri/core/workers/chunks/{bf7253f7e5d6d63333c3.js → b765a72c9d4f092855f5.js} +1 -1
- package/assets/esri/core/workers/chunks/b9490d5cc65cce2f2948.js +1 -0
- package/assets/esri/core/workers/chunks/{4706798c58398447d79f.js → bbd5477944da39234c30.js} +1 -1
- package/assets/esri/core/workers/chunks/cd8d595d577b74817623.js +1 -0
- package/assets/esri/core/workers/chunks/{145592dc516b86fbda63.js → cfc93bbd35cc4bfde7c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{48aeb087a1b10a8f4c0b.js → d5d70b3ecc0aca2ac184.js} +1 -1
- package/assets/esri/core/workers/chunks/{a784222a7f9dc40ed67c.js → e2a6f77c05d0818e3f74.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ee365125c9fb9d9cafe.js → e5474bcde5b8fa037b56.js} +11 -11
- package/assets/esri/core/workers/chunks/{f7ab24d3dfc0ba9bf760.js → ea561b2460e634a643fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf7be98af841fadacf50.js → fc5129c825bc3c78b112.js} +1 -1
- package/chunks/BloomComposition.glsl.js +45 -0
- package/chunks/Centroid-DZi-eb9F.js +5 -0
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +5 -0
- package/chunks/OperatorProximity.js +5 -0
- package/chunks/OperatorShapePreservingDensify.js +1 -1
- package/chunks/Polyline.js +1 -1
- package/core/mathUtils.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +5 -0
- package/geometry/operators/gx/operatorClip.js +1 -1
- package/geometry/operators/gx/operatorCut.js +1 -1
- package/geometry/operators/gx/operatorDensify.js +1 -1
- package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDensifyByLength.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +5 -0
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +5 -0
- package/geometry/operators/gx/operatorOffset.js +5 -0
- package/geometry/operators/gx/operatorShapePreservingDensify.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/operatorAutoComplete.js +5 -0
- package/geometry/operators/operatorCentroid.js +5 -0
- package/geometry/operators/operatorContains.js +1 -1
- package/geometry/operators/operatorCrosses.js +1 -1
- package/geometry/operators/operatorCut.js +1 -1
- package/geometry/operators/operatorDensify.js +1 -1
- package/geometry/operators/operatorDifference.js +1 -1
- package/geometry/operators/operatorDisjoint.js +1 -1
- package/geometry/operators/operatorEquals.js +1 -1
- package/geometry/operators/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/operatorGeodeticDensifyByLength.js +1 -1
- package/geometry/operators/operatorGeodeticDistance.js +5 -0
- package/geometry/operators/operatorIntersection.js +1 -1
- package/geometry/operators/operatorIntersects.js +1 -1
- package/geometry/operators/operatorLabelPoint.js +5 -0
- package/geometry/operators/operatorOffset.js +5 -0
- package/geometry/operators/operatorOverlaps.js +1 -1
- package/geometry/operators/operatorProximity.js +5 -0
- package/geometry/operators/operatorRelate.js +1 -1
- package/geometry/operators/operatorReshape.js +5 -0
- package/geometry/operators/operatorShapePreservingDensify.js +1 -1
- package/geometry/operators/operatorTouches.js +1 -1
- package/geometry/operators/operatorWithin.js +1 -1
- package/geometry/operators/support/converterAPI.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/geometry/support/webMercatorUtils.js +1 -1
- package/interfaces.d.ts +34 -6
- package/layers/LinkChartLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/versionManagement/gdbVersion/differences.js +5 -0
- package/rest/versionManagement/gdbVersion/support/DifferencesParameters.js +5 -0
- package/rest/versionManagement/gdbVersion/support/DifferencesResult.js +5 -0
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/support/highlightGroupUtils.js +1 -1
- package/views/2d/tiling/LODInfo.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomTechnique.js +5 -0
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/assets/esri/core/workers/chunks/0c6411a08d8b40fc7f4c.js +0 -1
- package/assets/esri/core/workers/chunks/22128034bf3b5aa713fc.js +0 -1
- package/assets/esri/core/workers/chunks/2dddb8a989b9c96572fe.js +0 -1
- package/assets/esri/core/workers/chunks/31f931de94414f13bd13.js +0 -1
- package/assets/esri/core/workers/chunks/370dd36904acad113842.js +0 -1
- package/assets/esri/core/workers/chunks/5f93a59c92f464925f9c.js +0 -1
- package/assets/esri/core/workers/chunks/6a04b6c7a5ec2389a768.js +0 -1
- package/assets/esri/core/workers/chunks/6f1853ab502bebefd3c3.js +0 -1
- package/assets/esri/core/workers/chunks/8a37c5b110665c8ff5a7.js +0 -1
- package/assets/esri/core/workers/chunks/945a3cc2191606f3a917.js +0 -1
- package/assets/esri/core/workers/chunks/9661398ce832137461f6.js +0 -1
- package/assets/esri/core/workers/chunks/b09bc516b7a7bf5a44a8.js +0 -1
- package/assets/esri/core/workers/chunks/b370dae404d8ff733a54.js +0 -1
- package/assets/esri/core/workers/chunks/c2ba052733e8ccae82e1.js +0 -1
- package/assets/esri/core/workers/chunks/d7d2552ff3e2d44319c7.js +0 -1
- package/assets/esri/core/workers/chunks/f2c3b68f00f88700e698.js +0 -1
- package/assets/esri/core/workers/chunks/f4d9689194d8d2547bb1.js +0 -1
- package/assets/esri/core/workers/chunks/f91b811fa044a01b6bb3.js +0 -1
- package/chunks/SimpleGeometryCursor.js +0 -5
- package/geometry/operators/support/cursorUtils.js +0 -5
- package/views/2d/layers/features/support/tileUtils.js +0 -5
package/interfaces.d.ts
CHANGED
|
@@ -89597,7 +89597,7 @@ declare namespace __esri {
|
|
|
89597
89597
|
*
|
|
89598
89598
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-HighlightLayerViewMixin.html#highlight)
|
|
89599
89599
|
*/
|
|
89600
|
-
highlight(target?: Graphic | Graphic[] | number | number[] | string | string[]): Handle;
|
|
89600
|
+
highlight(target?: Graphic | Graphic[] | number | number[] | string | string[], group?: string): Handle;
|
|
89601
89601
|
}
|
|
89602
89602
|
|
|
89603
89603
|
interface HighlightLayerViewMixinProperties {
|
|
@@ -90504,6 +90504,20 @@ declare namespace __esri {
|
|
|
90504
90504
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#floors)
|
|
90505
90505
|
*/
|
|
90506
90506
|
floors: Collection<string>;
|
|
90507
|
+
/**
|
|
90508
|
+
* Options for configuring the highlight.
|
|
90509
|
+
*
|
|
90510
|
+
* @deprecated since version 4.31. Use {@link module:esri/views/MapView#highlights MapView.highlights} instead.
|
|
90511
|
+
*
|
|
90512
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions)
|
|
90513
|
+
*/
|
|
90514
|
+
highlightOptions: HighlightOptions;
|
|
90515
|
+
/**
|
|
90516
|
+
* Options for configuring the MapView highlights.
|
|
90517
|
+
*
|
|
90518
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlights)
|
|
90519
|
+
*/
|
|
90520
|
+
highlights: Collection;
|
|
90507
90521
|
/**
|
|
90508
90522
|
* Defines which anchor stays still while resizing the browser window.
|
|
90509
90523
|
*
|
|
@@ -90653,6 +90667,20 @@ declare namespace __esri {
|
|
|
90653
90667
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#floors)
|
|
90654
90668
|
*/
|
|
90655
90669
|
floors?: CollectionProperties<string>;
|
|
90670
|
+
/**
|
|
90671
|
+
* Options for configuring the highlight.
|
|
90672
|
+
*
|
|
90673
|
+
* @deprecated since version 4.31. Use {@link module:esri/views/MapView#highlights MapView.highlights} instead.
|
|
90674
|
+
*
|
|
90675
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions)
|
|
90676
|
+
*/
|
|
90677
|
+
highlightOptions?: HighlightOptions;
|
|
90678
|
+
/**
|
|
90679
|
+
* Options for configuring the MapView highlights.
|
|
90680
|
+
*
|
|
90681
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlights)
|
|
90682
|
+
*/
|
|
90683
|
+
highlights?: CollectionProperties;
|
|
90656
90684
|
/**
|
|
90657
90685
|
* Defines which anchor stays still while resizing the browser window.
|
|
90658
90686
|
*
|
|
@@ -93135,7 +93163,7 @@ declare namespace __esri {
|
|
|
93135
93163
|
}
|
|
93136
93164
|
|
|
93137
93165
|
/**
|
|
93138
|
-
* Options for configuring the highlight on
|
|
93166
|
+
* Options for configuring the highlight on [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions), [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) or on layer views.
|
|
93139
93167
|
*
|
|
93140
93168
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#HighlightOptions)
|
|
93141
93169
|
*/
|
|
@@ -105980,7 +106008,7 @@ declare namespace __esri {
|
|
|
105980
106008
|
*/
|
|
105981
106009
|
readonly featureViewModels: FeatureViewModel[];
|
|
105982
106010
|
/**
|
|
105983
|
-
* Highlight the selected feature using the highlightOptions set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
106011
|
+
* Highlight the selected feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
105984
106012
|
*
|
|
105985
106013
|
* @default true
|
|
105986
106014
|
*
|
|
@@ -106204,7 +106232,7 @@ declare namespace __esri {
|
|
|
106204
106232
|
*/
|
|
106205
106233
|
featureViewModelAbilities?: Abilities;
|
|
106206
106234
|
/**
|
|
106207
|
-
* Highlight the selected feature using the highlightOptions set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
106235
|
+
* Highlight the selected feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
106208
106236
|
*
|
|
106209
106237
|
* @default true
|
|
106210
106238
|
*
|
|
@@ -114474,7 +114502,7 @@ declare namespace __esri {
|
|
|
114474
114502
|
*/
|
|
114475
114503
|
headingLevel: number;
|
|
114476
114504
|
/**
|
|
114477
|
-
* Highlight the selected popup feature using the highlightOptions set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
114505
|
+
* Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
114478
114506
|
*
|
|
114479
114507
|
* @default true
|
|
114480
114508
|
*
|
|
@@ -114689,7 +114717,7 @@ declare namespace __esri {
|
|
|
114689
114717
|
*/
|
|
114690
114718
|
headingLevel?: number;
|
|
114691
114719
|
/**
|
|
114692
|
-
* Highlight the selected popup feature using the highlightOptions set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
114720
|
+
* Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
114693
114721
|
*
|
|
114694
114722
|
* @default true
|
|
114695
114723
|
*
|
package/layers/LinkChartLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Layer.js";import{convertFromGeometry as h}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as u}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as p,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as C}from"./knowledgeGraph/layerUtils.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as b,LCSimpleLayout as E,LCSmartTreeLayout as N,LCRadialTreeLayout as T,LCHierarchicalLayout as I,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as R,load as O,LinkType as A}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import S from"../geometry/Polyline.js";let P=class extends(M(w(l))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((async a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),await C(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?h(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),await C(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=h(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,d=new Map,u=new Map,c=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Float64Array(n.length),M=new Float64Array(n.length),w=new Uint32Array(o.length),G=new Uint32Array(o.length),P=new Float64Array(o.length),j=new Float64Array(o.length),H=[],F="FORCE_DIRECTED",U=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let B,z="FORCE_DIRECTED",W=0,Q=0;const K=b.apply;switch(z="GEOGRAPHIC"===e?F:e,z){case"FORCE_DIRECTED":B=x.apply;break;case"COMMUNITY":B=D.apply;break;case"HIERARCHICAL":B=I.apply;break;case"RADIAL_TREE":B=T.apply;break;case"SMART_TREE":B=N.apply;break;default:B=E.apply}let Y=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[p])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[W]=R.IsGeographic:c[W]=R.None;const n=t.lockedNodeLocations.get(i.attributes[p]);L[W]=n.x,C[W]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[W]=R.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[W]=t?.x,C[W]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[W]=e.x,C[W]=e.y):c[W]=R.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[W]=e.x,C[W]=e.y):c[W]=R.IsMovable;break;default:c[W]=R.IsMovable}(null==L[W]||null==C[W]||Number.isNaN(L[W])||Number.isNaN(C[W]))&&(c[W]=R.IsMovable,L[W]=0,C[W]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[p])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;k[W]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;M[W]=r?new Date(r).getTime():NaN,L[W]=0,C[W]=0,c[W]=R.IsMovable}else c[W]=R.IsMovable,L[W]=0,C[W]=0;u.set(i.attributes[p],W),H[W]={feature:i,typeName:a},W++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let $=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[y],n=a.feature.attributes[g],o=u.get(i),r=u.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,c=l?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+d+"-"+p);const l=q.get(t),h=l?.has(a.typeName);h||(w[Q]=o,G[Q]=r,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(P[Q]=d?new Date(d).getTime():NaN,j[Q]=p?new Date(p).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,Q]])):l.set(a.typeName,Q),Q++),s.push(a)}else $=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),$&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await O();let X=!1,Z=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:X,links:Z,graphics:a}=K(c,L,C,k,M,w.subarray(0,Q),G.subarray(0,Q),P.subarray(0,Q),j.subarray(0,Q),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalOptions??{})),X&&(this.chronologicalAuxiliaryGraphics=a)}else({success:X,links:Z}=B(c,L,C,w.subarray(0,Q),G.subarray(0,Q),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<H.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),H[a].feature.attributes[m]=new v(L[a],C[a]),r.has(H[a].typeName)){const e=r.get(H[a].typeName);e?.set(H[a].feature.attributes[p],H[a].feature)}else{const e=new Map;e.set(H[a].feature.attributes[p],H[a].feature),r.set(H[a].typeName,e)}d.set(H[a].feature.attributes[p],H[a].feature);const e=h(H[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(H[a].feature.attributes[p],H[a].feature.attributes[m]?e:null),H[a].feature.attributes[m].x<U.xmin&&(U.xmin=H[a].feature.attributes[m].x),H[a].feature.attributes[m].x>U.xmax&&(U.xmax=H[a].feature.attributes[m].x),H[a].feature.attributes[m].y<U.ymin&&(U.ymin=H[a].feature.attributes[m].y),H[a].feature.attributes[m].y>U.ymax&&(U.ymax=H[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=U.xmin,this.linkChartExtent.xmax=U.xmax,this.linkChartExtent.ymin=U.ymin,this.linkChartExtent.ymax=U.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[y],c=o.feature.attributes[g];let f=r+"-"+c;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;f+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const L=q.get(f).get(o.typeName),C=0===L?0:Z?.vertexEndIndex[L-1];if(!ie.has(L)){if(ie.add(L),Z.types[L]===A.Recursive){const e=[Z.vertices[2*C],Z.vertices[2*C+1]],t=[Z.vertices[2*(C+1)],Z.vertices[2*(C+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[L]!==A.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=C;e<Z.vertexEndIndex[L];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=H[u.get(r)]?.feature.attributes[m],t=H[u.get(c)]?.feature.attributes[m];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(f)?ee.get(f).push(n):ee.set(f,[n])}const k=ee.get(f);te.has(f)||(te.set(f,new Map),ae.set(f,new Map));const M=te.get(f),w=ae.get(f);M.has(o.typeName)||(M.set(o.typeName,k.shift()),w.set(o.typeName,0));const b=M.get(o.typeName);w.set(o.typeName,w.get(o.typeName)+1);const E=new S({paths:[b]});if(o.feature.attributes[m]=E,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[p],o.feature)}else{const e=new Map;e.set(o.feature.attributes[p],o.feature),l.set(o.typeName,e)}d.set(o.feature.attributes[p],o.feature);const N=h(o.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[p],o.feature.attributes[m]?N:null)}for(const a of s)a.feature.attributes[f]=ae.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new v({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await C(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new v(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=h(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=h(new S({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[p],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[p],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(u).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:c,idealEdgeLengthType:p}=t;o(h)?l.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==c||void 0!==p)&&(s(p)?l.idealEdgeLengthType=p:void 0!==p&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?l.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalOptions){const e=t.chronologicalOptions;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===u.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new L({objectType:e,parentCompositeLayer:this,graphType:e.type})}};e([s()],P.prototype,"dataPreloadedInLocalCache",void 0),e([s()],P.prototype,"defaultLinkChartConfig",void 0),e([s()],P.prototype,"dataManager",void 0),e([s()],P.prototype,"knowledgeGraph",void 0),e([s()],P.prototype,"layers",void 0),e([s()],P.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],P.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],P.prototype,"linkChartExtent",void 0),e([s()],P.prototype,"memberEntityTypes",void 0),e([s()],P.prototype,"memberRelationshipTypes",void 0),e([s()],P.prototype,"sublayerIdsCache",void 0),e([s()],P.prototype,"tables",void 0),e([s({json:{read:!1}})],P.prototype,"type",void 0),e([s({json:{read:!1}})],P.prototype,"chronologicalAuxiliaryGraphics",void 0),P=e([r("esri.layers.LinkChartLayer")],P);const j=P;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Layer.js";import{convertFromGeometry as h}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as u}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import p from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as y,systemOidFieldName as g,systemOriginIdFieldName as m,systemDestinationIdFieldName as f,systemLayoutGeometryFieldName as L,systemAggregationCountFieldName as C}from"./knowledgeGraph/layerUtils.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as b,LCSimpleLayout as E,LCSmartTreeLayout as N,LCRadialTreeLayout as T,LCHierarchicalLayout as I,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as R,load as O,LinkType as A}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import S from"../geometry/Polyline.js";let P=class extends(M(w(l))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((async a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),await y(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?h(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),await y(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=h(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,d=new Map,u=new Map,c=new Uint8Array(n.length),p=new Float64Array(n.length),y=new Float64Array(n.length),k=new Float64Array(n.length),M=new Float64Array(n.length),w=new Uint32Array(o.length),G=new Uint32Array(o.length),P=new Float64Array(o.length),j=new Float64Array(o.length),H=[],F="FORCE_DIRECTED",U=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let B,z="FORCE_DIRECTED",W=0,Q=0;const K=b.apply;switch(z="GEOGRAPHIC"===e?F:e,z){case"FORCE_DIRECTED":B=x.apply;break;case"COMMUNITY":B=D.apply;break;case"HIERARCHICAL":B=I.apply;break;case"RADIAL_TREE":B=T.apply;break;case"SMART_TREE":B=N.apply;break;default:B=E.apply}let Y=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[g])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[W]=R.IsGeographic:c[W]=R.None;const n=t.lockedNodeLocations.get(i.attributes[g]);p[W]=n.x,y[W]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[W]=R.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":p[W]=t?.x,y[W]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):c[W]=R.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):c[W]=R.IsMovable;break;default:c[W]=R.IsMovable}(null==p[W]||null==y[W]||Number.isNaN(p[W])||Number.isNaN(y[W]))&&(c[W]=R.IsMovable,p[W]=0,y[W]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[g])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;k[W]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;M[W]=r?new Date(r).getTime():NaN,p[W]=0,y[W]=0,c[W]=R.IsMovable}else c[W]=R.IsMovable,p[W]=0,y[W]=0;u.set(i.attributes[g],W),H[W]={feature:i,typeName:a},W++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let $=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[m],n=a.feature.attributes[f],o=u.get(i),r=u.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,c=l?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+d+"-"+p);const l=q.get(t),h=l?.has(a.typeName);h||(w[Q]=o,G[Q]=r,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(P[Q]=d?new Date(d).getTime():NaN,j[Q]=p?new Date(p).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,Q]])):l.set(a.typeName,Q),Q++),s.push(a)}else $=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),$&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await O();let X=!1,Z=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:X,links:Z,graphics:a}=K(c,p,y,k,M,w.subarray(0,Q),G.subarray(0,Q),P.subarray(0,Q),j.subarray(0,Q),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalOptions??{})),X&&(this.chronologicalAuxiliaryGraphics=a)}else({success:X,links:Z}=B(c,p,y,w.subarray(0,Q),G.subarray(0,Q),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<H.length;a++){if(y[a]>84.9999?y[a]=84.9999:y[a]<-84.9999&&(y[a]=-84.9999),p[a]>179.9999?p[a]=179.9999:p[a]<-179.9999&&(p[a]=-179.9999),H[a].feature.attributes[L]=new v(p[a],y[a]),r.has(H[a].typeName)){const e=r.get(H[a].typeName);e?.set(H[a].feature.attributes[g],H[a].feature)}else{const e=new Map;e.set(H[a].feature.attributes[g],H[a].feature),r.set(H[a].typeName,e)}d.set(H[a].feature.attributes[g],H[a].feature);const e=h(H[a].feature.attributes[L]);this.entityLinkChartDiagramLookup.set(H[a].feature.attributes[g],H[a].feature.attributes[L]?e:null),H[a].feature.attributes[L].x<U.xmin&&(U.xmin=H[a].feature.attributes[L].x),H[a].feature.attributes[L].x>U.xmax&&(U.xmax=H[a].feature.attributes[L].x),H[a].feature.attributes[L].y<U.ymin&&(U.ymin=H[a].feature.attributes[L].y),H[a].feature.attributes[L].y>U.ymax&&(U.ymax=H[a].feature.attributes[L].y)}if(this.linkChartExtent.xmin=U.xmin,this.linkChartExtent.xmax=U.xmax,this.linkChartExtent.ymin=U.ymin,this.linkChartExtent.ymax=U.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[m],c=o.feature.attributes[f];let p=r+"-"+c;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;p+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const y=q.get(p).get(o.typeName),C=0===y?0:Z?.vertexEndIndex[y-1];if(!ie.has(y)){if(ie.add(y),Z.types[y]===A.Recursive){const e=[Z.vertices[2*C],Z.vertices[2*C+1]],t=[Z.vertices[2*(C+1)],Z.vertices[2*(C+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[y]!==A.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=C;e<Z.vertexEndIndex[y];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=H[u.get(r)]?.feature.attributes[L],t=H[u.get(c)]?.feature.attributes[L];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(p)?ee.get(p).push(n):ee.set(p,[n])}const k=ee.get(p);te.has(p)||(te.set(p,new Map),ae.set(p,new Map));const M=te.get(p),w=ae.get(p);M.has(o.typeName)||(M.set(o.typeName,k.shift()),w.set(o.typeName,0));const b=M.get(o.typeName);w.set(o.typeName,w.get(o.typeName)+1);const E=new S({paths:[b]});if(o.feature.attributes[L]=E,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[g],o.feature)}else{const e=new Map;e.set(o.feature.attributes[g],o.feature),l.set(o.typeName,e)}d.set(o.feature.attributes[g],o.feature);const N=h(o.feature.attributes[L]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[g],o.feature.attributes[L]?N:null)}for(const a of s)a.feature.attributes[C]=ae.get(a.feature.attributes[m]+"-"+a.feature.attributes[f])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new v({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await y(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new v(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=h(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[m]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[f]);if(t&&a){const i=h(new S({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[g],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[g],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(u).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:c,idealEdgeLengthType:p}=t;o(h)?l.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==c||void 0!==p)&&(s(p)?l.idealEdgeLengthType=p:void 0!==p&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?l.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalOptions){const e=t.chronologicalOptions;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===u.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new p({objectType:e,parentCompositeLayer:this,graphType:e.type})}};e([s()],P.prototype,"dataPreloadedInLocalCache",void 0),e([s()],P.prototype,"defaultLinkChartConfig",void 0),e([s()],P.prototype,"dataManager",void 0),e([s()],P.prototype,"knowledgeGraph",void 0),e([s()],P.prototype,"layers",void 0),e([s()],P.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],P.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],P.prototype,"linkChartExtent",void 0),e([s()],P.prototype,"memberEntityTypes",void 0),e([s()],P.prototype,"memberRelationshipTypes",void 0),e([s()],P.prototype,"sublayerIdsCache",void 0),e([s()],P.prototype,"tables",void 0),e([s({json:{read:!1}})],P.prototype,"type",void 0),e([s({json:{read:!1}})],P.prototype,"chronologicalAuxiliaryGraphics",void 0),P=e([r("esri.layers.LinkChartLayer")],P);const j=P;export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{JSONMap as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../TimeExtent.js";import t from"../core/Error.js";import{JSONMap as i}from"../core/jsonMap.js";import{clone as r}from"../core/lang.js";import{setDeepValue as o}from"../core/object.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import s from"./FeatureLayer.js";import{useViewTimeProperty as p}from"./mixins/TemporalLayer.js";import{orientedImageryTypeMap as m,timeIntervalUnitTypeMap as y,getEffectiveElevationSource as l,isOrientationAccuracy as u}from"./orientedImagery/core/utils.js";import d from"../time/TimeExtent.js";const c=new Set(["demPathPrefix","demPathSuffix","depthImagePathPrefix","depthImagePathSuffix","elevationSource","horizontalMeasurementUnit","verticalMeasurementUnit","videoPathPrefix","videoPathSuffix","timeAnimation","visibilityTimeExtent"]),h=(e,t)=>!c.has(t)&&e,f=(e,t,i)=>{const r=`orientedImageryProperties.${e}`;return{name:r,write:t?{ignoreOrigin:!0,target:r,writer:t}:{ignoreOrigin:!0},read:i?{ignoreOrigin:!0,source:r,reader:i}:{ignoreOrigin:!0}}};function g(e){return e.json?(e.json.origins=e.json.origins??{},e.json.origins["web-scene"]={write:!1,read:!1},e):e}function v(e,t,i,r){const{name:o,write:a,read:n}=f(e,t,i),s={name:o,write:a,read:n,origins:{service:{name:`orientedImageryInfo.${o}`,write:t,read:i},"web-scene":{name:o,write:h(a,e),read:h(n,e)},"web-map":{name:o,write:a,read:n}}};return r&&s.origins?(s.type=r,s.origins["web-map"].type=r,s.origins["web-scene"].type=r,s):s}let P=class extends s{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.supportedSourceTypes=new Set(["Oriented Imagery Layer"]),this.type="oriented-imagery",this.timeIntervalUnit="days",this.useViewTime=!0,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null,this.visibilityTimeExtent=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:i}=this;return l(e,t,i)}findFirstValidLayerId(e){return e.layers?.find((e=>this.supportedSourceTypes.has(e.type)))?.id}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([a({type:Number,json:v("cameraHeading")})],P.prototype,"cameraHeading",void 0),e([a({type:Number,json:v("cameraHeight")})],P.prototype,"cameraHeight",void 0),e([a({type:Number,json:v("cameraPitch")})],P.prototype,"cameraPitch",void 0),e([a({type:Number,json:v("cameraRoll")})],P.prototype,"cameraRoll",void 0),e([a({type:Number,json:v("coveragePercent")})],P.prototype,"coveragePercent",void 0),e([a({type:String,json:v("demPathPrefix")})],P.prototype,"demPathPrefix",void 0),e([a({type:String,json:v("demPathSuffix")})],P.prototype,"demPathSuffix",void 0),e([a({type:String,json:v("depthImagePathPrefix")})],P.prototype,"depthImagePathPrefix",void 0),e([a({type:String,json:v("depthImagePathSuffix")})],P.prototype,"depthImagePathSuffix",void 0),e([a({type:Object,json:v("elevationSource")})],P.prototype,"elevationSource",void 0),e([a()],P.prototype,"effectiveElevationSource",null),e([a({type:Number,json:v("farDistance")})],P.prototype,"farDistance",void 0),e([a()],P.prototype,"geometryType",void 0),e([a({type:Number,json:v("horizontalFieldOfView")})],P.prototype,"horizontalFieldOfView",void 0),e([a({type:String,json:v("horizontalMeasurementUnit")})],P.prototype,"horizontalMeasurementUnit",void 0),e([a({type:String,json:v("imagePathPrefix")})],P.prototype,"imagePathPrefix",void 0),e([a({type:String,json:v("imagePathSuffix")})],P.prototype,"imagePathSuffix",void 0),e([a({type:Number,json:v("imageRotation")})],P.prototype,"imageRotation",void 0),e([a({type:Number,json:v("maximumDistance")})],P.prototype,"maximumDistance",void 0),e([a({type:Number,json:v("nearDistance")})],P.prototype,"nearDistance",void 0),e([a({type:["OrientedImageryLayer"]})],P.prototype,"operationalLayerType",void 0),e([a({json:{...v("orientationAccuracy",((e,t,i)=>{o(i,e.join(";"),t)}),(e=>{const t=e?.split(";")?.map(Number);return u(t)?t:[0,0,0,0,0,0,0,0,0]}),String)}})],P.prototype,"orientationAccuracy",void 0),e([a({json:{...v("orientedImageryType",m.write,m.read,m.jsonValues.slice(1))}})],P.prototype,"orientedImageryType",void 0),e([a({json:{read:!1},value:"oriented-imagery",readOnly:!0})],P.prototype,"type",void 0),e([a({json:{...v("timeIntervalUnit",y.write,y.read,y.jsonValues),type:y.apiValues}})],P.prototype,"timeIntervalUnit",void 0),e([a(g(r(p)))],P.prototype,"useViewTime",void 0),e([a({type:Number,json:v("verticalFieldOfView")})],P.prototype,"verticalFieldOfView",void 0),e([a({json:{...v("verticalMeasurementUnit"),type:new i({Feet:"feet",Meter:"meter"}).apiValues}})],P.prototype,"verticalMeasurementUnit",void 0),e([a({type:String,json:v("videoPathPrefix")})],P.prototype,"videoPathPrefix",void 0),e([a({type:String,json:v("videoPathSuffix")})],P.prototype,"videoPathSuffix",void 0),e([a({type:d,json:{origins:{"web-scene":{write:!1,read:!1}}}})],P.prototype,"visibilityTimeExtent",void 0),P=e([n("esri.layers.OrientedImageryLayer")],P);const j=P;export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p??void 0);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t
|
|
5
|
+
import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p??void 0);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t;for(const s of l(e)){const{geometry:e,properties:t,id:l}=s;if(!e||(g||(g=u(e.type)),u(e.type)===g)){if(!p){p=a(f(e))}if(d||(d=null!=l,d&&(c=typeof l,t&&(y=Object.keys(t).filter((e=>t[e]===l))))),t&&y&&d&&null!=l&&(y.length>1?y=y.filter((e=>t[e]===l)):1===y.length&&(y=t[y[0]]===l?y:[])),t)for(const e in t){if(o.has(e))continue;const s=L(t[e]);if("unknown"===s){r.add(e);continue}r.delete(e),o.add(e);const c=i(e);c&&n.push({name:c,alias:e,type:s})}}}const m=i(1===y?.length&&y[0]||null)??void 0;if(m)for(const i of n)if(i.name===m&&s(i)){i.type="esriFieldTypeOID";break}return{fields:n,geometryType:g,hasZ:p,objectIdFieldName:m,objectIdFieldType:c,unknownFields:Array.from(r)}}function N(e,t){return Array.from(p(l(e),t))}export{N as createOptimizedFeatures,u as getGeometryType,I as inferLayerProperties,E as validateGeoJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polygon.js";import{initializeProjection as d,project as l}from"../../geometry/projection.js";import{wgs84 as m}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{extentToInBoundsRings as c}from"./supportUtils.js";import{executeQueryStreaming as y}from"../../rest/knowledgeGraphService.js";import u from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import f from"../../rest/support/Query.js";import g from"../../geometry/Extent.js";const b="ESRI__ID",w="ESRI__ORIGIN_ID",T="ESRI__DESTINATION_ID",I="ESRI__LAYOUT_GEOMETRY",D="ESRI__AGGREGATION_COUNT",E="LC.ESRI__IsSpatial";let M=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new f({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===b&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],a=[];return s.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)){i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.memberIdTypeLookup.get(i.attributes[w]),o=this.memberIdTypeLookup.get(i.attributes[T]),s=this._isEndEntitySpatial(n,i,w),a=this._isEndEntitySpatial(o,i,T);i.attributes[E]=Number(s&&a)}else{i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.geographicLookup.get(t.objectType.name);n&&i.attributes[n.name]?i.attributes[E]=1:i.attributes[E]=0}i.attributes[I]=i.geometry,a.push(i)})),a}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}const r={};let p="",d=-1;for(const[n,m]of a){d++,0!==d&&(p+=" UNION ");const e=`${n}_ids`;r[e]=m,p+=t&&0!==t?.length?`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r:${o}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`}const l=new Promise((e=>{(async()=>{const e=(await y(this.knowledgeGraph,new u({openCypherQuery:p,bindParameters:r}))).resultRowsStream.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;for(let e=0;e<n.length;e++){const t=n[e];i.push({id:t[0],typeName:t[1]}),i.push({id:t[2],typeName:t[3]})}}}catch(t){if("AbortError"!==t.name)throw t;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{e()}))}));return s.push(l),this.refreshCacheContent(),await Promise.all(s),i}async getRelationshipsBetweenNodes(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await y(this.knowledgeGraph,new u({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(a){if("AbortError"!==a.name)throw a;n.getLogger(this).info("Request aborted as expected")}return i}async getRelationshipsFromNodes(e,t,i){const o=[],s="MATCH (n)-[r]-(m) WHERE id(n) IN $targetEntityIds AND id(m) in $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",a=(await y(this.knowledgeGraph,new u({openCypherQuery:s,bindParameters:{targetEntityIds:e,possibleConnectionEntityIds:t,relationshipExclusionIds:i}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await a.read();if(e)break;for(let i=0;i<t.length;i++){const e=t[i];o.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return o}async refreshCacheContent(e,t,n,s=!0){const a=h.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[l,m]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(l)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(l)){const t=this.geographicLookup.get(l)?.name;t&&e.add(t)}if(this.entityTypeNames.has(l))h=`MATCH (n:${l}) ${m?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(l))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${l} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${l}]->() ${m?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new u(m?{openCypherQuery:h,bindParameters:{ids:m}}:{openCypherQuery:h});const f=(await y(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await f.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,b,this.geographicLookup.get(l)?.name);this.sublayerCaches.has(l)||this.sublayerCaches.set(l,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(l)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(l,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(l).members=new Map);const p=this.sublayerCaches.get(l);n.forEach((e=>{p?.set(e.attributes[b],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.has(e.attributes[b])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.set(e.attributes[b],{id:e.attributes[b]}),o(this.memberIdTypeLookup,e.attributes[b],(()=>new Set)).add(l))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(l)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=h.getInstance(),a=new Set,r=[];let f,w="",T=[];const I="relationship"===t.graphType,D=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,E=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let M=!D&&E?Array.from(E).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(M=e.objectIds);else if(null!=e.objectIds&&M&&M.length>0){const t=e.objectIds;e.objectIds=M.filter((e=>t.includes(e)))}else if(null!=e.objectIds)M=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=M}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==b&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,y=h?.spatialReference,b=h?.serviceCapabilities?.geometryCapabilities;let T=b?.geometryMaxBoundingRectangleSizeX,D=b?.geometryMaxBoundingRectangleSizeY;if("point"===n.type){let e=n;e.spatialReference?.isWGS84||(await d(e.spatialReference,m),e=l(e,m)),o=new g({spatialReference:m,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await d(n.extent.spatialReference,m),o=l(n.extent,m)):o=n.extent;if(T&&D&&y){if(4326!==y.wkid){const e=new g({spatialReference:y,xmax:T,ymax:D}),t=l(e,m);T=t.xmax,D=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>D)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${D}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}w=I?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{w+=`, n.${e}`,r.push(e)})),f=new u({openCypherQuery:w,bindParameters:{param_filter_geom:new p({rings:c(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=I?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;M&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",I&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),f=new u(M?{openCypherQuery:n,bindParameters:{ids:M}}:{openCypherQuery:n})}const k=(await y(t.parentCompositeLayer.dataManager.knowledgeGraph,f,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,I&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,b,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}_isEndEntitySpatial(e,t,i){for(const n of e??[])if(this.entityTypeNames.has(n)){const e=this.geographicLookup.get(n),o=e&&this.sublayerCaches.get(n)?.get(t.attributes[i]);if(e&&o?.attributes[e.name])return!0}return!1}};e([a()],M.prototype,"knowledgeGraph",void 0),e([a()],M.prototype,"inclusionModeDefinition",void 0),e([a()],M.prototype,"entityTypeNames",void 0),e([a()],M.prototype,"relationshipTypeNames",void 0),e([a()],M.prototype,"geographicLookup",void 0),e([a()],M.prototype,"sublayerCaches",void 0),e([a()],M.prototype,"nodeConnectionsLookup",void 0),e([a()],M.prototype,"relationshipConnectionsLookup",void 0),e([a()],M.prototype,"memberIdTypeLookup",void 0),M=e([r("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],M);export{M as KnowledgeGraphLayerDataManager,D as mockAggregationCountFieldName,T as mockDestinationIdFieldName,I as mockLayoutGeometryFieldName,b as mockOidFieldName,w as mockOriginIdFieldName,E as systemIsSpatialFieldName};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polygon.js";import{initializeProjection as d,project as l}from"../../geometry/projection.js";import{wgs84 as m}from"../../geometry/support/spatialReferenceUtils.js";import{systemOidFieldName as h,systemOriginIdFieldName as c,systemDestinationIdFieldName as y,systemIsSpatialFieldName as u,systemLayoutGeometryFieldName as f}from"./layerUtils.js";import g from"./SessionMemoryStorage.js";import{extentToInBoundsRings as b}from"./supportUtils.js";import{executeQueryStreaming as w}from"../../rest/knowledgeGraphService.js";import T from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import D from"../../rest/support/Query.js";import I from"../../geometry/Extent.js";let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const r=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&r.set(e.id,t)})),this.sublayerCaches.set(s,r)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return g.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new D({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===h&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],r=[];return s.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)){i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.memberIdTypeLookup.get(i.attributes[c]),o=this.memberIdTypeLookup.get(i.attributes[y]),s=this._isEndEntitySpatial(n,i,c),r=this._isEndEntitySpatial(o,i,y);i.attributes[u]=Number(s&&r)}else{i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.geographicLookup.get(t.objectType.name);n&&i.attributes[n.name]?i.attributes[u]=1:i.attributes[u]=0}i.attributes[f]=i.geometry,r.push(i)})),r}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],r=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;r.has(t)?r.get(t)?.push(e):r.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}const a={};let p="",d=-1;for(const[n,m]of r){d++,0!==d&&(p+=" UNION ");const e=`${n}_ids`;a[e]=m,p+=t&&0!==t?.length?`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r:${o}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`}const l=new Promise((e=>{(async()=>{const e=(await w(this.knowledgeGraph,new T({openCypherQuery:p,bindParameters:a}))).resultRowsStream.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;for(let e=0;e<n.length;e++){const t=n[e];i.push({id:t[0],typeName:t[1]}),i.push({id:t[2],typeName:t[3]})}}}catch(t){if("AbortError"!==t.name)throw t;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{e()}))}));return s.push(l),this.refreshCacheContent(),await Promise.all(s),i}async getRelationshipsBetweenNodes(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await w(this.knowledgeGraph,new T({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return i}async getRelationshipsFromNodes(e,t,i){const o=[],s="MATCH (n)-[r]-(m) WHERE id(n) IN $targetEntityIds AND id(m) in $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",r=(await w(this.knowledgeGraph,new T({openCypherQuery:s,bindParameters:{targetEntityIds:e,possibleConnectionEntityIds:t,relationshipExclusionIds:i}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await r.read();if(e)break;for(let i=0;i<t.length;i++){const e=t[i];o.push({id:e[0],typeName:e[1]})}}}catch(a){if("AbortError"!==a.name)throw a;n.getLogger(this).info("Request aborted as expected")}return o}async refreshCacheContent(e,t,n,s=!0){const r=g.getInstance(),a=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[l,m]of p){const e=new Promise((e=>{const a=async()=>{const e=new Set,a=[];let p,c="",y=!1;if(t||d.get(l)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(l)){const t=this.geographicLookup.get(l)?.name;t&&e.add(t)}if(this.entityTypeNames.has(l))c=`MATCH (n:${l}) ${m?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{c+=`, n.${e}`,a.push(e)}));else{if(!this.relationshipTypeNames.has(l))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${l} could not be determined. Was this type set in the KG data model and inclusion definition?`);y=!0,c=`MATCH ()-[n:${l}]->() ${m?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{c+=`, n.${e}`,a.push(e)}))}p=new T(m?{openCypherQuery:c,bindParameters:{ids:m}}:{openCypherQuery:c});const u=(await w(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await u.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,r=0;const p={properties:{}};for(p.id=e[n],n++,r++,y&&(p.originId=e[n],n++,r++,p.destinationId=e[n],n++,r++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[a[n-r]]=e[n];i.push(p)}const n=r.writeToStore(i,h,this.geographicLookup.get(l)?.name);this.sublayerCaches.has(l)||this.sublayerCaches.set(l,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(l)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(l,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(l).members=new Map);const p=this.sublayerCaches.get(l);n.forEach((e=>{p?.set(e.attributes[h],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.has(e.attributes[h])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.set(e.attributes[h],{id:e.attributes[h]}),o(this.memberIdTypeLookup,e.attributes[h],(()=>new Set)).add(l))}))}};a().then((()=>{e(null)}))}));a.push(e),this._processingCacheUpdatesLookup.get(l)?.push(e)}await Promise.all(a)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=g.getInstance(),r=new Set,a=[];let c,y="",u=[];const f="relationship"===t.graphType,D=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,E=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let M=!D&&E?Array.from(E).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(M=e.objectIds);else if(null!=e.objectIds&&M&&M.length>0){const t=e.objectIds;e.objectIds=M.filter((e=>t.includes(e)))}else if(null!=e.objectIds)M=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=M}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{r.add(e.name)})):i.forEach((e=>{e!==h&&e!==t.geometryFieldName&&r.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=h?.spatialReference,g=h?.serviceCapabilities?.geometryCapabilities;let w=g?.geometryMaxBoundingRectangleSizeX,D=g?.geometryMaxBoundingRectangleSizeY;if("point"===n.type){let e=n;e.spatialReference?.isWGS84||(await d(e.spatialReference,m),e=l(e,m)),o=new I({spatialReference:m,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await d(n.extent.spatialReference,m),o=l(n.extent,m)):o=n.extent;if(w&&D&&u){if(4326!==u.wkid){const e=new I({spatialReference:u,xmax:w,ymax:D}),t=l(e,m);w=t.xmax,D=t.ymax}if(o.xmax-o.xmin>w)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${w}° latitude, limit exceeded`);if(o.ymax-o.ymin>D)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${D}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&r.add(e.name)}))}y=f?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{y+=`, n.${e}`,a.push(e)})),c=new T({openCypherQuery:y,bindParameters:{param_filter_geom:new p({rings:b(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&r.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),a=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&a.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=f?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;M&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",f&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{n+=`, n.${e}`,a.push(e)})),c=new T(M?{openCypherQuery:n,bindParameters:{ids:M}}:{openCypherQuery:n})}const k=(await w(t.parentCompositeLayer.dataManager.knowledgeGraph,c,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const r={properties:{}};for(r.id=e[o],o++,s++,f&&(r.originId=e[o],o++,s++,r.destinationId=e[o],o++,s++);o<e.length;o++)r.properties[a[o-s]]=e[o];n.push(r)}u=u.concat(o.writeToStore(n,h,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return u}_isEndEntitySpatial(e,t,i){for(const n of e??[])if(this.entityTypeNames.has(n)){const e=this.geographicLookup.get(n),o=e&&this.sublayerCaches.get(n)?.get(t.attributes[i]);if(e&&o?.attributes[e.name])return!0}return!1}};e([r()],E.prototype,"knowledgeGraph",void 0),e([r()],E.prototype,"inclusionModeDefinition",void 0),e([r()],E.prototype,"entityTypeNames",void 0),e([r()],E.prototype,"relationshipTypeNames",void 0),e([r()],E.prototype,"geographicLookup",void 0),e([r()],E.prototype,"sublayerCaches",void 0),e([r()],E.prototype,"nodeConnectionsLookup",void 0),e([r()],E.prototype,"relationshipConnectionsLookup",void 0),e([r()],E.prototype,"memberIdTypeLookup",void 0),E=e([a("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],E);export{E as KnowledgeGraphLayerDataManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as i}from"../../core/lang.js";import{MultiOriginJSONMixin as n}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as l}from"../../core/accessorSupport/PropertyOrigin.js";import{initializeProjection as y,project as u}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{wgs84 as d}from"../../geometry/support/spatialReferenceUtils.js";import c from"../Layer.js";import h from"../graphics/data/FeatureStore.js";import{QueryEngine as f}from"../graphics/data/QueryEngine.js";import{createCapabilities as g,createDrawingInfo as j}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as b,mockAggregationCountFieldName as w,systemIsSpatialFieldName as T,mockLayoutGeometryFieldName as S}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as v}from"./KnowledgeGraphSublayerBase.js";import{BlendLayer as O,blendModeProperty as x,effectProperty as I}from"../mixins/BlendLayer.js";import{FeatureEffectLayer as E,featureEffectProperty as N}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as F}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as L,orderByProperty as R}from"../mixins/OrderedLayer.js";import{RefreshableLayer as Q}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as J,useViewTimeProperty as M}from"../mixins/TemporalLayer.js";import{labelsVisible as _,legendEnabled as k,maxScale as q,minScale as D,opacity as P,popupEnabled as G}from"../support/commonProperties.js";import{featureReductionProperty as U}from"../support/featureReductionUtils.js";import V from"../support/Field.js";import{fixRendererFields as Z,fixTimeInfoFields as B}from"../support/fieldUtils.js";import K from"../support/LabelClass.js";import{reader as W}from"../support/labelingInfo.js";import z from"../support/TimeInfo.js";import A from"../../rest/support/FeatureSet.js";import H from"../../rest/support/Query.js";import{createPopupTemplate as X}from"../../support/popupUtils.js";import Y from"../../core/workers/RemoteClient.js";import $ from"../../geometry/Extent.js";import ee from"../../geometry/Polygon.js";import te from"../../geometry/Polyline.js";import re from"../../geometry/Point.js";import{featureGeometryTypeKebabDictionary as oe}from"../../geometry/support/typeUtils.js";function ie(e){if(!e.json)return e;e.json.write=ne(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ne(e.write))}return e}function ne(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=se(e)),e):!0===e?ae():e}function se(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=pe.call(this,e,t);return r.enabled?{...i,...r}:r}}function ae(){return{overridePolicy:pe}}function pe(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...le.call(this,e,t)}),o}function le(e,t){return{ignoreOrigin:this.originIdOf(t)>l.DEFAULTS}}let ye=class extends(v(F(E(O(L(J(C(Q(n(c)))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=g(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.labelingInfo=null,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=b,this.objectType=null,this.opacity=1,this.orderBy=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new Y(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=H.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(V.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(V.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),V.fromJSON({name:w,type:"esriFieldTypeInteger",alias:w,editable:!1}),V.fromJSON({name:T,type:"esriFieldTypeInteger",alias:T,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?oe.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return S;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set renderer(e){Z(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){return this._isOverridden("renderer")?this._get("renderer"):"link-chart"===this.parentCompositeLayer?.type?"relationship"===this.graphType?r(j(oe.toJSON("polyline")).renderer):r(j(oe.toJSON("point")).renderer):r(j(oe.toJSON(this.geometryType)).renderer)}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??m.WGS84}set timeInfo(e){B(e,this.fieldsIndex),this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return X(this,e)}createQuery(){return new H({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=A.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new $(n.extent):new $,{count:n.count,extent:s}}async queryObjectIds(e,t){const r=H.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new h({geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new f({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new H({where:"1=1",outFields:[b]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=H.from(e),o=r.geometry;let i;if(o&&!o.spatialReference?.isWGS84&&(await y(o.spatialReference,d),r.geometry=u(o instanceof ee||o instanceof te||o instanceof re?o:o.extent,d)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:i}}};e([s(ie(i(x)))],ye.prototype,"blendMode",void 0),e([s()],ye.prototype,"capabilities",void 0),e([s({json:{origins:{"web-scene":{write:!1}},write:ae()}})],ye.prototype,"charts",void 0),e([s({readOnly:!0})],ye.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],ye.prototype,"definitionExpression",void 0),e([s()],ye.prototype,"displayField",void 0),e([s(ie(i(I)))],ye.prototype,"effect",void 0),e([s()],ye.prototype,"elevationInfo",void 0),e([s(ie(i(N)))],ye.prototype,"featureEffect",void 0),e([s(ie(i(U)))],ye.prototype,"featureReduction",null),e([s()],ye.prototype,"fields",null),e([s()],ye.prototype,"geometryType",null),e([s()],ye.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphTypeName",null),e([s()],ye.prototype,"hasM",null),e([s()],ye.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"id",void 0),e([s(ie(i(_)))],ye.prototype,"labelsVisible",void 0),e([s({type:[K],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:W,write:ae()}})],ye.prototype,"labelingInfo",void 0),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"layerType",void 0),e([s(ie(i(k)))],ye.prototype,"legendEnabled",void 0),e([s(ie(i(q)))],ye.prototype,"maxScale",void 0),e([s(ie(i(D)))],ye.prototype,"minScale",void 0),e([s()],ye.prototype,"objectIdField",void 0),e([s()],ye.prototype,"objectType",void 0),e([s(ie(i(P)))],ye.prototype,"opacity",void 0),e([s(ie(i(R)))],ye.prototype,"orderBy",void 0),e([s()],ye.prototype,"parentCompositeLayer",void 0),e([s(ie(i(G)))],ye.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:le}}})],ye.prototype,"refreshInterval",void 0),e([s({types:o,json:{name:"layerDefinition.drawingInfo.renderer",write:ae()}})],ye.prototype,"renderer",null),e([s()],ye.prototype,"source",void 0),e([s()],ye.prototype,"spatialReference",null),e([s({type:z,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],ye.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"title",null),e([p("title")],ye.prototype,"writeTitle",null),e([s({json:{read:!1}})],ye.prototype,"type",void 0),e([s(ie(i(M)))],ye.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:ae()}})],ye.prototype,"visible",void 0),ye=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],ye);const ue=ye;export{ue as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as i}from"../../core/lang.js";import{MultiOriginJSONMixin as n}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as l}from"../../core/accessorSupport/PropertyOrigin.js";import{initializeProjection as y,project as u}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{wgs84 as d}from"../../geometry/support/spatialReferenceUtils.js";import c from"../Layer.js";import h from"../graphics/data/FeatureStore.js";import{QueryEngine as f}from"../graphics/data/QueryEngine.js";import{createCapabilities as g,createDrawingInfo as j}from"../graphics/sources/support/clientSideDefaults.js";import{KnowledgeGraphSublayerBase as b}from"./KnowledgeGraphSublayerBase.js";import{systemOidFieldName as w,systemAggregationCountFieldName as T,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as v}from"./layerUtils.js";import{BlendLayer as O,blendModeProperty as x,effectProperty as I}from"../mixins/BlendLayer.js";import{FeatureEffectLayer as E,featureEffectProperty as N}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as F}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as L,orderByProperty as R}from"../mixins/OrderedLayer.js";import{RefreshableLayer as Q}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as J,useViewTimeProperty as M}from"../mixins/TemporalLayer.js";import{labelsVisible as _,legendEnabled as k,maxScale as q,minScale as D,opacity as P,popupEnabled as G}from"../support/commonProperties.js";import{featureReductionProperty as U}from"../support/featureReductionUtils.js";import V from"../support/Field.js";import{fixRendererFields as Z,fixTimeInfoFields as B}from"../support/fieldUtils.js";import K from"../support/LabelClass.js";import{reader as W}from"../support/labelingInfo.js";import z from"../support/TimeInfo.js";import A from"../../rest/support/FeatureSet.js";import H from"../../rest/support/Query.js";import{createPopupTemplate as X}from"../../support/popupUtils.js";import Y from"../../core/workers/RemoteClient.js";import $ from"../../geometry/Extent.js";import ee from"../../geometry/Polygon.js";import te from"../../geometry/Polyline.js";import re from"../../geometry/Point.js";import{featureGeometryTypeKebabDictionary as oe}from"../../geometry/support/typeUtils.js";function ie(e){if(!e.json)return e;e.json.write=ne(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ne(e.write))}return e}function ne(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=se(e)),e):!0===e?ae():e}function se(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=pe.call(this,e,t);return r.enabled?{...i,...r}:r}}function ae(){return{overridePolicy:pe}}function pe(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...le.call(this,e,t)}),o}function le(e,t){return{ignoreOrigin:this.originIdOf(t)>l.DEFAULTS}}let ye=class extends(b(F(E(O(L(J(C(Q(n(c)))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=g(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.labelingInfo=null,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=w,this.objectType=null,this.opacity=1,this.orderBy=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new Y(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=H.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(V.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(V.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),V.fromJSON({name:T,type:"esriFieldTypeInteger",alias:T,editable:!1}),V.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?oe.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return v;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set renderer(e){Z(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){return this._isOverridden("renderer")?this._get("renderer"):"link-chart"===this.parentCompositeLayer?.type?"relationship"===this.graphType?r(j(oe.toJSON("polyline")).renderer):r(j(oe.toJSON("point")).renderer):r(j(oe.toJSON(this.geometryType)).renderer)}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??m.WGS84}set timeInfo(e){B(e,this.fieldsIndex),this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return X(this,e)}createQuery(){return new H({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=A.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new $(n.extent):new $,{count:n.count,extent:s}}async queryObjectIds(e,t){const r=H.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new h({geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new f({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new H({where:"1=1",outFields:[w]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=H.from(e),o=r.geometry;let i;if(o&&!o.spatialReference?.isWGS84&&(await y(o.spatialReference,d),r.geometry=u(o instanceof ee||o instanceof te||o instanceof re?o:o.extent,d)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:i}}};e([s(ie(i(x)))],ye.prototype,"blendMode",void 0),e([s()],ye.prototype,"capabilities",void 0),e([s({json:{origins:{"web-scene":{write:!1}},write:ae()}})],ye.prototype,"charts",void 0),e([s({readOnly:!0})],ye.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],ye.prototype,"definitionExpression",void 0),e([s()],ye.prototype,"displayField",void 0),e([s(ie(i(I)))],ye.prototype,"effect",void 0),e([s()],ye.prototype,"elevationInfo",void 0),e([s(ie(i(N)))],ye.prototype,"featureEffect",void 0),e([s(ie(i(U)))],ye.prototype,"featureReduction",null),e([s()],ye.prototype,"fields",null),e([s()],ye.prototype,"geometryType",null),e([s()],ye.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphTypeName",null),e([s()],ye.prototype,"hasM",null),e([s()],ye.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"id",void 0),e([s(ie(i(_)))],ye.prototype,"labelsVisible",void 0),e([s({type:[K],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:W,write:ae()}})],ye.prototype,"labelingInfo",void 0),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"layerType",void 0),e([s(ie(i(k)))],ye.prototype,"legendEnabled",void 0),e([s(ie(i(q)))],ye.prototype,"maxScale",void 0),e([s(ie(i(D)))],ye.prototype,"minScale",void 0),e([s()],ye.prototype,"objectIdField",void 0),e([s()],ye.prototype,"objectType",void 0),e([s(ie(i(P)))],ye.prototype,"opacity",void 0),e([s(ie(i(R)))],ye.prototype,"orderBy",void 0),e([s()],ye.prototype,"parentCompositeLayer",void 0),e([s(ie(i(G)))],ye.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:le}}})],ye.prototype,"refreshInterval",void 0),e([s({types:o,json:{name:"layerDefinition.drawingInfo.renderer",write:ae()}})],ye.prototype,"renderer",null),e([s()],ye.prototype,"source",void 0),e([s()],ye.prototype,"spatialReference",null),e([s({type:z,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],ye.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"title",null),e([p("title")],ye.prototype,"writeTitle",null),e([s({json:{read:!1}})],ye.prototype,"type",void 0),e([s(ie(i(M)))],ye.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:ae()}})],ye.prototype,"visible",void 0),ye=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],ye);const ue=ye;export{ue as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../geometry.js";import{convertFromGeometry as e}from"../graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../graphics/OptimizedFeature.js";import{
|
|
5
|
+
import"../../geometry.js";import{convertFromGeometry as e}from"../graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../graphics/OptimizedFeature.js";import{systemOriginIdFieldName as r,systemDestinationIdFieldName as i}from"./layerUtils.js";import{fromJSON as s}from"../../geometry/support/jsonUtils.js";class o{constructor(){this._featureLookup=new Map}static getInstance(){return o.instance||(o.instance=new o),o.instance}static resetInstance(){o.instance&&(o.instance=null)}deleteFromStore(e){e.forEach((e=>{this._featureLookup.delete(e)}))}readFromStoreByList(e){const t=[];return e.forEach((e=>{const r=this.readFromStoreById(e);r&&t.push(r)})),t}readFromStoreById(e){return this._featureLookup.get(e)??null}writeToStore(o,n,p){const a=[];return o.forEach((o=>{if(!o?.id)return;o.properties||(o.properties=[]);let u,l=null;if(p&&o.properties[p]&&(l=e(o.properties[p])),"originId"in o&&"destinationId"in o&&(o.properties[r]=o.originId,o.properties[i]=o.destinationId),o.properties[n]=o.id,o.id&&this._featureLookup.has(o.id)&&this._featureLookup.get(o.id).attributes){const e=this._featureLookup.get(o.id),r=JSON.parse(JSON.stringify(Object.assign(e.attributes,o.properties)));p&&o.properties[p]&&(r[p]=s(o.properties[p])),u=new t(l?JSON.parse(JSON.stringify(l)):e?.geometry?JSON.parse(JSON.stringify(e.geometry)):null,r,null,o.properties[n])}else u=new t(l?JSON.parse(JSON.stringify(l)):null,o.properties,null,o.properties[n]);this._featureLookup.set(o.id,u),a.push(u)})),a}}export{o as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fetchClientDataAtKeys as e}from"../../rest/knowledgeGraphService.js";const a={initializeLayersFromClientData:async(a,
|
|
5
|
+
import{fetchClientDataAtKeys as e}from"../../rest/knowledgeGraphService.js";const a="ESRI__ID",t="ESRI__OriginID",r="ESRI__DestID",n="ESRI__LayoutGeometry",o="ESRI__AggregationCount",s="LC.ESRI__IsSpatial",i={initializeLayersFromClientData:async(a,t)=>{if(t||(t=[...a.layers,...a.tables].map((e=>e.graphTypeName))),0===t?.length)return;const r=new Map;for(const e of t)r.set(e,l(a,e));const n=await e(a.dataManager.knowledgeGraph,Array.from(r.values()));for(const e of[...a.layers,...a.tables]){const t=e.objectType.name;if(null===t)continue;const r=n.get(l(a,t));if(r){const a=JSON.parse(r);null===a||"object"!=typeof a||a.hasOwnProperty("showLabels")||(a.showLabels=!1),e.read(a,{origin:"service"})}}}},l=(e,a)=>"knowledge-graph"===e.type?`${a}/Map`:`${a}/LinkChart/LinkChartSubLayer`;async function c(e,a){return i.initializeLayersFromClientData(e,a)}export{c as initializeLayersFromClientData,i as layerUtils,o as systemAggregationCountFieldName,r as systemDestinationIdFieldName,s as systemIsSpatialFieldName,n as systemLayoutGeometryFieldName,a as systemOidFieldName,t as systemOriginIdFieldName};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GeoRSS:!0,GroupLayer:!0,KML:!0,KnowledgeGraphLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},r={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0},a={ArcGISFeatureLayer:!0,SubtypeGroupTable:!0},i={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GroupLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,KML:!0,LineOfSightLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,PointCloudLayer:!0,RasterDataLayer:!0,VectorTileLayer:!0,Voxel:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap":{ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":e,"web-map/basemap":r,"web-map/tables":a,"link-chart/operational-layers":{...e,LinkChartLayer:!0},"link-chart/basemap":r,"link-chart/tables":a,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,BuildingSceneLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,MediaLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,SubtypeGroupLayer:!0}};export{i as supportedTypes};
|
|
5
|
+
const e={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GeoRSS:!0,GroupLayer:!0,KML:!0,KnowledgeGraphLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},r={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0},a={ArcGISFeatureLayer:!0,SubtypeGroupTable:!0},i={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,CatalogLayer:!0,CSV:!0,GeoJSON:!0,GroupLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,KML:!0,LineOfSightLayer:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,RasterDataLayer:!0,VectorTileLayer:!0,Voxel:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},"web-scene/basemap":{ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":e,"web-map/basemap":r,"web-map/tables":a,"link-chart/operational-layers":{...e,LinkChartLayer:!0},"link-chart/basemap":r,"link-chart/tables":a,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,BuildingSceneLayer:!0,IntegratedMesh3DTilesLayer:!0,IntegratedMeshLayer:!0,MediaLayer:!0,OrientedImageryLayer:!0,PointCloudLayer:!0,SubtypeGroupLayer:!0}};export{i as supportedTypes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import{ClonableMixin as e}from"../../../core/Clonable.js";import r from"../../../core/Error.js";import{JSONSupport as t}from"../../../core/JSONSupport.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchArcGISServiceJSON as i}from"../../../support/requestPresets.js";let p=class extends(e(t)){constructor(){super(...arguments),this.url=null}};o([s({type:Number,json:{write:!0}})],p.prototype,"lod",void 0),o([s({type:String,json:{write:!0}})],p.prototype,"rasterFunction",void 0),o([s({type:String,json:{write:!0}})],p.prototype,"url",void 0),p=o([n("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ElevationSource")],p);let a=class extends(e(t)){constructor(){super(...arguments),this.constantElevation=null}};o([s({type:Number,json:{write:!0}})],a.prototype,"constantElevation",void 0),a=o([n("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ConstantElevation")],a);const c=o=>null!=o&&"constantElevation"in o&&"number"==typeof o.constantElevation,l=o=>null!=o&&"url"in o&&!!o.url;async function u(o){const e=await i(o),{tileInfo:t,cacheType:s}=e;return e.hasOwnProperty("bandCount")&&e.hasOwnProperty("pixelSizeX")?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?{isSupported:!0,isDynamic:!0}:{isSupported:!0}:{isSupported:!1,error:new r("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${o}`)}}export{a as ConstantElevation,p as ElevationSource,c as isConstantElevation,l as isElevationSource,u as validateElevationSourceURL};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{JSONMap as t}from"../../../core/jsonMap.js";import n from"./CameraOrientationHPR.js";import e from"./CameraOrientationOPK.js";import i from"./CameraOrientationYPR.js";import{ElevationSource as r,isConstantElevation as o,ConstantElevation as l}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as s}from"../enums/CameraOrientationType.js";import{isNumber as a}from"../../../widgets/support/dataUtils.js";function u(t,n,e){return n&&(t=`${n}${t}`),e&&(t+=`${e}`),t}function f(t,n,e){let{url:i}=t;return i?(i=u(i,n,e),new r({...t,url:i})):null}function c(t,n,e){return t?o(t)?new l(t):f(t,n,e):t}const m=new t({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new t({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),g=new Map;g.set(`${s.OPK}`,{desc:"Using Omega Phi Kappa",constructor:e}),g.set(`${s.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:n}),g.set(`${s.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:i});const h=new Map;function d(t){const[n,e,i,r,o,l,s,u,f,c,m,p,g,h,d,P,D,O,w
|
|
5
|
+
import{JSONMap as t}from"../../../core/jsonMap.js";import n from"./CameraOrientationHPR.js";import e from"./CameraOrientationOPK.js";import i from"./CameraOrientationYPR.js";import{ElevationSource as r,isConstantElevation as o,ConstantElevation as l}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as s}from"../enums/CameraOrientationType.js";import{isNumber as a}from"../../../widgets/support/dataUtils.js";function u(t,n,e){return n&&(t=`${n}${t}`),e&&(t+=`${e}`),t}function f(t,n,e){let{url:i}=t;return i?(i=u(i,n,e),new r({...t,url:i})):null}function c(t,n,e){return t?o(t)?new l(t):f(t,n,e):t}const m=new t({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new t({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),g=new Map;g.set(`${s.OPK}`,{desc:"Using Omega Phi Kappa",constructor:e}),g.set(`${s.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:n}),g.set(`${s.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:i});const h=new Map;function d(t){const[n,e,i,r,o,l,s,u,f,c,m,p,g,h,d,P,D,O,w,y,N,$]=t.slice(1),b=[f,c,m,p,g,h].map((t=>Number(t))),C=[P,D].map((t=>Number(t))),K=[O,w,y].map((t=>Number(t))),R=[N,$].map((t=>Number(t)));return{horizontalWKID:n,verticalWKID:e,x:i,y:r,z:o,omega:l,phi:s,kappa:u,affineTransformations:6===b.filter(a).length?b:null,focalLength:d,principalOffsetPoint:2!==C.filter(a).length?null:C,radialDistortionCoefficients:3!==K.filter(a).length?[0,0,0]:K,tangentialDistortionCoefficients:2!==R.filter(a).length?[0,0]:R}}function P(t){const[n,e,i,r,o,l,s,u,f,c,m,p,g,h,d,P,D,O,w,y,N,$]=t.slice(1),b=[f,c,m,p,g,h].map((t=>Number(t))),C=[P,D].map((t=>Number(t))),K=[O,w,y],R=[N,$];return{horizontalWKID:n,verticalWKID:e,x:i,y:r,z:o,heading:l,pitch:s,roll:u,affineTransformations:6===b.filter(a).length?b:null,focalLength:d,principalOffsetPoint:2!==C.filter(a).length?null:C,radialDistortionCoefficients:3!==K.filter(a).length?null:K,tangentialDistortionCoefficients:2!==R.filter(a).length?null:R}}function D(t){const[n,e,i,r,o,l,s,u,f,c,m,p,g,h,d,P,D,O,w,y,N,$]=t.slice(1),b=[f,c,m,p,g,h].map((t=>Number(t))),C=[P,D].map((t=>Number(t))),K=[O,w,y],R=[N,$];return{horizontalWKID:n,verticalWKID:e,x:i,y:r,z:o,yaw:l,pitch:s,roll:u,affineTransformations:6===b.filter(a).length?b:null,focalLength:d,principalOffsetPoint:2!==C.filter(a).length?null:C,radialDistortionCoefficients:3!==K.filter(a).length?null:K,tangentialDistortionCoefficients:2!==R.filter(a).length?null:R}}function O(t){const[n,e,i,r,o,...l]=t.slice(1),s=h.get(o);if(!s)return null;return{latitude:n,longitude:e,ellipsoidRadius:i,squaredEccentricity:r,properties:s([o,"",...l])}}function w(t){if(!t)return null;const n=`${t}`.split("|");if(0===n.length)return null;const e=g.get(n[0]);if(!e)return null;const i=h.get(n[0]);if(!i)return null;return new(0,e.constructor)(i(n))}function y(t){return Array.isArray(t)&&9===t?.length&&!t.some(isNaN)}h.set(`${s.HPR}`,P),h.set(`${s.YPR}`,D),h.set(`${s.OPK}`,d),h.set(`${s.LTP}`,O);export{u as appendPrefixAndSuffix,g as cameraOrientationRegistry,w as createCameraOrientation,c as getEffectiveElevationSource,y as isOrientationAccuracy,p as orientedImageryTypeMap,f as processElevationSource,m as timeIntervalUnitTypeMap,h as transformersRegistry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Collection.js";import"../../core/has.js";import{LayerLoadContext as r}from"./LayerLoadContext.js";import{layerLookupMap as a}from"./lazyLayerLoader.js";import t from"../../portal/PortalItem.js";import{isMapNotesLayer as y,isMarkupLayer as i,isRouteLayer as L}from"../../portal/support/featureCollectionUtils.js";import{selectLayerClassPath as
|
|
5
|
+
import e from"../../core/Collection.js";import"../../core/has.js";import{LayerLoadContext as r}from"./LayerLoadContext.js";import{layerLookupMap as a}from"./lazyLayerLoader.js";import t from"../../portal/PortalItem.js";import{isMapNotesLayer as y,isMarkupLayer as i,isRouteLayer as L}from"../../portal/support/featureCollectionUtils.js";import{selectLayerClassPath as n}from"../../portal/support/portalLayers.js";import{loadStyleRenderer as o}from"../../renderers/support/styleUtils.js";async function l(e,r,a){if(!r)return;const t=r.map((e=>G(e,a))),y=await Promise.allSettled(t);for(const i of y)"rejected"===i.status||i.value&&e.add(i.value)}const c={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BuildingSceneLayer:"BuildingSceneLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",IntegratedMesh3DTilesLayer:"IntegratedMesh3DTilesLayer",IntegratedMeshLayer:"IntegratedMeshLayer",KML:"KMLLayer",LineOfSightLayer:"LineOfSightLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",PointCloudLayer:"PointCloudLayer",RasterDataLayer:"UnsupportedLayer",VectorTileLayer:"VectorTileLayer",Voxel:"VoxelLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},s={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},p={ArcGISFeatureLayer:"FeatureLayer"},S={ArcGISImageServiceLayer:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WMS:"UnsupportedLayer",WebTiledLayer:"WebTileLayer"},u={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GeoRSS:"GeoRSSLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",KnowledgeGraphLayer:"KnowledgeGraphLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},d={ArcGISFeatureLayer:"FeatureLayer",SubtypeGroupTable:"UnsupportedLayer"},I={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},m={...u,LinkChartLayer:"LinkChartLayer"},g={...d},T={...I};async function G(e,r){return f(await M(e,r),e,r)}async function f(e,r,a){const t=new e;return t.read(r,a.context),"group"===t.type&&("GroupLayer"===r.layerType?await w(t,r,a):b(r)?h(t,r,a.context):A(r)&&await C(t,r,a.context)),await o(t,a.context),t}async function M(e,o){const l=o.context,c=v(l);let s=e.layerType||e.type;!s&&o?.defaultLayerType&&(s=o.defaultLayerType);const p=c[s];let S=p?a[p]:a.UnknownLayer;if(b(e)){const y=l?.portal;if(e.itemId){const i=new t({id:e.itemId,portal:y});await i.load();const L=(await n(i,new r)).className||"UnknownLayer";S=a[L]}}else"ArcGISFeatureLayer"===s?y(e)||i(e)?S=a.MapNotesLayer:L(e)?S=a.RouteLayer:A(e)&&(S=a.GroupLayer):e.wmtsInfo?.url&&e.wmtsInfo.layerIdentifier?S=a.WMTSLayer:"WFS"===s&&"2.0.0"!==e.wfsInfo?.version&&(S=a.UnsupportedLayer);return S()}function A(e){if("ArcGISFeatureLayer"!==e.layerType||b(e))return!1;return(e.featureCollection?.layers?.length??0)>1}function b(e){return"Feature Collection"===e.type}function v(e){let r;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":r=S;break;case"ground":r=s;break;case"tables":r=p;break;default:r=c}break;case"link-chart":switch(e.layerContainerType){case"basemap":r=T;break;case"tables":r=g;break;default:r=m}break;default:switch(e.layerContainerType){case"basemap":r=I;break;case"tables":r=d;break;default:r=u}}return r}async function w(r,a,t){const y=new e,i=l(y,Array.isArray(a.layers)?a.layers:[],t);try{try{if(await i,"group"===r.type)return r.layers.addMany(y),r}catch(L){r.destroy();for(const e of y)e.destroy();throw L}}catch(L){throw L}}function h(e,r,a){r.itemId&&(e.portalItem=new t({id:r.itemId,portal:a?.portal}),e.when((()=>{const t=t=>{const y=t.layerId;F(t,e,r,y,a);const i=r.featureCollection?.layers?.[y];i&&t.read(i,a)};e.layers?.forEach(t),e.tables?.forEach(t)})))}async function C(e,r,t){const y=a.FeatureLayer,i=await y(),L=r.featureCollection,n=L?.showLegend,o=L?.layers?.map(((a,y)=>{const L=new i;L.read(a,t);const o={...t,ignoreDefaults:!0};return F(L,e,r,y,o),null!=n&&L.read({showLegend:n},o),L}));e.layers.addMany(o??[])}function F(e,r,a,t,y){e.read({id:`${r.id}-sublayer-${t}`,visibility:a.visibleLayers?.includes(t)??!0},y)}export{w as populateGroupLayer,l as populateOperationalLayers};
|