@arcgis/core 6.0.0-next.34 → 6.0.0-next.35
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/Basemap.d.ts +2 -2
- package/analysis/ShadowCastAnalysis.d.ts +11 -5
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
- package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01f55004d64309f8538b.js +1 -0
- package/assets/esri/core/workers/chunks/0202eb8c2b2865f99981.js +1 -0
- package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
- package/assets/esri/core/workers/chunks/{7810586c35dfe1437516.js → 06102715e9a8f218e07c.js} +1 -1
- package/assets/esri/core/workers/chunks/{6029773458ab98600f67.js → 07e5482e1fc69be5de09.js} +1 -1
- package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +1 -0
- package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
- package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
- package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd30b02c5978c1c5f511.js → 155861fbd0e5fc2db80c.js} +1 -1
- package/assets/esri/core/workers/chunks/165ca7a97b611c8f26c4.js +1 -0
- package/assets/esri/core/workers/chunks/1ae0c9345626e70affd3.js +2 -0
- package/assets/esri/core/workers/chunks/{cd355baab983033c3ef0.js → 1ec772eaa63eb6937231.js} +1 -1
- package/assets/esri/core/workers/chunks/{5c04835b0b52461183cd.js → 1fd82fcba2758741996a.js} +1 -1
- package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
- package/assets/esri/core/workers/chunks/{e8e54faf947a582b4cf7.js → 247617c0dbae2386ab3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{97ec46605f16333144b7.js → 26ea39dfdf887f357fce.js} +1 -1
- package/assets/esri/core/workers/chunks/{85de980c5b296ec69323.js → 279089a6a3f08022c678.js} +1 -1
- package/assets/esri/core/workers/chunks/{b657363113f4a37e634b.js → 3223f9fbc76ba9ef8d13.js} +1 -1
- package/assets/esri/core/workers/chunks/322b22a5d54e404bebd5.js +1 -0
- package/assets/esri/core/workers/chunks/{122e75b21699a4e83b15.js → 338d800d4efcc91cead1.js} +1 -1
- package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
- package/assets/esri/core/workers/chunks/{f09bc86cd52224febfcb.js → 3b380e64566a6cce59e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1e8209d00809c9520a0.js → 3fe4c89acd325d36618d.js} +1 -1
- package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
- package/assets/esri/core/workers/chunks/{311e4969f19df63451dd.js → 4e5405134d079bdf9b7a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d070fcb73ce274ab80e4.js → 5504ec9bd9ee4d10af07.js} +1 -1
- package/assets/esri/core/workers/chunks/552c36b40e5a5ec117fb.js +1 -0
- package/assets/esri/core/workers/chunks/5622f3faa59434772857.js +1 -0
- package/assets/esri/core/workers/chunks/59a1b637d2c107504a04.js +1 -0
- package/assets/esri/core/workers/chunks/59a88dd53f8806bbec06.js +1 -0
- package/assets/esri/core/workers/chunks/5c2fe67527c9d7b4dba3.js +1 -0
- package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +1 -0
- package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
- package/assets/esri/core/workers/chunks/6604272ef6fe85279032.js +1 -0
- package/assets/esri/core/workers/chunks/{90c1d10eae7ae71889b0.js → 7400b8c454b47ee4fb3c.js} +1 -1
- package/assets/esri/core/workers/chunks/796c6195b6bf59dcc9bd.js +1 -0
- package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
- package/assets/esri/core/workers/chunks/{2de077c7b971f2c215a6.js → 7ddbde8fdd1cf3c53f50.js} +1 -1
- package/assets/esri/core/workers/chunks/804606b194dc9e71d088.js +1 -0
- package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
- package/assets/esri/core/workers/chunks/{676c8c0329d68f9f3ac4.js → 81bcc495e6eaf2cf7474.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
- package/assets/esri/core/workers/chunks/{e096c1d9d53af74d3207.js → 990e96139b5a1dccb061.js} +1 -1
- package/assets/esri/core/workers/chunks/{f28b63c1179366dac8a2.js → 9e2c30b67bab5795306e.js} +1 -1
- package/assets/esri/core/workers/chunks/{9184c947cdefe06bf551.js → a18c3cbe505a19d29569.js} +1 -1
- package/assets/esri/core/workers/chunks/aa6ee2aa4ff6e6d41efb.js +1 -0
- package/assets/esri/core/workers/chunks/{3fd5c3cd8457ddc68798.js → aa779896fd9e5c341349.js} +1 -1
- package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
- package/assets/esri/core/workers/chunks/{e0a7a75709121a26f255.js → afc8a9847f31bb66b13b.js} +1 -1
- package/assets/esri/core/workers/chunks/c7adb7b77721c75891f4.js +1 -0
- package/assets/esri/core/workers/chunks/{bead830a677690eeb6fb.js → ce8ef2eec290e1df6b2a.js} +1 -1
- package/assets/esri/core/workers/chunks/d3369ffed19f4c264dcd.js +1 -0
- package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
- package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
- package/assets/esri/core/workers/chunks/{c034c30e577d620b8e28.js → dac69c0047488fdf986d.js} +1 -1
- package/assets/esri/core/workers/chunks/dcc782e4bf9e8a8202f9.js +1 -0
- package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +1 -0
- package/assets/esri/core/workers/chunks/{19a4fa965b70fc6f78f6.js → e209cb1f3f14bf576ebe.js} +1 -1
- package/assets/esri/core/workers/chunks/e67ea2f1714e5abeae44.js +1 -0
- package/assets/esri/core/workers/chunks/e8fb2ba7b7a4f0916325.js +1 -0
- package/assets/esri/core/workers/chunks/efcd38aad9aa667001b2.js +1 -0
- package/assets/esri/core/workers/chunks/{3aafdb905c697bc9b1ad.js → f372f4eb5527238c46f5.js} +1 -1
- package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
- package/assets/esri/core/workers/chunks/f7123ba1286f64e13e91.js +1 -0
- package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/BlurEmission.glsl.js +9 -4
- package/chunks/Terrain.glsl.js +9 -9
- package/chunks/libtess-f32.js +1 -1
- package/chunks/libtess-f64.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +2 -2
- package/config.d.ts +3 -3
- package/config.js +1 -1
- package/core/mathUtils.js +1 -1
- package/form/FormTemplate.d.ts +1 -1
- package/geometry/libtess.js +1 -1
- package/geometry/projection/projectors.js +1 -1
- package/identity/Credential.d.ts +1 -1
- package/identity/IdentityManager.d.ts +1 -1
- package/identity/OAuthInfo.d.ts +1 -1
- package/identity/ServerInfo.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VectorTileLayer.d.ts +2 -2
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/CSVSource.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/MemorySource.js +2 -2
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
- package/layers/mixins/APIKeyMixin.d.ts +1 -1
- package/layers/ogc/types.d.ts +1 -1
- package/layers/support/TelemetryData.d.ts +28 -4
- package/layers/support/TimeInformation.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/support/timeInfoUtils.js +2 -0
- package/layers/video/videoUtils.js +1 -1
- package/package.json +2 -2
- package/rest/query/executeAttributeBinsQuery.js +1 -1
- package/rest/query/executeForExtent.js +1 -1
- package/rest/query/executeForTopCount.js +1 -1
- package/rest/query/executeForTopExtents.js +1 -1
- package/rest/query/executeForTopIds.js +1 -1
- package/rest/query/executeTopFeaturesQuery.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/timeUtils.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/materialKeyUtils.js +2 -0
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastError.d.ts +40 -0
- package/views/3d/analysis/ShadowCast/ShadowCastError.js +2 -0
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +16 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWorker.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FeatureMemory.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl.d.ts +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Directions.d.ts +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +0 -1
- package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +0 -1
- package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +0 -1
- package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
- package/assets/esri/core/workers/chunks/24ada9511b074dc5ae27.js +0 -1
- package/assets/esri/core/workers/chunks/277263466837e1673f56.js +0 -1
- package/assets/esri/core/workers/chunks/2c8ca43563c4f3e94535.js +0 -1
- package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
- package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
- package/assets/esri/core/workers/chunks/38df7b1d58c4bcf693d0.js +0 -1
- package/assets/esri/core/workers/chunks/507ecc3692e6d0700958.js +0 -1
- package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
- package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
- package/assets/esri/core/workers/chunks/661847f1b7044f21600f.js +0 -1
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +0 -1
- package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +0 -1
- package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +0 -1
- package/assets/esri/core/workers/chunks/7582654a0fc70910731c.js +0 -1
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +0 -1
- package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +0 -1
- package/assets/esri/core/workers/chunks/8517d96fc8ba7b21d845.js +0 -2
- package/assets/esri/core/workers/chunks/a107f16cd004626b5018.js +0 -1
- package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
- package/assets/esri/core/workers/chunks/bf62be00f3040f91aaee.js +0 -1
- package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
- package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
- package/assets/esri/core/workers/chunks/caad4f475d6eb01c2850.js +0 -1
- package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
- package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
- package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +0 -1
- package/assets/esri/core/workers/chunks/e81173724e8de8c1e65b.js +0 -1
- package/assets/esri/core/workers/chunks/e83f9abee611c5b80009.js +0 -1
- package/assets/esri/core/workers/chunks/ec8b7476eac4718eb0ac.js +0 -1
- package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +0 -1
- package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +0 -1
- package/views/2d/engine/webgl/hashMosaic.js +0 -2
- /package/assets/esri/core/workers/chunks/{8517d96fc8ba7b21d845.js.LICENSE.txt → 1ae0c9345626e70affd3.js.LICENSE.txt} +0 -0
package/identity/OAuthInfo.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface OAuthInfoProperties extends Partial<Pick<OAuthInfo, "appId" | "
|
|
|
14
14
|
*
|
|
15
15
|
* @since 4.0
|
|
16
16
|
* @see [Sample - Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
|
|
17
|
-
* @see [Authentication and
|
|
17
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
18
18
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
19
19
|
* @see [Proxy pages with the API](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
20
20
|
* @see [ArcGIS portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
|
package/identity/ServerInfo.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface ServerInfoProperties extends Partial<Pick<ServerInfo, "adminTok
|
|
|
7
7
|
*
|
|
8
8
|
* @since 4.0
|
|
9
9
|
* @see [IdentityManager](https://developers.arcgis.com/javascript/latest/references/core/identity/IdentityManager/)
|
|
10
|
-
* @see [
|
|
10
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
11
11
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
12
12
|
* @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
13
13
|
* @see [Guide topic - CORS](https://developers.arcgis.com/javascript/latest/cors/)
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.
|
|
2
|
+
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.35`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
package/layers/CSVLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as a}from"../core/urlUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import{excludeTables as c}from"../core/accessorSupport/layerContainerType.js";import l from"../geometry/SpatialReference.js";import u from"../graphic/CSVGraphicOrigin.js";import d from"./Layer.js";import{CSVSource as f}from"./graphics/sources/CSVSource.js";import{createCapabilities as p}from"./graphics/sources/support/clientSideDefaults.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as g}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as v}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as w}from"./mixins/TemporalLayer.js";import{TrackableLayer as T}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as E,elevationInfo as D,labelsVisible as O,legendEnabled as k,maxScale as A,minScale as j,opacityDrawingInfo as M,popupEnabled as N,screenSizePerspectiveEnabled as P,timeInfo as F,url as I}from"./support/commonProperties.js";import{validateBinsQuery as L}from"./support/featureLayerUtils.js";import R from"./support/Field.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as V}from"./support/fieldUtils.js";import H from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{webSceneRendererTypes as G,rendererTypes as K}from"../renderers/support/typeUtils.js";import q from"../rest/support/Query.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import{fromTimeReference as Y}from"../time/timeZoneUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";const Z=z();let Q=class extends b(g(h(v(_(m(w(T(C(S(y(x(r(d))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=p(!1,!1),this.copyright=null,this.definitionExpression=null,this.delimiter=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.geometryType=`point`,this.graphicOrigin=new u(this),this.labelingInfo=null,this.labelsVisible=!0,this.latitudeField=null,this.legendEnabled=!0,this.locationType=`coordinates`,this.longitudeField=null,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.opacity=1,this.operationalLayerType=`CSV`,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new f,this.spatialReference=l.WGS84,this.timeInfo=null,this.type=`csv`}load(e){let t=this.loadFromPortal({supportedTypes:[`CSV`],supportsData:!1},e).catch(i).then(()=>(this.source.loadOptions={delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},this.source.customParameters=this.customParameters??void 0,this.source.load(e))).then(()=>{this.read({layerDefinition:this.source.sourceJSON,locationInfo:this.source.locationInfo,columnDelimiter:this.source.delimiter},{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}),B(this.renderer,this.fieldsIndex),V(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this.source?.destroy()}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`capabilities`),(this._get(`createQueryVersion`)||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){return t.showLabels??!!t.layerDefinition?.drawingInfo?.labelingInfo}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}set renderer(e){B(e,this.fieldsIndex),this._set(`renderer`,e)}set url(e){if(!e){this._set(`url`,e);return}let t=a(e);this._set(`url`,t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}createPopupTemplate(e){return J(this,e)}createQuery(){let e=new q,t=this.capabilities?.data;e.returnGeometry=!0,t?.supportsZ&&(e.returnZ=!0),e.outFields=[`*`],e.where=this.definitionExpression||`1=1`;let{timeOffset:n,timeExtent:r}=this;return e.timeExtent=n&&r?r.offset(-n.value,n.unit):r??null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}async queryAttributeBins(e,t){let{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new n(`CSVLayer`,`Layer source does not support queryAttributeBins capability`);L(e,i,`CSVLayer`);let{default:a}=await import(`../rest/support/AttributeBinsQuery.js`),o=await r.queryAttributeBins(a.from(e),t),s=this.graphicOrigin;if(o.features)for(let e of o.features)e.layer=e.sourceLayer=this,e.origin=s;return o}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(q.from(e)||this.createQuery())).then(e=>{let t=this.graphicOrigin;if(e.features)for(let n of e.features)n.layer=n.sourceLayer=this,n.origin=t;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(q.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(q.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(q.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`latitudeField`,`longitudeField`].forEach(e=>this.revertToOrigin(e,`service`)),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}async hasDataChanged(){try{let{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([o(E)],Q.prototype,`attributeTableTemplate`,void 0),e([o({readOnly:!0,json:{read:!1,write:!1}})],Q.prototype,`capabilities`,void 0),e([o({type:String,json:{origins:{service:{read:{source:`copyrightText`}}}}})],Q.prototype,`copyright`,void 0),e([o({readOnly:!0})],Q.prototype,`createQueryVersion`,null),e([o({json:{name:`layerDefinition.dateFieldsTimeReference`,read:{reader:Y}}})],Q.prototype,`dateFieldsTimeZone`,void 0),e([o({readOnly:!0})],Q.prototype,`defaultPopupTemplate`,null),e([o({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([o({type:[`,`,` `,`;`,`|`,` `],json:{name:`columnDelimiter`,write:{ignoreOrigin:!0}}})],Q.prototype,`delimiter`,void 0),e([o({type:String})],Q.prototype,`displayField`,void 0),e([o(D)],Q.prototype,`elevationInfo`,void 0),e([o({type:[R],json:{name:`layerDefinition.fields`,write:{ignoreOrigin:!0}}})],Q.prototype,`fields`,void 0),e([o(Z.fieldsIndex)],Q.prototype,`fieldsIndex`,void 0),e([o({type:W,json:{name:`layerDefinition.floorInfo`,write:{layerContainerTypes:c}}})],Q.prototype,`floorInfo`,void 0),e([o({json:{origins:{service:{name:`layerDefinition.extent`}}}})],Q.prototype,`fullExtent`,void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,`geometryType`,void 0),e([o({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([o({readOnly:!0})],Q.prototype,`isTable`,null),e([o({type:[H],json:{name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:U},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([o(O)],Q.prototype,`labelsVisible`,void 0),e([X(`web-map`,`labelsVisible`,[`layerDefinition.drawingInfo.labelingInfo`,`showLabels`])],Q.prototype,`readWebMapLabelsVisible`,null),e([o({type:String,json:{name:`locationInfo.latitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`latitudeField`,void 0),e([o(k)],Q.prototype,`legendEnabled`,void 0),e([o({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([o({type:[`coordinates`],json:{name:`locationInfo.locationType`,write:{ignoreOrigin:!0,isRequired:!0}}})],Q.prototype,`locationType`,void 0),e([o({type:String,json:{name:`locationInfo.longitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`longitudeField`,void 0),e([o(A)],Q.prototype,`maxScale`,void 0),e([o(j)],Q.prototype,`minScale`,void 0),e([o({type:String,json:{name:`layerDefinition.objectIdField`,origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,ignoreOrigin:!0}}}}})],Q.prototype,`objectIdField`,void 0),e([o(M)],Q.prototype,`opacity`,void 0),e([o({type:[`CSV`]})],Q.prototype,`operationalLayerType`,void 0),e([o()],Q.prototype,`outFields`,void 0),e([o(N)],Q.prototype,`popupEnabled`,void 0),e([o({type:t,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([o({types:K,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:G,name:`layerDefinition.drawingInfo.renderer`,write:!0}},write:{ignoreOrigin:!0,layerContainerTypes:c}}})],Q.prototype,`renderer`,null),e([o(P)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([o({readOnly:!0})],Q.prototype,`source`,void 0),e([o({type:l,json:{origins:{service:{name:`layerDefinition.extent.spatialReference`}}}})],Q.prototype,`spatialReference`,void 0),e([o(F({name:`layerDefinition.timeInfo`,alwaysWriteNonItemOrigin:!0}))],Q.prototype,`timeInfo`,void 0),e([o({type:String,json:{origins:{service:{name:`layerDefinition.name`},"web-document":{name:`title`,write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Q.prototype,`title`,void 0),e([o({json:{read:!1},value:`csv`,readOnly:!0})],Q.prototype,`type`,void 0),e([o(I)],Q.prototype,`url`,null),Q=e([s(`esri.layers.CSVLayer`)],Q);const $=Q;export{$ as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as a}from"../core/urlUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import{excludeTables as c}from"../core/accessorSupport/layerContainerType.js";import l from"../geometry/SpatialReference.js";import u from"../graphic/CSVGraphicOrigin.js";import d from"./Layer.js";import{CSVSource as f}from"./graphics/sources/CSVSource.js";import{createCapabilities as p}from"./graphics/sources/support/clientSideDefaults.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as g}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as v}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as w}from"./mixins/TemporalLayer.js";import{TrackableLayer as T}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as E,elevationInfo as D,labelsVisible as O,legendEnabled as k,maxScale as A,minScale as j,opacityDrawingInfo as M,popupEnabled as N,screenSizePerspectiveEnabled as P,timeInfo as F,url as I}from"./support/commonProperties.js";import{validateBinsQuery as L}from"./support/featureLayerUtils.js";import R from"./support/Field.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as V}from"./support/fieldUtils.js";import H from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{webSceneRendererTypes as G,rendererTypes as K}from"../renderers/support/typeUtils.js";import q from"../rest/support/Query.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import{fromTimeReference as Y}from"../time/timeZoneUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";const Z=z();let Q=class extends b(g(h(v(_(m(w(T(C(S(y(x(r(d))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=p(!1,!1),this.copyright=null,this.definitionExpression=null,this.delimiter=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.geometryType=`point`,this.graphicOrigin=new u(this),this.labelingInfo=null,this.labelsVisible=!0,this.latitudeField=null,this.legendEnabled=!0,this.locationType=`coordinates`,this.longitudeField=null,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.opacity=1,this.operationalLayerType=`CSV`,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new f({layer:this}),this.spatialReference=l.WGS84,this.timeInfo=null,this.type=`csv`}load(e){let t=this.loadFromPortal({supportedTypes:[`CSV`],supportsData:!1},e).catch(i).then(()=>(this.source.loadOptions={delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},this.source.customParameters=this.customParameters??void 0,this.source.load(e))).then(()=>{this.read({layerDefinition:this.source.sourceJSON,locationInfo:this.source.locationInfo,columnDelimiter:this.source.delimiter},{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}),B(this.renderer,this.fieldsIndex),V(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this.source?.destroy()}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`capabilities`),(this._get(`createQueryVersion`)||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){return t.showLabels??!!t.layerDefinition?.drawingInfo?.labelingInfo}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}set renderer(e){B(e,this.fieldsIndex),this._set(`renderer`,e)}set url(e){if(!e){this._set(`url`,e);return}let t=a(e);this._set(`url`,t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}createPopupTemplate(e){return J(this,e)}createQuery(){let e=new q,t=this.capabilities?.data;e.returnGeometry=!0,t?.supportsZ&&(e.returnZ=!0),e.outFields=[`*`],e.where=this.definitionExpression||`1=1`;let{timeOffset:n,timeExtent:r}=this;return e.timeExtent=n&&r?r.offset(-n.value,n.unit):r??null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}async queryAttributeBins(e,t){let{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new n(`CSVLayer`,`Layer source does not support queryAttributeBins capability`);L(e,i,`CSVLayer`);let{default:a}=await import(`../rest/support/AttributeBinsQuery.js`),o=await r.queryAttributeBins(a.from(e),t),s=this.graphicOrigin;if(o.features)for(let e of o.features)e.layer=e.sourceLayer=this,e.origin=s;return o}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(q.from(e)||this.createQuery())).then(e=>{let t=this.graphicOrigin;if(e.features)for(let n of e.features)n.layer=n.sourceLayer=this,n.origin=t;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(q.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(q.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(q.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`latitudeField`,`longitudeField`].forEach(e=>this.revertToOrigin(e,`service`)),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}async hasDataChanged(){try{let{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([o(E)],Q.prototype,`attributeTableTemplate`,void 0),e([o({readOnly:!0,json:{read:!1,write:!1}})],Q.prototype,`capabilities`,void 0),e([o({type:String,json:{origins:{service:{read:{source:`copyrightText`}}}}})],Q.prototype,`copyright`,void 0),e([o({readOnly:!0})],Q.prototype,`createQueryVersion`,null),e([o({json:{name:`layerDefinition.dateFieldsTimeReference`,read:{reader:Y}}})],Q.prototype,`dateFieldsTimeZone`,void 0),e([o({readOnly:!0})],Q.prototype,`defaultPopupTemplate`,null),e([o({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([o({type:[`,`,` `,`;`,`|`,` `],json:{name:`columnDelimiter`,write:{ignoreOrigin:!0}}})],Q.prototype,`delimiter`,void 0),e([o({type:String})],Q.prototype,`displayField`,void 0),e([o(D)],Q.prototype,`elevationInfo`,void 0),e([o({type:[R],json:{name:`layerDefinition.fields`,write:{ignoreOrigin:!0}}})],Q.prototype,`fields`,void 0),e([o(Z.fieldsIndex)],Q.prototype,`fieldsIndex`,void 0),e([o({type:W,json:{name:`layerDefinition.floorInfo`,write:{layerContainerTypes:c}}})],Q.prototype,`floorInfo`,void 0),e([o({json:{origins:{service:{name:`layerDefinition.extent`}}}})],Q.prototype,`fullExtent`,void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,`geometryType`,void 0),e([o({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([o({readOnly:!0})],Q.prototype,`isTable`,null),e([o({type:[H],json:{name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:U},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([o(O)],Q.prototype,`labelsVisible`,void 0),e([X(`web-map`,`labelsVisible`,[`layerDefinition.drawingInfo.labelingInfo`,`showLabels`])],Q.prototype,`readWebMapLabelsVisible`,null),e([o({type:String,json:{name:`locationInfo.latitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`latitudeField`,void 0),e([o(k)],Q.prototype,`legendEnabled`,void 0),e([o({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([o({type:[`coordinates`],json:{name:`locationInfo.locationType`,write:{ignoreOrigin:!0,isRequired:!0}}})],Q.prototype,`locationType`,void 0),e([o({type:String,json:{name:`locationInfo.longitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`longitudeField`,void 0),e([o(A)],Q.prototype,`maxScale`,void 0),e([o(j)],Q.prototype,`minScale`,void 0),e([o({type:String,json:{name:`layerDefinition.objectIdField`,origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,ignoreOrigin:!0}}}}})],Q.prototype,`objectIdField`,void 0),e([o(M)],Q.prototype,`opacity`,void 0),e([o({type:[`CSV`]})],Q.prototype,`operationalLayerType`,void 0),e([o()],Q.prototype,`outFields`,void 0),e([o(N)],Q.prototype,`popupEnabled`,void 0),e([o({type:t,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([o({types:K,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:G,name:`layerDefinition.drawingInfo.renderer`,write:!0}},write:{ignoreOrigin:!0,layerContainerTypes:c}}})],Q.prototype,`renderer`,null),e([o(P)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([o({readOnly:!0})],Q.prototype,`source`,void 0),e([o({type:l,json:{origins:{service:{name:`layerDefinition.extent.spatialReference`}}}})],Q.prototype,`spatialReference`,void 0),e([o(F({name:`layerDefinition.timeInfo`,alwaysWriteNonItemOrigin:!0}))],Q.prototype,`timeInfo`,void 0),e([o({type:String,json:{origins:{service:{name:`layerDefinition.name`},"web-document":{name:`title`,write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Q.prototype,`title`,void 0),e([o({json:{read:!1},value:`csv`,readOnly:!0})],Q.prototype,`type`,void 0),e([o(I)],Q.prototype,`url`,null),Q=e([s(`esri.layers.CSVLayer`)],Q);const $=Q;export{$ as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import n from"../core/Error.js";import r from"../core/Logger.js";import{MultiOriginJSONSupportMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import u from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISService as f}from"./mixins/ArcGISService.js";import{CustomParametersMixin as p}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as m}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{url as _,elevationInfo as v}from"./support/commonProperties.js";import{default3DTilesFullExtent as y,default3DTilesSpatialReference as b,initFullExtent as x,hasEsriCrs as S}from"./support/tiles3DUtils.js";import{logInvalidElevationInfoWarning as C,elevationModeRequiredMessage as w,featureExpressionUnsupportedMessage as T}from"../support/elevationInfoUtils.js";let E=class extends f(m(h(g(i(p(d(u))))))){constructor(e){super(e),this.operationalLayerType=`GaussianSplatLayer`,this.type=`gaussian-splat`,this.opacity=1,this.minScale=0,this.maxScale=0,this.url=null,this.rootTilesetJSON=null,this.fullExtent=y,this.spatialReference=b,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null}get supportedSpatialReferences(){return!this.initialized||!this.esriCrsSpatialReference?[l.WGS84]:[l.WGS84,this.esriCrsSpatialReference]}get fullExtents(){return!this.initialized||!this.esriCrsFullExtent?[
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import n from"../core/Error.js";import r from"../core/Logger.js";import{MultiOriginJSONSupportMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import u from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISService as f}from"./mixins/ArcGISService.js";import{CustomParametersMixin as p}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as m}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{url as _,elevationInfo as v}from"./support/commonProperties.js";import{default3DTilesFullExtent as y,default3DTilesSpatialReference as b,initFullExtent as x,hasEsriCrs as S}from"./support/tiles3DUtils.js";import{logInvalidElevationInfoWarning as C,elevationModeRequiredMessage as w,featureExpressionUnsupportedMessage as T}from"../support/elevationInfoUtils.js";let E=class extends f(m(h(g(i(p(d(u))))))){constructor(e){super(e),this.operationalLayerType=`GaussianSplatLayer`,this.type=`gaussian-splat`,this.opacity=1,this.minScale=0,this.maxScale=0,this.url=null,this.rootTilesetJSON=null,this.fullExtent=y,this.spatialReference=b,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null}get supportedSpatialReferences(){return!this.initialized||!this.esriCrsSpatialReference?[l.WGS84]:[l.WGS84,this.esriCrsSpatialReference]}get fullExtents(){let e=this.fullExtent??y;return!this.initialized||!this.esriCrsFullExtent?[e]:[e,this.esriCrsFullExtent]}set elevationInfo(e){(e==null||e.mode===`absolute-height`)&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){let r=e==null?null:e.signal;try{await this.loadFromPortal({supportedTypes:[`3DTiles Service`],validateItem:e=>{if(e.typeKeywords?.includes(`GaussianSplat`))return!0;throw new n(`portal:invalid-layer-item-type`,"Invalid layer item, expected '${expectedType}' ",{expectedType:`3DTiles Service`})}},e)}catch(e){a(e)}this.url&&await t(this.url,{query:{...this.customParameters,token:this.apiKey},responseType:`json`,signal:r}).then(e=>{this.rootTilesetJSON=e.data,this.fullExtent=x(this.rootTilesetJSON,!1),S(this.rootTilesetJSON)&&(this.esriCrsFullExtent=x(this.rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference)},e=>{a(e)})}_validateElevationInfo(e){let t=`Gaussian Splat layers`;C(r.getLogger(this),w(t,`absolute-height`,e)),C(r.getLogger(this),T(t,e))}};e([o({type:[`GaussianSplatLayer`]})],E.prototype,`operationalLayerType`,void 0),e([o({readOnly:!0})],E.prototype,`type`,void 0),e([o({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],E.prototype,`opacity`,void 0),e([o({type:Number,json:{name:`layerDefinition.minScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],E.prototype,`minScale`,void 0),e([o({type:Number,json:{name:`layerDefinition.maxScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],E.prototype,`maxScale`,void 0),e([o(_)],E.prototype,`url`,void 0),e([o({type:c})],E.prototype,`fullExtent`,void 0),e([o({type:l})],E.prototype,`spatialReference`,void 0),e([o({readOnly:!0})],E.prototype,`supportedSpatialReferences`,null),e([o({type:[c]})],E.prototype,`fullExtents`,null),e([o({type:[`show`,`hide`]})],E.prototype,`listMode`,void 0),e([o(v)],E.prototype,`elevationInfo`,null),E=e([s(`esri.layers.GaussianSplatLayer`)],E);const D=E;export{D as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import has from"../core/has.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{on as s,sync as c,watch as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{persistable as f}from"../core/accessorSupport/decorators/persistable.js";import p from"../geometry/Extent.js";import m from"../geometry/SpatialReference.js";import h from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as _}from"./mixins/ArcGISService.js";import{CustomParametersMixin as v}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as b}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as S,url as C}from"./support/commonProperties.js";import w from"./support/SceneModifications.js";import{default3DTilesSpatialReference as T,default3DTilesFullExtent as E,initFullExtent as D,hasEsriCrs as O}from"./support/tiles3DUtils.js";import k from"../portal/Portal.js";import{getElevationOffsetInMeters as A,logInvalidElevationInfoWarning as j,elevationModeRequiredMessage as M,featureExpressionUnsupportedMessage as N}from"../support/elevationInfoUtils.js";import{isGround as P}from"../support/groundInstanceUtils.js";import{f as F}from"../chunks/persistableUrlUtils.js";import{isBasemap as I}from"../support/userTypeGuards/isBasemap.js";import{initialize as L,switchMeshModificationPolygonVCSSync as R}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as z,fromWasmModification as B}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as V}from"../core/accessorSupport/decorators/reader.js";let H=class extends _(y(b(x(a(v(g(n(h)))))))){readModifications(e,t,n){this._modificationsSource={url:F(e,n),context:n}}initialize(){this.addHandles([s(()=>this.modifications,`after-changes`,()=>{this.modifications=this.modifications,this._modificationsGeneration++},c),l(()=>this.modifications,()=>this._modificationsGeneration++)])}constructor(e){super(e),this.operationalLayerType=`IntegratedMesh3DTilesLayer`,this.modifications=null,this._modificationsSource=null,this.spatialReference=T,this.fullExtent=E,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type=`integrated-mesh-3dtiles`,this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._modificationsGeneration=0,this._simulateGoogleUrl=!1}get supportedSpatialReferences(){return!this.initialized||!this.esriCrsSpatialReference?[m.WGS84]:[m.WGS84,this.esriCrsSpatialReference]}get fullExtents(){return!this.initialized||!this.esriCrsFullExtent?[
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as n}from"../core/Clonable.js";import r from"../core/Error.js";import has from"../core/has.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{on as s,sync as c,watch as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{persistable as f}from"../core/accessorSupport/decorators/persistable.js";import p from"../geometry/Extent.js";import m from"../geometry/SpatialReference.js";import h from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as _}from"./mixins/ArcGISService.js";import{CustomParametersMixin as v}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as b}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as S,url as C}from"./support/commonProperties.js";import w from"./support/SceneModifications.js";import{default3DTilesSpatialReference as T,default3DTilesFullExtent as E,initFullExtent as D,hasEsriCrs as O}from"./support/tiles3DUtils.js";import k from"../portal/Portal.js";import{getElevationOffsetInMeters as A,logInvalidElevationInfoWarning as j,elevationModeRequiredMessage as M,featureExpressionUnsupportedMessage as N}from"../support/elevationInfoUtils.js";import{isGround as P}from"../support/groundInstanceUtils.js";import{f as F}from"../chunks/persistableUrlUtils.js";import{isBasemap as I}from"../support/userTypeGuards/isBasemap.js";import{initialize as L,switchMeshModificationPolygonVCSSync as R}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as z,fromWasmModification as B}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as V}from"../core/accessorSupport/decorators/reader.js";let H=class extends _(y(b(x(a(v(g(n(h)))))))){readModifications(e,t,n){this._modificationsSource={url:F(e,n),context:n}}initialize(){this.addHandles([s(()=>this.modifications,`after-changes`,()=>{this.modifications=this.modifications,this._modificationsGeneration++},c),l(()=>this.modifications,()=>this._modificationsGeneration++)])}constructor(e){super(e),this.operationalLayerType=`IntegratedMesh3DTilesLayer`,this.modifications=null,this._modificationsSource=null,this.spatialReference=T,this.fullExtent=E,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type=`integrated-mesh-3dtiles`,this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._modificationsGeneration=0,this._simulateGoogleUrl=!1}get supportedSpatialReferences(){return!this.initialized||!this.esriCrsSpatialReference?[m.WGS84]:[m.WGS84,this.esriCrsSpatialReference]}get fullExtents(){let e=this.fullExtent??E;return!this.initialized||!this.esriCrsFullExtent?[e]:[e,this.esriCrsFullExtent]}set elevationInfo(e){(e==null||e.mode===`absolute-height`)&&this._set(`elevationInfo`,e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){let t=[e];for(;t?.length>0;){let e=t.pop();if(!e)return;for(let[n,r]of Object.entries(e)){if(n===`uri`)try{let e=new URL(`https://tmp`+r).searchParams.get(`session`);if(e)return e}catch{}typeof r==`object`&&r&&t.push(r)}}return null}async requestRootAndSession(e){let n=(e,t)=>new r(`3dtiles-init:`+e,t);return this._rootRequestPromise||=new Promise((r,a)=>{this.url||a(n(`url-missing`,`Layer url missing`)),this._key=this.customParameters?this.customParameters.key:null,new Promise((e,r)=>{if(this.replacesTerrain&&!this._key){let i=this.portalItem?.portal||this.parent?.portalItem?.portal||k.getDefault();i.signIn().then(()=>{i.g3dTilesEnabled?t(i.restUrl+`/portals/self/modules/g3dtiles`,{responseType:`json`,query:{f:`json`}}).then(t=>{this._key=t.data.keyString,e()},()=>r(n(`g3dtiles-key-error`,`Error fetching Google 3D Tiles key from portal`))):r(n(`g3dTilesEnabled-false`,`Google 3D Tiles are not enabled on Portal `+i.url))},()=>r(n(`sign-in-failed`,`Error signing in to Portal`)))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:`array-buffer`,signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse(new TextDecoder().decode(e.data))}catch(e){a(n(`root-parse-failed`,`Error parsing root tile, details: `+e));return}this._rootTilesetJSON?(this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=D(this._rootTilesetJSON),O(this._rootTilesetJSON)&&(this.esriCrsFullExtent=D(this._rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference),r(),this._rootRequestPromise=null):a(n(`root-is-null`,`Root tile is null.`))},e=>{o(e),a(n(`root-load-failed`,`Error loading root tile`)),this._rootRequestPromise=null,i.getLogger(`IntegratedMesh3DTilesLayer`).error(`Layer loading failed`,e)})},e=>a(e))}),this._rootRequestPromise}_haveWGS84ZModifications(e){for(let t of e)if(!t.geometry?.spatialReference||t.geometry?.spatialReference.vcsWkid===115700&&t.geometry?.spatialReference.wkid===4326)return!0;return!1}async _doLoad(e){let t=e==null?null:e.signal;try{await this.loadFromPortal({supportedTypes:[`3DTiles Service`],validateItem:e=>{if(e.typeKeywords?.includes(`IntegratedMesh`))return!0;throw new r(`portal:invalid-layer-item-type`,"Invalid layer item, expected '${expectedType}' ",{expectedType:`3DTiles Service containing IntegratedMesh`})}},e)}catch(e){o(e)}if(this._modificationsSource!=null){let t=await w.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await L();try{let e=z(null,t.toArray(),m.WGS84),n=R({modifications:e,inVCS:115700});n.success&&n.modifications&&B(n.modifications,t)}catch(e){i.getLogger(this).error(`convert-mesh-modification-z-error`,`Error when converting:`,e)}}this.setAtOrigin(`modifications`,t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(this._modificationsSource==null){let{modifications:e}=this;e&&e.length>0&&await L()}else await this.load().then(()=>{},()=>{})}get memoizedElevationQueryDependencies(){return[this.loadStatus,this.queryElevationCallback!=null,A(this.elevationInfo),this._modificationsGeneration]}get hasAttributionData(){return!1}_validateElevationInfo(e){let t=`Integrated mesh 3d tiles layers`;j(i.getLogger(this),M(t,`absolute-height`,e)),j(i.getLogger(this),N(t,e))}get replacesTerrain(){return this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return has(`enable-feature:im-as-ground`)?I(this.parent)||P(this.parent):I(this.parent)}get hasGoogleUrl(){return this._simulateGoogleUrl||!!(this.url?.match(/.+\.googleapis.com/)??!1)}get test(){}};e([u({type:[`IntegratedMesh3DTilesLayer`]})],H.prototype,`operationalLayerType`,void 0),e([u({type:w,clonable:e=>e?.clone()??null}),f({origins:[`web-scene`,`portal-item`],type:`resource`,prefix:`modifications`})],H.prototype,`modifications`,void 0),e([u({clonable:e=>e?{...e}:null})],H.prototype,`_modificationsSource`,void 0),e([V([`web-scene`,`portal-item`],`modifications`)],H.prototype,`readModifications`,null),e([u({type:m})],H.prototype,`spatialReference`,void 0),e([u({type:p})],H.prototype,`fullExtent`,void 0),e([u({readOnly:!0})],H.prototype,`supportedSpatialReferences`,null),e([u({type:[p]})],H.prototype,`fullExtents`,null),e([u(S)],H.prototype,`elevationInfo`,null),e([u({type:[`show`,`hide`]})],H.prototype,`listMode`,void 0),e([u(C)],H.prototype,`url`,void 0),e([u({readOnly:!0})],H.prototype,`type`,void 0),e([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],H.prototype,`path`,void 0),e([u({type:Number,json:{name:`layerDefinition.minScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],H.prototype,`minScale`,void 0),e([u({type:Number,json:{name:`layerDefinition.maxScale`,write:!0,origins:{service:{read:!1,write:!1}}}})],H.prototype,`maxScale`,void 0),e([u()],H.prototype,`queryElevationCallback`,void 0),e([u()],H.prototype,`_modificationsGeneration`,void 0),e([u()],H.prototype,`memoizedElevationQueryDependencies`,null),e([u({readOnly:!0})],H.prototype,`hasAttributionData`,null),e([u()],H.prototype,`replacesTerrain`,null),e([u()],H.prototype,`isUsedAsGroundLayer`,null),e([u()],H.prototype,`hasGoogleUrl`,null),e([u()],H.prototype,`_simulateGoogleUrl`,void 0),H=e([d(`esri.layers.IntegratedMesh3DTilesLayer`)],H);const U=H;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import n from"../core/Accessor.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as o,isAborted as s,isAbortError as c}from"../core/promiseUtils.js";import l from"../core/ReactiveMap.js";import{watch as u}from"../core/reactiveUtils.js";import{signal as d}from"../core/signal.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import m from"../geometry/SpatialReference.js";import{isGeographic as h}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,elevQueriesFull as v,elevQueriesGenericFail as y,invalidLayerView as b}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as x}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as S}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as C}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as w}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as T}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{Yield as D}from"../views/support/Yield.js";const O=3857,k=4326,A=5773;let j=class extends n{get _frozen(){return this._frozenLayerViewCount>0}constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._frozenLayerViewCount=0,this._elevationQueries=new l,this._pendingJobCompleted=[],this._pendingJobFailed=[],this._pendingRenderableCreated=[],this._pulseDeferred=d(!1),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded=`method requiring WASM was called when WASM isn't loaded`,this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,n,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){let e=r?`[js] ${n}`:`${n}`;t===0||t===1?i.getLogger(this).error(e):t===2&&i.getLogger(this).warn(e),i.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(i.getLogger(this).level=`info`),this._debugLog(0,3,`Lyr3DWasmPerSceneView.initialize()`),this.addHandles([u(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),u(()=>this.view.state?.contentCamera.relativeElevation,()=>this._updateWasmCameraElevation()),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(E.LYR3D,this)}destroy(){this._debugLog(0,3,`Lyr3DWasmPerSceneView.destroy()`),this._lyr3DMain&&=(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(o())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;let e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),D}_hasPendingPulseWork(){return this._lyr3DMain?!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)):!1}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,`Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized`),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._is3DTilesIMLayerView(e)&&e.freeze&&this.decrementFrozenLayerViewCount(e),this._doRemoveLayerView(e);let t=this._layers.size;return t===0&&(this._debugLog(0,3,`Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying`),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_enabled(e.wasmLayerId,t),n.needMemoryUsageUpdate=!0;let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);n&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),n.needFrame=!0,n.layerView.updatingFlagChanged())}getAttributionText(){return this._lyr3DMain?this._lyr3DMain.get_current_attribution_text().split(`|`):(this._debugLog(0,1,this._wasmNotLoaded),[])}onRenderableEvicted(e,t,n){this._lyr3DMain?this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,n):this._debugLog(0,1,this._wasmNotLoaded)}setMeshModifications(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;let t=this._layers.get(e);return t?this._isUpdating(t):!1}incrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount+=1)}decrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&--this._frozenLayerViewCount}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,`Lyr3DWasmPerSceneView.initializeWasm()`),this._lyr3DMainPromise||=C().then(n=>{this._lyr3DMain=n,this._lyr3DMainPromise=null;let r=this._lyr3DMain.addFunction(this._onNewJob.bind(this),`vi`),i=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),`vi`),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),`vi`),o=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),`vi`),s=this._lyr3DMain.addFunction(this._onWasmError.bind(this),`viiii`),c=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),`vi`);if(!this.view.renderSpatialReference){this._lyr3DMain=null;return}this._viewSR=this.view.renderSpatialReference?.toJSON();let l=this.view.viewingMode===`global`?6:4;l===6?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A,this._viewSR.wkt=``):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=S(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=O,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):this.view.renderSpatialReference?.wkid===32662?(this._viewSR.wkid=this._viewSR.latestWkid=k,l=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):!this._viewSR.vcsWkid&&!this._viewSR.latestVcsWkid&&(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));let u=has(`esri-lyr3D-max-concurrent-requests`)??16;if(!this._lyr3DMain.initialize_lyr3d_wasm(s,r,i,a,o,c,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),u))this._lyr3DMain=null,this._debugLog(0,0,`Lyr3d Main WASM failed to initialize`,!1);else if(this._workerHandle=new x(T(this.view.resourceController)),this._workerHandle.promise)return this._workerHandle.promise}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)}),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);let n=this._layers.get(e.wasmLayerId);n&&(n.needFrame=!0,n.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{e.layerView.type===`gaussian-splat-3d`&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,n){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(t.coordinates.length===0)return Promise.reject(`no coordinates for elevation query`);let r=this.view.viewingMode===`global`?m.WGS84:this._viewSR.wkid===O?m.WebMercator:m.PlateCarree,i=t.projectSync(r);i&&(t=i);let a=t.coordinates.length*2,o=this._lyr3DMain._malloc(a*8),s=new Float64Array(this._lyr3DMain.HEAPF64.buffer,o,a);for(let e=0;e<t.coordinates.length;++e){let n=t.coordinates[e];s[e*2]=n.x,s[e*2+1]=n.y}let c=n?.maxGeometricError??0,l=this._lyr3DMain.create_elevation_query(e.wasmLayerId,c,o,a);if(this._lyr3DMain._free(o),l===v)return Promise.reject(`max mesh elevation query limit exceeded`);if(l===y)return Promise.reject(`elevation query failed`);let u={wasmLayerId:e.wasmLayerId,descriptor:t,signal:n?.signal,resolveCallback:null,rejectCallback:null},d=new Promise((e,t)=>{u.resolveCallback=e,u.rejectCallback=t});return this._elevationQueries.set(l,u),d}_checkForAbortedElevationQueries(){let e=[];this._elevationQueries.forEach((t,n)=>{s(t.signal)&&(this._lyr3DMain.cancel_elevation_query(n),t.rejectCallback(o()),e.push(n))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){let t=[];this._elevationQueries.forEach((n,r)=>{n.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(r),n.rejectCallback(o()),t.push(r))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){let t=this._lyr3DMain;if(t){if(this._frozen){this._checkForAbortedElevationQueries(),this._flushPendingWasmCalls(e);return}if(this._cameraDirty){let e=this.view.state?.contentCamera;if(e){let{eye:n,center:r,up:i,near:a,far:o,fovY:s}=e,c=[e.screenViewport[2],e.screenViewport[3]],l={eye:n,center:r,up:i,near:a,far:o,fov:s,aspectRatio:e.width/e.height,viewport:c};t.set_camera_parameters(l),this._cameraDirty=!1}}if(this._cameraElevationDirty){let e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}if(this._checkForAbortedElevationQueries(),!this._pulseDeferred.value&&(this._flushPendingWasmCalls(e),e.done))return;let n=0,r=0;this._layers.forEach(e=>{n+=e.layerView.usedMemory,r+=e.layerView.cachedMemory}),n/=1048576,r/=1048576;let i=this.view.resourceController.memoryController,a=i.usedMemory*i.maxMemory-n-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,n,r,a,i.maxMemory),this._pulseDeferred.value=!1,this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange(`isTerrainReady`)),e.madeProgress(),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||!this._frozen&&(e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._pulseDeferred.value||this._lyr3DBusyCount>0)}_incrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);e.outstandingJobCount+=1,n||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);--e.outstandingJobCount,n!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){let t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){let t=this._isUpdating(e);--e.outstandingRenderableCount,t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){let n=e.shift();this._pulseDeferred.value=!0,n(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,n){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_onJobSucceeded(e,t,n){if(e.layerView.destroyed){this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n);return}let{data:r}=t;this._lyr3DMain?this._pendingJobCompleted.push(i=>{try{let e=r.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(i.HEAPU8.buffer,a,e).set(r),i.on_job_completed(n.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,n,r,i){let a=[];for(let o of e){let e=new URL(o);if(i.type===`integrated-mesh-3dtiles`){if(e.origin===r.origin&&e.pathname===r.pathname){if(i.rootTileset){a.push(Promise.resolve(i.rootTileset.slice()));continue}}else i.session&&e.searchParams.set(`session`,i.session)}a.push(t(e.toString(),n).then(e=>e.data))}return a}_getInitialPromise(e,t,n,r,i,a,o){let s=this._getRequestPromises(e.urls,t,n,r);return Promise.all(s).then(e=>(i.inputs=e,this._workerHandle.invoke(i,a))).then(e=>e).catch(t=>{let n=1;return c(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&t.details?.httpStatus===400?(n=3,this._debugLog(1,2,`Session expired, trying to create new Session.`)):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:n,error:``,jobDescJson:``,data:new Uint8Array,missingInputUrls:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);let n=this._layers.get(t.layerId);if(!n)return;this._incrementJobCount(n,t);let r=n.abortController.signal,i=n.layerView.layer,a=i.type===`integrated-mesh-3dtiles`?i.key:null,o=i.type===`integrated-mesh-3dtiles`?i.session:null,s={responseType:`array-buffer`,signal:r,query:{...n.customParameters,token:n.apiKey,key:a}},l={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},u=new URL(i.url),d=e=>{if(e.status===1)this._onJobFailed(n,e,t);else if(e.status===0)this._onJobSucceeded(n,e,t);else if(e.status===2){let a=this._getRequestPromises(e.missingInputUrls,s,u,i);Promise.all(a).then(t=>{l.jobDescJson=e.jobDescJson,e.originalInputs?l.inputs=e.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(let e of t)l.inputs.push(e);return this._workerHandle.invoke(l,r)}).then(e=>{e.status===1?this._onJobFailed(n,e,t):e.status===0&&this._onJobSucceeded(n,e,t)}).catch(e=>{c(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)})}};try{let e=await this._getInitialPromise(t,s,u,i,l,r,o);e.status===3&&i.type===`integrated-mesh-3dtiles`?(o===i.session&&i.session!==null&&await i.requestRootAndSession(r),d(await this._getInitialPromise(t,s,u,i,l,r,i.session))):d(e)}catch(e){e&&this._debugLog(1,1,e.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onNewRenderable(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);n&&(this._incrementRenderableCount(n),n.layerView.createRenderable(t).then(e=>{this._lyr3DMain&&!n.layerView.destroyed?this._pendingRenderableCreated.push(r=>{try{let{layerId:n,handle:i}=t,a=e();r.on_renderable_created(!0,n,i,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(n)}}):this._decrementRenderableCountIfLayerExists(n)}).catch(e=>{c(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),this._lyr3DMain&&!n.layerView.destroyed?this._pendingRenderableCreated.push(e=>{try{let{layerId:n,handle:r}=t;e.on_renderable_created(!1,n,r,0,0)}finally{this._decrementRenderableCountIfLayerExists(n)}}):this._decrementRenderableCountIfLayerExists(n)}))}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_freeRenderables(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||!n)return;let r=n.layerView;for(let e=0;e<t.handles.length;++e)r.freeRenderable(t.handles[e])}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_setRenderableVisibility(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!n)return;let r=n.layerView,i=[],a=[];for(let e=0;e<t.handles.length;++e)i.push(t.handles[e]),a.push(!!(t.visibility[e]&1));r.setRenderableVisibility(i,a,t.handles.length)}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onWasmError(e,t,n,r){if(this._lyr3DMain)try{this._debugLog(n,r,this._lyr3DMain.UTF8ToString(e,t),!1)}catch{}}_onElevQueryComplete(e){try{let t=this._lyr3DMain.Emval.toValue(e),{queryId:n}=t,i=this._elevationQueries.get(n);if(!i){this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${n}.`);return}if(!t.succeeded||!t.zs)i.rejectCallback(new r(`elevation-query:error`,t?.error??`Elevation query failed`)),this._elevationQueries.delete(n);else{let{zs:e}=t,r=i.descriptor.clone();for(let t=0;t<e.length;++t)r.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${n}, number points ${e.length}.`),i.resolveCallback(r),this._elevationQueries.delete(n)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_doRemoveLayerView(e){let t=this._layers.get(e.wasmLayerId);return t?(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)),this._layers.delete(e.wasmLayerId),!0):!1}_is3DTilesIMLayerView(e){return e.layer.type===`integrated-mesh-3dtiles`}_is3DTilesIMLayer(e){return e.type===`integrated-mesh-3dtiles`}_isGaussianSplatLayerView(e){return e.layer.type===`gaussian-splat`}_isGaussianSplatLayer(e){return e.type===`gaussian-splat`}_toWasmQuality(e){switch(e){case`low`:return 1;case`medium`:return 2;case`high`:return 3}}_addLayerView(e){let t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:b};let n=t.type===`integrated-mesh-3dtiles`?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),n);if(r.errorCode!==0)return{wasmLayerId:b,check:r};let a=this._lyr3DMain.get_next_layer_id(),o=new AbortController;this._layers.set(a,{layerView:e,abortController:o,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});let s=w(t.elevationInfo),c=this._toWasmQuality(this.view?.qualityProfile),l=e=>i.getLogger(this).error(`add-spatial-reference-error`,`Error when adding SR:`,e),u=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let n=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){n=t.esriCrsSpatialReference;let r=h(n),i=1,a=1;!r&&n.wkid&&n.wkid!==-1&&(i=g.values[g[n.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(n)),r,i,a).catch(l),!this._haveAddedViewSRForNoOpPrj&&n.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==-1&&this._viewSR.vcsWkid!==n.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(l),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?u=this._lyr3DMain.add_gaussian_splat_layer(c,t.url,a,s):this._is3DTilesIMLayerView(e)&&(u=this._lyr3DMain.add_3dtiles_layer(c,t.url,a,s,e.replacesTerrain),u&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)))}return u?(this._updateWasmCamera(),this._is3DTilesIMLayerView(e)&&e.freeze&&this.incrementFrozenLayerViewCount(e),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:b})}_updateWasmCamera(){this.view.state?.contentCamera&&this._lyr3DMain&&(this._cameraDirty=!0,this._frozen||this._markAllLayerViewsUpdating())}_updateWasmCameraElevation(){this._cameraElevationDirty=!0,this._frozen||this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{let t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??``}}_cleanUpSR(e){return e?.wkid===-1&&e.latestWkid&&e.latestWkid!==-1?e.wkid=e.latestWkid:e?.latestWkid===-1&&e.wkid&&e.wkid!==-1&&(e.latestWkid=e.wkid),e?.vcsWkid===-1&&e.latestVcsWkid&&e.latestVcsWkid!==-1?e.vcsWkid=e.latestVcsWkid:e?.latestVcsWkid===-1&&e.vcsWkid&&e.vcsWkid!==-1&&(e.latestVcsWkid=e.vcsWkid),e}};e([f({constructOnly:!0})],j.prototype,`view`,void 0),e([f()],j.prototype,`updating`,null),e([f({readOnly:!0})],j.prototype,`isTerrainReady`,null),j=e([p(`esri.layers.Lyr3DWasmPerSceneView`)],j);const M=j;export{M as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import n from"../core/Accessor.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as o,isAborted as s,isAbortError as c}from"../core/promiseUtils.js";import l from"../core/ReactiveMap.js";import{watch as u}from"../core/reactiveUtils.js";import{signal as d}from"../core/signal.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import m from"../geometry/SpatialReference.js";import{isGeographic as h}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as _,elevQueriesFull as v,elevQueriesGenericFail as y,invalidLayerView as b}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as x}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as S}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as C}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as w}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as T}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as E}from"../views/support/Scheduler.js";import{Yield as D}from"../views/support/Yield.js";const O=3857,k=4326,A=5773;let j=class extends n{get _frozen(){return this._frozenLayerViewCount>0}constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._frozenLayerViewCount=0,this._elevationQueries=new l,this._pendingJobCompleted=[],this._pendingJobFailed=[],this._pendingRenderableCreated=[],this._pulseDeferred=d(!1),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=0,this._wasmNotLoaded=`method requiring WASM was called when WASM isn't loaded`,this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,n,r=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){let e=r?`[js] ${n}`:`${n}`;t===0||t===1?i.getLogger(this).error(e):t===2&&i.getLogger(this).warn(e),i.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(i.getLogger(this).level=`info`),this._debugLog(0,3,`Lyr3DWasmPerSceneView.initialize()`),this.addHandles([u(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),u(()=>this.view.state?.contentCamera.relativeElevation,()=>this._updateWasmCameraElevation()),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(E.LYR3D,this)}destroy(){this._debugLog(0,3,`Lyr3DWasmPerSceneView.destroy()`),this._lyr3DMain&&=(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(o())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;let e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),D}_hasPendingPulseWork(){return this._lyr3DMain?!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)):!1}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,`Lyr3DWasmPerSceneView.addLayerView() called when WASM wasn't initialized`),{wasmLayerId:_})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._is3DTilesIMLayerView(e)&&e.freeze&&this.decrementFrozenLayerViewCount(e),this._doRemoveLayerView(e);let t=this._layers.size;return t===0&&(this._debugLog(0,3,`Lyr3DWasmPerSceneView.removeLayerView() no Lyr3D layers left after removing a layer, destroying`),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_enabled(e.wasmLayerId,t),n.needMemoryUsageUpdate=!0;let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);n&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),n.needFrame=!0,n.layerView.updatingFlagChanged())}getAttributionText(){return this._lyr3DMain?this._lyr3DMain.get_current_attribution_text().split(`|`):(this._debugLog(0,1,this._wasmNotLoaded),[])}onRenderableEvicted(e,t,n){this._lyr3DMain?this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,n):this._debugLog(0,1,this._wasmNotLoaded)}setMeshModifications(e,t){if(!this._lyr3DMain){this._debugLog(0,1,this._wasmNotLoaded);return}let n=this._layers.get(e.wasmLayerId);if(n){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);let r=this._isUpdating(n);n.needFrame=!0,r||n.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;let t=this._layers.get(e);return t?this._isUpdating(t):!1}incrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount+=1)}decrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&--this._frozenLayerViewCount}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,`Lyr3DWasmPerSceneView.initializeWasm()`),this._lyr3DMainPromise||=C().then(n=>{this._lyr3DMain=n,this._lyr3DMainPromise=null;let r=this._lyr3DMain.addFunction(this._onNewJob.bind(this),`vi`),i=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),`vi`),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),`vi`),o=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),`vi`),s=this._lyr3DMain.addFunction(this._onWasmError.bind(this),`viiii`),c=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),`vi`);if(!this.view.renderSpatialReference){this._lyr3DMain=null;return}this._viewSR=this.view.renderSpatialReference?.toJSON();let l=this.view.viewingMode===`global`?6:4;l===6?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A,this._viewSR.wkt=``):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=S(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=O,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):this.view.renderSpatialReference?.wkid===32662?(this._viewSR.wkid=this._viewSR.latestWkid=k,l=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=A):!this._viewSR.vcsWkid&&!this._viewSR.latestVcsWkid&&(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));let u=has(`esri-lyr3D-max-concurrent-requests`)??16;if(!this._lyr3DMain.initialize_lyr3d_wasm(s,r,i,a,o,c,e,t,l,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),u))this._lyr3DMain=null,this._debugLog(0,0,`Lyr3d Main WASM failed to initialize`,!1);else if(this._workerHandle=new x(T(this.view.resourceController)),this._workerHandle.promise)return this._workerHandle.promise}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)}),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);let n=this._layers.get(e.wasmLayerId);n&&(n.needFrame=!0,n.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{e.layerView.type===`gaussian-splat-3d`&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,n){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(t.coordinates.length===0)return Promise.reject(`no coordinates for elevation query`);let r=this.view.viewingMode===`global`?m.WGS84:this._viewSR.wkid===O?m.WebMercator:m.PlateCarree,i=t.projectSync(r);i&&(t=i);let a=t.coordinates.length*2,o=this._lyr3DMain._malloc(a*8),s=new Float64Array(this._lyr3DMain.HEAPF64.buffer,o,a);for(let e=0;e<t.coordinates.length;++e){let n=t.coordinates[e];s[e*2]=n.x,s[e*2+1]=n.y}let c=n?.maxGeometricError??0,l=this._lyr3DMain.create_elevation_query(e.wasmLayerId,c,o,a);if(this._lyr3DMain._free(o),l===v)return Promise.reject(`max mesh elevation query limit exceeded`);if(l===y)return Promise.reject(`elevation query failed`);let u={wasmLayerId:e.wasmLayerId,descriptor:t,signal:n?.signal,resolveCallback:null,rejectCallback:null},d=new Promise((e,t)=>{u.resolveCallback=e,u.rejectCallback=t});return this._elevationQueries.set(l,u),d}_checkForAbortedElevationQueries(){let e=[];this._elevationQueries.forEach((t,n)=>{s(t.signal)&&(this._lyr3DMain.cancel_elevation_query(n),t.rejectCallback(o()),e.push(n))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){let t=[];this._elevationQueries.forEach((n,r)=>{n.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(r),n.rejectCallback(o()),t.push(r))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){let t=this._lyr3DMain;if(t){if(this._frozen){this._checkForAbortedElevationQueries(),this._flushPendingWasmCalls(e);return}if(this._cameraDirty){let e=this.view.state?.contentCamera;if(e){let{eye:n,center:r,up:i,near:a,far:o,fovY:s}=e,c=[e.screenViewport[2],e.screenViewport[3]],l={eye:n,center:r,up:i,near:a,far:o,fov:s,aspectRatio:e.width/e.height,viewport:c};t.set_camera_parameters(l),this._cameraDirty=!1}}if(this._cameraElevationDirty){let e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}if(this._checkForAbortedElevationQueries(),!this._pulseDeferred.value&&(this._flushPendingWasmCalls(e),e.done))return;let n=0,r=0;this._layers.forEach(e=>{n+=e.layerView.usedMemory,r+=e.layerView.cachedMemory}),n/=1048576,r/=1048576;let i=this.view.resourceController.memoryController,a=i.usedMemory*i.maxMemory-n-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(i.memoryFactor,n,r,a,i.maxMemory),this._pulseDeferred.value=!1,this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange(`isTerrainReady`)),e.madeProgress(),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||!this._frozen&&(e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._pulseDeferred.value||this._lyr3DBusyCount>0)}_incrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);e.outstandingJobCount+=1,n||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;let n=this._isUpdating(e);--e.outstandingJobCount,n!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){let t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){let t=this._isUpdating(e);--e.outstandingRenderableCount,t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){let n=e.shift();this._pulseDeferred.value=!0,n(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,n){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_onJobSucceeded(e,t,n){if(e.layerView.destroyed){this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(n.jobId,n.desc)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n);return}let{data:r}=t;this._lyr3DMain?this._pendingJobCompleted.push(i=>{try{let e=r.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(i.HEAPU8.buffer,a,e).set(r),i.on_job_completed(n.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,n)}}):this._decrementJobCountIfLayerExists(e,n)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,n,r,i){let a=[];for(let o of e){let e=new URL(o.url);if(i.type===`integrated-mesh-3dtiles`){if(e.origin===r.origin&&e.pathname===r.pathname){if(i.rootTileset){a.push(Promise.resolve(i.rootTileset.slice()));continue}}else i.session&&e.searchParams.set(`session`,i.session)}a.push(t(e.toString(),n).then(e=>e.data))}return a}_getInitialPromise(e,t,n,r,i,a,o){let s=this._getRequestPromises(e.inputs,t,n,r);return Promise.all(s).then(e=>(i.inputs=e,this._workerHandle.invoke(i,a))).then(e=>e).catch(t=>{let n=1;return c(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):o&&t.details?.httpStatus===400?(n=3,this._debugLog(1,2,`Session expired, trying to create new Session.`)):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:n,error:``,jobDescJson:``,data:new Uint8Array,missingInputs:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);let n=this._layers.get(t.layerId);if(!n)return;this._incrementJobCount(n,t);let r=n.abortController.signal,i=n.layerView.layer,a=i.type===`integrated-mesh-3dtiles`?i.key:null,o=i.type===`integrated-mesh-3dtiles`?i.session:null,s={responseType:`array-buffer`,signal:r,query:{...n.customParameters,token:n.apiKey,key:a}},l={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},u=new URL(i.url),d=e=>{if(e.status===1)this._onJobFailed(n,e,t);else if(e.status===0)this._onJobSucceeded(n,e,t);else if(e.status===2){let a=this._getRequestPromises(e.missingInputs,s,u,i);Promise.all(a).then(t=>{l.jobDescJson=e.jobDescJson,e.originalInputs?l.inputs=e.originalInputs:l.inputs=[],l.isMissingResourceCase=!0;for(let e of t)l.inputs.push(e);return this._workerHandle.invoke(l,r)}).then(e=>{e.status===1?this._onJobFailed(n,e,t):e.status===0&&this._onJobSucceeded(n,e,t)}).catch(e=>{c(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)})}};try{let e=await this._getInitialPromise(t,s,u,i,l,r,o);e.status===3&&i.type===`integrated-mesh-3dtiles`?(o===i.session&&i.session!==null&&await i.requestRootAndSession(r),d(await this._getInitialPromise(t,s,u,i,l,r,i.session))):d(e)}catch(e){e&&this._debugLog(1,1,e.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(n,t)}}):this._decrementJobCountIfLayerExists(n,t)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onNewRenderable(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);n&&(this._incrementRenderableCount(n),n.layerView.createRenderable(t).then(e=>{this._lyr3DMain&&!n.layerView.destroyed?this._pendingRenderableCreated.push(r=>{try{let{layerId:n,handle:i}=t,a=e();r.on_renderable_created(!0,n,i,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(n)}}):this._decrementRenderableCountIfLayerExists(n)}).catch(e=>{c(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),this._lyr3DMain&&!n.layerView.destroyed?this._pendingRenderableCreated.push(e=>{try{let{layerId:n,handle:r}=t;e.on_renderable_created(!1,n,r,0,0)}finally{this._decrementRenderableCountIfLayerExists(n)}}):this._decrementRenderableCountIfLayerExists(n)}))}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_freeRenderables(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||!n)return;let r=n.layerView;for(let e=0;e<t.handles.length;++e)r.freeRenderable(t.handles[e])}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_setRenderableVisibility(e){try{let t=this._lyr3DMain.Emval.toValue(e),n=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!n)return;let r=n.layerView,i=[],a=[];for(let e=0;e<t.handles.length;++e)i.push(t.handles[e]),a.push(!!(t.visibility[e]&1));r.setRenderableVisibility(i,a,t.handles.length)}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_onWasmError(e,t,n,r){if(this._lyr3DMain)try{this._debugLog(n,r,this._lyr3DMain.UTF8ToString(e,t),!1)}catch{}}_onElevQueryComplete(e){try{let t=this._lyr3DMain.Emval.toValue(e),{queryId:n}=t,i=this._elevationQueries.get(n);if(!i){this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${n}.`);return}if(!t.succeeded||!t.zs)i.rejectCallback(new r(`elevation-query:error`,t?.error??`Elevation query failed`)),this._elevationQueries.delete(n);else{let{zs:e}=t,r=i.descriptor.clone();for(let t=0;t<e.length;++t)r.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${n}, number points ${e.length}.`),i.resolveCallback(r),this._elevationQueries.delete(n)}}catch(e){e&&this._debugLog(1,1,e.toString(),!1)}}_doRemoveLayerView(e){let t=this._layers.get(e.wasmLayerId);return t?(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)),this._layers.delete(e.wasmLayerId),!0):!1}_is3DTilesIMLayerView(e){return e.layer.type===`integrated-mesh-3dtiles`}_is3DTilesIMLayer(e){return e.type===`integrated-mesh-3dtiles`}_isGaussianSplatLayerView(e){return e.layer.type===`gaussian-splat`}_isGaussianSplatLayer(e){return e.type===`gaussian-splat`}_toWasmQuality(e){switch(e){case`low`:return 1;case`medium`:return 2;case`high`:return 3}}_addLayerView(e){let t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:b};let n=t.type===`integrated-mesh-3dtiles`?0:2,r=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),n);if(r.errorCode!==0)return{wasmLayerId:b,check:r};let a=this._lyr3DMain.get_next_layer_id(),o=new AbortController;this._layers.set(a,{layerView:e,abortController:o,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});let s=w(t.elevationInfo),c=this._toWasmQuality(this.view?.qualityProfile),l=e=>i.getLogger(this).error(`add-spatial-reference-error`,`Error when adding SR:`,e),u=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let n=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){n=t.esriCrsSpatialReference;let r=h(n),i=1,a=1;!r&&n.wkid&&n.wkid!==-1&&(i=g.values[g[n.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(n)),r,i,a).catch(l),!this._haveAddedViewSRForNoOpPrj&&n.vcsWkid&&this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==-1&&this._viewSR.vcsWkid!==n.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(l),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?u=this._lyr3DMain.add_gaussian_splat_layer(c,t.url,a,s):this._is3DTilesIMLayerView(e)&&(u=this._lyr3DMain.add_3dtiles_layer(c,t.url,a,s,e.replacesTerrain),u&&e.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange(`isTerrainReady`)))}return u?(this._updateWasmCamera(),this._is3DTilesIMLayerView(e)&&e.freeze&&this.incrementFrozenLayerViewCount(e),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:b})}_updateWasmCamera(){this.view.state?.contentCamera&&this._lyr3DMain&&(this._cameraDirty=!0,this._frozen||this._markAllLayerViewsUpdating())}_updateWasmCameraElevation(){this._cameraElevationDirty=!0,this._frozen||this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{let t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??``}}_cleanUpSR(e){return e?.wkid===-1&&e.latestWkid&&e.latestWkid!==-1?e.wkid=e.latestWkid:e?.latestWkid===-1&&e.wkid&&e.wkid!==-1&&(e.latestWkid=e.wkid),e?.vcsWkid===-1&&e.latestVcsWkid&&e.latestVcsWkid!==-1?e.vcsWkid=e.latestVcsWkid:e?.latestVcsWkid===-1&&e.vcsWkid&&e.vcsWkid!==-1&&(e.latestVcsWkid=e.vcsWkid),e}};e([f({constructOnly:!0})],j.prototype,`view`,void 0),e([f()],j.prototype,`updating`,null),e([f({readOnly:!0})],j.prototype,`isTerrainReady`,null),j=e([p(`esri.layers.Lyr3DWasmPerSceneView`)],j);const M=j;export{M as default};
|
|
@@ -34,7 +34,7 @@ export interface VectorTileLayerProperties extends LayerProperties, APIKeyMixinP
|
|
|
34
34
|
* apiKey: "YOUR_API_KEY"
|
|
35
35
|
* });
|
|
36
36
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
37
|
-
* @see [
|
|
37
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
38
38
|
* @example
|
|
39
39
|
* // set the api key to access a protected service
|
|
40
40
|
* const layer = new FeatureLayer({
|
|
@@ -427,7 +427,7 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
|
|
|
427
427
|
* apiKey: "YOUR_API_KEY"
|
|
428
428
|
* });
|
|
429
429
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
430
|
-
* @see [
|
|
430
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
431
431
|
* @example
|
|
432
432
|
* // set the api key to access a protected service
|
|
433
433
|
* const layer = new FeatureLayer({
|
package/layers/VideoLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../request.js";import{deprecatedProperty as r}from"../core/deprecate.js";import i from"../core/Error.js";import a from"../core/Logger.js";import{clamp as o}from"../core/mathUtils.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as c}from"../core/promiseUtils.js";import{watch as l,initial as u,whenOnce as d}from"../core/reactiveUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{Integer as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/Extent.js";import g from"../geometry/Point.js";import _ from"../geometry/Polygon.js";import v from"../geometry/Polyline.js";import y from"../geometry/SpatialReference.js";import ee from"./Layer.js";import{ArcGISService as b}from"./mixins/ArcGISService.js";import{BlendLayer as te,effectProperty as ne}from"./mixins/BlendLayer.js";import{CustomParametersMixin as re}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as S}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{parse as w,cleanTitle as T,titleFromUrlAndName as ie}from"./support/arcgisLayerUrl.js";import{opacity as ae,id as oe}from"./support/commonProperties.js";import{normalizeParsedUrlObject as se,urlProperty as ce}from"./support/multiLayerServiceUtils.js";import le from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as ue}from"./support/serviceCapabilitiesUtils.js";import de from"./support/TelemetryData.js";import E from"./support/TelemetryDisplay.js";import fe from"./support/VideoFrame.js";import D from"./support/VideoTimeExtent.js";import O from"./video/VideoController.js";import{getFrameHorizonPoints as k,getGroundControlPoints as A,getTelemetryData as j,getServiceLayersInfo as M,getStyledTelemetrySymbol as N,getLineOfSight as P,getSensorTrailPoints as F,readVideoTimeExtent as I}from"./video/videoUtils.js";import L from"../symbols/CIMSymbol.js";import R from"../symbols/PictureMarkerSymbol.js";import z from"../symbols/SimpleFillSymbol.js";import B from"../symbols/SimpleLineSymbol.js";import V from"../symbols/SimpleMarkerSymbol.js";import pe from"../symbols/Symbol.js";import{write as me}from"../symbols/support/jsonUtils.js";import{addLayerUnsupportedError as he}from"../webdoc/support/unsupportedErrors.js";import{reader as H}from"../core/accessorSupport/decorators/reader.js";function U(e,t){return{ignoreOrigin:this.originIdOf(t)<3}}const W=new t([255,127,0]),G=new t([0,0,0,.05]),K=new V({angle:0,color:W,size:10,style:`cross`}),q=new z({color:G,outline:new B({color:W,width:2})}),J=new B({color:W,style:`dash`,width:1}),Y=new B({color:W,width:1}),X=new V({angle:0,color:W,outline:{color:[255,255,255],width:1.33},size:10,style:`circle`}),Z=new B({color:W,width:1}),ge={types:{base:pe,key:`type`,typeMap:{"simple-marker":V,"picture-marker":R,cim:L}},json:{name:`drawingInfo.sensorSymbol`,write:{writer:me,overridePolicy:U}}};function Q(e,t){return{type:t,json:{name:e,write:{overridePolicy:U}}}}let $=class extends te(C(b(x(S(s(re(ee))))))){constructor(e){super(e),this._trailPoints=[],this.cameraInfo=null,this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new O,this.copyright=null,this.coverage=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=K.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=q.clone(),this.fullExtent=null,this.fullTimeExtent=null,this.initialExtent=null,this.layerId=null,this.previewsInfo=null,this.operationalLayerType=`ArcGISVideoLayer`,this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbolOrientation={source:`platformHeading`,symbolOffset:0},this.sensorPathSymbol=J.clone(),this.sensorSymbol=X.clone(),this.sensorSightLineSymbol=Y.clone(),this.sensorTrailSymbol=Z.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=y.WGS84,this.start=0,this.telemetryDisplay=new E,this.sublayerTitleMode=`item-title`,this.type=`video`,this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([l(()=>this.metadata,()=>{this.notifyChange(`telemetry`),this.notifyChange(`groundControlPoints`),this.notifyChange(`frameHorizonPoints`)}),l(()=>this.telemetry?.sensorLocation,e=>{this._setSensorPath(e),this._setSensorTrail(e)},u)]),d(()=>this.loaded&&this.state===`can-play`&&this.duration>0).then(()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)})}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:[`Video Service`],supportsData:!0},e).catch(c).then(()=>this._fetchService(t)).then(()=>this._fetchCoverage(t)).then(()=>this._fetchPreviewsInfo(t));return this.addResolvingPromise(n),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return ue(t)}readConnectionInfo(e,t){let n=Object.values(t.connectionUrl);return n?.length&&(this.controller.startMode=t.serviceType===`ondemand`?`auto`:`metadata`,this.controller.playerUrl=n[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return k(this.metadata)}get groundControlPoints(){return A(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return se(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return j(this.metadata)}readTitleFromService(e,t){let{url:n}=this,r=t.name||w(n)?.title;switch(this.sublayerTitleMode){case`item-title`:if(n)return ie(n,r);break;case`item-title-and-service-name`:{let e=this.portalItem?.title;if(e&&e!==r)return e=T(e),r?`${e} - ${T(r)}`:e;break}}return r?T(r):void 0}readTitleFromPortalItem(e){return this.sublayerTitleMode===`item-title`?e:void 0}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return M(t)}get videoTimeExtent(){return r(a.getLogger(this),`videoTimeExtent`,{replacement:`fullTimeExtent`,version:`4.33`,warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this._trailPoints=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;let t=o(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;let t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e,n){if(!e)return;let r=new t(e);(!n||n?.frameCenter)&&(this.frameCenterSymbol=N(this.frameCenterSymbol,r)??K),(!n||n?.frameOutline)&&(this.frameOutlineSymbol=N(this.frameOutlineSymbol,r,G)??q),(!n||n?.lineOfSight)&&(this.sensorSightLineSymbol=N(this.sensorSightLineSymbol,r)??Y),(!n||n?.sensorLocation)&&(this.sensorSymbol=N(this.sensorSymbol,r)??X),(!n||n?.sensorPath)&&(this.sensorPathSymbol=N(this.sensorPathSymbol,r)??J),(!n||n?.sensorTrail)&&(this.sensorTrailSymbol=N(this.sensorTrailSymbol,r)??Z)}write(e,t){return this.layerId==null?(he(t,this,`the ArcGIS server version must be greater than 11.2.`),null):super.write(e,t)}async _fetchCoverage(e){if(!this.capabilities?.operations?.supportsCoverageQuery||typeof this.layerId!=`number`)return;let t=`${this.parsedUrl.path}/coverage`,{data:r}=await n(t,{query:{f:`json`,...this.customParameters},signal:e}),{area:i=null,sensorPoints:a=null,telemetry:o=null}=r,s={area:null,path:null};if(i?.rings?.length&&(s.area=_.fromJSON(i)),a?.points?.length){let e=a.points;s.path=new v({hasM:!0,hasZ:!0,paths:[e]})}if(o?.start){let{frameCenter:e=null,frameOutline:t=null,sensor:n=null}=o?.start||{};if(t&&(this.telemetry.frameOutline=_.fromJSON(t)),n&&(this.telemetry.sensorLocation=g.fromJSON(n)),e&&(this.telemetry.frameCenter=g.fromJSON(e)),n&&e){let{sensorLocation:e,frameCenter:t}=this.telemetry;this.telemetry.lineOfSight=P(e,t)}}this._set(`coverage`,s)}async _fetchPreviewsInfo(e){if(typeof this.layerId!=`number`||!this.capabilities?.operations?.supportsPreviews)return;let t=`${this.parsedUrl.path}/content/preview/preview.json`,{data:r}=await n(t,{query:{f:`json`},signal:e});if(!r?.preview)return;let{frameCount:i=0,frameInterval:a=0,frames:o=[],height:s,nCol:c,nRow:l,preview:u,width:d}=r||{},f={count:i,height:s,interval:a,numCols:c,numRows:l,thumbnailInfo:o,urlFragment:u,width:d};this.read({previewsInfo:f},{origin:`service`})}async _fetchService(e){if(this.sourceJSON){this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl});return}let{data:t,ssl:r}=await n(this.url,{query:{f:`json`,...this.parsedUrl.query,...this.customParameters},signal:e});if(r&&(this.url=this.url.replace(/^http:/i,`https:`)),!t?.currentVersion){t.currentVersion=`11.2`,this.sourceJSON=t,this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl});return}if(this.layerId??=t.layers?.[0]?.id??null,this.layerId==null)throw new i(`arcgis-layers:url-mismatch`,`The url is not a valid arcgis resource`);let{data:a}=await n(this.parsedUrl.path,{query:{f:`json`,...this.customParameters},signal:e});this.sourceJSON={...t,...a},this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;let t=F(e,this._trailPoints);this._trailPoints=[...t];let n=this._trailPoints.map(e=>e.toArray()),r=new v({hasZ:e.hasZ,paths:[n]});this.telemetry.sensorTrail=r.clone()}_setSensorPath(e){if(!e||this.coverage?.path?.type!==`polyline`)return;let t=this.telemetry?.sensorPath??this.coverage.path.clone(),{spatialReference:n,hasZ:r,hasM:i,paths:a}=t;if(!i)return;let o=t.hasZ?3:2,s=this.currentTime*1e3,c=[];for(let e of a){let t=0,n=e.length,r=s>500?s+1500:s;for(;t<n&&e[t][o]<=r;)t++;t<e.length&&c.push(...e.slice(t))}this.telemetry.sensorPath=new v({hasZ:r,hasM:i,paths:[c],spatialReference:n})}};e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`autoplay`,null),e([f({readOnly:!0})],$.prototype,`buffered`,null),e([f({readOnly:!0})],$.prototype,`cameraInfo`,void 0),e([f({readOnly:!0,json:{read:!1}})],$.prototype,`capabilities`,void 0),e([H(`service`,`capabilities`,[`supportsAppend`,`supportsCoverageQuery`,`supportsExportClip`,`supportsExportFrameset`,`supportsMensuration`,`supportsPreviews`,`supportsUpdate`])],$.prototype,`readCapabilitiesFromService`,null),e([f({readOnly:!0})],$.prototype,`codecs`,void 0),e([f({readOnly:!0})],$.prototype,`connectionInfo`,void 0),e([H(`connectionInfo`,[`connectionUrl`])],$.prototype,`readConnectionInfo`,null),e([f()],$.prototype,`controller`,void 0),e([f({type:String})],$.prototype,`copyright`,void 0),e([f({readOnly:!0})],$.prototype,`coverage`,void 0),e([f({readOnly:!0,type:Date})],$.prototype,`created`,void 0),e([f({type:Number})],$.prototype,`currentTime`,null),e([f({json:{write:!1}})],$.prototype,`customParameters`,void 0),e([f({type:String})],$.prototype,`description`,void 0),e([f({type:Number})],$.prototype,`duration`,null),e([f({readOnly:!0})],$.prototype,`elevationSource`,void 0),e([f({type:Boolean})],$.prototype,`ended`,null),e([f({type:fe})],$.prototype,`frame`,void 0),e([f(Q(`drawingInfo.frameCenterSymbol`,V))],$.prototype,`frameCenterSymbol`,void 0),e([f({readOnly:!0,type:m})],$.prototype,`frameCount`,void 0),e([f(ne)],$.prototype,`frameEffect`,void 0),e([f(ae)],$.prototype,`frameOpacity`,void 0),e([f(Q(`drawingInfo.frameOutlineSymbol`,z))],$.prototype,`frameOutlineSymbol`,void 0),e([f({type:h})],$.prototype,`fullExtent`,void 0),e([f({readOnly:!0})],$.prototype,`frameHorizonPoints`,null),e([f({readOnly:!0,json:{read:{reader:I,source:`time`}},type:D})],$.prototype,`fullTimeExtent`,void 0),e([f({readOnly:!0})],$.prototype,`groundControlPoints`,null),e([f(oe)],$.prototype,`id`,void 0),e([f({type:h})],$.prototype,`initialExtent`,void 0),e([f({readOnly:!0})],$.prototype,`isLive`,null),e([f({type:m,json:{read:!1,origins:{service:{read:{source:`id`}}}}})],$.prototype,`layerId`,void 0),e([f({readOnly:!0})],$.prototype,`livestreamStatus`,null),e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`loop`,null),e([f({readOnly:!0})],$.prototype,`metadata`,null),e([f({readOnly:!0})],$.prototype,`mimeType`,null),e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`muted`,null),e([f({readOnly:!0})],$.prototype,`previewsInfo`,void 0),e([f({type:[`ArcGISVideoLayer`]})],$.prototype,`operationalLayerType`,void 0),e([f({readOnly:!0})],$.prototype,`parsedUrl`,null),e([f({type:le})],$.prototype,`playbackInfo`,void 0),e([f({type:Number,json:{write:{ignoreOrigin:!0}}})],$.prototype,`playbackRate`,null),e([f({readOnly:!0,type:String})],$.prototype,`playerUrl`,null),e([f({readOnly:!0})],$.prototype,`playing`,null),e([f({readOnly:!0,json:{read:{source:`poster`}}})],$.prototype,`posterUrl`,void 0),e([f({readOnly:!0})],$.prototype,`qualities`,void 0),e([f()],$.prototype,`sensorSymbolOrientation`,void 0),e([f(Q(`drawingInfo.sensorPathSymbol`,B))],$.prototype,`sensorPathSymbol`,void 0),e([f(ge)],$.prototype,`sensorSymbol`,void 0),e([f(Q(`drawingInfo.sensorSightLineSymbol`,B))],$.prototype,`sensorSightLineSymbol`,void 0),e([f(Q(`drawingInfo.sensorTrailSymbol`,B))],$.prototype,`sensorTrailSymbol`,void 0),e([f({readOnly:!0})],$.prototype,`serviceItemId`,void 0),e([f()],$.prototype,`sourceJSON`,void 0),e([f({readOnly:!0})],$.prototype,`sourceQuality`,void 0),e([f({readOnly:!0,json:{name:`serviceType`}})],$.prototype,`sourceType`,void 0),e([f({type:y})],$.prototype,`spatialReference`,void 0),e([f({json:{write:!0}})],$.prototype,`start`,void 0),e([f({readOnly:!0})],$.prototype,`started`,null),e([f({readOnly:!0,type:String})],$.prototype,`state`,null),e([f({readOnly:!0,type:de})],$.prototype,`telemetry`,null),e([f({type:E,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],$.prototype,`telemetryDisplay`,void 0),e([H(`service`,`title`,[`name`])],$.prototype,`readTitleFromService`,null),e([H(`portal-item`,`title`)],$.prototype,`readTitleFromPortalItem`,null),e([f({type:String})],$.prototype,`sublayerTitleMode`,void 0),e([f({readOnly:!0})],$.prototype,`type`,void 0),e([f(ce())],$.prototype,`url`,void 0),e([f({readOnly:!0,type:Number,json:{read:{source:`currentVersion`}}})],$.prototype,`version`,void 0),e([f({readOnly:!0})],$.prototype,`videoElement`,null),e([f({readOnly:!0})],$.prototype,`videoHeight`,null),e([f({readOnly:!0,json:{read:!1}})],$.prototype,`videoLayersInfo`,void 0),e([H(`service`,`videoLayersInfo`,[`id`,`name`,`poster`,`serviceType`,`type`])],$.prototype,`readLayerInfosFromService`,null),e([f({type:D,readOnly:!0})],$.prototype,`videoTimeExtent`,null),e([f({readOnly:!0})],$.prototype,`videoWidth`,null),e([f()],$.prototype,`volume`,null),e([f({readOnly:!0})],$.prototype,`waiting`,null),$=e([p(`esri.layers.VideoLayer`)],$);const _e=$;export{_e as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../request.js";import{deprecatedProperty as r}from"../core/deprecate.js";import i from"../core/Error.js";import a from"../core/Logger.js";import{clamp as o}from"../core/mathUtils.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as c}from"../core/promiseUtils.js";import{watch as l,initial as u,whenOnce as d}from"../core/reactiveUtils.js";import{property as f,subclass as ee}from"../core/accessorSupport/decorators.js";import{Integer as p}from"../core/accessorSupport/ensureType.js";import m from"../geometry/Extent.js";import h from"../geometry/Point.js";import g from"../geometry/Polygon.js";import _ from"../geometry/Polyline.js";import v from"../geometry/SpatialReference.js";import te from"./Layer.js";import{ArcGISService as ne}from"./mixins/ArcGISService.js";import{BlendLayer as re,effectProperty as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as ie}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as ae}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{parse as S,cleanTitle as C,titleFromUrlAndName as w}from"./support/arcgisLayerUrl.js";import{opacity as T,id as oe}from"./support/commonProperties.js";import{normalizeParsedUrlObject as se,urlProperty as ce}from"./support/multiLayerServiceUtils.js";import le from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as ue}from"./support/serviceCapabilitiesUtils.js";import de from"./support/TelemetryData.js";import E from"./support/TelemetryDisplay.js";import fe from"./support/VideoFrame.js";import D from"./support/VideoTimeExtent.js";import O from"./video/VideoController.js";import{getFrameHorizonPoints as k,getGroundControlPoints as A,getTelemetryData as j,getServiceLayersInfo as M,getStyledTelemetrySymbol as N,getLineOfSight as P,getSensorTrailPoints as F,readVideoTimeExtent as I}from"./video/videoUtils.js";import L from"../symbols/CIMSymbol.js";import R from"../symbols/PictureMarkerSymbol.js";import z from"../symbols/SimpleFillSymbol.js";import B from"../symbols/SimpleLineSymbol.js";import V from"../symbols/SimpleMarkerSymbol.js";import pe from"../symbols/Symbol.js";import{write as me}from"../symbols/support/jsonUtils.js";import{addLayerUnsupportedError as he}from"../webdoc/support/unsupportedErrors.js";import{reader as H}from"../core/accessorSupport/decorators/reader.js";function U(e,t){return{ignoreOrigin:this.originIdOf(t)<3}}const W=new t([255,127,0]),G=new t([0,0,0,.05]),K=new V({angle:0,color:W,size:10,style:`cross`}),q=new z({color:G,outline:new B({color:W,width:2})}),J=new B({color:W,style:`dash`,width:1}),Y=new B({color:W,width:1}),X=new V({angle:0,color:W,outline:{color:[255,255,255],width:1.33},size:10,style:`circle`}),Z=new B({color:W,width:1}),ge={types:{base:pe,key:`type`,typeMap:{"simple-marker":V,"picture-marker":R,cim:L}},json:{name:`drawingInfo.sensorSymbol`,write:{writer:me,overridePolicy:U}}};function Q(e,t){return{type:t,json:{name:e,write:{overridePolicy:U}}}}let $=class extends re(x(ne(b(ae(s(ie(te))))))){constructor(e){super(e),this._trailPoints=[],this.cameraInfo=null,this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new O,this.copyright=null,this.coverage=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=K.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=q.clone(),this.fullExtent=null,this.fullTimeExtent=null,this.initialExtent=null,this.layerId=null,this.previewsInfo=null,this.operationalLayerType=`ArcGISVideoLayer`,this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbolOrientation={source:`platformHeading`,symbolOffset:0},this.sensorPathSymbol=J.clone(),this.sensorSymbol=X.clone(),this.sensorSightLineSymbol=Y.clone(),this.sensorTrailSymbol=Z.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=v.WGS84,this.start=0,this.telemetryDisplay=new E,this.sublayerTitleMode=`item-title`,this.type=`video`,this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([l(()=>this.metadata,()=>{this.notifyChange(`telemetry`),this.notifyChange(`groundControlPoints`),this.notifyChange(`frameHorizonPoints`)}),l(()=>({telemetry:this.telemetry,sensorLocation:this.telemetry.sensorLocation,path:this.coverage?.path,currentTime:this.currentTime}),(e,t)=>this._updateSensorGeometry({...e,previous:t}),u)]),d(()=>this.loaded&&this.state===`can-play`&&this.duration>0).then(()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)})}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){let t=e==null?null:e.signal,n=this.loadFromPortal({supportedTypes:[`Video Service`],supportsData:!0},e).catch(c).then(()=>this._fetchService(t)).then(()=>this._fetchCoverage(t)).then(()=>this._fetchPreviewsInfo(t));return this.addResolvingPromise(n),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return ue(t)}readConnectionInfo(e,t){let n=Object.values(t.connectionUrl);return n?.length&&(this.controller.startMode=t.serviceType===`ondemand`?`auto`:`metadata`,this.controller.playerUrl=n[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return k(this.metadata)}get groundControlPoints(){return A(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return se(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return j(this.metadata)}readTitleFromService(e,t){let{url:n}=this,r=t.name||S(n)?.title;switch(this.sublayerTitleMode){case`item-title`:if(n)return w(n,r);break;case`item-title-and-service-name`:{let e=this.portalItem?.title;if(e&&e!==r)return e=C(e),r?`${e} - ${C(r)}`:e;break}}return r?C(r):void 0}readTitleFromPortalItem(e){return this.sublayerTitleMode===`item-title`?e:void 0}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return M(t)}get videoTimeExtent(){return r(a.getLogger(this),`videoTimeExtent`,{replacement:`fullTimeExtent`,version:`4.33`,warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this._trailPoints=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;let t=o(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;let t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e,n){if(!e)return;let r=new t(e);(!n||n?.frameCenter)&&(this.frameCenterSymbol=N(this.frameCenterSymbol,r)??K),(!n||n?.frameOutline)&&(this.frameOutlineSymbol=N(this.frameOutlineSymbol,r,G)??q),(!n||n?.lineOfSight)&&(this.sensorSightLineSymbol=N(this.sensorSightLineSymbol,r)??Y),(!n||n?.sensorLocation)&&(this.sensorSymbol=N(this.sensorSymbol,r)??X),(!n||n?.sensorPath)&&(this.sensorPathSymbol=N(this.sensorPathSymbol,r)??J),(!n||n?.sensorTrail)&&(this.sensorTrailSymbol=N(this.sensorTrailSymbol,r)??Z)}write(e,t){return this.layerId==null?(he(t,this,`the ArcGIS server version must be greater than 11.2.`),null):super.write(e,t)}async _fetchCoverage(e){if(!this.capabilities?.operations?.supportsCoverageQuery||typeof this.layerId!=`number`)return;let t=`${this.parsedUrl.path}/coverage`,{data:r}=await n(t,{query:{f:`json`,...this.customParameters},signal:e}),{area:i=null,sensorPoints:a=null,telemetry:o=null}=r,s={area:null,path:null};if(i?.rings?.length&&(s.area=g.fromJSON(i)),a?.points?.length){let e=a.points;s.path=new _({hasM:a.hasM??!0,hasZ:a.hasZ??!0,paths:[e],spatialReference:v.fromJSON(a.spatialReference)})}if(o?.start){let{frameCenter:e=null,frameOutline:t=null,sensor:n=null}=o?.start||{};if(t&&(this.telemetry.frameOutline=g.fromJSON(t)),n&&(this.telemetry.sensorLocation=h.fromJSON(n)),e&&(this.telemetry.frameCenter=h.fromJSON(e)),n&&e){let{sensorLocation:e,frameCenter:t}=this.telemetry;this.telemetry.lineOfSight=P(e,t)}}this._set(`coverage`,s)}async _fetchPreviewsInfo(e){if(typeof this.layerId!=`number`||!this.capabilities?.operations?.supportsPreviews)return;let t=`${this.parsedUrl.path}/content/preview/preview.json`,{data:r}=await n(t,{query:{f:`json`},signal:e});if(!r?.preview)return;let{frameCount:i=0,frameInterval:a=0,frames:o=[],height:s,nCol:c,nRow:l,preview:u,width:d}=r||{},f={count:i,height:s,interval:a,numCols:c,numRows:l,thumbnailInfo:o,urlFragment:u,width:d};this.read({previewsInfo:f},{origin:`service`})}async _fetchService(e){if(this.sourceJSON){this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl});return}let{data:t,ssl:r}=await n(this.url,{query:{f:`json`,...this.parsedUrl.query,...this.customParameters},signal:e});if(r&&(this.url=this.url.replace(/^http:/i,`https:`)),!t?.currentVersion){t.currentVersion=`11.2`,this.sourceJSON=t,this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl});return}if(this.layerId??=t.layers?.[0]?.id??null,this.layerId==null)throw new i(`arcgis-layers:url-mismatch`,`The url is not a valid arcgis resource`);let{data:a}=await n(this.parsedUrl.path,{query:{f:`json`,...this.customParameters},signal:e});this.sourceJSON={...t,...a},this.read(this.sourceJSON,{origin:`service`,url:this.parsedUrl})}_setSensorRoute(e,t,n){let{spatialReference:r,hasZ:i,hasM:a,paths:o}=e,s=i?3:2,c=[],l=[];for(let e of o){let r=0,a=e.length;for(;r<a;){let t=Math.floor((r+a)/2);e[t][s]<=n?r=t+1:a=t}let o=e.slice(0,r),u=e.slice(r);if(r>0&&n<=e[e.length-1][s]){let a=e[r-1],c=a[s]===n,l=a.slice();if(!c){let t=e[r],i=(n-a[s])/(t[s]-a[s]);for(let e=0;e<s;e++)l[e]=a[e]+(t[e]-a[e])*i}t&&(l[0]=t.x,l[1]=t.y,i&&t.hasZ&&(l[2]=t.z)),l[s]=n,c?o[o.length-1]=l:o.push(l),u.length&&u.unshift(l.slice())}o.length&&c.push(o),u.length&&l.push(u)}this.telemetry.sensorTrail=new _({hasZ:i,hasM:a,paths:c,spatialReference:r}),this.telemetry.sensorPath=new _({hasZ:i,hasM:a,paths:l,spatialReference:r})}_setSensorTrail(e){if(!e)return;this._trailPoints=F(e,this._trailPoints,this.currentTime*1e3);let t=this._trailPoints.map(e=>e.toArray()),n=new _({hasZ:e.hasZ,hasM:!0,paths:[t],spatialReference:e.spatialReference});this.telemetry.sensorTrail=n.clone()}_updateSensorGeometry(e){let{telemetry:t,sensorLocation:n,path:r,currentTime:i,previous:a}=e;r?.hasM&&r.paths.some(e=>e.length>0)?this._setSensorRoute(r,n,i*1e3):(t.sensorPath=null,a?.path!==r&&(this._trailPoints=[],t.sensorTrail=null),(a?.sensorLocation!==n||a?.path!==r)&&this._setSensorTrail(n))}};e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`autoplay`,null),e([f({readOnly:!0})],$.prototype,`buffered`,null),e([f({readOnly:!0})],$.prototype,`cameraInfo`,void 0),e([f({readOnly:!0,json:{read:!1}})],$.prototype,`capabilities`,void 0),e([H(`service`,`capabilities`,[`supportsAppend`,`supportsCoverageQuery`,`supportsExportClip`,`supportsExportFrameset`,`supportsMensuration`,`supportsPreviews`,`supportsUpdate`])],$.prototype,`readCapabilitiesFromService`,null),e([f({readOnly:!0})],$.prototype,`codecs`,void 0),e([f({readOnly:!0})],$.prototype,`connectionInfo`,void 0),e([H(`connectionInfo`,[`connectionUrl`])],$.prototype,`readConnectionInfo`,null),e([f()],$.prototype,`controller`,void 0),e([f({type:String})],$.prototype,`copyright`,void 0),e([f({readOnly:!0})],$.prototype,`coverage`,void 0),e([f({readOnly:!0,type:Date})],$.prototype,`created`,void 0),e([f({type:Number})],$.prototype,`currentTime`,null),e([f({json:{write:!1}})],$.prototype,`customParameters`,void 0),e([f({type:String})],$.prototype,`description`,void 0),e([f({type:Number})],$.prototype,`duration`,null),e([f({readOnly:!0})],$.prototype,`elevationSource`,void 0),e([f({type:Boolean})],$.prototype,`ended`,null),e([f({type:fe})],$.prototype,`frame`,void 0),e([f(Q(`drawingInfo.frameCenterSymbol`,V))],$.prototype,`frameCenterSymbol`,void 0),e([f({readOnly:!0,type:p})],$.prototype,`frameCount`,void 0),e([f(y)],$.prototype,`frameEffect`,void 0),e([f(T)],$.prototype,`frameOpacity`,void 0),e([f(Q(`drawingInfo.frameOutlineSymbol`,z))],$.prototype,`frameOutlineSymbol`,void 0),e([f({type:m})],$.prototype,`fullExtent`,void 0),e([f({readOnly:!0})],$.prototype,`frameHorizonPoints`,null),e([f({readOnly:!0,json:{read:{reader:I,source:`time`}},type:D})],$.prototype,`fullTimeExtent`,void 0),e([f({readOnly:!0})],$.prototype,`groundControlPoints`,null),e([f(oe)],$.prototype,`id`,void 0),e([f({type:m})],$.prototype,`initialExtent`,void 0),e([f({readOnly:!0})],$.prototype,`isLive`,null),e([f({type:p,json:{read:!1,origins:{service:{read:{source:`id`}}}}})],$.prototype,`layerId`,void 0),e([f({readOnly:!0})],$.prototype,`livestreamStatus`,null),e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`loop`,null),e([f({readOnly:!0})],$.prototype,`metadata`,null),e([f({readOnly:!0})],$.prototype,`mimeType`,null),e([f({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$.prototype,`muted`,null),e([f({readOnly:!0})],$.prototype,`previewsInfo`,void 0),e([f({type:[`ArcGISVideoLayer`]})],$.prototype,`operationalLayerType`,void 0),e([f({readOnly:!0})],$.prototype,`parsedUrl`,null),e([f({type:le})],$.prototype,`playbackInfo`,void 0),e([f({type:Number,json:{write:{ignoreOrigin:!0}}})],$.prototype,`playbackRate`,null),e([f({readOnly:!0,type:String})],$.prototype,`playerUrl`,null),e([f({readOnly:!0})],$.prototype,`playing`,null),e([f({readOnly:!0,json:{read:{source:`poster`}}})],$.prototype,`posterUrl`,void 0),e([f({readOnly:!0})],$.prototype,`qualities`,void 0),e([f()],$.prototype,`sensorSymbolOrientation`,void 0),e([f(Q(`drawingInfo.sensorPathSymbol`,B))],$.prototype,`sensorPathSymbol`,void 0),e([f(ge)],$.prototype,`sensorSymbol`,void 0),e([f(Q(`drawingInfo.sensorSightLineSymbol`,B))],$.prototype,`sensorSightLineSymbol`,void 0),e([f(Q(`drawingInfo.sensorTrailSymbol`,B))],$.prototype,`sensorTrailSymbol`,void 0),e([f({readOnly:!0})],$.prototype,`serviceItemId`,void 0),e([f()],$.prototype,`sourceJSON`,void 0),e([f({readOnly:!0})],$.prototype,`sourceQuality`,void 0),e([f({readOnly:!0,json:{name:`serviceType`}})],$.prototype,`sourceType`,void 0),e([f({type:v})],$.prototype,`spatialReference`,void 0),e([f({json:{write:!0}})],$.prototype,`start`,void 0),e([f({readOnly:!0})],$.prototype,`started`,null),e([f({readOnly:!0,type:String})],$.prototype,`state`,null),e([f({readOnly:!0,type:de})],$.prototype,`telemetry`,null),e([f({type:E,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],$.prototype,`telemetryDisplay`,void 0),e([H(`service`,`title`,[`name`])],$.prototype,`readTitleFromService`,null),e([H(`portal-item`,`title`)],$.prototype,`readTitleFromPortalItem`,null),e([f({type:String})],$.prototype,`sublayerTitleMode`,void 0),e([f({readOnly:!0})],$.prototype,`type`,void 0),e([f(ce())],$.prototype,`url`,void 0),e([f({readOnly:!0,type:Number,json:{read:{source:`currentVersion`}}})],$.prototype,`version`,void 0),e([f({readOnly:!0})],$.prototype,`videoElement`,null),e([f({readOnly:!0})],$.prototype,`videoHeight`,null),e([f({readOnly:!0,json:{read:!1}})],$.prototype,`videoLayersInfo`,void 0),e([H(`service`,`videoLayersInfo`,[`id`,`name`,`poster`,`serviceType`,`type`])],$.prototype,`readLayerInfosFromService`,null),e([f({type:D,readOnly:!0})],$.prototype,`videoTimeExtent`,null),e([f({readOnly:!0})],$.prototype,`videoWidth`,null),e([f()],$.prototype,`volume`,null),e([f({readOnly:!0})],$.prototype,`waiting`,null),$=e([ee(`esri.layers.VideoLayer`)],$);const _e=$;export{_e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,initial as l}from"../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{runUntracked as f}from"../../../core/accessorSupport/tracking.js";import{exactEquals as p}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as m}from"../../../core/support/UpdatingHandles.js";import{create as h,fromValues as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as _}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as v}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as y}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as b}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import S from"../../../views/3d/layers/i3s/I3SLodHandling.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as w,getIndexCrs as T,findIntersectingNodes as E}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{projectElevationUpdateExtent as O}from"../../../views/3d/support/elevationUpdateExtentUtils.js";import{toBoundingRect as k}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as j}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const N=1e4,P=1e-4;let F=class extends a(t){get isMeshPyramid(){return this.layer.profile===`mesh-pyramids`||this.layer.store?.lodType===`MeshPyramid`}get isGraphics3D(){return this.layer.profile===`points`}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority===`High`)}get indexRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return T(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return f(()=>{if(this._index){let e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new m,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new i({deallocator:null}),this._modificationsNodeFilteringArray=new i,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=[],this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new j,this._elevationUpdateNodes=new i({deallocator:null}),this._errorCount=0}initialize(){let{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new S(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has(`disable-feature:idb-cache`),`fields`in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([r])=>{if(this.destroyed||!e||e.destroyed||!r)return;let{view:i,clientGeometry:a}=e;if(this._setClippingArea(i.clippingArea),this.addHandles([this._updatingHandles.add(()=>i?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:p}),s(()=>i.quality,()=>this._setCameraDirty(),c),this._updatingHandles.add(()=>i.state.mode===2,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),b(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>i.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),c),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>this._index!=null&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,i.renderCoordsHelper,i.state.contentCamera,!i.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?i.groundView:i.elevationProvider,_(i.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new v(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:i.renderCoordsHelper.spatialReference},i.resourceController.memoryController,this.worker),this._index=new x(_(i.viewingMode),t,r,this.indexRequester,this._clientNodeLoader,this._viewportQueries,n.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),a!=null){for(let e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on(`change`,e=>{for(let t of e.removed)this._removeMesh(t.oid);for(let t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){let t=this._index,n=this.layerView;t!=null&&n?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{let n=t.getNode(e);n!=null&&this._modificationsNodeFilteringArray.push(n)}),n.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,I.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),L!=null&&(L.hide(),L=null),this._index=null,this._lodHandling=r(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set(`worker`,null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];let e=this._attributeStorageInfo,t=this._fields,n=this.layer.objectIdField;return this.layerView.availableFields.map(n=>{let r=z(e,n),i=z(t,n);return r>=0&&i>=0?{index:r,name:t[i].name,field:t[i],attributeStorageInfo:e[r]}:null}).filter(e=>e!=null&&e.name!==n)}_requiredFieldsChange(){let e=this._getRequiredAttributes();R(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){let t=h();this._clippingArea=k(e,t,this.layerView.view.renderSpatialReference)?t:null}_pointOfInterestChanged(e){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(e),this._index!=null&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(this._index==null)return;let n=this._clientNodeLoader.createMeshNodeInfo(e,t),r=this._index.addClientNodeToIndex(n.id,n.mbs);this._clientNodeLoader.addMeshNode(r,n),this._evaluateRunning(),this.notifyChange(`rootNodeVisible`)}_removeMesh(e){let t=this._clientNodeLoader.getMeshNodeIndex(e);if(t!=null){if(this._index!=null)this._index.removeClientNodeFromIndex(t,(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&e!=null&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},(e,t,n)=>{this._clientNodeLoader.updateNodeIndex(e,t,n),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,n)}),this.notifyChange(`rootNodeVisible`);else throw Error(`delayed removal of client side i3s node geometry not supported yet.`)}}updateElevationChanged(e,t){let n=this._index,r=this._viewportQueries;if(n?.rootNode==null||t==null||r==null)return null;let i=r.elevationIntersectionSpatialReference;i.equals(t)||(O(e,t,B,i)||g(-1/0,-1/0,1/0,1/0,B),e=B);let a=this._elevationUpdateNodes;return a.clear(),E(e,n.rootNode,n,e=>a.push(e.index),r),a.length&&(a.forAll(e=>n.updateElevationChanged(e)),this._setCameraDirty()),a}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return this._viewportQueries==null?null:this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e)}_elevationInfoChanged(e){this._index!=null&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){let n=this._idleQueue.push(e,t);return this._evaluateRunning(),n}reschedule(e,t){let n=this._idleQueue.unshift(e,t);return this._evaluateRunning(),n}get _isIntegratedMesh(){return this.layer.type===`integrated-mesh`}get unloadedMemoryEstimate(){return this._index==null||!this.layerView.contentVisible?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,n){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,n)}get indexDepth(){return this._index==null?0:this._index.maxLevel}set disableMemCache(e){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData||e}runTask(e,t){return this.layerView.contentVisible?!this.layerView.visible||this._index==null?-1/0:(this._processWithErrorLogging(e,t),this._index.maxPriority):(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(e){this._errorCount<50?n.getLogger(this).error(`Error during processing: ${e} at ${e.stack}`):this._errorCount===50&&n.getLogger(this).error(`Too many errors for this layer. Further errors will not be displayed.`),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));let t=this._index.featureEstimate.leavesReached;!this._index.isLoading&&t!==this._get(`leavesReached`)&&this._set(`leavesReached`,t)}return this._index.load()}_prefetchIndex(){return this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0?!1:this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;let e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,n=this._index.featureEstimate;if(n.estimate=n.estimate||t/2,this._index.indexMissing>500){if(this._featureLOD<=P)return;this._featureLOD/=1.5,this._stableFeatureLOD=!1}else if(e&&n.estimate<t){if(n.leavesReached||this._featureLOD>=N||this._stableFeatureLOD)return;let e=Math.min(10,Math.max(t/n.estimate,1.001));this._featureLOD*=e;let r=this._lod,i=this._index.checkFeatureTarget(t,r);i!==r&&(this._featureLOD=i/this._baseLOD,this._stableFeatureLOD=!0)}else if(n.estimate>t*1.2||e&&n.estimate>t){if(this._featureLOD<=P)return;this._featureLOD/=1+(n.estimate/t-1)*.25,this._stableFeatureLOD=!1}else return;this._featureLOD=Math.min(N,Math.max(P,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){let t=this._index;if(t==null)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){let n=this._newLoadingNodes.pop();for(let r=t.getParent(n);r!=null&&!this.layerView.isNodeLoaded(r.index);r=t.getParent(r.index)){if(!this._disableMemCache&&!t.useNodeAsHole(r.index)){e.enabled&&e.madeProgress();break}if(this._enableFromGPUCache(r,0)){e.madeProgress();break}}}return e.hasProgressed}_processNodes(e,t){if(this._index==null)return!1;let n=(this._isIdle?100:2)-this._loadingNodes.size,r=this._index.updates;for(r.cancel.forEach(this._cancelNode,this),r.cancel=[];r.remove.length>0&&!e.done;)this.layerView.removeNode(r.remove.pop()),e.madeProgress();for(;r.update.length>0&&!e.done;){let t=this._index.getNode(r.update.pop());t!=null&&(this._updateLoadedNode(t),e.madeProgress())}for(;r.add.length>0&&!e.done&&n>0;){--n;let i=this._index.getNode(r.add.back());if(i==null||i.cacheState!==2&&!this._hasNodeLoadToken(t))break;r.add.pop(),this._loadNode(i),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){let t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=2?!1:this.index==null||!this.dataRequester.isFull(this._index.urlPrefix)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(!this.layerView.contentVisible)e=this._cameraDirty,t=+!e;else{let n=(this._index?.indexMissing??0)+(this._index?.updates.add.length??0)*3+this._loadingNodes.size*2;e=!!(n>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),n===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(n,this._progressMaxNumNodes),t=1-n/this._progressMaxNumNodes}this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;let e=this.layerView.view,{contentCamera:t,fixedContentCamera:n}=e.state;this._viewportQueries.updateCamera(t,!n||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange(`rootNodeVisible`)}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){let e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-A)/(.5-A)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e)||this._index==null||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(this._viewportQueries==null)return!1;let t=this._lodDropFactor;return t>=1||!this._lodHandling.hasNoVisibleChildren(e)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minCenterDistance>(this._viewportQueries.maxCenterDistance-this._viewportQueries.minCenterDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;let e=this._index;if(this._updatesDisabled||e==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&=(this._requiredAttributes=this._getRequiredAttributes(),!1);let t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataRequester,n.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){let t=this._index;if(t==null||this._viewportQueries==null)return!1;I.clear(),this.layerView.getLoadedNodeIndices(I);let n=this._viewportQueries.maxCenterDistance===0,r=n?()=>!1:e=>this._shouldDropNode(e);return I.filterInPlace(e=>{let n=t.getNode(e);return n==null||!t.isGeometryVisible(e)||r(n)}),I.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(I,e,0),n&&this._lodDropFactor<1?!1:I.length===0||(I.clear(),!1)}markNodeToRemove(e){I.push(e)}removeMarkedNodes(){this._removeNodes(I,M,0)}_removeNodes(e,t,n){if(!(e.length===0||t.done))for(this._index!=null&&this._index.requestUpdate();e.length>0&&!t.done;){let r=e.pop(),i=this._index;n===1&&this.layerView.nodeFadeoutEnabled&&i!=null&&i.isGeometryVisible(r)?this.layerView.fadeNode(r,1,!0):this.layerView.removeNode(r),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;let t=this.layerView.getLoadedAttributes(e.index);return t!=null&&t!==this._requiredAttributes}async _updateLoadedNode(e){let t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{let n=R(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:n},t.signal),t.signal)}catch(n){if(!o(n))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index)){n.getLogger(this).error(`already loading node `+e.index);return}let t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(n=>{n&&this._index!=null&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(()=>{}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return e.cacheState===1?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!o(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||this._index==null)return!1;let n=this._loadCachedGPUData(e);return n?(this.layerView.addCachedGPUData(e,n,t),this._nodeAdded(),!0):!1}_loadCachedGPUData(e){let t=this.layerView.loadCachedGPUData(e.index);return t?.attributeInfo!=null&&R(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){this._index?.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;let n=this.layerView;if(this.disableIDBCache||!n.loadCachedNodeData||!n.addCachedNodeData)return!1;let r=e.index>=0?(t,n)=>this._nodeLoader.loadTextures(e,t,n):t=>this._clientNodeLoader.loadTextures(e,t),i=await this.schedule(()=>n.loadCachedNodeData(e,t,r),t);if(i==null)return!1;let a=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,a,t),t);return await this.reschedule(()=>n.addCachedNodeData(e,i,{loadedAttributes:a,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(n=>this.schedule(()=>this.layerView.addNode(e,n,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!o(t))throw n.getLogger(this).error(`#loadNodeData()`,this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(e){this._index?.layerFilterChanged(e),this._setCameraDirty()}};e([u({readOnly:!0})],F.prototype,`isMeshPyramid`,null),e([u({readOnly:!0})],F.prototype,`isGraphics3D`,null),e([u({readOnly:!0})],F.prototype,`useMaximumNumberOfFeatures`,null),e([u({readOnly:!0})],F.prototype,`indexRequester`,null),e([u({readOnly:!0})],F.prototype,`dataRequester`,null),e([u({readOnly:!0})],F.prototype,`crsVertex`,null),e([u({readOnly:!0})],F.prototype,`crsIndex`,null),e([u()],F.prototype,`featureTarget`,void 0),e([u()],F.prototype,`fixedFeatureTarget`,void 0),e([u()],F.prototype,`layerView`,void 0),e([u()],F.prototype,`layer`,null),e([u()],F.prototype,`_updatingHandles`,void 0),e([u()],F.prototype,`updating`,null),e([u()],F.prototype,`running`,void 0),e([u()],F.prototype,`updatingProgress`,void 0),e([u({readOnly:!0})],F.prototype,`leavesReached`,void 0),e([u({constructOnly:!0})],F.prototype,`worker`,void 0),e([u({readOnly:!0})],F.prototype,`rootNodeVisible`,null),F=e([d(`esri.layers.graphics.controllers.I3SOnDemandController`)],F);const I=new i({deallocator:null});let L;function R(e,t){return e!=null&&e.length===t.length&&e.every(e=>z(t,e.name)>=0)}function z(e,t){let n=t.toLowerCase();for(let t=0;t<e.length;t++)if(e[t].name.toLowerCase()===n)return t;return-1}const B=h(),V=F;export{V as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,initial as l}from"../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{runUntracked as f}from"../../../core/accessorSupport/tracking.js";import{exactEquals as p}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as m}from"../../../core/support/UpdatingHandles.js";import{create as h,fromValues as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as _}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as v}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as y}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as b}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import S from"../../../views/3d/layers/i3s/I3SLodHandling.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as w,getIndexCrs as T,findIntersectingNodes as E}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{groundNavigationConstants as O}from"../../../views/3d/state/utils/groundNavigationUtils.js";import{projectElevationUpdateExtent as k}from"../../../views/3d/support/elevationUpdateExtentUtils.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as j}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as N}from"../../../views/support/Scheduler.js";const P=1e4,F=1e-4;let I=class extends a(t){get isMeshPyramid(){return this.layer.profile===`mesh-pyramids`||this.layer.store?.lodType===`MeshPyramid`}get isGraphics3D(){return this.layer.profile===`points`}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority===`High`)}get indexRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return T(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return f(()=>{if(this._index){let e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new m,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new i({deallocator:null}),this._modificationsNodeFilteringArray=new i,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=[],this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new i({deallocator:null}),this._errorCount=0}initialize(){let{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new S(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has(`disable-feature:idb-cache`),`fields`in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([r])=>{if(this.destroyed||!e||e.destroyed||!r)return;let{view:i,clientGeometry:a}=e;if(this._setClippingArea(i.clippingArea),this.addHandles([this._updatingHandles.add(()=>i?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:p}),s(()=>i.quality,()=>this._setCameraDirty(),c),this._updatingHandles.add(()=>i.state.mode===2,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),b(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>i.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>i.navigation.mode?.type,e=>{this._setCameraDirty(),this._index&&(this._index.isGroundNavigationMode=e===`ground`)}),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),c),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>this._index!=null&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,i.renderCoordsHelper,i.state.contentCamera,!i.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?i.groundView:i.elevationProvider,_(i.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new v(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:i.renderCoordsHelper.spatialReference},i.resourceController.memoryController,this.worker),this._index=new x(_(i.viewingMode),t,i.navigation.mode.type===`ground`,O.i3sNodeDownwardCheckDistanceInMeters/i.renderCoordsHelper.unitInMeters,r,this.indexRequester,this._clientNodeLoader,this._viewportQueries,n.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),a!=null){for(let e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on(`change`,e=>{for(let t of e.removed)this._removeMesh(t.oid);for(let t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){let t=this._index,n=this.layerView;t!=null&&n?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{let n=t.getNode(e);n!=null&&this._modificationsNodeFilteringArray.push(n)}),n.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,L.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),R!=null&&(R.hide(),R=null),this._index=null,this._lodHandling=r(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set(`worker`,null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];let e=this._attributeStorageInfo,t=this._fields,n=this.layer.objectIdField;return this.layerView.availableFields.map(n=>{let r=B(e,n),i=B(t,n);return r>=0&&i>=0?{index:r,name:t[i].name,field:t[i],attributeStorageInfo:e[r]}:null}).filter(e=>e!=null&&e.name!==n)}_requiredFieldsChange(){let e=this._getRequiredAttributes();z(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){let t=h();this._clippingArea=A(e,t,this.layerView.view.renderSpatialReference)?t:null}_pointOfInterestChanged(e){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(e),this._index!=null&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(this._index==null)return;let n=this._clientNodeLoader.createMeshNodeInfo(e,t),r=this._index.addClientNodeToIndex(n.id,n.mbs);this._clientNodeLoader.addMeshNode(r,n),this._evaluateRunning(),this.notifyChange(`rootNodeVisible`)}_removeMesh(e){let t=this._clientNodeLoader.getMeshNodeIndex(e);if(t!=null){if(this._index!=null)this._index.removeClientNodeFromIndex(t,(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&e!=null&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},(e,t,n)=>{this._clientNodeLoader.updateNodeIndex(e,t,n),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,n)}),this.notifyChange(`rootNodeVisible`);else throw Error(`delayed removal of client side i3s node geometry not supported yet.`)}}updateElevationChanged(e,t){let n=this._index,r=this._viewportQueries;if(n?.rootNode==null||t==null||r==null)return null;let i=r.elevationIntersectionSpatialReference;i.equals(t)||(k(e,t,V,i)||g(-1/0,-1/0,1/0,1/0,V),e=V);let a=this._elevationUpdateNodes;return a.clear(),E(e,n.rootNode,n,e=>a.push(e.index),r),a.length&&(a.forAll(e=>n.updateElevationChanged(e)),this._setCameraDirty()),a}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return this._viewportQueries==null?null:this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e)}_elevationInfoChanged(e){this._index!=null&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){let n=this._idleQueue.push(e,t);return this._evaluateRunning(),n}reschedule(e,t){let n=this._idleQueue.unshift(e,t);return this._evaluateRunning(),n}get _isIntegratedMesh(){return this.layer.type===`integrated-mesh`}get unloadedMemoryEstimate(){return this._index==null||!this.layerView.contentVisible?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,n){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,n)}get indexDepth(){return this._index==null?0:this._index.maxLevel}set disableMemCache(e){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData||e}runTask(e,t){return this.layerView.contentVisible?!this.layerView.visible||this._index==null?-1/0:(this._processWithErrorLogging(e,t),this._index.maxPriority):(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(e){this._errorCount<50?n.getLogger(this).error(`Error during processing: ${e} at ${e.stack}`):this._errorCount===50&&n.getLogger(this).error(`Too many errors for this layer. Further errors will not be displayed.`),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));let t=this._index.featureEstimate.leavesReached;!this._index.isLoading&&t!==this._get(`leavesReached`)&&this._set(`leavesReached`,t)}return this._index.load()}_prefetchIndex(){return this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0?!1:this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;let e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,n=this._index.featureEstimate;if(n.estimate=n.estimate||t/2,this._index.indexMissing>500){if(this._featureLOD<=F)return;this._featureLOD/=1.5,this._stableFeatureLOD=!1}else if(e&&n.estimate<t){if(n.leavesReached||this._featureLOD>=P||this._stableFeatureLOD)return;let e=Math.min(10,Math.max(t/n.estimate,1.001));this._featureLOD*=e;let r=this._lod,i=this._index.checkFeatureTarget(t,r);i!==r&&(this._featureLOD=i/this._baseLOD,this._stableFeatureLOD=!0)}else if(n.estimate>t*1.2||e&&n.estimate>t){if(this._featureLOD<=F)return;this._featureLOD/=1+(n.estimate/t-1)*.25,this._stableFeatureLOD=!1}else return;this._featureLOD=Math.min(P,Math.max(F,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){let t=this._index;if(t==null)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){let n=this._newLoadingNodes.pop();for(let r=t.getParent(n);r!=null&&!this.layerView.isNodeLoaded(r.index);r=t.getParent(r.index)){if(!this._disableMemCache&&!t.useNodeAsHole(r.index)){e.enabled&&e.madeProgress();break}if(this._enableFromGPUCache(r,0)){e.madeProgress();break}}}return e.hasProgressed}_processNodes(e,t){if(this._index==null)return!1;let n=(this._isIdle?100:2)-this._loadingNodes.size,r=this._index.updates;for(r.cancel.forEach(this._cancelNode,this),r.cancel=[];r.remove.length>0&&!e.done;)this.layerView.removeNode(r.remove.pop()),e.madeProgress();for(;r.update.length>0&&!e.done;){let t=this._index.getNode(r.update.pop());t!=null&&(this._updateLoadedNode(t),e.madeProgress())}for(;r.add.length>0&&!e.done&&n>0;){--n;let i=this._index.getNode(r.add.back());if(i==null||i.cacheState!==2&&!this._hasNodeLoadToken(t))break;r.add.pop(),this._loadNode(i),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){let t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=2?!1:this.index==null||!this.dataRequester.isFull(this._index.urlPrefix)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(!this.layerView.contentVisible)e=this._cameraDirty,t=+!e;else{let n=(this._index?.indexMissing??0)+(this._index?.updates.add.length??0)*3+this._loadingNodes.size*2;e=!!(n>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),n===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(n,this._progressMaxNumNodes),t=1-n/this._progressMaxNumNodes}this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;let e=this.layerView.view,{contentCamera:t,fixedContentCamera:n}=e.state;this._viewportQueries.updateCamera(t,!n||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange(`rootNodeVisible`)}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){let e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-j)/(.5-j)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e)||this._index==null||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(this._viewportQueries==null)return!1;let t=this._lodDropFactor;return t>=1||!this._lodHandling.hasNoVisibleChildren(e)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minCenterDistance>(this._viewportQueries.maxCenterDistance-this._viewportQueries.minCenterDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;let e=this._index;if(this._updatesDisabled||e==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&=(this._requiredAttributes=this._getRequiredAttributes(),!1);let t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataRequester,n.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){let t=this._index;if(t==null||this._viewportQueries==null)return!1;L.clear(),this.layerView.getLoadedNodeIndices(L);let n=this._viewportQueries.maxCenterDistance===0,r=n?()=>!1:e=>this._shouldDropNode(e);return L.filterInPlace(e=>{let n=t.getNode(e);return n==null||!t.isGeometryVisible(e)||r(n)}),L.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(L,e,0),n&&this._lodDropFactor<1?!1:L.length===0||(L.clear(),!1)}markNodeToRemove(e){L.push(e)}removeMarkedNodes(){this._removeNodes(L,N,0)}_removeNodes(e,t,n){if(!(e.length===0||t.done))for(this._index!=null&&this._index.requestUpdate();e.length>0&&!t.done;){let r=e.pop(),i=this._index;n===1&&this.layerView.nodeFadeoutEnabled&&i!=null&&i.isGeometryVisible(r)?this.layerView.fadeNode(r,1,!0):this.layerView.removeNode(r),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;let t=this.layerView.getLoadedAttributes(e.index);return t!=null&&t!==this._requiredAttributes}async _updateLoadedNode(e){let t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{let n=z(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:n},t.signal),t.signal)}catch(n){if(!o(n))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index)){n.getLogger(this).error(`already loading node `+e.index);return}let t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(n=>{n&&this._index!=null&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(()=>{}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return e.cacheState===1?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!o(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||this._index==null)return!1;let n=this._loadCachedGPUData(e);return n?(this.layerView.addCachedGPUData(e,n,t),this._nodeAdded(),!0):!1}_loadCachedGPUData(e){let t=this.layerView.loadCachedGPUData(e.index);return t?.attributeInfo!=null&&z(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){this._index?.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;let n=this.layerView;if(this.disableIDBCache||!n.loadCachedNodeData||!n.addCachedNodeData)return!1;let r=e.index>=0?(t,n)=>this._nodeLoader.loadTextures(e,t,n):t=>this._clientNodeLoader.loadTextures(e,t),i=await this.schedule(()=>n.loadCachedNodeData(e,t,r),t);if(i==null)return!1;let a=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,a,t),t);return await this.reschedule(()=>n.addCachedNodeData(e,i,{loadedAttributes:a,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(n=>this.schedule(()=>this.layerView.addNode(e,n,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!o(t))throw n.getLogger(this).error(`#loadNodeData()`,this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(e){this._index?.layerFilterChanged(e),this._setCameraDirty()}};e([u({readOnly:!0})],I.prototype,`isMeshPyramid`,null),e([u({readOnly:!0})],I.prototype,`isGraphics3D`,null),e([u({readOnly:!0})],I.prototype,`useMaximumNumberOfFeatures`,null),e([u({readOnly:!0})],I.prototype,`indexRequester`,null),e([u({readOnly:!0})],I.prototype,`dataRequester`,null),e([u({readOnly:!0})],I.prototype,`crsVertex`,null),e([u({readOnly:!0})],I.prototype,`crsIndex`,null),e([u()],I.prototype,`featureTarget`,void 0),e([u()],I.prototype,`fixedFeatureTarget`,void 0),e([u()],I.prototype,`layerView`,void 0),e([u()],I.prototype,`layer`,null),e([u()],I.prototype,`_updatingHandles`,void 0),e([u()],I.prototype,`updating`,null),e([u()],I.prototype,`running`,void 0),e([u()],I.prototype,`updatingProgress`,void 0),e([u({readOnly:!0})],I.prototype,`leavesReached`,void 0),e([u({constructOnly:!0})],I.prototype,`worker`,void 0),e([u({readOnly:!0})],I.prototype,`rootNodeVisible`,null),I=e([d(`esri.layers.graphics.controllers.I3SOnDemandController`)],I);const L=new i({deallocator:null});let R;function z(e,t){return e!=null&&e.length===t.length&&e.every(e=>B(t,e.name)>=0)}function B(e,t){let n=t.toLowerCase();for(let t=0;t<e.length;t++)if(e[t].name.toLowerCase()===n)return t;return-1}const V=h(),H=I;export{H as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{Loadable as t}from"../../../core/Loadable.js";import{debounce as n}from"../../../core/promiseUtils.js";import{open as r}from"../../../core/workers.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../rest/support/FeatureSet.js";let
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{Loadable as t}from"../../../core/Loadable.js";import{debounce as n}from"../../../core/promiseUtils.js";import{open as r}from"../../../core/workers.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import{applyTimeExtentToQuery as s}from"./support/timeQueryUtils.js";import c from"../../../rest/support/FeatureSet.js";let l=class extends t{constructor(e){super(e),this.type=`csv`,this.refresh=n(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return t&&(this.sourceJSON.extent=t),n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryFeatures`,n.toJSON(),t);return c.fromJSON(r)}async queryFeaturesJSON(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)}async queryFeatureCount(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatureCount`,n.toJSON(),t)}async queryObjectIds(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryObjectIds`,n.toJSON(),t)}async queryExtent(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryExtent`,n.toJSON(),t);return{count:r.count,extent:o.fromJSON(r.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke(`querySnapping`,e,t)}async queryAttributeBins(e,t={}){await this.load();let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryAttributeBins`,n.toJSON(),t)}async _startWorker(e){this._connection=await r(`CSVSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{url:t,delimiter:n,fields:i,latitudeField:a,longitudeField:o,spatialReference:s,timeInfo:c}=this.loadOptions,l=await this._connection.invoke(`load`,{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:n,fields:i?.map(e=>e.toJSON()),latitudeField:a,longitudeField:o,spatialReference:s?.toJSON(),timeInfo:c?.toJSON()}},{signal:e});this.locationInfo=l.locationInfo,this.sourceJSON=l.layerDefinition,this.delimiter=l.delimiter}};e([i()],l.prototype,`type`,void 0),e([i()],l.prototype,`loadOptions`,void 0),e([i()],l.prototype,`customParameters`,void 0),e([i({constructOnly:!0})],l.prototype,`layer`,void 0),e([i()],l.prototype,`locationInfo`,void 0),e([i()],l.prototype,`sourceJSON`,void 0),e([i()],l.prototype,`delimiter`,void 0),l=e([a(`esri.layers.graphics.sources.CSVSource`)],l);export{l as CSVSource};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import f from"../../../rest/support/FeatureSet.js";let
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import{applyTimeExtentToQuery as f}from"./support/timeQueryUtils.js";import p from"../../../rest/support/FeatureSet.js";let m=class extends n{constructor(){super(...arguments),this.type=`geojson`,this.refresh=i(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return this.sourceJSON.extent=t,n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)}).then(e=>p.fromJSON(e))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)})}queryFeatureCount(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatureCount`,n.toJSON(),t)})}queryObjectIds(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryObjectIds`,n.toJSON(),t)})}queryExtent(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryExtent`,n.toJSON(),t)}).then(e=>({count:e.count,extent:c.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke(`querySnapping`,e,t))}async queryAttributeBins(e,t={}){await this.load();let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryAttributeBins`,n.toJSON(),t)}_applyEdits(e){if(!this._connection)throw new t(`geojson-layer-source:edit-failure`,`Memory source not loaded`);let n=this.layer.objectIdField,r=[],i=[],a=[];if(e.addFeatures)for(let t of e.addFeatures)r.push(this._serializeFeature(t));if(e.deleteFeatures)for(let t of e.deleteFeatures)`objectId`in t&&t.objectId!=null?i.push(t.objectId):`attributes`in t&&t.attributes[n]!=null&&i.push(t.attributes[n]);if(e.updateFeatures)for(let t of e.updateFeatures)a.push(this._serializeFeature(t));return this._connection.invoke(`applyEdits`,{adds:r,updates:a,deletes:i}).then(({extent:e,timeExtent:t,featureEditResults:n})=>(this.sourceJSON.extent=e,t&&(this.sourceJSON.timeInfo.timeExtent=[t.start,t.end]),this._createEditsResult(n)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let n=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:n?new t(`geojson-layer-source:edit-failure`,n.description,{code:n.code}):null}}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e);return n?{geometry:n.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:t.type===`mesh`||t.type===`extent`?l.fromExtent(t.extent):t}async _startWorker(e){this._connection=await a(`GeoJSONSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,hasZ:i,geometryType:o,objectIdField:s,url:c,timeInfo:l,customParameters:f}=this.layer,p=this.layer.originOf(`spatialReference`)===`defaults`,m={url:c,customParameters:f,fields:t&&t.map(e=>e.toJSON()),geometryType:u.toJSON(o),hasZ:i,objectIdField:s,timeInfo:l?l.toJSON():null,spatialReference:p?null:n&&n.toJSON()},h=await this._connection.invoke(`load`,m,{signal:e});for(let e of h.warnings)r.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});h.featureErrors.length&&r.getLogger(this.layer).warn(`#load()`,`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=d(this.sourceJSON.hasZ,!0,!this.sourceJSON.geometryType)}};e([o()],m.prototype,`capabilities`,void 0),e([o()],m.prototype,`type`,void 0),e([o({constructOnly:!0})],m.prototype,`layer`,void 0),e([o()],m.prototype,`sourceJSON`,void 0),m=e([s(`esri.layers.graphics.sources.GeoJSONSource`)],m);export{m as GeoJSONSource};
|